From 719a06df779502358711bd6f6734bd20404970a6 Mon Sep 17 00:00:00 2001 From: Yue Tao Date: Sun, 24 Apr 2022 15:44:46 +0800 Subject: [PATCH] pkgbuilder: disconnect with Debian upstream Add new environment variable DEBIAN_VERSION, and replace the 'bullseye' and '11.3' with DEBIAN_DISTRIBUTION and DEBIAN_VERSION Replace the Debian upsteam URL with CENGN mirror. The sources.list of chroot is changed to deb-local-binary deb-local-build Debian snapshot (11.3) Debian upstream ----> CENGN mirror (11.3) Since the Debian 11.4 is coming, disconnecting with Debian upstream to avoid build depends on Debian 11.4. Test plan: Pass: no Debian upstream URLs in chroot sources.list $cat /etc/apt/sources.list 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 deb http://snapshot.debian.org/archive/debian/20220331T000000Z bullseye main deb-src http://snapshot.debian.org/archive/debian/20220331T000000Z bullseye main deb http://mirror.starlingx.cengn.ca/mirror/debian/debian/deb.debian.org/debian/bullseye-11.3 bullseye main deb-src http://mirror.starlingx.cengn.ca/mirror/debian/debian/deb.debian.org/debian/bullseye-11.3 bullseye main Pass: build-pkgs -c -a Story: 2008846 Task: 44979 Signed-off-by: Yue Tao Change-Id: I52ee93c8e17548b28ab79a7db12d4400d92ac56e --- stx.conf.sample | 1 + stx/lib/stx/stx_control.py | 2 ++ .../stx-builder/configmap/localrc.sample | 2 ++ stx/toCOPY/builder/finishSetup.sh | 8 ++++---- stx/toCOPY/pkgbuilder/debbuilder.conf | 12 ++++++------ stx/toCOPY/pkgbuilder/debbuilder.py | 4 ++-- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/stx.conf.sample b/stx.conf.sample index 064306b7..7c5d7f6d 100644 --- a/stx.conf.sample +++ b/stx.conf.sample @@ -9,6 +9,7 @@ buildbranch = master manifest = default.xml ostree_osname = debian debian_distribution = bullseye +debian_version = 11.3 # These URLs must contain snapshots of debian & debian-security repos. # We will append debian_snapshot_timestamp to each of them when creating diff --git a/stx/lib/stx/stx_control.py b/stx/lib/stx/stx_control.py index f91dab79..f181088a 100644 --- a/stx/lib/stx/stx_control.py +++ b/stx/lib/stx/stx_control.py @@ -100,6 +100,7 @@ class HandleControlTask: '/' + \ self.config.get('project', 'debian_snapshot_timestamp') debian_distribution = self.config.get('project', 'debian_distribution') + debian_version = self.config.get('project', 'debian_version') if sourceslist: if not (deblist or dsclist): self.logger.warning('*************************************\ @@ -173,6 +174,7 @@ stx-pkgbuilder/configmap/') line = line.replace("@DEBIAN_SNAPSHOT@", debian_snapshot) line = line.replace("@DEBIAN_SECURITY_SNAPSHOT@", debian_security_snapshot) line = line.replace("@DEBIAN_DISTRIBUTION@", debian_distribution) + line = line.replace("@DEBIAN_VERSION@", debian_version) line = line.replace("@MAX_CPUS@", max_cpus) if sourceslist: line = line.replace("@fetch@", "true") 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 748ea957..f82a35d3 100644 --- a/stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample +++ b/stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample @@ -61,4 +61,6 @@ export DEBIAN_SECURITY_SNAPSHOT="@DEBIAN_SECURITY_SNAPSHOT@" export DEBIAN_DISTRIBUTION="@DEBIAN_DISTRIBUTION@" +export DEBIAN_VERSION="@DEBIAN_VERSION@" + export MAX_CPUS=@MAX_CPUS@ diff --git a/stx/toCOPY/builder/finishSetup.sh b/stx/toCOPY/builder/finishSetup.sh index 1c38c44d..afafe52c 100755 --- a/stx/toCOPY/builder/finishSetup.sh +++ b/stx/toCOPY/builder/finishSetup.sh @@ -4,10 +4,10 @@ REPOMGR=aptly if [ "$REPOMGR" == "aptly" ]; then - CENGN_MIRROR="${CENGNURL}/debian/debian/deb.debian.org/debian/bullseye-11.3 bullseye main" - REPO_SNAPSHOT="[check-valid-until=no] ${DEBIAN_SNAPSHOT} bullseye main" - REPO_BIN="deb [trusted=yes] ${REPOMGR_DEPLOY_URL}deb-local-binary bullseye main" - REPO_SRC="deb-src [trusted=yes] ${REPOMGR_DEPLOY_URL}deb-local-source bullseye main" + CENGN_MIRROR="${CENGNURL}/debian/debian/deb.debian.org/debian/${DEBIAN_DISTRIBUTION}-${DEBIAN_VERSION} ${DEBIAN_DISTRIBUTION} main" + REPO_SNAPSHOT="[check-valid-until=no] ${DEBIAN_SNAPSHOT} ${DEBIAN_DISTRIBUTION} main" + REPO_BIN="deb [trusted=yes] ${REPOMGR_DEPLOY_URL}deb-local-binary ${DEBIAN_DISTRIBUTION} main" + REPO_SRC="deb-src [trusted=yes] ${REPOMGR_DEPLOY_URL}deb-local-source ${DEBIAN_DISTRIBUTION} main" ret=`grep 'deb-local-binary' /etc/apt/sources.list` if [ "x$ret" == "x" ]; then sed -i "1i\\${REPO_BIN}" /etc/apt/sources.list diff --git a/stx/toCOPY/pkgbuilder/debbuilder.conf b/stx/toCOPY/pkgbuilder/debbuilder.conf index 41aacea1..ba600d35 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.conf +++ b/stx/toCOPY/pkgbuilder/debbuilder.conf @@ -24,8 +24,8 @@ $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-build bullseye main', - 'deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-binary bullseye main']; +$extra_repositories = ['deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-build @DEBIAN_DISTRIBUTION@ main', + 'deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-binary @DEBIAN_DISTRIBUTION@ main']; $log_colour = 1; $build_environment = { 'OSTREE_OSNAME' => '@OSTREE_OSNAME@' @@ -33,10 +33,10 @@ $build_environment = { $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', + 'sed -i "1 i\deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-binary @DEBIAN_DISTRIBUTION@ main" tmp.list', + 'sed -i "1 i\deb [trusted=yes] http://stx-stx-repomgr:80/deb-local-build @DEBIAN_DISTRIBUTION@ main" tmp.list', + 'echo "deb @CENGNURL@/debian/debian/deb.debian.org/debian/@DEBIAN_DISTRIBUTION@-@DEBIAN_VERSION@ @DEBIAN_DISTRIBUTION@ main" >> tmp.list', + 'echo "deb-src @CENGNURL@/debian/debian/deb.debian.org/debian/@DEBIAN_DISTRIBUTION@-@DEBIAN_VERSION@ @DEBIAN_DISTRIBUTION@ 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', diff --git a/stx/toCOPY/pkgbuilder/debbuilder.py b/stx/toCOPY/pkgbuilder/debbuilder.py index 5064de58..b3254b69 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.py +++ b/stx/toCOPY/pkgbuilder/debbuilder.py @@ -22,7 +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'] +ENVIRON_VARS = ['OSTREE_OSNAME', 'CENGNURL', 'DEBIAN_DISTRIBUTION', 'DEBIAN_VERSION'] class Debbuilder: @@ -77,7 +77,7 @@ class Debbuilder: 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] + value = outs.strip().split("\n")[0].strip('"') 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)