[Bug][Build]: Fix the package url not found when package name encoded issue (#9683)
When the package name with special characters, such as +, the package name may be encoded as %2b, the package url will not be found when reproducible build enabled.
This commit is contained in:
parent
6c507329b7
commit
284b2e783a
@ -13,6 +13,9 @@ TARGET=$TARGET_PATH
|
|||||||
TARGET_BASEIMAGE_PATH=$TARGET/versions/host-base-image
|
TARGET_BASEIMAGE_PATH=$TARGET/versions/host-base-image
|
||||||
mkdir -p $TARGET_BASEIMAGE_PATH
|
mkdir -p $TARGET_BASEIMAGE_PATH
|
||||||
|
|
||||||
|
alias urlencode='python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))"'
|
||||||
|
shopt -s expand_aliases
|
||||||
|
|
||||||
generate_version_file()
|
generate_version_file()
|
||||||
{
|
{
|
||||||
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "dpkg-query -W -f '\${Package}==\${Version}\n'" > $TARGET_BASEIMAGE_PATH/versions-deb-${IMAGE_DISTRO}-${CONFIGURED_ARCH}
|
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "dpkg-query -W -f '\${Package}==\${Version}\n'" > $TARGET_BASEIMAGE_PATH/versions-deb-${IMAGE_DISTRO}-${CONFIGURED_ARCH}
|
||||||
@ -58,7 +61,7 @@ rm -rf $BASEIMAGE_TARBALLPATH $BASEIMAGE_TARBALL
|
|||||||
ARCHIEVES=$BASEIMAGE_TARBALLPATH/var/cache/apt/archives
|
ARCHIEVES=$BASEIMAGE_TARBALLPATH/var/cache/apt/archives
|
||||||
APTLIST=$BASEIMAGE_TARBALLPATH/var/lib/apt/lists
|
APTLIST=$BASEIMAGE_TARBALLPATH/var/lib/apt/lists
|
||||||
TARGET_DEBOOTSTRAP=$BASEIMAGE_TARBALLPATH/debootstrap
|
TARGET_DEBOOTSTRAP=$BASEIMAGE_TARBALLPATH/debootstrap
|
||||||
APTDEBIAN="$APTLIST/deb.debian.org_debian_dists_buster_main_binary-${CONFIGURED_ARCH}_Packages"
|
APTDEBIAN="$APTLIST/deb.debian.org_debian_dists_${DISTRO}_main_binary-${CONFIGURED_ARCH}_Packages"
|
||||||
DEBPATHS=$TARGET_DEBOOTSTRAP/debpaths
|
DEBPATHS=$TARGET_DEBOOTSTRAP/debpaths
|
||||||
DEBOOTSTRAP_BASE=$TARGET_DEBOOTSTRAP/base
|
DEBOOTSTRAP_BASE=$TARGET_DEBOOTSTRAP/base
|
||||||
DEBOOTSTRAP_REQUIRED=$TARGET_DEBOOTSTRAP/required
|
DEBOOTSTRAP_REQUIRED=$TARGET_DEBOOTSTRAP/required
|
||||||
@ -74,13 +77,14 @@ for ((i=0;i<LENGTH;i++))
|
|||||||
do
|
do
|
||||||
package=${PACKAGE_ARR[$i]}
|
package=${PACKAGE_ARR[$i]}
|
||||||
packagename=$(echo $package | sed -E 's/=[^=]*$//')
|
packagename=$(echo $package | sed -E 's/=[^=]*$//')
|
||||||
url=$(echo "$URL_ARR" | grep "/${packagename}_")
|
encoded_packagename=$(urlencode $packagename)
|
||||||
|
url=$(echo "$URL_ARR" | grep -i "/${packagename}_\|/${encoded_packagename}_")
|
||||||
if [ -z "$url" ] || [[ $(echo "$url" | wc -l) -gt 1 ]]; then
|
if [ -z "$url" ] || [[ $(echo "$url" | wc -l) -gt 1 ]]; then
|
||||||
echo "No found package or found multiple package for package $packagename, url: $url" 2>&1
|
echo "No found package or found multiple package for package $packagename, url: $url" 2>&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
filename=$(basename "$url")
|
filename=$(basename "$url")
|
||||||
SKIP_BUILD_HOOK=y wget $url -P $ARCHIEVES
|
SKIP_BUILD_HOOK=y wget $url -O $ARCHIEVES/$filename
|
||||||
echo $packagename >> $DEBOOTSTRAP_REQUIRED
|
echo $packagename >> $DEBOOTSTRAP_REQUIRED
|
||||||
echo "$packagename /var/cache/apt/archives/$filename" >> $DEBPATHS
|
echo "$packagename /var/cache/apt/archives/$filename" >> $DEBPATHS
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user