On 21-Sep-2013, Dmitry Shachnev wrote: > Hi Ben, and Barry! Thank you for testing and providing information. I'll address here the clear problem of changing the location of the platform-independent files.
> Dpkg cannot replace directories with symlinks on package upgrades.
I understand; when I read Debian Policy §6.6, the install procedure
contains this text:
A directory will never be replaced by a symbolic link to a directory or
vice versa; instead, the existing state (symlink or not) will be left
alone […].
Thank you for bringing my attention to this.
> You need a dpkg preinst hook to remove old
> /usr/lib/python2.*/dist-packages/coverage/htmlfiles before install,
> otherwise users who upgrade the package (like me) end up with that
> directory being empty.
According to this discussion on the ‘debian-devel’ forum
<URL:https://lists.debian.org/debian-devel/2012/09/msg00705.html> there is
no good way for package maintainer scripts to change an already-installed
directory to a symlink:
This [removing a directory] is not normally a thing that you would ever
do […].
A package that wants to change a directory to a symlink (or vice versa)
is a very special case […].
The most accurate statement about this case is probably "this change is
not fully supported by the current Debian packaging tools." I don't
think it's something for which we currently have easy answers. It may
require either some design work or some case-by-case analysis.
Will this preinst script (attached) do the job correctly?
--
\ “If we have to give up either religion or education, we should |
`\ give up education.” —William Jennings Bryan, 1923-01 |
_o__) |
Ben Finney <[email protected]>
#! /bin/sh
set -e
action=$1
oldversion=$2
if [ "$action" = upgrade ] ; then
for python in $(pyversions --supported) ; do
htmlfiles_dir="/usr/lib/${python}/dist-packages/coverage/htmlfiles"
if [ -d "$htmlfiles_dir" ] && [ ! -L "$htmlfiles_dir" ] ; then
# The ‘htmlfiles’ location should be platform-independent.
# The new package will replace the directory with a symlink.
rmdir "$htmlfiles_dir"
fi
done
fi
#DEBHELPER#
signature.asc
Description: Digital signature

