Subject: Updating binary_local-packageslists to treat non-main packages correctly.

From: Daniel Baumann <[email-masked]>
Date: Mon, 12 Jul 2010 21:37:57 +0200

---
 helpers/binary_local-packageslists | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/helpers/binary_local-packageslists b/helpers/binary_local-packageslists
index 26fc0bb..c5381f4 100755
--- a/helpers/binary_local-packageslists
+++ b/helpers/binary_local-packageslists
@@ -67,6 +67,7 @@ then
 	for FILE in chroot/binary.deb/archives/*.deb
 	do
 		SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
+		SECTION="$(dpkg -f ${FILE} Section | awk '{ print $1 }')"
 
 		if [ -z "${SOURCE}" ]
 		then
@@ -83,17 +84,34 @@ then
 				;;
 		esac
 
+		if echo "${SECTION}" | grep -qs contrib
+		then
+			SECTION="contrib"
+		elif echo "${SECTION}" | grep -qs non-free
+		then
+			SECTION="non-free"
+		else
+			SECTION="main"
+		fi
+
 		# Install directory
-		mkdir -p binary/pool/main/"${LETTER}"/"${SOURCE}"
+		mkdir -p binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}"
 
 		# Move files
-		mv "${FILE}" binary/pool/main/"${LETTER}"/"${SOURCE}"
+		mv "${FILE}" binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}"
 	done
 
 	cd binary
-	mkdir -p dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}
-	apt-ftparchive packages pool/main > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages
-	gzip -9 -c dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz
+
+	for SECTION in pool/*
+	do
+		SECTION="$(basename ${SECTION})"
+
+		mkdir -p dists/${LH_DISTRIBUTION}/${SECTION}/binary-${LH_ARCHITECTURE}
+		apt-ftparchive packages pool/${SECTION} > dists/${LH_DISTRIBUTION}/${SECTION}/binary-${LH_ARCHITECTURE}/Packages
+		gzip -9 -c dists/${LH_DISTRIBUTION}/${SECTION}/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/${SECTION}/binary-${LH_ARCHITECTURE}/Packages.gz
+	done
+
 	cd "${OLDPWD}"
 
 	rm -rf chroot/binary.deb
-- 
cgit v1.0