#444029 would be nice if debhelper could handle dpkg-diversion

#444029#5
Date:
2007-09-25 15:03:12 UTC
From:
To:
package: debhelper
severity: wishlist

Hello,

it would be nice if debhelper could handle the adding and removing of
dpkg-diversion.

Lets' consider one of my packages, unace-nonfree, as an example. At the
moment I have the following lines in the packages' preinst to add a
diversion to the free unace binary and manpage (there's similar code in
postrm, but I guess you get the point):

    #!/bin/sh
    set -e

    case "$1" in

        install)

            dpkg-divert --package unace-nonfree --add --rename --divert \
            /usr/bin/unace-free /usr/bin/unace

            dpkg-divert --package unace-nonfree --add --rename --divert \
            /usr/share/man/man1/unace-free.1.gz
            /usr/share/man/man1/unace.1.gz

        ;;

        upgrade|abort-upgrade)
        ;;

        *)

            echo "preinst called with unknown argument \`$1'" >&2
            exit 1

        ;;

    esac

    #DEBHELPER#

    exit 0

Now it would be nice if debhelper could automagically add these lines to
the appropriate files based on a helper-file called
unace-nonfree.diversions that would look similar to this:

    /usr/bin/unace-free /usr/bin/unace
    /usr/share/man/man1/unace-free.1.gz /usr/share/man/man1/unace.1.gz


What do you think about this?

Cheers,
Fabian

PS: Another cool feature will be the handling of /etc/alternative!