summaryrefslogtreecommitdiff
path: root/localdebpool
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2007-11-26 04:35:57 +0000
committerJonas Smedegaard <dr@jones.dk>2007-11-26 04:35:57 +0000
commit671a687eb7a16c40b23e831fab9a577275d3d006 (patch)
tree27823edd9ab577a01e78c6c972e88b14a0fcb12e /localdebpool
parent1a364209008b5c0eb6d2ddf3bd328aca2c9ed37b (diff)
New script to generate Packages files for deb package pools.
Diffstat (limited to 'localdebpool')
-rwxr-xr-xlocaldebpool74
1 files changed, 74 insertions, 0 deletions
diff --git a/localdebpool b/localdebpool
new file mode 100755
index 0000000..3ca414a
--- /dev/null
+++ b/localdebpool
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+set -e
+#set -x
+
+SRCBASE=~/public_debian
+PUBBASE=~/public_websites/debian.jones.dk
+#PUBTOSRC=../../public_debian
+
+pathsfromsuites() {
+ case "$@" in
+ all)
+ suites_re=""
+ ;;
+ *)
+ suites_re="\b\($(echo "$@" | sed 's/[[:space:]]\+/\\|/g')\)\b"
+ ;;
+ esac
+ find $SRCBASE -type f -name HINTS -exec grep -q "^Sections:.*$suites_re" '{}' ';' -printf '%h\n' \
+ | sed "s,^$SRCBASE/,,"
+}
+
+suitesfrompaths() {
+ case "$@" in
+ all)
+ fullpaths="$SRCBASE"
+ ;;
+ *)
+ fullpaths=
+ for path in "$@"; do
+ # TODO: rewrite to support spaces in directory names
+ fullpaths="$fullpaths $SRCBASE/$path"
+ done
+ ;;
+ esac
+ find $fullpaths -type f -name HINTS -exec cat '{}' ';' \
+ | grep '^Sections:' \
+ | sed 's/^Sections://; s/[[:space:]]\+/ /g; s/^ //; s/ $//' \
+ | tr ' ' '\n' \
+ | sort -u
+}
+
+suites="$@"
+paths="$(pathsfromsuites "$suites")"
+#echo $paths; exit 0
+#suitesfrompaths all; exit 0
+
+for path in $paths; do
+ package="$(basename "$path")"
+ pool="$(echo $(dirname "$path") | sed 's,.*/pool-\([^/]\+\)/\?.*,\1,; s,-all$,,')"
+ buildhost="$(echo $(dirname "$path") | sed 's,^\([^/]\+\)/pool-.*,\1,')"
+ symlink_dir="$pool/$package"
+ mkdir -p "$PUBBASE/pools/$symlink_dir"
+# ln -sf -T "../../../$PUBTOSRC/$path" "$PUBBASE/pools/$symlink_dir/$buildhost"
+ ln -sf -T "$SRCBASE/$path" "$PUBBASE/pools/$symlink_dir/$buildhost"
+ for suite in $(suitesfrompaths "$path"); do
+ mkdir -p "$SRCBASE/suites/$suite/$symlink_dir"
+ ln -sf -T "../../../../$path" "$SRCBASE/suites/$suite/$symlink_dir/$buildhost"
+ done
+done
+
+srcdir="$SRCBASE/suites/sugar"
+pubdir="$PUBBASE/dists/sid/sugar/binary-amd64"
+mkdir -p "$pubdir"
+( cd "$srcdir" && dpkg-scanpackages * /dev/null pools/ ) > "$pubdir/Packages"
+gzip -c "$pubdir/Packages" > "$pubdir/Packages.gz"
+bzip2 -c "$pubdir/Packages" > "$pubdir/Packages.bz2"
+pubdir="$PUBBASE/dists/sid/sugar/source"
+mkdir -p "$pubdir"
+( cd "$srcdir" && dpkg-scansources * /dev/null pools/ ) > "$pubdir/Sources"
+gzip -c "$pubdir/Sources" > "$pubdir/Sources.gz"
+bzip2 -c "$pubdir/Sources" > "$pubdir/Sources.bz2"
+
+exit 0