From ab1e4ce5a803804edbec20c9c8fbae79f31fa23e Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Sat, 27 Sep 2008 22:33:58 +0100
Subject: Create a "missing-source.txt" file containing missing source packages
 instead of exiting.

---
 helpers/lh_source_debian | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/helpers/lh_source_debian b/helpers/lh_source_debian
index a121cd2..247543e 100755
--- a/helpers/lh_source_debian
+++ b/helpers/lh_source_debian
@@ -92,7 +92,31 @@ EOF
 		;;
 esac
 
-Chroot "xargs --arg-file=/root/dpkg-selection.txt apt-get ${APT_OPTIONS} --download-only source"
+MISSING=""
+
+grep . chroot/root/dpkg-selection.txt | \
+while read PACKAGE
+do
+	if ! Chroot "apt-get ${APT_OPTIONS} --download-only source ${PACKAGE}"
+	then
+		MISSING="${MISSING} ${PACKAGE}"
+	fi
+done
+
+if [ -n "${MISSING}" ]
+then
+	cat > source/missing-source.txt << EOF
+This file contains the list of binary packages that are installed on this live
+system that do not have a corresponding source package.
+
+EOF
+
+	for PACKAGE in ${MISSING}
+	do
+		Chroot "dpkg -l ${PACKAGE}" | tail -n1 >> source/missing-source.txt
+	done
+fi
+
 rm -f chroot/root/dpkg-selection.txt
 
 # Sort sources
-- 
cgit v1.0