summaryrefslogtreecommitdiff
path: root/unpack-debian-sources
diff options
context:
space:
mode:
Diffstat (limited to 'unpack-debian-sources')
-rwxr-xr-xunpack-debian-sources104
1 files changed, 0 insertions, 104 deletions
diff --git a/unpack-debian-sources b/unpack-debian-sources
deleted file mode 100755
index 0b6f097..0000000
--- a/unpack-debian-sources
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/sh
-#
-# unpack-debian-sources - unpack all Debian packages in a Debian
-# repository
-#
-# Usage: unpack-debian-sources MIRROR SUITE [SECTION]...
-#
-# where MIRROR is the URL to a Debian mirror site, SUITE is the release,
-# and SECTION is a section within the release. For example:
-#
-# unpack-debian-sources http://ftp.debian.org/debian etch main contrib
-#
-# If SECTION is missing, it defaults to "main contrib non-free"
-
-set -e
-
-die()
-{
- echo "$@" 1>&2
- exit 1
-}
-
-fetch()
-{
- wget -q -O - "$1"
-}
-
-parse_sources()
-{
- awk '
- /^Directory:/ {
- if (dir && paths) print dir, paths
- dir = $2
- paths = ""
- }
- /^Files:/ { infiles = 1; next }
- infiles && /^ / { paths = paths " " $NF }
- infiles && (NF == 0 || /^[^ ]/) { infiles = 0 }
- '
-}
-
-showiferror()
-{
- local temp="$(mktemp)"
- if ! "$@" > "$temp" 2>&1
- then
- cat "$temp"
- rm -f "$temp"
- exit 1
- fi
- rm -f "$temp"
-}
-
-unpack_dsc()
-{
- (
- cd "$1"
- dsc="$(ls *.dsc)"
- showiferror dpkg-source -x *.dsc
- )
-}
-
-[ "$2" = "" ] && die "Usage: $0 MIRROR SUITE [SECTION]..."
-
-mirror="$1"
-suite="$2"
-shift 2
-sections="$@"
-
-gpghome="$(mktemp -d)"
-export GNUPGHOME="$gpghome"
-
-for section in $sections
-do
- sources="$mirror/dists/$suite/$section/source/Sources.bz2"
- sources_tmp="$(mktemp)"
- fetch "$sources" | bunzip2 > "$sources_tmp"
-
- num_packages=$(parse_sources < "$sources_tmp" | wc -l)
-
- n=0
- parse_sources < "$sources_tmp" |
- while read dir paths
- do
- n=$(expr $n + 1)
- if [ ! -d "$dir" ]
- then
- printf "$n/$num_packages: $dir\n"
- temp="$(mktemp -d)"
- for path in $paths
- do
- fetch "$mirror/$dir/$path" > "$temp/$path"
- done
- unpack_dsc "$temp"
- for path in $paths
- do
- rm "$temp/$path"
- done
- mkdir -p "$dir" # Create parent dirs
- rmdir "$dir" # Remove tail dir
- mv "$temp"/* "$dir" # Move the _single_ dir, which has the src
- fi
- done
-done