Re: maintainer scripts handling symlink to directory conversion
Hi,
On Fri, Dec 12, 2014 at 02:11:59PM +0100, Ondřej Surý wrote:
> I found two things you need to do to avoid breakages:
>
> 1. Strip trailing slash for any argument (especially the first argument,
> e.g. the path)
> 2. Strip full path for old_path, as readlink -f is a beast in case you
> have symlink->symlink->dir or something like that
>
> E.g. do:
>
> symlink_to_dir /usr/share/doc/libavifile-0.7-bin libavifile-0.7-common
> 1:0.7.48~20090503.ds-16.1~
>
> symlink_to_dir /usr/share/doc/libavifile-0.7c2 libavifile-0.7-common
> 1:0.7.48~20090503.ds-16.1~
>
> symlink_to_dir /usr/share/doc/libavifile-0.7-dev libavifile-0.7-common
> 1:0.7.48~20090503.ds-16.1~
>
> In case this doesn't help, you might need to set DPKG_DEBUG=1 before
> running upgrade, or even mangle dpkg-maintscript-helper to have
> #!/bin/sh -x stanza.
I tried to follow this and have removed the full path only for
libavifile-0.7-bin to have some comparison what works and what not.
In other words I have:
$ cat debian/*.maint*
symlink_to_dir /usr/share/doc/libavifile-0.7-bin libavifile-0.7-common 1:0.7.48~20090503.ds-16.1~
symlink_to_dir /usr/share/doc/libavifile-0.7c2 /usr/share/doc/libavifile-0.7-common 1:0.7.48~20090503.ds-16.1~
symlink_to_dir /usr/share/doc/libavifile-0.7-dev /usr/share/doc/libavifile-0.7-common 1:0.7.48~20090503.ds-16.1~
Here is what DPKG_DEBUG=1 shows on installation of libavifile-0.7-bin
and libavifile-0.7-dev:
$ LANG= sudo DPKG_DEBUG=1 dpkg -i libavifile-0.7-bin_0.7.48~20090503.ds-16.2_amd64.deb
(Reading database ... 427590 files and directories currently installed.)
Preparing to unpack libavifile-0.7-bin_0.7.48~20090503.ds-16.2_amd64.deb ...
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in prerm of libavifile-0.7-bin
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-bin -> libavifile-0.7-common PACKAGE=libavifile-0.7-bin:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=upgrade PARAM=1:0.7.48~20090503.ds-16.2
DEBUG: dpkg-maintscript-helper: /usr/bin/dpkg-maintscript-helper symlink_to_dir not required in prerm
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in preinst of libavifile-0.7-bin
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-bin -> libavifile-0.7-common PACKAGE=libavifile-0.7-bin:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=upgrade PARAM=1:0.7.48~20090503.ds-16.2
Unpacking libavifile-0.7-bin (1:0.7.48~20090503.ds-16.2) over (1:0.7.48~20090503.ds-16.2) ...
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in postrm of libavifile-0.7-bin
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-bin -> libavifile-0.7-common PACKAGE=libavifile-0.7-bin:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=upgrade PARAM=1:0.7.48~20090503.ds-16.2
Setting up libavifile-0.7-bin (1:0.7.48~20090503.ds-16.2) ...
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in postinst of libavifile-0.7-bin
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-bin -> libavifile-0.7-common PACKAGE=libavifile-0.7-bin:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=configure PARAM=1:0.7.48~20090503.ds-16.2
Processing triggers for man-db (2.7.0.2-3) ...
$ LANG= sudo DPKG_DEBUG=1 dpkg -i libavifile-0.7-dev_0.7.48~20090503.ds-16.2_amd64.deb
(Reading database ... 427590 files and directories currently installed.)
Preparing to unpack libavifile-0.7-dev_0.7.48~20090503.ds-16.2_amd64.deb ...
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in prerm of libavifile-0.7-dev
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-dev -> /usr/share/doc/libavifile-0.7-common PACKAGE=libavifile-0.7-dev:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=upgrade PARAM=1:0.7.48~20090503.ds-16.2
DEBUG: dpkg-maintscript-helper: /usr/bin/dpkg-maintscript-helper symlink_to_dir not required in prerm
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in preinst of libavifile-0.7-dev
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-dev -> /usr/share/doc/libavifile-0.7-common PACKAGE=libavifile-0.7-dev:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=upgrade PARAM=1:0.7.48~20090503.ds-16.2
Unpacking libavifile-0.7-dev (1:0.7.48~20090503.ds-16.2) over (1:0.7.48~20090503.ds-16.2) ...
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in postrm of libavifile-0.7-dev
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-dev -> /usr/share/doc/libavifile-0.7-common PACKAGE=libavifile-0.7-dev:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=upgrade PARAM=1:0.7.48~20090503.ds-16.2
Setting up libavifile-0.7-dev (1:0.7.48~20090503.ds-16.2) ...
DEBUG: dpkg-maintscript-helper: Executing /usr/bin/dpkg-maintscript-helper symlink_to_dir in postinst of libavifile-0.7-dev
DEBUG: dpkg-maintscript-helper: SYMLINK=/usr/share/doc/libavifile-0.7-dev -> /usr/share/doc/libavifile-0.7-common PACKAGE=libavifile-0.7-dev:amd64 LASTVERSION=1:0.7.48~20090503.ds-16.1~ ACTION=configure PARAM=1:0.7.48~20090503.ds-16.2
Processing triggers for man-db (2.7.0.2-3) ...
The effect in both cases is the same (==none):
$ ls -l /usr/share/doc/libavifile*-bin /usr/share/doc/libavifile*-dev
lrwxrwxrwx 1 root root 21 Feb 22 2013 /usr/share/doc/libavifile-0.7-bin -> libavifile-0.7-common
lrwxrwxrwx 1 root root 21 Feb 22 2013 /usr/share/doc/libavifile-0.7-dev -> libavifile-0.7-common
Any further hints are really welcome.
Kind regards
Andreas.
--
http://fam-tille.de
Reply to: