[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

lintian: r1160 - in trunk: checks debian testset testset/filenames/debian



Author: rra
Date: 2008-02-04 00:06:18 +0100 (Mon, 04 Feb 2008)
New Revision: 1160

Modified:
   trunk/checks/files
   trunk/checks/files.desc
   trunk/debian/changelog
   trunk/testset/filenames/debian/rules
   trunk/testset/tags.filenames
Log:
* checks/files{.desc,}:
  + [RA] Fix a long-standing error in the regex checking for *.desktop
    files in /usr/share/gnome/apps that caused the tag to never be
    issued.  Remove the check for /usr/share/applnk, since obsolete or
    not KDE appears to actively use it still.
  + [RA] Check for *.devhelp{2,} files not linked into devhelp's search
    path.  Based on a patch by Bradley Smith.  (Closes: #273309)

Modified: trunk/checks/files
===================================================================
--- trunk/checks/files	2008-02-03 21:28:53 UTC (rev 1159)
+++ trunk/checks/files	2008-02-03 23:06:18 UTC (rev 1160)
@@ -85,6 +85,8 @@
 my $warned_debug_name = 0;
 
 my %dir_counts;
+my @devhelp;
+my @devhelp_links;
 
 # Read package contents...
 open(IN, '<', "index") or fail("cannot open index file index: $!");
@@ -126,9 +128,27 @@
 	tag "package-contains-ancient-file", "$file $date";
     }
 
+    # *.devhelp and *.devhelp2 files must be accessible from a directory in
+    # the devhelp search path: /usr/share/devhelp/books and
+    # /usr/share/gtk-doc/html.  We therefore look for any links in one of
+    # those directories to another directory.  The presence of such a link
+    # blesses any file below that other directory.
+    if ($link and $file =~ m,usr/share/(devhelp/books|gtk-doc/html)/,) {
+	my $blessed = $link;
+	if ($blessed !~ m,^/,) {
+	    my $base = $file;
+	    $base =~ s,/+[^/]+$,,;
+	    while ($blessed =~ s,^\.\./,,) {
+		$base =~ s,/+[^/]+$,,;
+	    }
+	    $blessed = "$base/$blessed";
+	}
+	push (@devhelp_links, $blessed);
+    }
+
     #count directory contents:
     $dir_counts{$file} ||= 0 if ($perm =~ m/^d/);
-    $dir_counts{$1} = ($dir_counts{$1} || 0) + 1 if ($file =~ m{^(.+/)[^/]+/?$});
+    $dir_counts{$1} = ($dir_counts{$1} || 0) + 1 if ($file =~ m,^(.+/)[^/]+/?$,);
 
     # ---------------- /etc
     if ($file =~ m,^etc/,) {
@@ -384,17 +404,16 @@
 	    # at some point and are not worth moving.
 	}
 	# ---------------- .desktop files
-	# People have placed them everywhere, but nowadays the consensus 
-	# seems to be to stick to the fd.org standard drafts, which says
-	# that .desktop files intended for menus should be placed in 
-	# $XDG_DATA_DIRS/applications.
-	# The default for $XDG_DATA_DIRS is /usr/local/share/:/usr/share/,
-	# according to the basedir-spec on fd.org. As distributor, we 
-	# should only allow /usr/share.
+	# People have placed them everywhere, but nowadays the consensus seems
+	# to be to stick to the fd.org standard drafts, which says that
+	# .desktop files intended for menus should be placed in
+	# $XDG_DATA_DIRS/applications.  The default for $XDG_DATA_DIRS is
+	# /usr/local/share/:/usr/share/, according to the basedir-spec on
+	# fd.org. As distributor, we should only allow /usr/share.
 	#
-	# Other applications also use .desktop files (yay!), so we need to
-	# exclude them.
-	elsif ($file =~ m,/usr/share/(?:gnome/apps|applink)/[^/]+\.desktop$,) {
+	# KDE hasn't moved its files from /usr/share/applnk, so don't warn
+	# about this yet until KDE adopts the new location.
+	elsif ($file =~ m,^usr/share/gnome/apps/.*\.desktop$,) {
 	    tag "desktop-file-in-wrong-dir", $file;
 	}
 
@@ -547,6 +566,15 @@
 	tag "extra-license-file", "$file";
     }
 
+    # ---------------- .devhelp2? files
+    if ($file =~ m,\.devhelp2?(\.gz)?$,
+	# If the file is located in a directory not searched by devhelp, we
+	# check later to see if it's in a symlinked directory.
+	and not $file =~ m,^usr/share/(devhelp/books|gtk-doc/html)/,
+	and not $file =~ m,^usr/share/doc/[^/]+/examples/,) {
+	push (@devhelp, $file);
+    }
+
     # ---------------- weird file names
     if ($file =~ m,\s+\z,) {
 	tag "file-name-ends-in-whitespace", "$file";
@@ -835,15 +863,15 @@
 
 #check for sect: games but nothing in /usr/games. Check for any binary to
 #save ourselves from game-data false positives:
-if ($pkg_section =~ m{games$} && 
-    (($dir_counts{"usr/games/"} || 0) == 0) &&
-    (($dir_counts{"bin/"} || 0) + ($dir_counts{"usr/bin/"} || 0)) > 0) {
+if ($pkg_section =~ m,games$,
+    and (($dir_counts{"usr/games/"} || 0) == 0)
+    and (($dir_counts{"bin/"} || 0) + ($dir_counts{"usr/bin/"} || 0)) > 0) {
     tag "package-section-games-but-contains-no-game";
 }
 
-if ($pkg_section =~ m{games$} && 
-    (($dir_counts{"usr/games/"} || 0)> 0) &&
-    (($dir_counts{"bin/"} || 0) + ($dir_counts{"usr/bin/"} || 0)) > 0) {
+if ($pkg_section =~ m,games$,
+    and (($dir_counts{"usr/games/"} || 0)> 0)
+    and (($dir_counts{"bin/"} || 0) + ($dir_counts{"usr/bin/"} || 0)) > 0) {
     tag "package-section-games-but-has-usr-bin";
 }
 
@@ -873,8 +901,21 @@
     }
 }
 
+# Check for .devhelp2? files that aren't symlinked into paths searched by
+# devhelp.
+for my $file (@devhelp) {
+    my $found = 0;
+    for my $link (@devhelp_links) {
+	if ($file =~ m,^\Q$link,) {
+	    $found = 1;
+	    last;
+	}
+    }
+    tag 'package-contains-devhelp-file-without-symlink', $file unless $found;
 }
 
+}
+
 1;
 
 # Local Variables:

Modified: trunk/checks/files.desc
===================================================================
--- trunk/checks/files.desc	2008-02-03 21:28:53 UTC (rev 1159)
+++ trunk/checks/files.desc	2008-02-03 23:06:18 UTC (rev 1160)
@@ -668,11 +668,10 @@
 
 Tag: desktop-file-in-wrong-dir
 Type: warning
-Info: package contains a .desktop file in an obsolete directory.
- According to the menu-spec draft on freedesktop.org, those .desktop
- files that are intended to create a menu should be placed in 
- <tt>/usr/share/applications/</tt>, and no longer in
- <tt>/usr/share/gnome/apps</tt> or <tt>/usr/share/applnk</tt>
+Info: The package contains a .desktop file in an obsolete directory.
+ According to the menu-spec draft on freedesktop.org, those .desktop files
+ that are intended to create a menu should be placed in
+ <tt>/usr/share/applications</tt>, not <tt>/usr/share/gnome/apps</tt>.
 
 Tag: file-in-usr-lib-cgi-bin
 Type: warning
@@ -737,6 +736,18 @@
  exectuables in <tt>/bin</tt> or <tt>/usr/bin/</tt>.  This can be intentional,
  but is usually a mistake.
 
+Tag: package-contains-devhelp-file-without-symlink
+Type: warning
+Info: This package contains a *.devhelp or *.devhelp2 file which is not in
+ the devhelp search path (<tt>/usr/share/devhelp/books</tt> and
+ <tt>/usr/share/gtk-doc/html</tt>) and is apparently not in a directory
+ linked into the devhelp search path.  This will prevent devhelp from
+ finding the documentation.
+ .
+ If the devhelp documentation is installed in a path outside the devhelp
+ search path (such as <tt>/usr/share/doc</tt>), create a symlink in
+ <tt>/usr/share/gtk-doc/html</tt> pointing to the documentation directory.
+
 Tag: debug-package-should-be-named-dbg
 Type: warning
 Info: This package provides at least one file in <tt>/usr/lib/debug</tt>,

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-02-03 21:28:53 UTC (rev 1159)
+++ trunk/debian/changelog	2008-02-03 23:06:18 UTC (rev 1160)
@@ -20,9 +20,15 @@
       explain the dependency possibilities.  Ignore dh_python if
       debian/pyversion or a Python-Version control field are present.
       Thanks, Loïc Minier.  (Closes: #460625)
-  * checks/files.desc:
+  * checks/files{.desc,}:
     + [RA] In many of the long descriptions for symlink-related tags,
       mention that running dh_link will fix symlink problems.
+    + [RA] Fix a long-standing error in the regex checking for *.desktop
+      files in /usr/share/gnome/apps that caused the tag to never be
+      issued.  Remove the check for /usr/share/applnk, since obsolete or
+      not KDE appears to actively use it still.
+    + [RA] Check for *.devhelp{2,} files not linked into devhelp's search
+      path.  Based on a patch by Bradley Smith.  (Closes: #273309)
   * checks/infofiles:
     + [RA] Don't issue unknown-intepreter for maintainer scripts with
       weird interpreters.  checks/scripts already handles this and the tag

Modified: trunk/testset/filenames/debian/rules
===================================================================
--- trunk/testset/filenames/debian/rules	2008-02-03 21:28:53 UTC (rev 1159)
+++ trunk/testset/filenames/debian/rules	2008-02-03 23:06:18 UTC (rev 1160)
@@ -131,6 +131,9 @@
 	install -d debian/tmp/usr/lib/sgml
 	touch debian/tmp/usr/lib/sgml/package
 
+	install -d debian/tmp/usr/share/gnome/apps/System
+	touch debian/tmp/usr/share/gnome/apps/System/foo.desktop
+
 	ln -s '../filenames/doc/version6.txt.gz' debian/tmp/usr/share/doc/filenames/version.txt.gz
 	ln -s ../../share/symlink debian/tmp/usr/lib/filenames/symlink1ok
 	ln -s ../../../etc/symlink debian/tmp/usr/lib/filenames/symlink1wrong
@@ -150,6 +153,24 @@
 	ln -s / debian/tmp/usr/lib/filenames/symlink7ok+warn
 	ln -s ../../.. debian/tmp/usr/lib/filenames/symlink10wrong
 
+# devhelp tests.  Files in /usr/share/gtk-doc/html or /usr/share/devhelp/books
+# are okay.  Files elsewhere are okay iff their parent path is symlinked into
+# one of those paths.
+	install -d debian/tmp/usr/share/devhelp/books/filenames
+	echo 'Not really XML' > debian/tmp/usr/share/devhelp/books/filenames/a.devhelp
+	echo 'Not really XML' > debian/tmp/usr/share/devhelp/books/filenames/.devhelp2
+	gzip -9 debian/tmp/usr/share/devhelp/books/filenames/.devhelp2
+	install -d debian/tmp/usr/share/gtk-doc/html/filenames
+	echo 'Not really XML' > debian/tmp/usr/share/gtk-doc/html/filenames/b.devhelp
+	gzip -9 debian/tmp/usr/share/gtk-doc/html/filenames/b.devhelp
+	install -d debian/tmp/usr/share/doc/filenames/good-devhelp
+	echo 'Not really XML' > debian/tmp/usr/share/doc/filenames/good-devhelp/.devhelp2
+	install -d debian/tmp/usr/share/doc/filenames/bad-devhelp
+	echo 'Not really XML' > debian/tmp/usr/share/doc/filenames/bad-devhelp/c.devhelp
+	gzip -9 debian/tmp/usr/share/doc/filenames/bad-devhelp/c.devhelp
+	ln -s ../../doc/filenames/good-devhelp debian/tmp/usr/share/gtk-doc/html/good
+	ln -s ../doc/filenames/bad-devhelp debian/tmp/usr/share/gtk-doc/html/bad
+
 	dpkg-gencontrol -pfilenames -Pdebian/tmp
 	dpkg --build debian/tmp ..
 

Modified: trunk/testset/tags.filenames
===================================================================
--- trunk/testset/tags.filenames	2008-02-03 21:28:53 UTC (rev 1159)
+++ trunk/testset/tags.filenames	2008-02-03 23:06:18 UTC (rev 1160)
@@ -56,6 +56,7 @@
 W: filenames: binary-without-manpage usr/bin/mh/read
 W: filenames: cvsignore-file-in-package files/.cvsignore
 W: filenames: debian-news-file-not-compressed usr/share/doc/filenames/NEWS.Debian
+W: filenames: desktop-file-in-wrong-dir usr/share/gnome/apps/System/foo.desktop
 W: filenames: executable-not-elf-or-script ./usr/bin/bin/bad
 W: filenames: executable-not-elf-or-script ./usr/bin/mh/read
 W: filenames: extra-license-file usr/share/pixmaps/COPYING
@@ -85,6 +86,7 @@
 W: filenames: package-contains-arch-control-dir usr/lib/perl5/.arch-ids/
 W: filenames: package-contains-arch-control-dir usr/lib/perl5/{arch}/
 W: filenames: package-contains-bzr-control-dir usr/lib/perl5/.bzr/
+W: filenames: package-contains-devhelp-file-without-symlink usr/share/doc/filenames/bad-devhelp/c.devhelp.gz
 W: filenames: package-contains-empty-directory usr/lib/perl5/.arch-ids/
 W: filenames: package-contains-empty-directory usr/lib/perl5/.bzr/
 W: filenames: package-contains-empty-directory usr/lib/perl5/.svn/


Reply to: