diff --git a/stx/toCOPY/pkgbuilder/debbuilder.conf b/stx/toCOPY/pkgbuilder/debbuilder.conf index 12eda711..ebbc15b6 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.conf +++ b/stx/toCOPY/pkgbuilder/debbuilder.conf @@ -22,12 +22,25 @@ $lintian_require_success = 0; $run_piuparts = 0; $purge_build_deps = 'always'; $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']; +$extra_repositories = ['deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-build bullseye main', + 'deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-binary bullseye main']; $log_colour = 1; $build_environment = { 'OSTREE_OSNAME' => '@OSTREE_OSNAME@' }; +$external_commands = { + "chroot-setup-commands" => [ + 'cp /etc/apt/sources.list tmp.list', + 'sed -i "1 i\deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-binary bullseye main" tmp.list', + 'sed -i "1 i\deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-build bullseye main" tmp.list', + 'echo "deb http://deb.debian.org/debian bullseye main" >> tmp.list', + 'echo "deb-src http://deb.debian.org/debian bullseye main" >> tmp.list', + 'awk \'!a[$0]++\' tmp.list > new.list && mv -f new.list /etc/apt/sources.list', + 'echo "Package: *" > /etc/apt/preferences.d/local_repos', + 'echo "Pin: origin stx-stx-repomgr" >> /etc/apt/preferences.d/local_repos', + 'echo "Pin-Priority: 900" >> /etc/apt/preferences.d/local_repos', + ], +}; 1; diff --git a/stx/toCOPY/pkgbuilder/debbuilder.py b/stx/toCOPY/pkgbuilder/debbuilder.py index 76b3cda0..5064de58 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.py +++ b/stx/toCOPY/pkgbuilder/debbuilder.py @@ -94,16 +94,19 @@ class Debbuilder: for item in env_list: if item.startswith('export '): envvar = item.replace('export ', '').split('=') - if envvar and envvar[0] == 'REPOMGR_DEPLOY_URL': - repomgr_url = envvar[1] + if envvar and len(envvar) >= 2 and envvar[0].strip() == 'REPOMGR_DEPLOY_URL': + repomgr_url = envvar[1].strip() break if repomgr_url: + url_parts = repomgr_url.split(':') + repo_origin = url_parts[1][2:] + self.logger.debug('The origin of local repositories is %s', repo_origin) try: with open(SBUILD_CONF, '+r') as f: sconf = f.read() - sconf = sconf.replace('http://stx-stx-repomgr:80/', - repomgr_url.strip()) + sconf = sconf.replace('http://stx-stx-repomgr:80/', repomgr_url) + sconf = sconf.replace('stx-stx-repomgr', repo_origin) f.seek(0, 0) f.write(sconf) f.truncate()