[dpkg] 145/192: debian: Remove maintscript code for downgrades to ancient dpkg versions
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:04:11 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit b7507002eeac63c580e8ea9d8c8e1e9071733150
Author: Guillem Jover <guillem at debian.org>
Date: Sun Sep 24 18:35:16 2017 +0200
debian: Remove maintscript code for downgrades to ancient dpkg versions
The code here was handling pre-triggers and pre-multiarch downgrades.
---
Makefile.am | 1 -
debian/changelog | 2 +
debian/dpkg.postrm | 17 ------
debian/dpkg.prerm | 149 -----------------------------------------------------
4 files changed, 2 insertions(+), 167 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 46a35cb..1345784 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,7 +59,6 @@ EXTRA_DIST = \
debian/dpkg.manpages \
debian/dpkg.postinst \
debian/dpkg.postrm \
- debian/dpkg.prerm \
debian/dpkg.logrotate \
debian/dpkg.lintian-overrides \
debian/dselect.cfg \
diff --git a/debian/changelog b/debian/changelog
index 3c8c77e..eb1f5e8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -131,6 +131,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
from xz to gzip in the dpkg daily cron job.
- Remove Replaces and Breaks for ancient transitions.
- Remove workaround for ancient gcc lacking stackprotectorstrong support.
+ - Remove maintainer script code to handle downgrades to pre-triggers and
+ pre-multiarch dpkg versions.
* Test suite:
- Enable perlcritic Documentation::RequirePodSections and
Miscellanea::ProhibitTies.
diff --git a/debian/dpkg.postrm b/debian/dpkg.postrm
index 5b2120a..9b0234b 100755
--- a/debian/dpkg.postrm
+++ b/debian/dpkg.postrm
@@ -8,19 +8,6 @@ remove_logfile() {
rm -f /var/log/dpkg.log /var/log/dpkg.log.* 2>/dev/null
}
-# Cleanup multiarch infodb leftovers
-cleanup_multiarch_infodb()
-{
- admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
- pkgadmindir=$admindir/info
-
- echo "Cleaning up the multiarch dpkg control files database ..."
- ls $pkgadmindir | grep : | while read oldfile; do
- rm "$pkgadmindir/$oldfile"
- done
- rm -f $pkgadmindir/format
-}
-
case "$1" in
remove)
;;
@@ -30,10 +17,6 @@ case "$1" in
;;
upgrade)
- # Downgrade the multiarch db to a “monoarch” db layout
- if dpkg --compare-versions "$2" lt 1.16.2; then
- cleanup_multiarch_infodb
- fi
;;
failed-upgrade|disappear|abort-install|abort-upgrade)
diff --git a/debian/dpkg.prerm b/debian/dpkg.prerm
deleted file mode 100755
index 1b9d927..0000000
--- a/debian/dpkg.prerm
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/sh
-# See deb-prerm(5).
-
-set -e
-
-ensure_no_triggers_noawait()
-{
- admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
- pkgadmindir=$admindir/info
-
- trig_noawait=$(find "$pkgadmindir" -name "*.triggers" -type f | \
- xargs -r grep -El "^(interest|activate)-(no)?await" | \
- sed -e 's,^.*/\([^/.:]\+\)[^/]\+$,\1,')
-
- # Abort if we cannot possibly downgrade
- if [ -n "$trig_noawait" ]; then
- cat <<- MSG
- dpkg: error: You have packages using the "interest-noawait" and/or
- "activate-noawait" trigger directives but the dpkg version that
- you're trying to downgrade to doesn't support them. Aborting
- downgrade.
-
- List of affected packages:
-
- $trig_noawait
- MSG
- exit 1
- fi
-
- bad_triggers_files=$(find "$admindir/triggers" -type f | \
- xargs -r grep -l "/noawait$" || true)
- if [ -n "$bad_triggers_files" ]; then
- cat <<- MSG
- dpkg: error: Some internal trigger files unexpectedly reference
- packages tagged with "/noawait" while their corresponding
- infodb files doesn't seem to contain any "interest-noawait"
- directive. Aborting the downgrade as those tags are not supported
- by the version you're trying to downgrade to.
-
- List of internal trigger files that are affected:
-
- $bad_triggers_files
- MSG
- exit 1
- fi
-}
-
-downgrade_multiarch_infodb()
-{
- admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
- pkgadmindir=$admindir/info
- triggersdir=$admindir/triggers
-
- coinst_pkgs="`ls "$pkgadmindir" | \
- sed -n -e 's/^\([^:]\+:[^.]\+\)\..*$/\1/p' | sort -u | \
- cut -d: -f1 | uniq -d`"
-
- # Abort if we cannot possibly downgrade
- if [ -n "$coinst_pkgs" ]; then
- cat <<- MSG
- dpkg: error: You have more than one architecture instance for some
- installed 'Multi-Arch: same' packages, to be able to downgrade dpkg
- you will need to have only one instance installed per package.
-
- List of co-installed packages:
-
- $coinst_pkgs
- MSG
- exit 1
- fi
-
- bad_dep_pkgs=$(dpkg-query -f '${Package}\t${Depends} ${Recommends} ${Suggests} ${Enhances} ${Conflicts} ${Replaces} ${Breaks}\n' -W | \
- grep ":any" | cut -f1 | sort -u)
- if [ -n "$bad_dep_pkgs" ]; then
- cat <<- MSG
- dpkg: error: Some installed packages have multiarch dependencies that
- the old dpkg won't parse. You should get rid of them (or downgrade
- them to versions without those dependencies) before proceeding with
- dpkg's downgrade.
-
- List of affected packages:
-
- $bad_dep_pkgs
- MSG
- exit 1
- fi
-
- dep_fields='Depends|Recommends|Suggests|Enhances|Conflicts|Replaces|Breaks'
- if grep -qE "^($dep_fields):.*:any" $admindir/available; then
- cat <<- MSG
- dpkg: error: Some available packages have multiarch dependencies that
- the old dpkg won't parse. You should clear this file before proceeding
- with dpkg's downgrade, with:
-
- # dpkg --clear-avail
- MSG
- exit 1
- fi
-
- file_triggers_pkgs="`sed -n -e 's/^[^ ]\+ \([^:]\+\):[^.]\+$/\1/p' \
- $triggersdir/File| sort -u`"
-
- if [ -n "$file_triggers_pkgs" ]; then
- cat <<-MSG
- dpkg: error: The triggers database contains arch-qualified package
- names that the old dpkg won't parse. You should get rid of them (or
- downgrade them to a non Multi-Arch: same version) before proceeding
- with dpkg's downgrade.
-
- List of affected packages:
-
- $file_triggers_pkgs
- MSG
- exit 1
- fi
-
- echo "Downgrading the multiarch dpkg control files database ..."
- ls $pkgadmindir | grep : | while read oldfile; do
- # We first do a round of hardlinks to the new names, so that the db
- # will never be unusable for either of the dpkg versions.
- newfile=$(echo $oldfile | sed -e 's/:[^.]\+//')
- ln -f "$pkgadmindir/$oldfile" "$pkgadmindir/$newfile"
- done
-}
-
-case "$1" in
- upgrade)
- # Allow the downgrade only if no package is using the
- # (interest|activate)-noawait trigger directives
- if dpkg --compare-versions "$2" lt 1.16.1; then
- ensure_no_triggers_noawait
- fi
- # Downgrade the multiarch db to a “monoarch” db layout
- if dpkg --compare-versions "$2" lt 1.16.2; then
- downgrade_multiarch_infodb
- fi
- ;;
-
- remove|failed-upgrade|deconfigure)
- ;;
-
- *)
- echo "$0 called with unknown argument '$1'" 1>&2
- exit 1
- ;;
-esac
-
-#DEBHELPER#
-exit 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list