summaryrefslogtreecommitdiff
path: root/test/integration/framework
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-01-07 17:39:32 +0100
committerJulian Andres Klode <jak@debian.org>2025-10-25 18:42:14 +0000
commit9d62eef571ffd1fd2df8b97884d3689fced27fb1 (patch)
tree100d5321f364b389100928e927639e852c52ff48 /test/integration/framework
parent50d8703c785898d06463513896e37cbe7cedd471 (diff)
Implement architecture variants
Architecture variants are children of an architecture that share the same ABI but are optimized for different ISA levels. They are available in Ubuntu 25.10 and newer, and not supported in Debian or other distributions. A deb built for a variant contains the Architecture-Variant field, and the Architecture field points to the baseline, for example: Architecture: amd64 Architecture-Variant: amd64v3 However, the apt-get indextargets command reports the variant in the Architecture: field, and most of the code in APT presents the variant as the architecture. There are two types of variants: 1. Standalone variants are recorded in the Architectures field of the Release file as if they were a real architecture: Architectures: amd64 amd64v3 Standalone architecture variants only fetch the standalone architecture variant's Packages file. To do this, this patch changes the code such that the variants indextargets "supplant" the base targets. This may have complicated outcomes on the apt-get indextargets command. 2. Other variants can only be identified by their files being recorded with hashes in the Release file. APT fetches both the base architecture's as well as the variant's Packages file. Variants are configured in the APT::Architecture-Variants list. Image builders may want to build specific variant images using APT::Architecture-Variants { "amd64v3"; } But this commit also implements an automatic discovery mechanism using the varianttable and /proc/cpuinfo. APT::Architecture-Variants "auto";
Diffstat (limited to 'test/integration/framework')
-rw-r--r--test/integration/framework11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/integration/framework b/test/integration/framework
index d95a1799a..7780ef835 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -547,6 +547,7 @@ exec fakeroot gdb --quiet -ex run '${DPKG:-dpkg}' --args '${DPKG:-dpkg}' --root=
EOF
chmod +x "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg"
echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir/etc/apt/apt.conf.d/99dpkg
+ echo "Dir::dpkg::varianttable \"${TESTDIRECTORY}/varianttable\";" > rootdir/etc/apt/apt.conf.d/99variants
# Set the solver for the test case.
if [ "$APT_SOLVER" ]; then
echo "APT::Solver \"$APT_SOLVER\";" >> aptconfig.conf
@@ -1033,10 +1034,12 @@ insertpackage() {
continue
fi
for arch in $(getarchitecturesfromcommalist "$ARCH"); do
+ local variant="${arch#*:}"
+ arch="${arch%:*}"
if [ "$arch" = 'none' ]; then
ARCHS="$(getarchitectures)"
else
- ARCHS="$arch"
+ ARCHS="$variant"
fi
for BUILDARCH in $ARCHS; do
local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}"
@@ -1054,8 +1057,9 @@ Size: 42"
fi
echo "Maintainer: Joe Sixpack <joe@example.org>"
test "$arch" = 'none' || echo "Architecture: $arch"
+ test "$arch" = "$variant" || echo "Architecture-Variant: $variant"
echo "Version: $VERSION
-Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb"
+Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${variant}.deb"
test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES"
echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)"
echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)"
@@ -1118,6 +1122,8 @@ insertinstalledpackage() {
local FILE='rootdir/var/lib/dpkg/status'
local INFO='rootdir/var/lib/dpkg/info'
for arch in $(getarchitecturesfromcommalist "$ARCH"); do
+ local variant="${arch#*:}"
+ arch="${arch%:*}"
echo "Package: $NAME
Status: $STATUS
Priority: $PRIORITY" >> "$FILE"
@@ -1128,6 +1134,7 @@ Priority: $PRIORITY" >> "$FILE"
Maintainer: Joe Sixpack <joe@example.org>
Version: $VERSION" >> "$FILE"
test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE"
+ test "$arch" = "$variant" || echo "Architecture-Variant: $variant" >> "$FILE"
test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE"
printf "%b\n" "Description: $DESCRIPTION" >> "$FILE"
echo >> "$FILE"