From: Anil Belur Date: Tue, 28 Jan 2020 02:56:48 +0000 (+1000) Subject: Use netselect to choose a package mirror X-Git-Tag: v0.4.2^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=4c9db8e41b3b546a52d702b4f1f3d6f655c90e3e;p=releng%2Fcommon-packer.git Use netselect to choose a package mirror Use netselect to choose a package mirror to install python-minimal in a reliable manner. apt{-get} does not refresh the package mirrors (for packer builds run within Jenkins), therefore fails with "E: Unable to locate package python-minimal" while installing python-minimal. Issue: RELENG-2548 Change-Id: Iab90212657816a9b66db07b356c32ae7e90272d8 Signed-off-by: Anil Belur --- diff --git a/provision/install-python.sh b/provision/install-python.sh index 5c06432..464f318 100755 --- a/provision/install-python.sh +++ b/provision/install-python.sh @@ -29,7 +29,20 @@ function is_ubuntu() } if is_ubuntu; then + # Use netselect to choose a package mirror to install python-minimal in a + # reliable manner. + # apt{-get} does not refresh the package mirrors (for packer builds run + # within Jenkins), therefore fails with "E: Unable to locate package + # python-minimal" while installing python-minimal. + echo "Install netselect to choose a mirror." + apt install wget -y + wget http://ftp.au.debian.org/debian/pool/main/n/netselect/netselect_0.3.ds1-26_amd64.deb + dpkg -i netselect_0.3.ds1-26_amd64.deb + netselect -s 20 -t 40 "$(wget -qO - mirrors.ubuntu.com/mirrors.txt)" + sed -i 's/http:\/\/us.archive.ubuntu.com\/ubuntu\//http:\/\/ubuntu.uberglobalmirror.com\/archive\//' /etc/apt/sources.list + echo "Installing python-minimal..." + apt clean all -y apt -y update apt install -y python-minimal fi diff --git a/releasenotes/notes/use-netselect-to-choose-working-mirror-56d62fe30d69d134.yaml b/releasenotes/notes/use-netselect-to-choose-working-mirror-56d62fe30d69d134.yaml new file mode 100644 index 0000000..f5166a6 --- /dev/null +++ b/releasenotes/notes/use-netselect-to-choose-working-mirror-56d62fe30d69d134.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Use netselect to choose a package mirror to install python-minimal in a + reliable manner. + + apt{-get} does not refresh the package mirrors (for packer builds run + within Jenkins), therefore fails with "E: Unable to locate package + python-minimal" while installing python-minimal.