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

[SCM] Debian package checker branch, master, updated. 2.2.14-53-g6019f6d



The following commit has been merged in the master branch:
commit 6019f6d89449dff3c7da7c7cdef9d34440932d0b
Author: Russ Allbery <rra@debian.org>
Date:   Sun Sep 13 21:27:16 2009 -0700

    Add check for desktop entries limited to multiple environments
    
    * checks/menu-format{,.desc}:
      + [RA] Add a new check for desktop entries that are limited to
        multiple environments.  NotShowIn was probably intended instead.
        Thanks, Andrew Lee.  (Closes: #537737)
    
    Also add a test suite for general issues with desktop files.

diff --git a/checks/menu-format b/checks/menu-format
index 981e5d5..9568ad1 100644
--- a/checks/menu-format
+++ b/checks/menu-format
@@ -818,6 +818,7 @@ sub VerifyDesktopFile {
     }
 
     # Check the Category tag.
+    my $in_reserved;
     if (defined $vals{'Categories'}) {
         my @cats = split (';', $vals{'Categories'});
         my $saw_main;
@@ -827,6 +828,7 @@ sub VerifyDesktopFile {
                 tag "desktop-entry-uses-reserved-category", "$cat /$file"
                     unless $vals{'OnlyShowIn'};
                 $saw_main = 1;
+		$in_reserved = 1;
             } elsif (not $categories{$cat} and not $main_categories{$cat}) {
                 tag "desktop-entry-invalid-category", "$cat /$file";
             } elsif ($main_categories{$cat}) {
@@ -837,6 +839,17 @@ sub VerifyDesktopFile {
             tag "desktop-entry-lacks-main-category", "/$file";
         }
     }
+
+    # Check the OnlyShowIn tag.  If this is not an application in a reserved
+    # category, warn about any desktop entry that specifies OnlyShowIn for
+    # more than one environment.  In that case, the application probably
+    # should be using NotShowIn instead.
+    if (defined $vals{OnlyShowIn} and not $in_reserved) {
+	my @envs = split (';', $vals{OnlyShowIn});
+	if (@envs > 1) {
+	    tag 'desktop-entry-limited-to-environments', "/$file";
+	}
+    }
 }
 
 # Verify whether a command is shipped as part of the package.  Takes the full
diff --git a/checks/menu-format.desc b/checks/menu-format.desc
index be7def1..95d5874 100644
--- a/checks/menu-format.desc
+++ b/checks/menu-format.desc
@@ -352,3 +352,15 @@ Info: kdelnk files were used by KDE 1 and since KDE 2 desktop files are used
  instead.  Renaming the file and removing the deprecated header and keys
  is often all that needs to be done.
 Ref: http://standards.freedesktop.org/desktop-entry-spec/1.0/apc.html
+
+Tag: desktop-entry-limited-to-environments
+Severity: normal
+Certainty: wild-guess
+Info: This desktop entry uses OnlyShowIn to limit the environments in
+ which it's displayed but lists multiple environments.  This is often a
+ sign of a desktop file written assuming that only GNOME, KDE, and Xfce
+ are in use and the desktop file intended to exclude one of them.  This
+ unintentionally hides the application from desktop environments such as
+ LXDE where it would work fine.  If this application supports any desktop
+ environment except some specific ones, it should list the unsupported
+ environments in the NotShowIn key instead.
diff --git a/debian/changelog b/debian/changelog
index 38c5a43..1c44dbd 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ lintian (2.2.15) UNRELEASED; urgency=low
   * Summary of tag changes:
     + Added:
       - build-depends-on-non-build-package
+      - desktop-entry-limited-to-environments
       - example-interpreter-in-usr-local (pedantic)
       - example-interpreter-not-absolute
       - example-script-without-interpreter
@@ -74,11 +75,14 @@ lintian (2.2.15) UNRELEASED; urgency=low
       (Closes: #543641)
     + [RA] Document the MANWIDTH variable when running man by hand to
       check for man page errors.  (Closes: #542584)
-  * checks/menu-format.desc:
+  * checks/menu-format{,.desc}:
     + [RA] Add a pointer to desktop-file-validate in many of the tag
       descriptions for desktop tags.  (Closes: #539403)
     + [RA] Mention in the description of desktop-entry-invalid-category
       that whitespace isn't allowed and categories are case-sensitive.
+    + [RA] Add a new check for desktop entries that are limited to
+      multiple environments.  NotShowIn was probably intended instead.
+      Thanks, Andrew Lee.  (Closes: #537737)
   * checks/rules:
     + [RA] Anchor the dh_quilt regex to not trigger on commented-out
       calls.  Patch from Cesare Tirabassi.  (Closes: #543259)
diff --git a/t/COVERAGE b/t/COVERAGE
index a65f96f..5504f1c 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,10 +1,11 @@
-Last generated 2009-09-13
+Last generated 2009-09-14
 
 The following tags are not tested by the test suite:
 
 binaries apparently-corrupted-elf-binary
 binaries binary-file-compressed-with-upx
 binaries library-not-linked-against-libc
+binaries ocaml-custom-executable
 binaries program-not-linked-against-libc
 
 changelog-file html-changelog-without-text-version
@@ -130,9 +131,6 @@ manpages manpage-for-x11-binary-in-wrong-directory
 manpages manpage-in-wrong-directory
 
 menu-format bad-test-in-menu-item
-menu-format desktop-entry-contains-deprecated-key
-menu-format desktop-entry-lacks-main-category
-menu-format duplicated-key-in-desktop-entry
 menu-format duplicated-tag-in-menu-item
 menu-format menu-icon-cannot-be-parsed
 menu-format menu-icon-missing
@@ -422,15 +420,9 @@ md5sums md5sums-lists-nonexisting-file
 md5sums no-md5sums-control-file
 
 menu-format deprecated-kdelnk-file
-menu-format desktop-command-not-in-package
 menu-format desktop-contains-deprecated-header
-menu-format desktop-entry-contains-encoding-key
-menu-format desktop-entry-contains-unknown-key
-menu-format desktop-entry-file-has-crs
 menu-format desktop-entry-invalid-category
 menu-format desktop-entry-missing-required-key
-menu-format desktop-entry-uses-reserved-category
-menu-format executable-desktop-file
 menu-format menu-command-not-in-package
 menu-format menu-item-creates-new-section
 menu-format menu-item-missing-required-tag
@@ -560,14 +552,9 @@ binary
   debian-news-file-uses-obsolete-national-encoding
   debian-rules-uses-pwd
   deprecated-kdelnk-file
-  desktop-command-not-in-package
   desktop-contains-deprecated-header
-  desktop-entry-contains-encoding-key
-  desktop-entry-contains-unknown-key
-  desktop-entry-file-has-crs
   desktop-entry-invalid-category
   desktop-entry-missing-required-key
-  desktop-entry-uses-reserved-category
   doc-base-abstract-field-separator-extra-whitespaces
   doc-base-document-field-ends-in-whitespace
   doc-base-file-duplicated-format
@@ -582,7 +569,6 @@ binary
   doc-base-index-references-multiple-files
   doc-base-invalid-document-field
   doc-base-unknown-section
-  executable-desktop-file
   executable-not-elf-or-script
   file-directly-in-usr-share
   file-in-unusual-dir
diff --git a/t/tests/menu-format-desktop-general/debian/crlf.desktop b/t/tests/menu-format-desktop-general/debian/crlf.desktop
new file mode 100644
index 0000000..ea3eb03
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/crlf.desktop
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=general
+Comment=An entirely correct desktop entry
+Type=Application
+Categories=Development;Building;
diff --git a/t/tests/menu-format-desktop-general/debian/debian/install b/t/tests/menu-format-desktop-general/debian/debian/install
new file mode 100644
index 0000000..4463089
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/debian/install
@@ -0,0 +1,6 @@
+crlf.desktop         usr/share/applications
+environments.desktop usr/share/applications
+general.desktop      usr/share/applications
+missing.desktop      usr/share/applications
+reserved-bad.desktop usr/share/applications
+reserved.desktop     usr/share/applications
diff --git a/t/tests/menu-format-desktop-general/debian/debian/rules b/t/tests/menu-format-desktop-general/debian/debian/rules
new file mode 100644
index 0000000..704ddff
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/debian/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+
+pkg = $(shell dh_listpackages)
+
+%:
+	dh $@
+
+override_dh_fixperms:
+	dh_fixperms
+	chmod a+x debian/$(pkg)/usr/share/applications/general.desktop
diff --git a/t/tests/menu-format-desktop-general/debian/environments.desktop b/t/tests/menu-format-desktop-general/debian/environments.desktop
new file mode 100644
index 0000000..e0a4b59
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/environments.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=environments
+Type=Application
+Comment=Incorrectly limited to particular environments
+Categories=Development;
+Exec=foo
+OnlyShowIn=GNOME;KDE;
diff --git a/t/tests/menu-format-desktop-general/debian/general.desktop b/t/tests/menu-format-desktop-general/debian/general.desktop
new file mode 100644
index 0000000..2a0ef96
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/general.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=general
+Name=general
+Comment=Various general errors
+Type=Application
+Foo=Bar
+Encoding=UTF-8
+Categories=Building;Lintian;
+Terminal=true
+TerminalOptions=-g 80x25
+Exec=foo
diff --git a/t/tests/menu-format-desktop-general/debian/missing.desktop b/t/tests/menu-format-desktop-general/debian/missing.desktop
new file mode 100644
index 0000000..6a07c8f
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/missing.desktop
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=foo
+Comment=This entry has no Application
+Categories=Development;
+Exec=foo
diff --git a/t/tests/menu-format-desktop-general/debian/reserved-bad.desktop b/t/tests/menu-format-desktop-general/debian/reserved-bad.desktop
new file mode 100644
index 0000000..c503ecb
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/reserved-bad.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=reserved
+Comment=Entry in a reserved category (incorrect)
+Type=Application
+Categories=Screensaver;
+Exec=foo
diff --git a/t/tests/menu-format-desktop-general/debian/reserved.desktop b/t/tests/menu-format-desktop-general/debian/reserved.desktop
new file mode 100644
index 0000000..bfbc5be
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/debian/reserved.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=reserved
+Comment=Entry in a reserved category (correct)
+Type=Application
+Categories=Screensaver;
+Exec=foo
+OnlyShowIn=GNOME;KDE;
diff --git a/t/tests/menu-format-desktop-general/desc b/t/tests/menu-format-desktop-general/desc
new file mode 100644
index 0000000..5e4e135
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/desc
@@ -0,0 +1,17 @@
+Testname: menu-format-desktop-general
+Sequence: 6000
+Version: 1.0
+Description: Test desktop file tags
+Test-For:
+ desktop-command-not-in-package
+ desktop-entry-contains-deprecated-key
+ desktop-entry-contains-encoding-key
+ desktop-entry-contains-unknown-key
+ desktop-entry-file-has-crs
+ desktop-entry-invalid-catgory
+ desktop-entry-lacks-main-category
+ desktop-entry-limited-to-environments
+ desktop-entry-uses-reserved-category
+ duplicated-key-in-desktop-entry
+ executable-desktop-file
+References: Debian Bug#537737
diff --git a/t/tests/menu-format-desktop-general/tags b/t/tests/menu-format-desktop-general/tags
new file mode 100644
index 0000000..3737c14
--- /dev/null
+++ b/t/tests/menu-format-desktop-general/tags
@@ -0,0 +1,15 @@
+E: menu-format-desktop-general: executable-desktop-file /usr/share/applications/general.desktop 0755
+I: menu-format-desktop-general: desktop-entry-contains-encoding-key /usr/share/applications/general.desktop:7 Encoding
+I: menu-format-desktop-general: desktop-entry-limited-to-environments /usr/share/applications/environments.desktop
+W: menu-format-desktop-general: desktop-command-not-in-package /usr/share/applications/environments.desktop foo
+W: menu-format-desktop-general: desktop-command-not-in-package /usr/share/applications/general.desktop foo
+W: menu-format-desktop-general: desktop-command-not-in-package /usr/share/applications/reserved-bad.desktop foo
+W: menu-format-desktop-general: desktop-command-not-in-package /usr/share/applications/reserved.desktop foo
+W: menu-format-desktop-general: desktop-entry-contains-deprecated-key usr/share/applications/general.desktop:10 TerminalOptions
+W: menu-format-desktop-general: desktop-entry-contains-unknown-key /usr/share/applications/general.desktop:6 Foo
+W: menu-format-desktop-general: desktop-entry-file-has-crs /usr/share/applications/crlf.desktop:1
+W: menu-format-desktop-general: desktop-entry-invalid-category Lintian /usr/share/applications/general.desktop
+W: menu-format-desktop-general: desktop-entry-lacks-main-category /usr/share/applications/general.desktop
+W: menu-format-desktop-general: desktop-entry-uses-reserved-category Screensaver /usr/share/applications/reserved-bad.desktop
+W: menu-format-desktop-general: duplicated-key-in-desktop-entry /usr/share/applications/general.desktop:3 Name
+W: menu-format-desktop-general: executable-not-elf-or-script ./usr/share/applications/general.desktop

-- 
Debian package checker


Reply to: