use http.debian.net as mirror and only download package header

This commit is contained in:
josch 2014-12-16 04:38:53 +01:00
parent 0f6a2c90b7
commit 67510542cc
2 changed files with 24 additions and 7 deletions

11
extract_binary_control.py Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env python3
import arpy
import sys
ar=arpy.Archive(fileobj=sys.stdin.buffer)
for f in ar:
if f.header.name == b"control.tar.gz":
sys.stdout.buffer.write(f.read())
break

View file

@ -16,7 +16,8 @@ set -e
ARCH="amd64" ARCH="amd64"
DIST="sid" DIST="sid"
MIRROR="http://snapshot.debian.org/archive/debian/20141211T041251Z/" MIRROR="http://http.debian.net/debian"
#MIRROR="http://snapshot.debian.org/archive/debian/20141211T041251Z/"
DIRECTORY="`pwd`/debian-$DIST-$ARCH" DIRECTORY="`pwd`/debian-$DIST-$ARCH"
#FIXME: if the host has more than one arch enabled then those Packages files will be downloaded as well #FIXME: if the host has more than one arch enabled then those Packages files will be downloaded as well
@ -31,7 +32,7 @@ APT_OPTS=$APT_OPTS" -o Dir::Etc::SourceList=$DIRECTORY/etc/apt/sources.list"
APT_OPTS=$APT_OPTS" -o Dir::State=$DIRECTORY/var/lib/apt/" APT_OPTS=$APT_OPTS" -o Dir::State=$DIRECTORY/var/lib/apt/"
APT_OPTS=$APT_OPTS" -o Dir::State::Status=$DIRECTORY/var/lib/dpkg/status" APT_OPTS=$APT_OPTS" -o Dir::State::Status=$DIRECTORY/var/lib/dpkg/status"
APT_OPTS=$APT_OPTS" -o Dir::Cache=$DIRECTORY/var/cache/apt/" APT_OPTS=$APT_OPTS" -o Dir::Cache=$DIRECTORY/var/cache/apt/"
APT_OPTS=$APT_OPTS" -o Acquire::Check-Valid-Until=false" # because we use snapshot #APT_OPTS=$APT_OPTS" -o Acquire::Check-Valid-Until=false" # because we use snapshot
mkdir -p $DIRECTORY mkdir -p $DIRECTORY
mkdir -p $DIRECTORY/etc/apt/ mkdir -p $DIRECTORY/etc/apt/
@ -63,13 +64,19 @@ printf "" > interested-explicit
printf "" > activated-file printf "" > activated-file
printf "" > activated-explicit printf "" > activated-explicit
cat control_triggers_packages | while read pkg; do # find all binary packages with /triggers$
curl "http://binarycontrol.debian.net/?q=&path=%2Ftriggers%24&format=pkglist" \
| xargs apt-get $APT_OPTS --print-uris download \
| sed -ne "s/^'\([^']\+\)'\s\+\([^_]\+\)_.*/\2 \1/p" \
| sort \
| while read pkg url; do
echo "working on $pkg..." >&2 echo "working on $pkg..." >&2
apt-get $APT_OPTS download $pkg mkdir DEBIAN
dpkg-deb --control ${pkg}_*.deb curl --location --silent "$url" \
| ./extract_binary_control.py \
| tar -C "DEBIAN" --exclude=./md5sums -xz
if [ ! -f DEBIAN/triggers ]; then if [ ! -f DEBIAN/triggers ]; then
rm -r DEBIAN rm -r DEBIAN
rm ${pkg}_*.deb
continue continue
fi fi
# find all triggers that are either interest or interest-await # find all triggers that are either interest or interest-await
@ -87,7 +94,6 @@ cat control_triggers_packages | while read pkg; do
echo "$pkg $line" echo "$pkg $line"
done >> activated-explicit done >> activated-explicit
rm -r DEBIAN rm -r DEBIAN
rm ${pkg}_*.deb
done done
printf "" > result-file printf "" > result-file