[Pkg-libvirt-commits] [Git][libvirt-team/libvirt][debian/master] 3 commits: libvirt-clients: Remove versioned Breaks on libvirt-login-shell
Guido Günther
gitlab at salsa.debian.org
Thu Jan 14 08:26:39 GMT 2021
Guido Günther pushed to branch debian/master at Libvirt Packaging Team / libvirt
Commits:
ce1a1cff by Andrea Bolognani at 2020-12-27T16:41:36+01:00
libvirt-clients: Remove versioned Breaks on libvirt-login-shell
According to
https://wiki.debian.org/PackageTransition
this is needed when both packages you're moving files between
already existed, but that is not the case here.
Gbp-Dch: Ignore
- - - - -
f90e9d44 by Andrea Bolognani at 2020-12-27T16:41:36+01:00
libvirt-clients: Add Recommends for libvirt-login-shell
If this is not present, then apt will not know that the package
needs to be installed, and virt-login-shell will disappear from
the user's system during upgrade, which is something that we
don't want.
We will probably want to weaken this to a Suggests for bookworm,
as most people don't need virt-login-shell to be installed on
their machines, but not breaking existing setups is more
important and Recommends still makes it possible to remove the
package after upgrade, so it's a good compromise.
Gbp-Dch: Ignore
- - - - -
291fc670 by Andrea Bolognani at 2021-01-14T00:29:19+01:00
libvirt-login-shell: Transfer conffile from libvirt-clients correctly
If we simply remove the conffile from libvirt-clients and add it
to libvirt-login-shell, at the end of the update any local
modification that was made in the past will only be present in
the .dpkg-bak file, with the actual conffile being reverted back
to its default state.
Since dpkg-maintscript-helper doesn't currently have support for
tranferring conffiles between packages, we have to implement the
logic ourselves.
Gbp-Dch: Ignore
- - - - -
5 changed files:
- debian/control
- − debian/libvirt-clients.maintscript
- + debian/libvirt-clients.postrm
- + debian/libvirt-clients.preinst
- + debian/libvirt-login-shell.postinst
Changes:
=====================================
debian/control
=====================================
@@ -81,12 +81,13 @@ Depends:
sensible-utils,
${misc:Depends},
${shlibs:Depends},
+Recommends:
+ libvirt-login-shell,
Suggests:
libvirt-daemon,
Breaks:
libvirt-daemon (<< 6.9.0-2~),
libvirt-daemon-driver-qemu (<< 6.9.0-2~),
- libvirt-login-shell (<< 6.9.0-2~),
Replaces:
libvirt-daemon (<< 6.9.0-2~),
Description: Programs for the libvirt library
@@ -101,6 +102,7 @@ Package: libvirt-login-shell
Section: admin
Architecture: alpha amd64 arm64 armel armhf hppa i386 m68k mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sh4 sparc64 x32
Depends:
+ libvirt-clients (= ${binary:Version}),
libvirt-daemon-driver-lxc,
libvirt0 (= ${binary:Version}),
${misc:Depends},
=====================================
debian/libvirt-clients.maintscript deleted
=====================================
@@ -1,2 +0,0 @@
-# Moved to libvirt-login-shell
-rm_conffile /etc/libvirt/libvirt-login-shell.conf 6.9.0-2~ libvirt-clients
=====================================
debian/libvirt-clients.postrm
=====================================
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+abort_conffile_transfer() {
+ local conffile="$1"
+ local lastver="$2"
+ local pkgfrom="$3"
+ local pkgto="$4"
+
+ if [ "$5" != "--" ]; then
+ echo "abort_conffile_transfer called with the wrong number of arguments" >&2
+ return 1
+ fi
+ for _ in $(seq 1 5); do
+ shift
+ done
+
+ # If we were installing from scratch or upgrading from a new enough version
+ # when the error occurred, then no transfer was in progress and we don't
+ # need to rollback any changes
+ if [ -z "$2" ] || dpkg --compare-versions -- "$2" gt "$lastver"; then
+ return 0
+ fi
+
+ # If the conffile was being transferred, return it to its original location
+ if [ -e "$conffile.dpkg-transfer" ]; then
+ mv -f "$conffile.dpkg-transfer" "$conffile"
+ fi
+
+ # Clean up additional state
+ rm -f "$conffile.dpkg-disappear"
+}
+
+case "$1" in
+ abort-install|abort-upgrade)
+ abort_conffile_transfer \
+ "/etc/libvirt/virt-login-shell.conf" \
+ "6.9.0-2~" \
+ "libvirt-clients" \
+ "libvirt-login-shell" \
+ -- \
+ "$@"
+ ;;
+
+ remove|purge|upgrade|failed-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
=====================================
debian/libvirt-clients.preinst
=====================================
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+prepare_conffile_transfer() {
+ local conffile="$1"
+ local lastver="$2"
+ local pkgfrom="$3"
+ local pkgto="$4"
+
+ if [ "$5" != "--" ]; then
+ echo "prepare_conffile_transfer called with the wrong number of arguments" >&2
+ return 1
+ fi
+ for _ in $(seq 1 5); do
+ shift
+ done
+
+ # If we're installing from scratch or upgrading from a new enough version
+ # of the package, then no transfer needs to happen and we can stop here
+ if [ -z "$2" ] || dpkg --compare-versions -- "$2" gt "$lastver"; then
+ return 0
+ fi
+
+ # Depending on the current state of the conffile, we need to perform different
+ # steps to transfer it. Moving the conffile to a different location depending
+ # on its current state achieves two goals: dpkg will see the conffile is no
+ # longer present on disk after $pkgfrom has been upgraded, and so it will no
+ # longer associate it with that package (not even as an obsolete conffile);
+ # more importanly, $pkgto's postinst, where the transfer process is completed,
+ # will be able to figure out the original state of the conffile and make sure
+ # it is restored
+ if [ -e "$conffile" ]; then
+ echo "Preparing transfer of config file $conffile (from $pkgfrom to $pkgto) ..."
+ mv -f "$conffile" "$conffile.dpkg-transfer"
+ else
+ # If the conffile is no longer present on the disk, it means the admin
+ # has deleted it, and we should preserve this local modification
+ touch "$conffile.dpkg-disappear"
+ fi
+}
+
+case "$1" in
+ install|upgrade)
+ prepare_conffile_transfer \
+ "/etc/libvirt/virt-login-shell.conf" \
+ "6.9.0-2~" \
+ "libvirt-clients" \
+ "libvirt-login-shell" \
+ -- \
+ "$@"
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
=====================================
debian/libvirt-login-shell.postinst
=====================================
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+finish_conffile_transfer() {
+ local conffile="$1"
+ local lastver="$2"
+ local pkgfrom="$3"
+ local pkgto="$4"
+
+ if [ "$5" != "--" ]; then
+ echo "finish_conffile_transfer called with the wrong number of arguments" >&2
+ return 1
+ fi
+ for _ in $(seq 1 5); do
+ shift
+ done
+
+ # If we're upgrading rather than installing from scratch, we can assume
+ # the transfer must have happened at some point in the past and stop here
+ if [ -n "$2" ]; then
+ return 0
+ fi
+
+ if [ -e "$conffile.dpkg-transfer" ]; then
+ # Complete the process started in $pkgfrom's preinst by restoring the
+ # version of the conffile containing local modifications
+ echo "Finishing transfer of config file $conffile (from $pkgfrom to $pkgto) ..."
+ mv -f "$conffile.dpkg-transfer" "$conffile"
+ return 0
+ fi
+
+ if [ -e "$conffile.dpkg-disappear" ]; then
+ # The conffile had been deleted by the admin, so let's return to
+ # that state
+ rm -f "$conffile" "$conffile.dpkg-disappear"
+ return 0
+ fi
+}
+
+case "$1" in
+ configure)
+ finish_conffile_transfer \
+ "/etc/libvirt/virt-login-shell.conf" \
+ "6.9.0-2~" \
+ "libvirt-clients" \
+ "libvirt-login-shell" \
+ -- \
+ "$@"
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt/-/compare/acb5c16882c082560b2b75fe7388d4ddadbf8953...291fc6701118f239cc9575148fda8d8e95519ee4
--
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt/-/compare/acb5c16882c082560b2b75fe7388d4ddadbf8953...291fc6701118f239cc9575148fda8d8e95519ee4
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20210114/a6ec06c2/attachment-0001.html>
More information about the Pkg-libvirt-commits
mailing list