From c69ef9da7ef5e4024d06b2ef9bc2a8f47789628d Mon Sep 17 00:00:00 2001 From: Andrew Phelps Date: Tue, 10 Sep 2024 23:05:02 +0000 Subject: [PATCH 1/3] include release in elf module version --- .../azurelinux-rpm-macros.signatures.json | 7 +++---- .../azurelinux-rpm-macros.spec | 5 ++++- SPECS/azurelinux-rpm-macros/gen-ld-script.sh | 16 ++++++++++------ SPECS/azurelinux-rpm-macros/macros | 2 +- .../manifests/package/pkggen_core_aarch64.txt | 4 ++-- .../manifests/package/pkggen_core_x86_64.txt | 4 ++-- .../manifests/package/toolchain_aarch64.txt | 4 ++-- .../manifests/package/toolchain_x86_64.txt | 4 ++-- 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json index 1d3cacafb5e..87403391c98 100644 --- a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json +++ b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json @@ -10,18 +10,17 @@ "default-hardened-cc1": "2102bdfbb06934d95ceb3c81f789c59c9f77f91b0f996fd39588e0aa052d6f77", "default-hardened-ld": "4dbb822a27eed292759bc4e9cabb4b84f34fc6701535fcac2fdddac33328678b", "forge.lua": "79e710a646811de99643a0a7a4d429417556aa5071e745acaefa18321125114b", - "gen-ld-script.sh": "1204146a11095b0c3e4651aff1a1df86c23c1e4ac8811e21e8ee443d8f3af648", + "gen-ld-script.sh": "bb781864275ef9cb0dfec16167cd3612aa66d1202445133d900ae11b5b807ed3", "generate-package-note.py": "bd76a8e88a1356fed74863c38e5cf6a20c1c26426ac94ba21dd172578e8ca2a2", "gpgverify": "db0e050f56b694497d70603a6f5c17dd60ddbcf7cee670616851cd389f6767c4", "import_all_modules.py": "543d8c90e7db902e3b4587b7c488419e2f20a6d8b34174b7303dcd70794d8fc7", - "macros": "d94e2ee84806c5cb996b810137e0498c2accd5ccc73cd5aff4cfc0235d760ecc", + "macros": "708d2eb17e715ad05a0f8ad7494262080d27a02efb7b5de06cda4c62009e640f", "macros.check": "79367176c3c7d10c0158b6e5d881e0fc3c8fd50c5957dad2f097c2d4a37833e7", "macros.fonts": "f52edc646414c5dd0f5f4cdd570f2f9dbe6fb97d4f0db360908deb56d96492f8", "macros.forge": "52cdffd48217cafe33afe47c625cd6aac6460848cd76de66fe61031c26beeaf4", "macros.grub2": "b03f6f713601214406971de53538dfc25136bf836f09a663eaffc4332a72c38b", "macros.mono-srpm": "a9201ae36fc482e966134e38f42412378e955faf296b214cb6dd63981af8bc49", "macros.nodejs-srpm": "b2515cc7fad3f14849cff8593b10543a3f73edccff4c3c6d0d2764dae19c38e8", - "macros.ocaml-srpm": "c35c6db7ede8ea534212329d010920646f80368e1fbd0b9025e48ed0a85a09ce", "macros.openblas-srpm": "bd46ab2c99aa504d3fb09de1f071f0e19a9b2605772c1a738a32cfb0129d33b8", "macros.perl-srpm": "27f09c386944fc7478cdde55168bbc720d03ecd11ec60ae1133a42db6432e7f7", "macros.pybytecompile": "b07fbaa0f534bfee9706e343f4c1892d6903127e18f7561d0ad8445674658d26", @@ -35,4 +34,4 @@ "rpmrc": "c197369d806430f581de9d5f0e89384d231745712f394ce39497ada47d1f4efe", "verify-package-notes.sh": "121715379dcfda33f4e66b3eb5520c80c55c1b0d88348f8895d45d3b89dfe965" } -} +} \ No newline at end of file diff --git a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.spec b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.spec index 8b4df1dacf6..95902f693b8 100644 --- a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.spec +++ b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.spec @@ -7,7 +7,7 @@ Summary: Azure Linux specific rpm macro files Name: azurelinux-rpm-macros Version: %{azl}.0 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL+ AND MIT Vendor: Microsoft Corporation Distribution: Azure Linux @@ -143,6 +143,9 @@ install -p -m 644 -t %{buildroot}%{rcluadir}/srpm python.lua %{_rpmconfigdir}/macros.d/macros.check %changelog +* Mon Sep 09 2024 Andrew Phelps - 3.0-7 +- Include release information in ELF metadata version field + * Tue Aug 13 2024 Daniel McIlvaney - 3.0-6 - Move grub2-rpm-macros to the azurelinux-rpm-macros package diff --git a/SPECS/azurelinux-rpm-macros/gen-ld-script.sh b/SPECS/azurelinux-rpm-macros/gen-ld-script.sh index 7717c25162f..59a00d959b1 100755 --- a/SPECS/azurelinux-rpm-macros/gen-ld-script.sh +++ b/SPECS/azurelinux-rpm-macros/gen-ld-script.sh @@ -6,26 +6,30 @@ # gen-ld-script.sh # Generate linker script to embed ELF binaries with build metadata -# /usr/lib/rpm/azl/gen-ld-script.sh %{name} %{version} %{_topdir} %{distro_release_version} +# /usr/lib/rpm/azl/gen-ld-script.sh %{name} %{version}-%{release} %{_topdir} %{distro_release_version} echo "gen-ld-script.sh name($1) version($2) _topdir($3) osversion($4)" OS_VERSION=$(echo $4 | cut -d. -f1,2) +# When generating moduleVersion, strip everything after the dash. +# ex: "1.8.0-2.azl3" -> "1.8.0", +VERSION_NO_RELEASE=$(echo $2 | cut -d- -f1) + # Count number of dot separators in $2 (version) -NUM_DOT_SEPARATORS="${2//[^.]}" +NUM_DOT_SEPARATORS="${VERSION_NO_RELEASE//[^.]}" # Ensure moduleVersion contains 4 version parts by adding ".0" padding case ${#NUM_DOT_SEPARATORS} in 0) - MODULEVERSION=$2".0.0.0" + MODULEVERSION=$VERSION_NO_RELEASE".0.0.0" ;; 1) - MODULEVERSION=$2".0.0" + MODULEVERSION=$VERSION_NO_RELEASE".0.0" ;; 2) - MODULEVERSION=$2".0" + MODULEVERSION=$VERSION_NO_RELEASE".0" ;; *) - MODULEVERSION=$2 + MODULEVERSION=$VERSION_NO_RELEASE ;; esac diff --git a/SPECS/azurelinux-rpm-macros/macros b/SPECS/azurelinux-rpm-macros/macros index 85b3941af31..131e2a144f4 100644 --- a/SPECS/azurelinux-rpm-macros/macros +++ b/SPECS/azurelinux-rpm-macros/macros @@ -36,7 +36,7 @@ # Generate metadata linker script before prep section of each SPEC %__spec_prep_template #!%{__spec_prep_shell}\ %{__spec_prep_pre}\ -/usr/lib/rpm/azl/gen-ld-script.sh %{name} %{version} %{_topdir} %{distro_release_version}\ +/usr/lib/rpm/azl/gen-ld-script.sh %{name} %{version}-%{release} %{_topdir} %{distro_release_version}\ %{nil} # This section overrides the default behavior of the build macro to export diff --git a/toolkit/resources/manifests/package/pkggen_core_aarch64.txt b/toolkit/resources/manifests/package/pkggen_core_aarch64.txt index 34e9c8ea0a8..4d563e38307 100644 --- a/toolkit/resources/manifests/package/pkggen_core_aarch64.txt +++ b/toolkit/resources/manifests/package/pkggen_core_aarch64.txt @@ -209,8 +209,8 @@ libltdl-2.4.7-1.azl3.aarch64.rpm libltdl-devel-2.4.7-1.azl3.aarch64.rpm lua-5.4.6-1.azl3.aarch64.rpm lua-libs-5.4.6-1.azl3.aarch64.rpm -azurelinux-rpm-macros-3.0-6.azl3.noarch.rpm -azurelinux-check-macros-3.0-6.azl3.noarch.rpm +azurelinux-rpm-macros-3.0-7.azl3.noarch.rpm +azurelinux-check-macros-3.0-7.azl3.noarch.rpm tdnf-3.5.6-2.azl3.aarch64.rpm tdnf-cli-libs-3.5.6-2.azl3.aarch64.rpm tdnf-devel-3.5.6-2.azl3.aarch64.rpm diff --git a/toolkit/resources/manifests/package/pkggen_core_x86_64.txt b/toolkit/resources/manifests/package/pkggen_core_x86_64.txt index 97199613ef7..4ece13fbb79 100644 --- a/toolkit/resources/manifests/package/pkggen_core_x86_64.txt +++ b/toolkit/resources/manifests/package/pkggen_core_x86_64.txt @@ -209,8 +209,8 @@ libltdl-2.4.7-1.azl3.x86_64.rpm libltdl-devel-2.4.7-1.azl3.x86_64.rpm lua-5.4.6-1.azl3.x86_64.rpm lua-libs-5.4.6-1.azl3.x86_64.rpm -azurelinux-rpm-macros-3.0-6.azl3.noarch.rpm -azurelinux-check-macros-3.0-6.azl3.noarch.rpm +azurelinux-rpm-macros-3.0-7.azl3.noarch.rpm +azurelinux-check-macros-3.0-7.azl3.noarch.rpm tdnf-3.5.6-2.azl3.x86_64.rpm tdnf-cli-libs-3.5.6-2.azl3.x86_64.rpm tdnf-devel-3.5.6-2.azl3.x86_64.rpm diff --git a/toolkit/resources/manifests/package/toolchain_aarch64.txt b/toolkit/resources/manifests/package/toolchain_aarch64.txt index 0e814f5eec5..94e18b317b5 100644 --- a/toolkit/resources/manifests/package/toolchain_aarch64.txt +++ b/toolkit/resources/manifests/package/toolchain_aarch64.txt @@ -9,7 +9,7 @@ audit-devel-3.1.2-1.azl3.aarch64.rpm audit-libs-3.1.2-1.azl3.aarch64.rpm autoconf-2.72-2.azl3.noarch.rpm automake-1.16.5-2.azl3.noarch.rpm -azurelinux-check-macros-3.0-6.azl3.noarch.rpm +azurelinux-check-macros-3.0-7.azl3.noarch.rpm azurelinux-repos-3.0-3.azl3.noarch.rpm azurelinux-repos-debug-3.0-3.azl3.noarch.rpm azurelinux-repos-debug-preview-3.0-3.azl3.noarch.rpm @@ -23,7 +23,7 @@ azurelinux-repos-ms-oss-3.0-3.azl3.noarch.rpm azurelinux-repos-ms-oss-preview-3.0-3.azl3.noarch.rpm azurelinux-repos-preview-3.0-3.azl3.noarch.rpm azurelinux-repos-shared-3.0-3.azl3.noarch.rpm -azurelinux-rpm-macros-3.0-6.azl3.noarch.rpm +azurelinux-rpm-macros-3.0-7.azl3.noarch.rpm bash-5.2.15-3.azl3.aarch64.rpm bash-debuginfo-5.2.15-3.azl3.aarch64.rpm bash-devel-5.2.15-3.azl3.aarch64.rpm diff --git a/toolkit/resources/manifests/package/toolchain_x86_64.txt b/toolkit/resources/manifests/package/toolchain_x86_64.txt index f8811a5c8e0..410cd4d7ddd 100644 --- a/toolkit/resources/manifests/package/toolchain_x86_64.txt +++ b/toolkit/resources/manifests/package/toolchain_x86_64.txt @@ -9,7 +9,7 @@ audit-devel-3.1.2-1.azl3.x86_64.rpm audit-libs-3.1.2-1.azl3.x86_64.rpm autoconf-2.72-2.azl3.noarch.rpm automake-1.16.5-2.azl3.noarch.rpm -azurelinux-check-macros-3.0-6.azl3.noarch.rpm +azurelinux-check-macros-3.0-7.azl3.noarch.rpm azurelinux-repos-3.0-3.azl3.noarch.rpm azurelinux-repos-debug-3.0-3.azl3.noarch.rpm azurelinux-repos-debug-preview-3.0-3.azl3.noarch.rpm @@ -23,7 +23,7 @@ azurelinux-repos-ms-oss-3.0-3.azl3.noarch.rpm azurelinux-repos-ms-oss-preview-3.0-3.azl3.noarch.rpm azurelinux-repos-preview-3.0-3.azl3.noarch.rpm azurelinux-repos-shared-3.0-3.azl3.noarch.rpm -azurelinux-rpm-macros-3.0-6.azl3.noarch.rpm +azurelinux-rpm-macros-3.0-7.azl3.noarch.rpm bash-5.2.15-3.azl3.x86_64.rpm bash-debuginfo-5.2.15-3.azl3.x86_64.rpm bash-devel-5.2.15-3.azl3.x86_64.rpm From 136fd88571e9a4ce1b73baf22724318f941cf3f2 Mon Sep 17 00:00:00 2001 From: Andrew Phelps Date: Thu, 12 Sep 2024 23:08:58 +0000 Subject: [PATCH 2/3] include epoch in version --- .../azurelinux-rpm-macros.signatures.json | 4 ++-- SPECS/azurelinux-rpm-macros/gen-ld-script.sh | 9 +++++---- SPECS/azurelinux-rpm-macros/macros | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json index 87403391c98..453dcd74af1 100644 --- a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json +++ b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json @@ -10,11 +10,11 @@ "default-hardened-cc1": "2102bdfbb06934d95ceb3c81f789c59c9f77f91b0f996fd39588e0aa052d6f77", "default-hardened-ld": "4dbb822a27eed292759bc4e9cabb4b84f34fc6701535fcac2fdddac33328678b", "forge.lua": "79e710a646811de99643a0a7a4d429417556aa5071e745acaefa18321125114b", - "gen-ld-script.sh": "bb781864275ef9cb0dfec16167cd3612aa66d1202445133d900ae11b5b807ed3", + "gen-ld-script.sh": "c66c293368e00c471d1009ac4afb469572d5a88d8e6f9665a7cccf7942e0f441", "generate-package-note.py": "bd76a8e88a1356fed74863c38e5cf6a20c1c26426ac94ba21dd172578e8ca2a2", "gpgverify": "db0e050f56b694497d70603a6f5c17dd60ddbcf7cee670616851cd389f6767c4", "import_all_modules.py": "543d8c90e7db902e3b4587b7c488419e2f20a6d8b34174b7303dcd70794d8fc7", - "macros": "708d2eb17e715ad05a0f8ad7494262080d27a02efb7b5de06cda4c62009e640f", + "macros": "831c67c69bc37ee1eefdebf5bb32501b88160c831eb26738e872df0bb128e981", "macros.check": "79367176c3c7d10c0158b6e5d881e0fc3c8fd50c5957dad2f097c2d4a37833e7", "macros.fonts": "f52edc646414c5dd0f5f4cdd570f2f9dbe6fb97d4f0db360908deb56d96492f8", "macros.forge": "52cdffd48217cafe33afe47c625cd6aac6460848cd76de66fe61031c26beeaf4", diff --git a/SPECS/azurelinux-rpm-macros/gen-ld-script.sh b/SPECS/azurelinux-rpm-macros/gen-ld-script.sh index 59a00d959b1..cb1006b704b 100755 --- a/SPECS/azurelinux-rpm-macros/gen-ld-script.sh +++ b/SPECS/azurelinux-rpm-macros/gen-ld-script.sh @@ -6,14 +6,15 @@ # gen-ld-script.sh # Generate linker script to embed ELF binaries with build metadata -# /usr/lib/rpm/azl/gen-ld-script.sh %{name} %{version}-%{release} %{_topdir} %{distro_release_version} +# /usr/lib/rpm/azl/gen-ld-script.sh %{name} %{?epoch:%{epoch}:}%{version}-%{release} %{_topdir} %{distro_release_version} echo "gen-ld-script.sh name($1) version($2) _topdir($3) osversion($4)" OS_VERSION=$(echo $4 | cut -d. -f1,2) -# When generating moduleVersion, strip everything after the dash. -# ex: "1.8.0-2.azl3" -> "1.8.0", -VERSION_NO_RELEASE=$(echo $2 | cut -d- -f1) +# When generating moduleVersion, strip everything after the dash. Also remove the epoch, if present +# ex: "1.8.0-2.azl3" -> "1.8.0" +# ex: "1:3.0.0-7.azl3" -> "3.0.0" +VERSION_NO_RELEASE=$(echo $2 | cut -d- -f1 | cut -d: -f2) # Count number of dot separators in $2 (version) NUM_DOT_SEPARATORS="${VERSION_NO_RELEASE//[^.]}" diff --git a/SPECS/azurelinux-rpm-macros/macros b/SPECS/azurelinux-rpm-macros/macros index 131e2a144f4..d6e568e6256 100644 --- a/SPECS/azurelinux-rpm-macros/macros +++ b/SPECS/azurelinux-rpm-macros/macros @@ -36,7 +36,7 @@ # Generate metadata linker script before prep section of each SPEC %__spec_prep_template #!%{__spec_prep_shell}\ %{__spec_prep_pre}\ -/usr/lib/rpm/azl/gen-ld-script.sh %{name} %{version}-%{release} %{_topdir} %{distro_release_version}\ +/usr/lib/rpm/azl/gen-ld-script.sh %{name} %{?epoch:%{epoch}:}%{version}-%{release} %{_topdir} %{distro_release_version}\ %{nil} # This section overrides the default behavior of the build macro to export From a21ccba54a19979d60eec7a11213381862701568 Mon Sep 17 00:00:00 2001 From: Andrew Phelps Date: Thu, 12 Sep 2024 23:12:35 +0000 Subject: [PATCH 3/3] update comment in script --- .../azurelinux-rpm-macros.signatures.json | 2 +- SPECS/azurelinux-rpm-macros/gen-ld-script.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json index 453dcd74af1..1d915fca183 100644 --- a/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json +++ b/SPECS/azurelinux-rpm-macros/azurelinux-rpm-macros.signatures.json @@ -10,7 +10,7 @@ "default-hardened-cc1": "2102bdfbb06934d95ceb3c81f789c59c9f77f91b0f996fd39588e0aa052d6f77", "default-hardened-ld": "4dbb822a27eed292759bc4e9cabb4b84f34fc6701535fcac2fdddac33328678b", "forge.lua": "79e710a646811de99643a0a7a4d429417556aa5071e745acaefa18321125114b", - "gen-ld-script.sh": "c66c293368e00c471d1009ac4afb469572d5a88d8e6f9665a7cccf7942e0f441", + "gen-ld-script.sh": "0a4baf97651f0d6067063dd287ea61e0e9e87ff60508bfcf9957c5e383a30167", "generate-package-note.py": "bd76a8e88a1356fed74863c38e5cf6a20c1c26426ac94ba21dd172578e8ca2a2", "gpgverify": "db0e050f56b694497d70603a6f5c17dd60ddbcf7cee670616851cd389f6767c4", "import_all_modules.py": "543d8c90e7db902e3b4587b7c488419e2f20a6d8b34174b7303dcd70794d8fc7", diff --git a/SPECS/azurelinux-rpm-macros/gen-ld-script.sh b/SPECS/azurelinux-rpm-macros/gen-ld-script.sh index cb1006b704b..1ad17ce11f3 100755 --- a/SPECS/azurelinux-rpm-macros/gen-ld-script.sh +++ b/SPECS/azurelinux-rpm-macros/gen-ld-script.sh @@ -16,9 +16,10 @@ OS_VERSION=$(echo $4 | cut -d. -f1,2) # ex: "1:3.0.0-7.azl3" -> "3.0.0" VERSION_NO_RELEASE=$(echo $2 | cut -d- -f1 | cut -d: -f2) +# Azure Watson requires a "moduleVersion" field, which always contains a 4-part version number. +# Ensure moduleVersion contains 4 version parts by adding ".0" padding # Count number of dot separators in $2 (version) NUM_DOT_SEPARATORS="${VERSION_NO_RELEASE//[^.]}" -# Ensure moduleVersion contains 4 version parts by adding ".0" padding case ${#NUM_DOT_SEPARATORS} in 0) MODULEVERSION=$VERSION_NO_RELEASE".0.0.0"