summaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
authorjnqnfe <jnqnfe@gmail.com>2014-11-29 20:25:03 +0000
committerLuca Boccassi <bluca@debian.org>2020-03-10 12:44:11 +0000
commit158950b873bcfbac2d6bd59fd82a15b9fb4476b8 (patch)
treeefb01c60da10627d791fc584f9bd807fdbc4361e /scripts/build
parentfeec6262749503805a831771fac47a253d0c869f (diff)
downloadvyos-live-build-158950b873bcfbac2d6bd59fd82a15b9fb4476b8.tar.gz
vyos-live-build-158950b873bcfbac2d6bd59fd82a15b9fb4476b8.zip
source: downloaded pkgs to a clean directory rather than chroot root
Closes: #952931
Diffstat (limited to 'scripts/build')
-rwxr-xr-xscripts/build/source_debian48
1 files changed, 30 insertions, 18 deletions
diff --git a/scripts/build/source_debian b/scripts/build/source_debian
index ee0984400..2ba647362 100755
--- a/scripts/build/source_debian
+++ b/scripts/build/source_debian
@@ -131,19 +131,9 @@ case "${LB_MODE}" in
;;
esac
-MISSING=""
-while read -r PACKAGE
-do
- if ! Chroot chroot "apt-get ${APT_OPTIONS} --download-only source ${PACKAGE}"
- then
- MISSING="${MISSING} ${PACKAGE}"
- fi
-done < source-selection.txt
-rm -f source-selection.txt
+mkdir -p chroot/source.pkgs
-if [ -n "${MISSING}" ]
-then
- cat > source/missing-source.txt << EOF
+cat > chroot/missing-source.txt << EOF
This file contains the list of binary packages that are installed on the "live"
system (to which this source disc is a companion) for which a corresponding
source package is not included on this disc. This may be because the binary
@@ -152,14 +142,34 @@ the source package available was not the same as that of the binary.
EOF
- for PACKAGE in ${MISSING}
- do
- Chroot chroot "dpkg -l ${PACKAGE}" | tail -n1 >> source/missing-source.txt
- done
+cat > chroot/source-download.sh << EOF
+#!/bin/sh
+cd source.pkgs
+PACKAGE="\${1}"
+if ! apt-get ${APT_OPTIONS} --download-only source \${PACKAGE}
+then
+ dpkg -l \${PACKAGE} | tail -n1 >> ../missing-source.txt
+ touch ../missing-source-some
+fi
+EOF
+
+while read -r PACKAGE
+do
+ Chroot chroot "sh source-download.sh ${PACKAGE}" || true
+done < source-selection.txt
+rm -f source-selection.txt
+rm -f chroot/source-download.sh
+
+if [ -e chroot/missing-source-some ]
+then
+ mv chroot/missing-source.txt source/missing-source.txt
+ rm -f chroot/missing-source-some
+else
+ rm -f chroot/missing-source.txt
fi
# Sort sources
-for DSC in chroot/*.dsc
+for DSC in chroot/source.pkgs/*.dsc
do
SOURCE="$(sed -n 's|^Source: ||p' ${DSC} 2>/dev/null || :)"
# The sed may fail if multiple dsc files exist for same source, as the
@@ -180,9 +190,11 @@ do
mkdir -p source/debian/"${LETTER}"/"${SOURCE}"
# Move files
- mv chroot/"${SOURCE}"_* source/debian/"${LETTER}"/"${SOURCE}"
+ mv chroot/source.pkgs/"${SOURCE}"_* source/debian/"${LETTER}"/"${SOURCE}"
done
+rmdir --ignore-fail-on-non-empty chroot/source.pkgs
+
# Reverting apt sources again
if [ -e chroot/etc/apt/sources.list.d/progress-linux.list.orig ]
then