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
This commit is contained in:
parent
4f27f71cd6
commit
b5e2177257
1 changed files with 9 additions and 1 deletions
|
@ -40,6 +40,10 @@ except ImportError:
|
||||||
|
|
||||||
from xml.etree import ElementTree
|
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]
|
product = sys.argv[1]
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
|
@ -180,6 +184,9 @@ def is_in_manifest(projectpath):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def add_to_manifest(repositories):
|
def add_to_manifest(repositories):
|
||||||
|
if dryrun:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lm = ElementTree.parse(".repo/local_manifests/roomservice.xml")
|
lm = ElementTree.parse(".repo/local_manifests/roomservice.xml")
|
||||||
lm = lm.getroot()
|
lm = lm.getroot()
|
||||||
|
@ -243,7 +250,8 @@ def fetch_dependencies(repo_path):
|
||||||
|
|
||||||
if len(syncable_repos) > 0:
|
if len(syncable_repos) > 0:
|
||||||
print('Syncing dependencies')
|
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:
|
for deprepo in verify_repos:
|
||||||
fetch_dependencies(deprepo)
|
fetch_dependencies(deprepo)
|
||||||
|
|
Loading…
Reference in a new issue