From cfb8ef4568a9dab994b8a682d137409594f65454 Mon Sep 17 00:00:00 2001 From: treydock Date: Fri, 13 Oct 2023 14:37:21 -0400 Subject: [PATCH] Support Debian 12 packages (#252) * Support Debian 12 packages Fixes #251 --- .github/workflows/e2e.yaml | 3 +++ .github/workflows/release.yaml | 1 + .gitlab-ci.yml | 10 ++++++---- Gemfile.lock | 2 +- lib/ood_packaging/build.rb | 5 +++++ lib/ood_packaging/build_box.rb | 4 +++- .../build_box/docker-image/Dockerfile.erb | 5 ++++- lib/ood_packaging/version.rb | 2 +- packages/ondemand-release-latest/deb/debian/rules | 4 ++++ .../ondemand-release-latest/deb/debian/source/format | 2 +- packages/ondemand-release/deb/debian/rules | 4 ++++ packages/ondemand-release/deb/debian/source/format | 2 +- release-manifest.yaml | 1 + release.py | 1 + repo-update.sh | 3 +++ spec/ood_packaging/build_spec.rb | 5 +++++ sync-release.py | 6 ++++-- 17 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 8cdb04b6..3ef3551b 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -19,6 +19,7 @@ jobs: - el9 - ubuntu-20.04 - ubuntu-22.04 + - debian-12 - amzn2023 arch: - x86_64 @@ -186,6 +187,7 @@ jobs: dist: - ubuntu-20.04 - ubuntu-22.04 + - debian-12 arch: - x86_64 - aarch64 @@ -258,6 +260,7 @@ jobs: - el9 - ubuntu-20.04 - ubuntu-22.04 + - debian-12 - amzn2023 arch: - x86_64 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 75069e13..e8186a82 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,6 +17,7 @@ jobs: - amzn2023 - ubuntu-20.04 - ubuntu-22.04 + - debian-12 arch: - x86_64 - aarch64 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 000315d1..1f04f5ad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,7 @@ build-image: - OOD_PACKAGING_DIST: [el7, el8] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec - - OOD_PACKAGING_DIST: [el9] + - OOD_PACKAGING_DIST: [el9, debian-12] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] - OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04] OOD_PACKAGING_ARCH: [x86_64, aarch64] @@ -50,7 +50,8 @@ build-ondemand-release: - bundle exec rake ood_packaging:package:ondemand-release parallel: matrix: - - OOD_PACKAGING_DIST: [el7, el8, el9, amzn2023, ubuntu-20.04, ubuntu-22.04] + - OOD_PACKAGING_DIST: [el7, el8, el9, amzn2023] + - OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04, debian-12] artifacts: paths: - tmp/output @@ -67,7 +68,8 @@ build-ondemand-release-latest: - bundle exec rake ood_packaging:package:ondemand-release-latest parallel: matrix: - - OOD_PACKAGING_DIST: [el7, el8, el9, amzn2023, ubuntu-20.04, ubuntu-22.04] + - OOD_PACKAGING_DIST: [el7, el8, el9, amzn2023] + - OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04, debian-12] artifacts: paths: - tmp/output @@ -128,7 +130,7 @@ build-passenger: - OOD_PACKAGING_DIST: [el7, el8] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec - - OOD_PACKAGING_DIST: [el9] + - OOD_PACKAGING_DIST: [el9, debian-12] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] - OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04] OOD_PACKAGING_ARCH: [x86_64, aarch64] diff --git a/Gemfile.lock b/Gemfile.lock index 4aedefbd..cd6e84ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ood_packaging (0.12.1) + ood_packaging (0.13.0) rake (~> 13.0.1) GEM diff --git a/lib/ood_packaging/build.rb b/lib/ood_packaging/build.rb index 23f53d11..7a9fd773 100644 --- a/lib/ood_packaging/build.rb +++ b/lib/ood_packaging/build.rb @@ -284,8 +284,13 @@ def install_deb_dependencies! 'mk-build-deps --install --remove --root-cmd sudo', "--tool='#{tool.join(' ')}'" ] + cleanup = [ + "#{package}-build-deps*.buildinfo", + "#{package}-build-deps*.changes" + ] Dir.chdir(deb_work_dir) do sh "#{cmd.join(' ')}#{cmd_suffix}" + sh "rm -f #{cleanup.join(' ')}#{cmd_suffix}" end end diff --git a/lib/ood_packaging/build_box.rb b/lib/ood_packaging/build_box.rb index 5441a5f6..033ae8e5 100644 --- a/lib/ood_packaging/build_box.rb +++ b/lib/ood_packaging/build_box.rb @@ -15,12 +15,14 @@ class OodPackaging::BuildBox 'el9' => 'almalinux:9', 'ubuntu-20.04' => 'ubuntu:20.04', 'ubuntu-22.04' => 'ubuntu:22.04', + 'debian-12' => 'debian:12', 'amzn2023' => 'amazonlinux:2023' }.freeze CODENAMES = { 'ubuntu-20.04' => 'focal', - 'ubuntu-22.04' => 'jammy' + 'ubuntu-22.04' => 'jammy', + 'debian-12' => 'bookworm' }.freeze ARCH_PLATFORMS = { diff --git a/lib/ood_packaging/build_box/docker-image/Dockerfile.erb b/lib/ood_packaging/build_box/docker-image/Dockerfile.erb index 0fcf0e6d..5b304edd 100644 --- a/lib/ood_packaging/build_box/docker-image/Dockerfile.erb +++ b/lib/ood_packaging/build_box/docker-image/Dockerfile.erb @@ -2,7 +2,9 @@ FROM --platform=<%= platform %> <%= base_image %> ENV ARCH=<%= arch %> MAINTAINER Trey Dockendorf ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 ENV LC_CTYPE=en_US.UTF-8 +ENV LC_ALL=en_US.UTF-8 ENV USER=<%= ctr_user %> ENV GEM_PATH=<%= ctr_gems_dir %>: <% if dist == 'el7' -%> @@ -33,7 +35,8 @@ RUN dnf install -y --allowerasing systemd ruby nodejs sudo which wget \ <% elsif dist =~ /^ubuntu|debian/ -%> ENV DEBIAN_FRONTEND=noninteractive RUN apt update -y && apt upgrade -y && apt clean all -y -RUN apt update -y && apt install -y locales && locale-gen $LANG && \ +RUN apt update -y && apt install -y locales && \ + echo "en_US UTF-8" >> /etc/locale.gen && locale-gen $LANG && \ apt clean all -y RUN apt update -y && apt install -y apt-transport-https ca-certificates \ init debhelper devscripts dh-make build-essential apt-cudf lintian equivs \ diff --git a/lib/ood_packaging/version.rb b/lib/ood_packaging/version.rb index b4529300..98f5c1d9 100644 --- a/lib/ood_packaging/version.rb +++ b/lib/ood_packaging/version.rb @@ -2,7 +2,7 @@ # Version code for OodPackaging module OodPackaging - VERSION = '0.12.1' + VERSION = '0.13.0' PACKAGE_VERSION = { 'ondemand-release' => { '(ubuntu|debian)' => '3.1.0', diff --git a/packages/ondemand-release-latest/deb/debian/rules b/packages/ondemand-release-latest/deb/debian/rules index 352b434c..0c594769 100755 --- a/packages/ondemand-release-latest/deb/debian/rules +++ b/packages/ondemand-release-latest/deb/debian/rules @@ -20,8 +20,12 @@ override_dh_auto_install: mkdir -p $(WEB_DESTDIR)/etc/apt/trusted.gpg.d echo "deb https://apt.osc.edu/ondemand/latest/web/apt $(CODENAME) main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/ondemand-web.list install -m 644 -D $(CURDIR)/ondemand.gpg $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/ondemand-web.gpg +# Debian 12 (bookworm) has NodeJS 18 in OS repos +ifeq ($(CODENAME),"bookworm") +else echo "deb https://deb.nodesource.com/$(NODEREPO) $(CODENAME) main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/nodesource.list curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor > $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/nodesource.gpg +endif override_dh_builddeb: dh_builddeb -- -Zgzip \ No newline at end of file diff --git a/packages/ondemand-release-latest/deb/debian/source/format b/packages/ondemand-release-latest/deb/debian/source/format index 89ae9db8..163aaf8d 100644 --- a/packages/ondemand-release-latest/deb/debian/source/format +++ b/packages/ondemand-release-latest/deb/debian/source/format @@ -1 +1 @@ -3.0 (native) +3.0 (quilt) diff --git a/packages/ondemand-release/deb/debian/rules b/packages/ondemand-release/deb/debian/rules index 0dc7f9da..3655f6ba 100755 --- a/packages/ondemand-release/deb/debian/rules +++ b/packages/ondemand-release/deb/debian/rules @@ -23,8 +23,12 @@ override_dh_auto_install: mkdir -p $(WEB_DESTDIR)/etc/apt/trusted.gpg.d echo "deb https://apt.osc.edu/ondemand/$(REPO)/web/apt $(CODENAME) main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/ondemand-web.list install -m 644 -D $(CURDIR)/ondemand.gpg $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/ondemand-web.gpg +# Debian 12 (bookworm) has NodeJS 18 in OS repos +ifeq ($(CODENAME),"bookworm") +else echo "deb https://deb.nodesource.com/$(NODEREPO) $(CODENAME) main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/nodesource.list curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor > $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/nodesource.gpg +endif override_dh_builddeb: dh_builddeb -- -Zgzip \ No newline at end of file diff --git a/packages/ondemand-release/deb/debian/source/format b/packages/ondemand-release/deb/debian/source/format index 89ae9db8..163aaf8d 100644 --- a/packages/ondemand-release/deb/debian/source/format +++ b/packages/ondemand-release/deb/debian/source/format @@ -1 +1 @@ -3.0 (native) +3.0 (quilt) diff --git a/release-manifest.yaml b/release-manifest.yaml index 9271c2d4..de11e0a7 100644 --- a/release-manifest.yaml +++ b/release-manifest.yaml @@ -12,6 +12,7 @@ ondemand-release: # deb package - '{major}.0-focal' - '{major}.0-jammy' + - '{major}.0-bookworm' # web cjose: diff --git a/release.py b/release.py index c18b864a..7772ac79 100755 --- a/release.py +++ b/release.py @@ -21,6 +21,7 @@ 'ubuntu-18.04': 'bionic', 'ubuntu-20.04': 'focal', 'ubuntu-22.04': 'jammy', + 'debian-12': 'bookworm', } PROJ_ROOT = os.path.dirname(os.path.realpath(__file__)) diff --git a/repo-update.sh b/repo-update.sh index 05ff652a..cbe0418d 100755 --- a/repo-update.sh +++ b/repo-update.sh @@ -99,6 +99,9 @@ LOCK_FILE="/var/lib/oodpkg/repo-update-${LOCK_NAME}.lock" gpg --default-key ${GPG_KEY} --detach-sign --passphrase-file ${GPGPASS} --pinentry-mode loopback --batch --yes --no-tty --armor repodata/repomd.xml else case "${DIST}" in + debian-12|bookworm) + DIST="bookworm" + ;; ubuntu-22.04|jammy) DIST="jammy" ;; diff --git a/spec/ood_packaging/build_spec.rb b/spec/ood_packaging/build_spec.rb index f1c3d53f..17f4dd4c 100644 --- a/spec/ood_packaging/build_spec.rb +++ b/spec/ood_packaging/build_spec.rb @@ -158,8 +158,13 @@ "--tool='#{tool.join(' ')}'", '2>/dev/null 1>/dev/null' ] + cleanup = [ + 'ondemand-build-deps*.buildinfo', + 'ondemand-build-deps*.changes' + ] expect(build).to receive(:sh).with('sudo apt update -y 2>/dev/null 1>/dev/null') expect(build).to receive(:sh).with(expected_cmd.join(' ')) + expect(build).to receive(:sh).with("rm -f #{cleanup.join(' ')} 2>/dev/null 1>/dev/null") build.install_dependencies! end end diff --git a/sync-release.py b/sync-release.py index 04ece643..51b727da 100755 --- a/sync-release.py +++ b/sync-release.py @@ -20,7 +20,8 @@ 'el9', 'amzn2023', 'ubuntu-20.04', - 'ubuntu-22.04' + 'ubuntu-22.04', + 'debian-12' ] EL_RELEASES = [ 'el7', @@ -32,7 +33,8 @@ ] DEB_CODENAMES = [ 'focal', - 'jammy' + 'jammy', + 'bookworm' ] SKIP = [ 'bionic'