Your message dated Wed, 23 Jul 2008 11:14:00 -0400
with message-id <[EMAIL PROTECTED]>
and subject line Re: Bug#492027: dh_desktop: hardcode the path to the
executable when possible
has caused the Debian Bug report #492027,
regarding dh_desktop: hardcode the path to the executable when possible
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)
--
492027: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492027
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: debhelper
Version: 7.0.14
Severity: wishlist
Following the discussion on debian-devel about hardcoding paths to
binaries in desktop files, here is a patch to dh_desktop which will do
that automatically if the file is located in the same package.
Cheers,
--
.''`.
: :' : We are debian.org. Lower your prices, surrender your code.
`. `' We will add your hardware and software distinctiveness to
`- our own. Resistance is futile.
--- /usr/bin/dh_desktop 2008-07-05 14:24:31.000000000 +0200
+++ dh_desktop 2008-07-23 12:09:54.177650163 +0200
@@ -17,12 +17,14 @@
dh_desktop is a debhelper program that registers .desktop files.
Currently this program does not handle installation of the files, though it
-may do so at a later date. It takes care of adding maintainer script
-fragments to call F<update-desktop-database>.
+may do so at a later date.
-Note that since F<update-desktop-database> currently only handles mime
-types, as an optimisation, desktop files not containing MimeType fields
-will currently be ignored by dh_desktop.
+This program takes care of adding maintainer script fragments to call
+F<update-desktop-database> when there are desktop files containing the
+MimeType field.
+
+It will also modify files to hardcode the path to the executable if it
+can be found in the same package.
=cut
@@ -30,17 +32,40 @@
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp=tmpdir($package);
+ my $need_script=0;
- if (-d "$tmp/usr/share/applications") {
- # Get a list of the desktop files that are in
- # usr/share/applications and thus might need
- # update-desktop-database be called. Other desktop
- # files don't.
- my $desktop_files = `find $tmp/usr/share/applications -type f -name \\*.desktop -execdir grep -q "^MimeType" '{}' \\; -printf '%p\n'`;
- if ($desktop_files && ! $dh{NOSCRIPTS}) {
- autoscript($package,"postinst","postinst-desktop");
- autoscript($package,"postrm","postrm-desktop");
+ # Get a list of desktop files in /usr/share/applications
+ foreach my $desktop_file (glob("$tmp/usr/share/applications/*.desktop")) {
+ next if excludefile ($desktop_file);
+ open (ORIG, $desktop_file) || error("cannot read $desktop_file: $!\n");
+ open (NEW, "> $desktop_file.new") || error ("cannot write $desktop_file: $!\n");
+ while (<ORIG>) {
+ # Only files specifying MIME types need a call to update-desktop-database
+ if (/^MimeType\=/) {
+ $need_script=1;
+ }
+ if (/^Exec\=(\S+)(.*)$/) {
+ my $execname = $1;
+ # Look for the executable's absolute path in the same package
+ foreach my $bindir ("/usr/bin", "/usr/sbin", "/usr/games") {
+ if (-f "$tmp$bindir/$1") {
+ $execname = "$bindir/$1";
+ last;
+ }
+ }
+ print NEW "Exec=$execname$2\n";
+ } else {
+ print NEW $_;
+ }
}
+ close (ORIG);
+ close (NEW);
+ rename "$desktop_file.new", $desktop_file;
+ }
+
+ if ($need_script && ! $dh{NOSCRIPTS}) {
+ autoscript($package,"postinst","postinst-desktop");
+ autoscript($package,"postrm","postrm-desktop");
}
}
@@ -53,5 +78,6 @@
=head1 AUTHOR
Ross Burton <[EMAIL PROTECTED]>
+Josselin Mouette <[EMAIL PROTECTED]>
=cut
signature.asc
Description: Ceci est une partie de message numériquement signée
--- End Message ---
--- Begin Message ---
Josselin Mouette wrote:
> Following the discussion on debian-devel about hardcoding paths to
> binaries in desktop files, here is a patch to dh_desktop which will do
> that automatically if the file is located in the same package.
I don't recall that thread being particularly convincing. I've reviewed
it and find it even less convincing. In fact the sole useful data point
in the whole thread was from you; you said that you were hardcoding
paths to gnome-games because /usr/games had caused problems, but you
didn't mention how it caused problems, and you certianly didn't
establish that said problems would affect anything outside of
/usr/games.
Hardcoded paths are evil, and short of said evil getting into policy, I
am not going there. Period.
And if it *did* get into policy, dh_desktop would be the wrong place to
do it anyway.
--
see shy jo, who personally installs wrappers about beep, epiphany,
iceweasel, mplayer, procmeter, sonata, and xlock in ~/bin
signature.asc
Description: Digital signature
--- End Message ---