summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJohannes 'josch' Schauer <josch@mister-muffin.de>2017-11-19 00:16:59 +0100
committerHolger Levsen <holger@layer-acht.org>2017-11-18 23:27:01 +0000
commit26159e8373bc5163f0344c45bb9960e1b4595825 (patch)
tree24850106162e1621a50408b5846962b74431349e /bin
parent4388d6d550dee3b8d84277866b6654e26a06001a (diff)
downloadjenkins.debian.net-26159e8373bc5163f0344c45bb9960e1b4595825.tar.xz
bin/find_dpkg_trigger_cycles.sh: update for Debian Stretch
- Update from apt-file 2 to apt-file 3 - the --cache and --sources-list are replaced by --config-file - "apt-file update" is replaced by "apt update" - apt config gains Acquire::IndexTargets section - Make use of features of more recent apt version - use sources.list in deb822 format - instead of relying on an uncompressed Packages file with a fixed pattern in /var/lib/apt/lists/, use "apt-get indextargets" in connection with "apt-helper cat-file" Interface change: Before, the script allowed either a suite name or codename to specify the Debian release to check. Now, the script is limited to the codename (jessie, stretch, buster, ...). The reason is, that we want to make sure to grab the right Packages file using "apt-get indextargets" and for that we need to specify the suite or the codename. To avoid having to implement a mapping mechanism, the script now is limited to working with codenames. Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/find_dpkg_trigger_cycles.sh60
1 files changed, 44 insertions, 16 deletions
diff --git a/bin/find_dpkg_trigger_cycles.sh b/bin/find_dpkg_trigger_cycles.sh
index 9fdad932..938f9942 100755
--- a/bin/find_dpkg_trigger_cycles.sh
+++ b/bin/find_dpkg_trigger_cycles.sh
@@ -105,8 +105,8 @@ set -o pipefail
set -e
ARCH="amd64"
-DIST="$1"
-DIRECTORY="`pwd`/debian-$DIST-$ARCH"
+CODENAME="$1"
+DIRECTORY="`pwd`/debian-$CODENAME-$ARCH"
APT_OPTS="-y"
#APT_OPTS=$APT_OPTS" -o Acquire::Check-Valid-Until=false" # because we use snapshot
@@ -127,30 +127,58 @@ cp /etc/apt/trusted.gpg.d/* $DIRECTORY/etc/apt/trusted.gpg.d/
touch $DIRECTORY/var/lib/dpkg/status
-echo deb $MIRROR $DIST main > $DIRECTORY/etc/apt/sources.list
+cat << END > $DIRECTORY/etc/apt/sources.list.d/default.sources
+Types: deb
+URIs: $MIRROR
+Suites: $CODENAME
+Components: main
+Architectures: $ARCH
+END
cat << END > "$DIRECTORY/etc/apt/apt.conf"
Apt::Architecture "$ARCH";
+Apt::Architectures "$ARCH";
Dir::Etc::TrustedParts "$DIRECTORY/etc/apt/trusted.gpg.d";
Dir::Etc::Trusted "$DIRECTORY/etc/apt/trusted.gpg";
Dir "$DIRECTORY/";
Dir::Etc "$DIRECTORY/etc/apt/";
Dir::Etc::SourceList "$DIRECTORY/etc/apt/sources.list";
+Dir::Etc::SourceParts "$DIRECTORY/etc/apt/sources.list.d/";
Dir::State "$DIRECTORY/var/lib/apt/";
Dir::State::Status "$DIRECTORY/var/lib/dpkg/status";
Dir::Cache "$DIRECTORY/var/cache/apt/";
+Acquire::IndexTargets {
+ deb::Contents-deb::DefaultEnabled "true";
+ deb::Contents-deb {
+ MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
+ ShortDescription "Contents-\$(ARCHITECTURE)";
+ Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents (deb)";
+ flatMetaKey "Contents-\$(ARCHITECTURE)";
+ flatDescription "\$(RELEASE) Contents (deb)";
+ PDiffs "true";
+ KeepCompressed "true";
+ };
+ deb::Packages::DefaultEnabled "true";
+ deb::Translations::DefaultEnabled "false";
+ deb-src::Contents-dsc::DefaultEnabled "false";
+ deb-src::Sources::DefaultEnabled "false";
+};
+apt-file::Index-Names "deb";
+#clear APT::Default-Release;
END
+APT_FILE_OPTS="--architecture $ARCH --config-file $DIRECTORY/etc/apt/apt.conf"
APT_CONFIG="$DIRECTORY/etc/apt/apt.conf"
export APT_CONFIG
-apt-get $APT_OPTS update
-
-APT_FILE_OPTS="--architecture $ARCH"
-APT_FILE_OPTS=$APT_FILE_OPTS" --cache $DIRECTORY/var/cache/apt/apt-file"
-APT_FILE_OPTS=$APT_FILE_OPTS" --sources-list $DIRECTORY/etc/apt/sources.list"
+apt $APT_OPTS update
-apt-file $APT_FILE_OPTS update
+PACKAGES=$(apt-get indextargets \
+ | grep-dctrl --exact \( --field Created-By Packages \
+ --and --field Architecture $ARCH \
+ --and --field Codename $CODENAME \
+ --and --field Component main \) \
+ -s Filename -n)
printf "" > $DIRECTORY/interested-file
printf "" > $DIRECTORY/interested-explicit
@@ -170,7 +198,7 @@ trap finish EXIT
# of the package names passed to it is not known by apt. This can easily
# happen in unstable where binarycontrol.debian.net still knows about
# a package which was already removed.
-curl --retry 3 --retry-delay 10 --globoff "http://binarycontrol.debian.net/?q=&path=${DIST}%2F[^%2F]%2B%2Ftriggers%24&format=pkglist" \
+curl --retry 3 --retry-delay 10 --globoff "http://binarycontrol.debian.net/?q=&path=${CODENAME}%2F[^%2F]%2B%2Ftriggers%24&format=pkglist" \
| xargs python3 -c "import apt,sys;c=apt.Cache();[print(n, c[n].candidate.uri) for n in sys.argv[1:] if n in c]" \
| sort -u \
| while read pkg url; do
@@ -229,8 +257,8 @@ cat $DIRECTORY/interested-file | while read pkg ttype ipath; do
#
# We ignore the implicit dependencies on Essential:yes packages because
# they do not create trigger cycles.
- dose-ceve --deb-ignore-essential -c $pkg -T cudf -t deb \
- $DIRECTORY/var/lib/apt/lists/*_dists_${DIST}_main_binary-${ARCH}_Packages \
+ /usr/lib/apt/apt-helper cat-file "$PACKAGES" \
+ | dose-ceve --deb-ignore-essential -c $pkg -T cudf -t deb \
| awk '/^package:/ { print $2 }' \
| apt-file $APT_FILE_OPTS show -F --from-file - \
| sed -ne "s ^\([^:]\+\):\s\+\(${ipath}\(\$\|/.*\)\) \1\t\2 p" \
@@ -250,8 +278,8 @@ cat $DIRECTORY/interested-file | while read pkg ttype ipath; do
#
# We ignore the implicit dependencies on Essential:yes packages because
# they do not create trigger cycles.
- dose-ceve --deb-ignore-essential -c $pkg -T cudf -t deb \
- $DIRECTORY/var/lib/apt/lists/*_dists_${DIST}_main_binary-${ARCH}_Packages \
+ /usr/lib/apt/apt-helper cat-file "$PACKAGES" \
+ | dose-ceve --deb-ignore-essential -c $pkg -T cudf -t deb \
| awk '/^package:/ { print $2 }' \
| while read dep; do
[ "$pkg" != "$dep" ] || continue
@@ -275,8 +303,8 @@ cat $DIRECTORY/interested-explicit | while read pkg ttype iname; do
#
# We ignore the implicit dependencies on Essential:yes packages because
# they do not create trigger cycles.
- dose-ceve --deb-ignore-essential -c $pkg -T cudf -t deb \
- $DIRECTORY/var/lib/apt/lists/*_dists_${DIST}_main_binary-${ARCH}_Packages \
+ /usr/lib/apt/apt-helper cat-file "$PACKAGES" \
+ | dose-ceve --deb-ignore-essential -c $pkg -T cudf -t deb \
| awk '/^package:/ { print $2 }' \
| while read dep; do
[ "$pkg" != "$dep" ] || continue