source: downloaded pkgs to a clean directory rather than chroot root

Closes: #952931
This commit is contained in:
jnqnfe 2014-11-29 20:25:03 +00:00 committed by Luca Boccassi
parent feec626274
commit 158950b873
1 changed files with 30 additions and 18 deletions

View File

@ -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