summaryrefslogtreecommitdiff
path: root/localdebpool
diff options
context:
space:
mode:
Diffstat (limited to 'localdebpool')
-rwxr-xr-xlocaldebpool117
1 files changed, 95 insertions, 22 deletions
diff --git a/localdebpool b/localdebpool
index 3ca414a..bfb43cc 100755
--- a/localdebpool
+++ b/localdebpool
@@ -3,24 +3,41 @@
set -e
#set -x
+ARCHS="i386 powerpc amd64"
+DISTS="etch lenny sid"
+
SRCBASE=~/public_debian
PUBBASE=~/public_websites/debian.jones.dk
#PUBTOSRC=../../public_debian
-pathsfromsuites() {
+archsfrompaths() {
+ find "$@" -type l -exec find '{}'/ -type f -name '*.deb' ';' \
+ | sed 's/^.*_\([a-z0-9-]\+\)\.deb$/\1/' \
+ | sort -u
+}
+
+distsfrompaths() {
+ find "$@" -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
+}
+
+pathsfromsections() {
case "$@" in
all)
- suites_re=""
+ sections_re=""
+ ;;
+ "")
+ echo 1>&2 "ERROR: At least one section (or the magic \"all\") is needed."
+ exit 1
;;
*)
- suites_re="\b\($(echo "$@" | sed 's/[[:space:]]\+/\\|/g')\)\b"
+ sections_re="\b\($(echo "$@" | sed 's/[[:space:]]\+/\\|/g')\)\b"
;;
esac
- find $SRCBASE -type f -name HINTS -exec grep -q "^Sections:.*$suites_re" '{}' ';' -printf '%h\n' \
+ find $SRCBASE -type f -name HINTS -exec grep -q "^Sections:.*$sections_re" '{}' ';' -printf '%h\n' \
| sed "s,^$SRCBASE/,,"
}
-suitesfrompaths() {
+sectionsfrompaths() {
case "$@" in
all)
fullpaths="$SRCBASE"
@@ -40,10 +57,74 @@ suitesfrompaths() {
| sort -u
}
-suites="$@"
-paths="$(pathsfromsuites "$suites")"
+genlist() {
+ dist="$1"
+ arch="$2"
+ srcdir="$3"
+ basedir="$4"
+ case "$arch" in
+ source)
+ destdir="$basedir/source";
+ cmd="dpkg-scansources";
+ file="Sources";
+ ;;
+ *)
+ destdir="$basedir/binary_$arch";
+ cmd="dpkg-scanpackages";
+ file="Packages";
+ ;;
+ esac
+ mkdir -p "$destdir"
+ ( cd "$srcdir" && $cmd $dist /dev/null pools/ ) > "$destdir/$file"
+ gzip -c "$destdir/$file" > "$destdir/$file.gz"
+ bzip2 -c "$destdir/$file" > "$destdir/$file.bz2"
+}
+
+genlistsfromsection() {
+ section="$1"
+ case "$section" in
+ all)
+ srcdir="$SRCBASE/sections"
+ ;;
+ "")
+ echo 1>&2 "ERROR: At least one section (or the magic \"all\") is needed."
+ exit 1
+ ;;
+ *)
+ srcdir="$SRCBASE/sections/$section"
+ ;;
+ esac
+ dists="$(distsfrompaths "$srcdir")"
+ archs="$(archsfrompaths "$srcdir")"
+ for dist in $DISTS; do
+ do_dist=
+ for dist_found in $dists; do
+ if [ "$dist_found" = "$dist" ]; then
+ do_dist=1
+ continue
+ fi
+ done
+ [ -n "$do_dist" ] || continue
+ for arch in $ARCHS; do
+ do_arch=
+ for arch_found in $archs; do
+ case $arch_found in
+ $arch|all)
+ do_arch=1
+ continue
+ esac
+ done
+ [ -n "$do_arch" ] || continue
+ echo genlist "$section" "$dist" "$arch" "$srcdir" "$PUBBASE/dists/$dist/$section"
+ done
+ echo genlist "$section" "$dist" "source" "$srcdir" "$PUBBASE/dists/$dist/$section"
+ done
+}
+
+sections="$@"
+paths="$(pathsfromsections "$sections")"
#echo $paths; exit 0
-#suitesfrompaths all; exit 0
+#sectionsfrompaths all; exit 0
for path in $paths; do
package="$(basename "$path")"
@@ -53,22 +134,14 @@ for path in $paths; do
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"
+ for section in $(sectionsfrompaths "$path"); do
+ mkdir -p "$SRCBASE/sections/$section/$symlink_dir"
+ ln -sf -T "../../../../$path" "$SRCBASE/sections/$section/$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"
+for section in $sections; do
+ genlistsfromsection $section
+done
exit 0