diff --git a/pungi/ostree/utils.py b/pungi/ostree/utils.py index 02540c92..d80fb9f8 100644 --- a/pungi/ostree/utils.py +++ b/pungi/ostree/utils.py @@ -17,6 +17,7 @@ import datetime import json import os +import rpmUtils.arch from pungi.util import makedirs @@ -29,14 +30,21 @@ def make_log_file(log_dir, filename): return os.path.join(log_dir, '%s.log' % filename) -def get_ref_from_treefile(treefile): - """Return ref name by parsing the tree config file""" +def get_ref_from_treefile(treefile, arch=None): + """ + Return ref name by parsing the tree config file. Replacing ${basearch} with + the basearch of the architecture we are running on or of the passed in arch. + """ ref = None if os.path.isfile(treefile): with open(treefile, 'r') as f: try: parsed = json.loads(f.read()) - ref = parsed['ref'] + if arch is None: + basearch = rpmUtils.arch.getBaseArch() + else: + basearch = rpmUtils.arch.getBaseArch(arch) + ref = parsed['ref'].replace('${basearch}', basearch) except Exception as e: print('Unable to get ref from treefile: %s' % e) else: diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py index ebe03d0d..e61e969c 100644 --- a/pungi/phases/ostree.py +++ b/pungi/phases/ostree.py @@ -104,7 +104,7 @@ class OSTreeThread(WorkerThread): extra_config_file=extra_config_file) if compose.notifier: - ref = get_ref_from_treefile(os.path.join(repodir, config['treefile'])) + ref = get_ref_from_treefile(os.path.join(repodir, config['treefile']), arch) # 'pungi-make-ostree tree' writes commitid to commitid.log in logdir commitid = get_commitid_from_commitid_file(os.path.join(self.logdir, 'commitid.log')) compose.notifier.send('ostree',