[Reproducible-commits] [dpkg] 68/105: dpkg: Pass <new-version> to maintscript actions that cannot get it otherwise
Niko Tyni
ntyni at moszumanska.debian.org
Mon May 2 13:49:54 UTC 2016
This is an automated email from the git hooks/post-receive script.
ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.
commit 580246792085f4bfd3433e11cff523145df32662
Author: Guillem Jover <guillem at debian.org>
Date: Sat Jan 24 02:10:22 2015 +0100
dpkg: Pass <new-version> to maintscript actions that cannot get it otherwise
The upgrade actions and their rollback counterparts do not have access
to the new binary package which is somewhere on the filesystem depending
on how dpkg was invoked, nor to its metadata. If the maintainer script
wants to know the <new-version>, it needs to be turned into a template
and that version instantiated at build-time, which is cumbersome.
So we now pass <new-version> when these upgrade actions are already
getting <old-version>, but not on the cases where they do not get any
argument at all, as that's their differentiator.
Prompted-by: Andrey Utkin <andrey.krieger.utkin at gmail.com>
---
debian/changelog | 9 +++++++++
debian/dpkg.postrm | 6 +++---
debian/dpkg.preinst | 4 ++--
debian/dpkg.prerm | 2 +-
src/cleanup.c | 2 ++
src/script.c | 1 +
src/unpack.c | 2 ++
7 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 1c55556..1343d0c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,15 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
* Decouple local keyword declaration from command assignment in
dpkg-maintscript-helper, which masks the command return value when
using «set -e».
+ * Make dpkg pass <new-version> to maintscript actions that cannot get it
+ otherwise. These actions are now:
+ - <new-postrm> failed-upgrade <old-version> <new-version>
+ - <new-postrm> abort-install <old-version> <new-version>
+ - <new-postrm> abort-upgrade <old-version> <new-version>
+ - <new-preinst> install <old-version> <new-version>
+ - <new-preinst> upgrade <old-version> <new-version>
+ - <new-prerm> failed-upgrade <old-version> <new-version>
+ Prompted by Andrey Utkin <andrey.krieger.utkin at gmail.com>.
* Portability:
- Move DPKG_ADMINDIR environment variable name out from update-alternatives
code, to make life easier for non-dpkg-based systems.
diff --git a/debian/dpkg.postrm b/debian/dpkg.postrm
index 5d2a741..c50cb16 100755
--- a/debian/dpkg.postrm
+++ b/debian/dpkg.postrm
@@ -10,7 +10,7 @@
# After the package was upgraded:
# <old-postrm> upgrade <new-version>
# if that fails:
-# <new-postrm> failed-upgrade <old-version>
+# <new-postrm> failed-upgrade <old-version> <new-version>
#
#
# After all of the packages files have been replaced:
@@ -21,10 +21,10 @@
# <new-postrm> abort-install
#
# If preinst fails during upgrade of removed package:
-# <new-postrm> abort-install <old-version>
+# <new-postrm> abort-install <old-version> <new-version>
#
# If preinst fails during upgrade:
-# <new-postrm> abort-upgrade <old-version>
+# <new-postrm> abort-upgrade <old-version> <new-version>
set -e
diff --git a/debian/dpkg.preinst b/debian/dpkg.preinst
index 4cde19f..12707fa 100755
--- a/debian/dpkg.preinst
+++ b/debian/dpkg.preinst
@@ -5,10 +5,10 @@
# <new-preinst> install
#
# Before removed package is upgraded:
-# <new-preinst> install <old-version>
+# <new-preinst> install <old-version> <new-version>
#
# Before the package is upgraded:
-# <new-preinst> upgrade <old-version>
+# <new-preinst> upgrade <old-version> <new-version>
#
#
# If postrm fails during upgrade or fails on failed upgrade:
diff --git a/debian/dpkg.prerm b/debian/dpkg.prerm
index 4b17018..a0552a5 100755
--- a/debian/dpkg.prerm
+++ b/debian/dpkg.prerm
@@ -7,7 +7,7 @@
# Before an upgrade:
# <old-prerm> upgrade <new-version>
# if that fails:
-# <new-prerm> failed-upgrade <old-version>
+# <new-prerm> failed-upgrade <old-version> <new-version>
#
#
# Before package is deconfigured while dependency is replaced due to conflict:
diff --git a/src/cleanup.c b/src/cleanup.c
index dd8510e..ded8219 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -209,6 +209,7 @@ void cu_preinstnew(int argc, void **argv) {
maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
"abort-install",
versiondescribe(&pkg->installed.version, vdew_nonambig),
+ versiondescribe(&pkg->available.version, vdew_nonambig),
NULL);
pkg_set_status(pkg, PKG_STAT_CONFIGFILES);
pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
@@ -226,6 +227,7 @@ void cu_preinstupgrade(int argc, void **argv) {
maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
"abort-upgrade",
versiondescribe(&pkg->installed.version, vdew_nonambig),
+ versiondescribe(&pkg->available.version, vdew_nonambig),
NULL);
pkg_set_status(pkg, *oldstatusp);
pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ);
diff --git a/src/script.c b/src/script.c
index d9514da..41cd501 100644
--- a/src/script.c
+++ b/src/script.c
@@ -348,6 +348,7 @@ maintscript_fallback(struct pkginfo *pkg,
command_init(&cmd, cidir, buf);
command_add_args(&cmd, scriptname, iffallback,
versiondescribe(&pkg->installed.version, vdew_nonambig),
+ versiondescribe(&pkg->available.version, vdew_nonambig),
NULL);
if (stat(cidir, &stab)) {
diff --git a/src/unpack.c b/src/unpack.c
index 04594da..45d3ff6 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -1299,6 +1299,7 @@ void process_archive(const char *filename) {
maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
"install",
versiondescribe(&pkg->installed.version, vdew_nonambig),
+ versiondescribe(&pkg->available.version, vdew_nonambig),
NULL);
} else {
push_cleanup(cu_preinstupgrade, ~ehflag_normaltidy, NULL, 0,
@@ -1306,6 +1307,7 @@ void process_archive(const char *filename) {
maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
"upgrade",
versiondescribe(&pkg->installed.version, vdew_nonambig),
+ versiondescribe(&pkg->available.version, vdew_nonambig),
NULL);
}
--
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