From b5e21772572d1ac288c3a6e9a30da4013cf4ed10 Mon Sep 17 00:00:00 2001 From: Yumi Yukimura Date: Wed, 7 Feb 2024 02:45:06 +0800 Subject: [PATCH] roomservice: Add support for dry run * In local build environments, we may want roomservice to not mess with the repos and local_manifests Change-Id: I83014fdedbfdcd9f731463954a8779cf6d1f4cbf --- build/tools/roomservice.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/tools/roomservice.py b/build/tools/roomservice.py index c723f921..76b10c47 100755 --- a/build/tools/roomservice.py +++ b/build/tools/roomservice.py @@ -40,6 +40,10 @@ except ImportError: from xml.etree import ElementTree +dryrun = os.getenv('ROOMSERVICE_DRYRUN') == "true" +if dryrun: + print("Dry run roomservice, no change will be made.") + product = sys.argv[1] if len(sys.argv) > 2: @@ -180,6 +184,9 @@ def is_in_manifest(projectpath): return False def add_to_manifest(repositories): + if dryrun: + return + try: lm = ElementTree.parse(".repo/local_manifests/roomservice.xml") lm = lm.getroot() @@ -243,7 +250,8 @@ def fetch_dependencies(repo_path): if len(syncable_repos) > 0: print('Syncing dependencies') - os.system('repo sync --force-sync %s' % ' '.join(syncable_repos)) + if not dryrun: + os.system('repo sync --force-sync %s' % ' '.join(syncable_repos)) for deprepo in verify_repos: fetch_dependencies(deprepo)