Commit 7a440069 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Juerg Haefliger

UBUNTU: [Packaging] getabis -- handle all known package combinations

Traditionally we have tried to download all and any packages we can
find.  If we have any packages we just assume that what we got is a
consistent set and use it.  This leads to incomplete sets being
committed on network failure.

Firstly detect and differentiate transport errors and valid missing
packages.  Secondly switch to analysing known good package set
combinations; this relies on the presumption that the publisher
only publishes all or none of a binary package set.  This lets us
throw errors when we are unable to find an internally consistent
set of packages.

BugLink: http://bugs.launchpad.net/bugs/1806380Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 6a59a04a
...@@ -28,7 +28,7 @@ fwinfo=$abidir/fwinfo ...@@ -28,7 +28,7 @@ fwinfo=$abidir/fwinfo
test -d $tmpdir || mkdir $tmpdir test -d $tmpdir || mkdir $tmpdir
package_prefixes() { package_prefixes() {
__package_prefixes="$@" : # no longer used ...
} }
getall() { getall() {
...@@ -39,49 +39,82 @@ getall() { ...@@ -39,49 +39,82 @@ getall() {
for sub in $@; do for sub in $@; do
if [ -f $abidir/$arch/$sub ]; then if [ -f $abidir/$arch/$sub ]; then
echo "Exists: $sub" echo "Existing $sub($arch)..."
continue continue
fi fi
echo -n "Fetching $sub($arch)..." echo "Fetching $sub($arch)..."
prefixes="" getall_set "linux-buildinfo" "$arch" "$sub" || \
getall_set "linux-image-unsigned linux-modules linux-modules-extra" "$arch" "$sub" || \
getall_set "linux-image-unsigned linux-modules" "$arch" "$sub" || \
getall_set "linux-image linux-modules linux-modules-extra" "$arch" "$sub" || \
getall_set "linux-image linux-modules" "$arch" "$sub" || \
getall_set "linux-image linux-image-extra" "$arch" "$sub" || \
getall_set "linux-image" "$arch" "$sub" || \
{ echo "FAILED"; exit 1; }
done
}
getall_set()
{
prefixes="$1"
arch="$2"
sub="$3"
(
echo -n " set:"
filenames="" filenames=""
cd $tmpdir cd $tmpdir
for prefix in $__package_prefixes found=1
for prefix in $prefixes
do do
echo -n " $prefix="
if [ "$found" = 0 ]; then
echo -n "-"
continue
fi
filename=${prefix}-${verabi}-${sub}_${verfull}_${arch}.deb filename=${prefix}-${verabi}-${sub}_${verfull}_${arch}.deb
for r in "${repo_list[@]}" for r in "${repo_list[@]}"
do do
if ! [ -f $filename ]; then if ! [ -f $filename ]; then
$WGET $r/$filename $WGET $r/$filename
rc="$?"
# If this was not successful or a valid error
# return from the server all bets are off, bail.
[ "$rc" != 0 -a "$rc" != 8 ] && return 1
fi fi
if [ -f $filename ]; then if [ -f $filename ]; then
prefixes="$prefixes $prefix" echo -n "y"
filenames="$filenames $filename" filenames="$filenames $filename"
break break
fi fi
done done
if [ ! -f "$filename" ]; then
echo -n "n"
found=0
fi
done done
if [ "$filenames" != "" ]; then echo ""
echo -n "extracting$prefixes..." if [ "$found" = 0 ]; then
return 1
fi
echo " extracting..."
for filename in $filenames for filename in $filenames
do do
dpkg-deb --extract $filename tmp dpkg-deb --extract $filename tmp
done done
# FORM 1: linux-image et al extracted here. # FORM 1: linux-image et al extracted here.
if [ -d tmp/boot ]; then if [ -d tmp/boot ]; then
echo -n "images..." echo " images..."
find tmp -name "*.ko" | while read f; do find tmp -name "*.ko" | while read f; do
modinfo $f | grep ^firmware >> $fwinfo modinfo $f | grep ^firmware >> $fwinfo
done done
if [ -f tmp/boot/abi-* ]; then if [ -f tmp/boot/abi-* ]; then
mv tmp/boot/abi-* $abidir/$arch/$sub mv tmp/boot/abi-* $abidir/$arch/$sub
else else
echo -n "NO ABI FILE..." echo " NO ABI FILE"
fi fi
if [ -f tmp/boot/retpoline-* ]; then if [ -f tmp/boot/retpoline-* ]; then
mv tmp/boot/retpoline-* $abidir/$arch/$sub.retpoline mv tmp/boot/retpoline-* $abidir/$arch/$sub.retpoline
else else
echo -n "NO RETPOLINE FILE..." echo " NO RETPOLINE FILE"
fi fi
(cd tmp; find lib/modules/$verabi-$sub/kernel -name '*.ko') | \ (cd tmp; find lib/modules/$verabi-$sub/kernel -name '*.ko') | \
sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > \ sed -e 's/.*\/\([^\/]*\)\.ko/\1/' | sort > \
...@@ -101,12 +134,12 @@ getall() { ...@@ -101,12 +134,12 @@ getall() {
print "" print ""
}' | sort -u >$abidir/$arch/$sub.compiler }' | sort -u >$abidir/$arch/$sub.compiler
version=`cat $abidir/$arch/$sub.compiler` version=`cat $abidir/$arch/$sub.compiler`
echo -n "$version..." echo " $version"
) )
# FORM 2: moduleinfo packages # FORM 2: moduleinfo packages
# cranky-fix -- modinfo supported # cranky-fix -- modinfo supported
else else
echo -n "buildinfo..." echo " buildinfo..."
base="tmp/usr/lib/linux/${verabi}-${sub}" base="tmp/usr/lib/linux/${verabi}-${sub}"
mv "$base/abi" "$abidir/$arch/$sub" mv "$base/abi" "$abidir/$arch/$sub"
for comp in 'modules' 'retpoline' 'compiler' for comp in 'modules' 'retpoline' 'compiler'
...@@ -116,12 +149,8 @@ getall() { ...@@ -116,12 +149,8 @@ getall() {
cat "$base/fwinfo" >>"$fwinfo" cat "$base/fwinfo" >>"$fwinfo"
fi fi
rm -rf tmp $filenames rm -rf tmp $filenames
echo "done." echo " done"
else )
echo "FAILED."
fi
cd $origdir
done
} }
# MAIN # MAIN
...@@ -133,8 +162,6 @@ echo $abi > $abidir/abiname ...@@ -133,8 +162,6 @@ echo $abi > $abidir/abiname
# NOTE: The flavours are hardcoded, because they may have changed from the # NOTE: The flavours are hardcoded, because they may have changed from the
# current build. # current build.
__package_prefixes="linux-image"
. $DEBIAN/etc/getabis . $DEBIAN/etc/getabis
# Extract compiler source package version from e.g.: # Extract compiler source package version from e.g.:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment