Skip to content

Commit 9d66b61

Browse files
authored
Fix the apt-get download package disorder issue (sonic-net#8021)
Why I did it Multiple build failed in 202012 branch It is caused by the disorder of the package urls retrieved from the command "apt-get download --print-urls "
1 parent 724d193 commit 9d66b61

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/build_debian_base_system.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,18 @@ mkdir -p $ARCHIEVES
6363
mkdir -p $APTLIST
6464
mkdir -p $TARGET_DEBOOTSTRAP
6565
PACKAGES=$(sed -E 's/=(=[^=]*)$/\1/' $BASE_VERSIONS)
66-
URL_ARR=($(apt-get download --print-uris $PACKAGES | cut -d" " -f1 | tr -d "'"))
66+
URL_ARR=$(apt-get download --print-uris $PACKAGES | cut -d" " -f1 | tr -d "'")
6767
PACKAGE_ARR=($PACKAGES)
6868
LENGTH=${#PACKAGE_ARR[@]}
6969
for ((i=0;i<LENGTH;i++))
7070
do
7171
package=${PACKAGE_ARR[$i]}
7272
packagename=$(echo $package | sed -E 's/=[^=]*$//')
73-
url=${URL_ARR[$i]}
73+
url=$(echo "$URL_ARR" | grep "/${packagename}_")
74+
if [ -z "$url" ] || [[ $(echo "$url" | wc -l) -gt 1 ]]; then
75+
echo "No found package or found multiple package for package $packagename, url: $url" 2>&1
76+
exit 1
77+
fi
7478
filename=$(basename "$url")
7579
SKIP_BUILD_HOOK=y wget $url -P $ARCHIEVES
7680
echo $packagename >> $DEBOOTSTRAP_REQUIRED

0 commit comments

Comments
 (0)