[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#823256: debian-policy: Update maintscript arguments with dpkg >= 1.18.5



Guillem Jover <guillem@debian.org> writes:

> Starting with dpkg 1.18.5, several maintainer script actions involving a
> new package version, get that version as an argument after the old
> version, because they could not get it in any other easy way. The new
> version was only available in the new package somewhere in the
> filesystem.

> One previous way to workaround this limitation was to inject the new
> version at build time into those maintainer scripts, which is rather
> cumbersome, when dpkg already knows at run-time which new version it is
> handling.

> This was proposed and discussed some time ago in the debian-dpkg mailing
> list.

> The list of the actions and their new arguments, from the dpkg changelog
> entry are:

>   - <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>

> Please, update the relevant section to mention those new arguments.

Here is a patch that I believe implements that, and which I think is ready
for seconds.

-- 
Russ Allbery (rra@debian.org)              <https://www.eyrie.org/~eagle/>

>From 2260f7a3aafe93282860aad07b7d8c1544bcf0ce Mon Sep 17 00:00:00 2001
From: Russ Allbery <rra@debian.org>
Date: Tue, 20 Sep 2022 18:49:04 -0700
Subject: [PATCH] new-version now passed to more maintainer scripts

Starting with dpkg 1.18.5, several maintainer script actions
involving a new package version get that version as an argument
after the old version. Update Policy's maintainer script
documentation accordingly.
---
 policy/ch-maintainerscripts.rst | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/policy/ch-maintainerscripts.rst b/policy/ch-maintainerscripts.rst
index 709aabf..724074c 100644
--- a/policy/ch-maintainerscripts.rst
+++ b/policy/ch-maintainerscripts.rst
@@ -107,8 +107,8 @@ old version of a package that is being upgraded from or downgraded from.
 The ``preinst`` script may be called in the following ways:
 
 | ``new-preinst`` install
-| ``new-preinst`` install *old-version*
-| ``new-preinst`` upgrade *old-version*
+| ``new-preinst`` install *old-version* *new-version*
+| ``new-preinst`` upgrade *old-version* *new-version*
 
     The package will not yet be unpacked, so the ``preinst`` script
     cannot rely on any files included in its package. Only essential
@@ -168,10 +168,10 @@ The ``prerm`` script may be called in the following ways:
     where dependencies are only "Half-Installed" due to a partial
     upgrade.
 
-``new-prerm`` failed-upgrade *old-version*
-    Called during error handling when ``prerm upgrade`` fails. The new package will not yet be
-    unpacked, and all the same constraints as for ``preinst upgrade``
-    apply.
+``new-prerm`` failed-upgrade *old-version* *new-version*
+    Called during error handling when ``prerm upgrade`` fails. The new
+    package will not yet be unpacked, and all the same constraints as for
+    ``preinst upgrade`` apply.
 
 The ``postrm`` script may be called in the following ways:
 
@@ -189,7 +189,7 @@ The ``postrm`` script may be called in the following ways:
     the package's dependencies if those dependencies are unavailable.
     [#]_
 
-``new-postrm`` failed-upgrade *old-version*
+``new-postrm`` failed-upgrade *old-version* *new-version*
     Called when the old ``postrm upgrade`` action fails. The new package
     will be unpacked, but only essential packages and pre-dependencies
     can be relied on. Pre-dependencies will either be configured or will
@@ -197,8 +197,8 @@ The ``postrm`` script may be called in the following ways:
     configured and was never removed.
 
 | ``new-postrm`` abort-install
-| ``new-postrm`` abort-install *old-version*
-| ``new-postrm`` abort-upgrade *old-version*
+| ``new-postrm`` abort-install *old-version* *new-version*
+| ``new-postrm`` abort-upgrade *old-version* *new-version*
 
     Called before unpacking the new package as part of the error
     handling of ``preinst`` failures. May assume the same state as
@@ -229,7 +229,7 @@ These are the "error unwind" calls listed below.
 
        .. parsed-literal::
 
-           new-prerm failed-upgrade *old-version*
+           new-prerm failed-upgrade *old-version* *new-version*
 
        If this works, the upgrade continues. If this does not work, the
        error unwind:
@@ -305,13 +305,13 @@ These are the "error unwind" calls listed below.
 
        .. parsed-literal::
 
-           *new-preinst* upgrade *old-version*
+           *new-preinst* upgrade *old-version* *new-version*
 
        If this fails, we call:
 
        .. parsed-literal::
 
-           *new-postrm* abort-upgrade *old-version*
+           *new-postrm* abort-upgrade *old-version* *new-version*
 
        i.  If that works, then
 
@@ -331,13 +331,13 @@ These are the "error unwind" calls listed below.
 
        .. parsed-literal::
 
-           *new-preinst* install *old-version*
+           *new-preinst* install *old-version* *new-version*
 
        Error unwind:
 
        .. parsed-literal::
 
-           *new-postrm* abort-install *old-version*
+           *new-postrm* abort-install *old-version* *new-version*
 
        If this fails, the package is left in a "Half-Installed" state,
        which requires a reinstall. If it works, the packages is left in
@@ -397,7 +397,7 @@ These are the "error unwind" calls listed below.
 
        .. parsed-literal::
 
-           *new-postrm* failed-upgrade *old-version*
+           *new-postrm* failed-upgrade *old-version* *new-version*
 
        If this works, installation continues. If not, Error unwind:
 
@@ -410,7 +410,7 @@ These are the "error unwind" calls listed below.
 
        .. parsed-literal::
 
-           *new-postrm* abort-upgrade *old-version*
+           *new-postrm* abort-upgrade *old-version* *new-version*
 
        If this fails, the old version is left in a "Half-Installed"
        state. If it works, dpkg now calls:
-- 
2.37.2


Reply to: