Re: Bug#487437: Please include /etc/dpkg/origins/{debian,default}
On Wed, 27 Aug 2008, Santiago Vila wrote:
> Sorry for not answering this before. Is this something that you would
> like to see implemented in lenny?
It's not required for lenny. The code making use of this is only in dpkg
1.15 which will only be uploaded in lenny+1.
> However, I can understand that convenience is a good thing, and that
> forking base-files is a lot easier than forking dpkg (if only because
> of the build time).
Indeed. And it's best to reduce the number of packages any derivative has
to fork.
> You mean something like this in debian/rules, right?
>
> mkdir -p debian/tmp/etc/dpkg/origins
> cp -a origins/* debian/tmp/etc/dpkg/origins
>
> (That would copy whatever is in "origins" directory).
Right.
> I don't understand the part about "making easy to update the symlink".
> I can think of two ways of doing that.
>
> The bad one, to be put in debian/rules:
>
> ln -s debian debian/tmp/etc/dpkg/origins/default
Bad indeed.
> A better way to handle the symlink would be to make it in the postinst,
> exactly once, the very first time base-files is installed by
> debootstrap, i.e. inside the block starting with this line:
>
> if [ "$1" = "configure" ] && [ "$2" = "" ]; then
Well, it should create the symlink if it doesn't exist... because that
would cope with upgrade as well.
However the symlink should point to ubuntu if base-files is built on
Ubuntu and to debian if built on Debian. For this I suggest that
base-files uses $(DEB_VENDOR) to find out the current distribution.
Since $(DEB_VENDOR) is a variable that is only set by dpkg-buildpackage
from version 1.15 or later, you would provide a default value in
debian/rules with:
DEB_VENDOR ?= Debian
Then you can replace #VENDOR# in the postinst:
dh_installdeb
vendor=$$(echo "$(DEB_VENDOR)" | tr A-Z a-z); sed -i -e "s/#VENDOR#/$$vendor/g" debian/base-files/DEBIAN/postinst
The postinst would contain this:
if [ ! -e /etc/dpkg/origins/default ]; then
if [ -e /etc/dpkg/origins/#VENDOR# ]; then
ln -sf #VENDOR# /etc/dpkg/origins/default
fi
fi
Any derivative distribution would then put the files in the origins dir,
and bootstrap base-files by building with DEB_VENDOR set to the name of
their distribution (or they could manually create
/etc/dpkg/origins/default provided that they are already using dpkg >=
1.15).
> * A new "origins" directory in the source code.
> * The "debian" file inside such directory.
> * Two lines in debian/rules to copy the files into debian/tmp
> * A line in the postinst to set the default symlink.
>
> Would you be happy with this?
Yes, but see above for a small improvement to avoid the need to change the
postinst for the derivative distribution.
Cheers,
--
Raphaël Hertzog
Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
Reply to: