mime-support (3.53~experimental1) unstable; urgency=low 3.53_experimental1
authorCharles Plessy <plessy@debian.org>
Thu, 26 Jul 2012 00:09:41 +0000 (09:09 +0900)
committerCharles Plessy <plessy@debian.org>
Thu, 26 Jul 2012 00:09:41 +0000 (09:09 +0900)
  * Adopted by László Böszörményi and Charles Plessy. (Closes: #681640)
  * Manage the source package with Git in Alioth collab-maint's group.
    (Closes: #682745)
  * Parse Desktop entries to generate mailcap entries. Patch from Brian M. Carlson.
    (Closes: #497779)
  * Trigger update-mime for Desktop entry files added in /usr/share/applications.

 -- Charles Plessy <plessy@debian.org>  Thu, 26 Jul 2012 07:29:22 +0900

This was really uploaded to experimental as intended.

debian/changelog
debian/control
debian/debhelper.log
debian/triggers
update-mime

index 4599874..e8f03a1 100644 (file)
@@ -1,3 +1,14 @@
+mime-support (3.53~experimental1) unstable; urgency=low
+
+  * Adopted by László Böszörményi and Charles Plessy. (Closes: #681640)
+  * Manage the source package with Git in Alioth collab-maint's group.
+    (Closes: #682745)
+  * Parse Desktop entries to generate mailcap entries. Patch from Brian M. Carlson.
+    (Closes: #497779)
+  * Trigger update-mime for Desktop entry files added in /usr/share/applications.
+
+ -- Charles Plessy <plessy@debian.org>  Thu, 26 Jul 2012 07:29:22 +0900
+
 mime-support (3.52-1) unstable; urgency=low
 
   * removed application/x-httpd-* types (closes: 589384)
index 2d3b51e..44bda90 100644 (file)
@@ -2,8 +2,13 @@ Source: mime-support
 Build-Depends: debhelper
 Section: net
 Priority: standard
-Maintainer: Brian White <bcwhite@pobox.com>
+Maintainer: Mime-Support Maintainers <mime-support@plessy.org>
+Uploaders:
+ Laszlo Boszormenyi (GCS) <gcs@debian.hu>,
+ Charles Plessy <plessy@debian.org>,
 Standards-Version: 3.1.1.1
+Vcs-Browser: http://git.debian.org/?p=collab-maint/mime-support.git
+Vcs-Git: git://git.debian.org/collab-maint/mime-support.git
 
 Package: mime-support
 Architecture: all
index 4068976..0dfb34d 100644 (file)
@@ -10,3 +10,4 @@ dh_md5sums
 dh_md5sums
 dh_md5sums
 dh_md5sums
+dh_md5sums
index 56c3022..dcbc2a9 100644 (file)
@@ -1 +1,2 @@
 interest /usr/lib/mime/packages
+interest /usr/share/applications
index f1c98f7..9608f2f 100755 (executable)
@@ -24,6 +24,7 @@ $conffile     = "/etc/update-mime.conf";
 $mailcap       = "/etc/mailcap";
 $mailcapdef    = "/usr/lib/mime/mailcap";
 $mimedir       = "/usr/lib/mime/packages";
+$appsdir       = "/usr/share/applications";
 $orderfile     = "/etc/mailcap.order";
 $defpriority    = 5;
 $localgen      = 0;
@@ -63,14 +64,12 @@ do $conffile if -f $conffile;
 %packages;
 %priorities;
 @order;
-
+$counter=1;
 
 
 sub ReadEntries
 {
-       my($pkg,$priority,$counter);
-
-       $counter=1;
+       my($pkg,$priority);
 
 #      foreach $file (glob "$mimedir/*") {
        foreach $file (map { glob $_.'/*' } split ':',$mimedir) {
@@ -110,6 +109,67 @@ sub ReadEntries
        }
 }
 
+sub RecurseIntoDirectories
+{
+       my @files;
+       foreach my $dir (@_) {
+               next if ($dir =~ m!(^|/)(\.|\#)|(\~)$!);
+               my @entries = glob "$dir/*";
+               push @files, RecurseIntoDirectories(grep { -d $_ } @entries);
+               push @files, grep { -f $_ } @entries;
+       }
+       return @files;
+}
+
+sub ReadDesktopEntries
+{
+       my($pkg,$priority);
+
+       foreach $file (RecurseIntoDirectories(split ':',$appsdir)) {
+               next if ($file =~ m!(^|/)(\.|\#)|(\~)$!);
+               next unless ($file =~ m/\.desktop$/);
+               ($pkg) = ($file =~ m|/([^/]*)\.desktop$|);
+               print STDERR "$pkg:\n" if $debug;
+
+               next if (defined $packages{$pkg});
+               $packages{$pkg} = [];
+
+               if (open(FILE,"<$file")) {
+                       my($terminal, $exec, @types) = ("test=test -n \"\$DISPLAY\"");
+                       while (<FILE>) {
+                               chomp;
+                               next if (m/^\s*$|^\s*\#/);
+                               if (m/^Terminal=(\w+)/i) {
+                                       $terminal = "needsterminal" if ($1 eq "true");
+                               }
+                               elsif (m/Exec=(.*)$/i) {
+                                       $exec = $1;
+                                       $exec =~ s/%[fFuU]/%s/g;
+                                       $exec .= " %s" if ($exec !~ m/%s/);
+                               }
+                               elsif (m/MimeType=(.*)/i) {
+                                       push @types, split(/;/, $1);
+                               }
+                       }
+                       if (!defined($exec) || !scalar(@types)) {
+                               close(FILE);
+                               next;
+                       }
+                       foreach $type (@types) {
+                               my $entry = "$type; $exec; $terminal";
+                               $priority=$defpriority;
+                               $entries{$counter} = $entry;
+                               push @{$packages{$pkg}},$counter;
+                               push @{$priorities{$priority}},$counter;
+                               print STDERR "$counter: $entry\n" if $debug;
+                               $counter++;
+                       }
+                       close(FILE);
+               } else {
+                       print STDERR "Warning: could not open file '$file' -- $!\n";
+               }
+       }
+}
 
 
 sub ReadOrder
@@ -270,6 +330,7 @@ sub UpdateMailcap
 
 
 ReadEntries();
+ReadDesktopEntries();
 ReadOrder();
 @list = OrderEntries();
 UpdateMailcap(@list);