Use netselect to choose a package mirror 68/62968/1
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 28 Jan 2020 02:56:48 +0000 (12:56 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Tue, 28 Jan 2020 03:01:07 +0000 (13:01 +1000)
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 <abelur@linuxfoundation.org>
provision/install-python.sh
releasenotes/notes/use-netselect-to-choose-working-mirror-56d62fe30d69d134.yaml [new file with mode: 0644]

index 5c06432..464f318 100755 (executable)
@@ -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 (file)
index 0000000..f5166a6
--- /dev/null
@@ -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.