pungi/0001-replace-basearch-when-updating-the-ref.patch
Dennis Gilmore 0a6966ac86 add patches for pagure pr#517
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
2017-01-24 02:23:23 -06:00

67 lines
2.4 KiB
Diff

From 59dd4dbcd84ce30faa6558ad0d052370077d3fe5 Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
Date: Jan 19 2017 03:21:26 +0000
Subject: replace ${basearch} when updating the ref
pungi-make-ostree has to run on the target arch so that rpm
scriptlets can be ran. as a reult we can ask rpm what the
basearch is for the running environment. For notifications
we have to pass in the arch we are running for.
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
---
diff --git a/pungi/ostree/utils.py b/pungi/ostree/utils.py
index 02540c9..d80fb9f 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 ebe03d0..e61e969 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',