diff --git a/stx.conf.sample b/stx.conf.sample index ccea9be6..5f443a82 100644 --- a/stx.conf.sample +++ b/stx.conf.sample @@ -7,6 +7,7 @@ proxyserver = opendev.org proxyport = 8080 buildbranch = master manifest = default.xml +ostree_osname = wrlinux [builder] uid = 1000 diff --git a/stx/lib/stx/stx_control.py b/stx/lib/stx/stx_control.py index 99525d2c..e302b71e 100644 --- a/stx/lib/stx/stx_control.py +++ b/stx/lib/stx/stx_control.py @@ -85,6 +85,7 @@ class HandleControlTask: sourceslist = self.stxconfig.getConfig('repomgr', 'sourceslist') deblist = self.stxconfig.getConfig('repomgr', 'deblist') dsclist = self.stxconfig.getConfig('repomgr', 'dsclist') + ostree_osname = self.stxconfig.getConfig('project', 'ostree_osname') if sourceslist: if not (deblist or dsclist): self.logger.warning('*************************************\ @@ -155,6 +156,7 @@ stx-pkgbuilder/configmap/') line = line.replace("@MANIFEST@", manifest) line = line.replace("@HOSTUSERNAME@", hostusername) line = line.replace("@CENGNURL@", cengnurl) + line = line.replace("@OSTREE_OSNAME@", ostree_osname) if sourceslist: line = line.replace("@fetch@", "true") line = line.replace("@SOURCESLIST@", sourceslist) diff --git a/stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample b/stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample index 4f11a3a3..a4d63f1c 100644 --- a/stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample +++ b/stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample @@ -49,3 +49,5 @@ export REPOMGR_URL=http://@PROJECT@-stx-repomgr:8080 export REPOMGR_DEPLOY_URL=http://@PROJECT@-stx-repomgr:80/ export BUILDER_URL=http://@PROJECT@-stx-pkgbuilder:8080/pkgbuilder/ + +export OSTREE_OSNAME=@OSTREE_OSNAME@ diff --git a/stx/toCOPY/pkgbuilder/debbuilder.conf b/stx/toCOPY/pkgbuilder/debbuilder.conf index 0979796d..f7184035 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.conf +++ b/stx/toCOPY/pkgbuilder/debbuilder.conf @@ -25,5 +25,9 @@ $purge_build_directory = 'always'; $extra_repositories = ['deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-binary bullseye main', 'deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-build bullseye main']; $log_colour = 1; +$build_environment = { + 'OSTREE_OSNAME' => '@OSTREE_OSNAME@' +}; + 1; diff --git a/stx/toCOPY/pkgbuilder/debbuilder.py b/stx/toCOPY/pkgbuilder/debbuilder.py index 131dca95..efbcc41c 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.py +++ b/stx/toCOPY/pkgbuilder/debbuilder.py @@ -22,6 +22,7 @@ BUILD_ENGINE = 'sbuild' DEBDIST = 'bullseye' STX_LOCALRC = '/usr/local/bin/stx/stx-localrc' SBUILD_CONF = '/etc/sbuild/sbuild.conf' +ENVIRON_VARS = ['OSTREE_OSNAME'] class Debbuilder: @@ -51,6 +52,7 @@ class Debbuilder: self.sbuild_processes = {} self.ctlog = None self.set_extra_repos() + self.set_environ_vars() @property def state(self): @@ -64,6 +66,21 @@ class Debbuilder: def mode(self, mode): self._mode = mode + def set_environ_vars(self): + if not os.path.exists(STX_LOCALRC): + self.logger.warning('stx-localrc does not exist') + return + + for var in ENVIRON_VARS: + cmd = "grep '^export *%s=.*' %s | cut -d \\= -f 2" % (var, STX_LOCALRC) + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True, shell=True) + outs, errs = process.communicate() + value = outs.strip().split("\n")[0] + if value: + cmd = "sed -ie 's#@%s@#%s#g' %s" % (var, value, SBUILD_CONF) + process = subprocess.Popen(cmd, shell=True, stdout=self.ctlog, stderr=self.ctlog) + def set_extra_repos(self): repomgr_url = None if not os.path.exists(STX_LOCALRC):