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

Re: Upgrading a package with diversions



At 12:28 1996-04-10, Ian Jackson wrote:
> You need to test the value of "$1" - and iff you're adding diversions
> that a previous version didn't have, also "$2".  See the Maintainer
> script arguments appendix to the guidelines info document.

Are you saying that the prerm and postrm should know what diversions were
used by each previous version of the package, and manage to get it right
based on the version number?  This seems like a lot of work, and
error-prone.

Maybe, instead of running dpkg-divert from preinst/postrm at all, there
should be a DEBIAN/diversions file in the package.  It would simply contain
pairs of old and new filenames:

    /bin/ls
    /bin/ls.mono
    /usr/bin/thingy
    /usr/bin/thingy.mono

dpkg would store this in /var/lib/dpkg/info/PACKAGE.diversions.

dpkg would then be taught to run one of

    dpkg-divert --rename --divert NEWNAME --package PACKAGE OLDNAME
    dpkg-divert --remove --rename --divert NEWNAME --package PACKAGE OLDNAME

to install or remove a diversion.  When installing, it would add all
diversions listed in DEBIAN/diversions just after running preinst, and when
removing, would remove all diversions listed in
/var/lib/dpkg/info/PACKAGE.diversions just before running postrm.  When
upgrading, it would diff DEBIAN/diversions and PACKAGE.diversions and
add/remove diversions just before unpacking (between step 3a and 4).

Is this a reasonable proposal?  The job of maintaining diversions is much
like the job of maintaining file lists, so I think it would be appropriate
for dpkg to handle it.

--
Shields, CrossLink.




Reply to: