Debian Bug report logs -
#45614
debhelper: dh_alternatives scripts?
Reply or subscribe to this bug.
Toggle useless messages
Report forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@master.debian.org>:
Bug#45614; Package debhelper.
(full text, mbox, link).
Acknowledgement sent to Fumitoshi UKAI <ukai@debian.or.jp>:
New Bug report received and forwarded. Copy sent to Joey Hess <joeyh@master.debian.org>.
(full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: debhelper
Version: 2.0.50
Severity: wishlist
It might be nice to have a dh_alternatives scripts to automatically write
any wanted update-alternatives commands for the postinst/prerm scripts
by debian/alternatives or debian/<package>.alternatives, like follows:
(I don't have good idea about debian/alternatives format...)
#!/usr/bin/perl -w
BEGIN { push @INC, "debian", "/usr/share/debhelper" }
use Dh_Lib;
init();
foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
$TMP=tmpdir($PACKAGE);
$alternatives=pkgfile($PACKAGE,"alternatives");
if ($alternatives ne '') {
if (! $dh{NOSCRIPTS}) {
open(IN, "<$alternatives") || die "$alternatives: $!";
while (<IN>) {
# read alternatives file
# and check it
autoscript($PACKAGE,"postinst",
"postinst-alternatives",
"s:#ALTINSTALLARGS#:$altinstargs:");
autoscript($PACKAGE,"postrm",
"postrm-alternatives",
"s:#ALTRMARGS#:$altrmargs:")
}
}
}
}
/usr/lib/debhelper/autoscripts/postinst-alternatives:
if [ "$1" = "configure" ]; then
update-alternatives #ALTINSTALLARGS#
fi
/usr/lib/debhelper/autoscripts/prerm-alternatives:
if [ "$1" != "upgrade" ]; then
update-alternatives #ALTRMARGS#
fi
Regards,
Fumitoshi UKAI
Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@master.debian.org>:
Bug#45614; Package debhelper.
(full text, mbox, link).
Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@master.debian.org>.
(full text, mbox, link).
Message #10 received at 45614@bugs.debian.org (full text, mbox, reply):
Brian Bassett wrote:
> I've done a bit of work on automating maintainer scripts that use
> alternatives. I have come up with a new dh_ script,
> dh_installalternatives. It uses a debian/alternatives (for the first
> package) file which contains the information about priorities, link, and
> destination information for the primary link and slave links. For
> example, for a package foo that installs two alternatives, one of which
> has a slave link, dh_installalternatives would use the following
> debian/alternatives file:
>
> 100
> /usr/bin/foo
> /usr/bin/foo-foo
> /usr/share/man/man1/foo.1.gz
> /usr/share/man/man1/foo-foo.1.gz
> 100
> /usr/bin/bar
> /usr/bin/bar-foo
This is the main reason I've never come up with such a script. I dislike
this config file format, but I can't come up with a better one.
I think this format is too obscure to be useful. Raw update-alternatives
commands in a postinst are more understandable.
> It generates the following maintainer script snippets:
>
> postinst:
>
> # Automatically added by dh_installalternatives
> if [ "$1" = "configure" ]; then
> if update-alternatives --display /usr/bin/foo | grep 'status is
> manual' > /dev/null; then
> echo "You have manually overriden the alternatives
> mechanism for /usr/bin/foo"
> echo -e "Please run\n\n\tupdate-alternatives --auto
> /usr/bin/foo\n\nas root to reset /usr/bin/foo to its default."
> fi
> update-alternatives --install /usr/bin/foo foo /usr/bin/foo-foo
> 100 --slave /usr/share/man/man1/foo.1.gz foo.1.gz
> /usr/share/man/man1/foo-foo.1.gz
Debhelper postinst additions scripts cannot echo anything to the user
without pausing, because that is a villation of policy. I really don't want
anything debhelper adds to maintainer scripts to output anything at all
except error messages. I think the messages update-alternatives outputs when
something in on manual are good enough.
> Would you be interested in including this in debhelper?
Yes, if we can come up with a better config file format.
--
see shy jo
Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#45614; Package debhelper.
(full text, mbox, link).
Acknowledgement sent to Danilo Piazzalunga <danilopiazza@libero.it>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>.
(full text, mbox, link).
Message #17 received at 45614@bugs.debian.org (full text, mbox, reply):
Joey Hess wrote:
> This is the main reason I've never come up with such a script. I dislike
> this config file format, but I can't come up with a better one.
>
> I think this format is too obscure to be useful. Raw update-alternatives
> commands in a postinst are more understandable.
[...]
> > Would you be interested in including this in debhelper?
>
> Yes, if we can come up with a better config file format.
Sorry for respawning this issue after such a long time...
A better config file format could possibly be one which mimics the way
update-alternatives is called: it would simplify things only if you consider
that bugs caused by update-alternatives --remove commands being out of sync
with their --install counterparts.
The proposed format is like the following:
<link> <name> <path> <priority>
<slave-link> <slave-name> <slave-path>
...
<link> <name> <path> <priority>
...
Where slave lines (if any) begin with any amount of white space and an empty
line separates stanzas (if there are more than one).
Using the following format, the config file for e.g. mawk would be:
/usr/bin/awk awk /usr/bin/mawk 5
/usr/share/man/man1/awk.1.gz awk.1.gz /usr/share/man/man1/mawk.1.gz
/usr/bin/nawk nawk /usr/bin/mawk
/usr/share/man/man1/nawk.1.gz nawk.1.gz /usr/share/man/man1/mawk.1.gz
And for e.g vim, it would look like:
/usr/bin/vi vi /usr/bin/vim 120
/usr/share/man/man1/vi.1.gz vi.1.gz /usr/share/man/man1/vim.1.gz
/usr/bin/view view /usr/bin/vim 120
/usr/share/man/man1/view.1.gz view.1.gz /usr/share/man/man1/vim.1.gz
/usr/bin/ex ex /usr/bin/vim 120
/usr/share/man/man1/ex.1.gz ex.1.gz /usr/share/man/man1/vim.1.gz
/usr/bin/editor editor /usr/bin/vim 120
/usr/share/man/man1/editor.1.gz editor.1.gz /usr/share/man/man1/vim.1.gz
(I admit that, in this case, a for loop in the maintainer scripts would be
less redundant, but a package maintainer can choose whether to use this
facility.)
Regards,
Danilo
--
Danilo Piazzalunga +--------------------+
PGP Key available at subkeys.pgp.net | Linux User #245762 |
Fingerprint: D018 815E 8C7F 2AE2 5565 | ICQ #105550412 |
0C36 B5F6 DB20 B800 CB9F +--------------------+
Information forwarded
to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#45614; Package debhelper.
(Wed, 19 Aug 2009 09:18:07 GMT) (full text, mbox, link).
Acknowledgement sent
to Guido Günther <agx@sigxcpu.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>.
(Wed, 19 Aug 2009 09:18:07 GMT) (full text, mbox, link).
Message #22 received at 45614@bugs.debian.org (full text, mbox, reply):
Hi,
wouldn't
100: /usr/bin/nc.openbsd /usr/bin/nc
/usr/share/man/man1/nc.openbsd.1.gz /usr/share/man/man1/nc.1.gz
100: /usr/bin/bar.foo /usr/bin/bar
look o.k? Masters could be identified with ^[0-9]+: and slave links
with ^[[:space:]]+ .
This is quiet similar to what Danilo propsed in 2005.
Cheers,
-- Guido
Information forwarded
to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#45614; Package debhelper.
(Wed, 14 Nov 2012 15:57:03 GMT) (full text, mbox, link).
Acknowledgement sent
to Samuel Bronson <naesten@gmail.com>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>.
(Wed, 14 Nov 2012 15:57:03 GMT) (full text, mbox, link).
Message #27 received at 45614@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
I would like to propose something like this for the basic syntax:
[mawk.alternatives (text/plain, inline)]
Link: /usr/bin/awk
Name: awk
Alternative: /usr/bin/mawk
Priority: 5
Slaves:
/usr/share/man/man1/awk.1.gz awk.1.gz /usr/share/man/man1/mawk.1.gz
/usr/bin/nawk nawk /usr/bin/mawk
/usr/share/man/man1/nawk.1.gz nawk.1.gz /usr/share/man/man1/mawk.1.gz
[Message part 3 (text/plain, inline)]
It's no less verbose, but I think it's a bit clearer than the existing
proposals, and it's certainly easier to extend; I've already recieved
a suggestion that something like "Manpages-Too: 8" should cause matching
section 8 manpages to be included automatically among the slaves.
(I'm really not sure how good of an idea that is, but it certainly
wouldn't be difficult to determine whether such a feature was supposed
to be in use for a particular alternative: just check for the
field.)
I'm not too good with Perl, though, so I'm having trouble actually
trying to implement this; I think Dpkg::Control::Hash would probably be
useful, but I can't quite seem to figure out how to actually use it :-(.
p.s. I noticed that mawk's actual postinst script is missing the
conditional that the proposed template has. Is there a good reason for
that, or is it actually a bug, or ... ?
--
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
Information forwarded
to debian-bugs-dist@lists.debian.org, Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>:
Bug#45614; Package debhelper.
(Sun, 26 Apr 2015 08:43:38 GMT) (full text, mbox, link).
Acknowledgement sent
to Tomas Pospisek <tpo@sourcepole.ch>:
Extra info received and forwarded to list. Copy sent to Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>.
(Sun, 26 Apr 2015 08:43:38 GMT) (full text, mbox, link).
Message #32 received at 45614@bugs.debian.org (full text, mbox, reply):
See also https://bugs.debian.org/71621 and https://bugs.debian.org/582873
which are related to this wishlist bug.
*t
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Sun Jan 7 04:13:34 2018;
Machine Name:
beach
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.