GNU bug report logs - #29472
[patch 0/4] Add perl-file-mimeinfo and dependencies; add it as an input to xdg-utils

Previous Next

Package: guix-patches;

Reported by: brendan.tildesley <at> openmailbox.org

Date: Mon, 27 Nov 2017 12:52:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29472 in the body.
You can then email your comments to 29472 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#29472; Package guix-patches. (Mon, 27 Nov 2017 12:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to brendan.tildesley <at> openmailbox.org:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 27 Nov 2017 12:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: brendan.tildesley <at> openmailbox.org
To: guix-patches <at> gnu.org
Subject: [patch 0/4] Add perl-file-mimeinfo and dependencies;
 add it as an input to xdg-utils
Date: Mon, 27 Nov 2017 12:50:53 -0000
I was wondering why my pdf documents were getting opened in Gimp by default instead of Evince, so I investigated xdg-open and found it uses mimeopen as a fallback, and packaged it. Turns out it didn't make a difference and the issue was simply that the generated mimedata.cache in xdg-mime-database had Gimp listed before Evince.

I was also I little confused that xdg-mime-database produces so many conflicts with shared-mime-info. It's role appears to be to update the data in shared-mime-data and have it overshadow the original data when  conflicts are resolved during profile generation. Looks ugly seeing all those conflicts though.

I had a look at Fedora's version. They just have a single shared-mime-data package that runs update-mime-database, but also they add a few changes to make Evince open pdf's instead of Gimp, among other changes.

This makes me feel that it's desirable for us to also tweak mimedata to make it more sensible -- Pdf's should open in a pdf reader before it opens in an image editor. It seems unrealistic to only tweak upstream projects to make all this mimedata mesh together perfectly to produce ideal default behaviour.

I rambled on a bit too much... Here are some patches that add perl-file-mimeinfo

Information forwarded to guix-patches <at> gnu.org:
bug#29472; Package guix-patches. (Mon, 27 Nov 2017 12:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 29472 <at> debbugs.gnu.org (full text, mbox):

From: Brendan Tildesley <brendan.tildesley <at> openmailbox.org>
To: 29472 <at> debbugs.gnu.org
Subject: [PATCH 1/4] gnu: Add perl-file-basedir.
Date: Mon, 27 Nov 2017 23:54:31 +1100
* gnu/packages/perl.scm: (perl-file-basedir): New variable.
---
 gnu/packages/perl.scm | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 73bab96a2..b52d6fd91 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -44,7 +44,8 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages perl-web)
-  #:use-module (gnu packages pkg-config))
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages freedesktop))
 
 ;;;
 ;;; Please: Try to add new module packages in alphabetic order.
@@ -3418,6 +3419,36 @@ files, it will not remove directories; this module remedies that.  It also
 accepts wildcards, * and ?, as arguments for file names.")
     (license (package-license perl))))
 
+(define-public perl-file-basedir
+  (package
+    (name "perl-file-basedir")
+    (version "0.07")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://cpan/authors/id/K/KI/KIMRYAN/"
+                           "File-BaseDir-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0aq8d4hsaxqibp36f773y6dfck7zd82v85sp8vhi6pjkg3pmf2hj"))))
+    (build-system perl-build-system)
+    (native-inputs
+     `(("perl-module-build" ,perl-module-build)
+       ("perl-file-which" ,perl-file-which)
+       ("perl-test-pod" ,perl-test-pod)
+       ("perl-test-pod-coverage" ,perl-test-pod-coverage)
+       ("xdg-user-dirs" ,xdg-user-dirs)))
+    (propagated-inputs
+     `(("perl-ipc-system-simple" ,perl-ipc-system-simple)))
+    (home-page "http://search.cpan.org/dist/File-BaseDir/")
+    (synopsis "Use the Freedesktop.org base directory specification")
+    (description
+     "File::Basedir can be used to find directories and files as specified by
+the Freedesktop.org Base Directory Specification.  This specifications gives a
+mechanism to locate directories for configuration, application data and cache
+data.")
+    (license (package-license perl))))
+
 (define-public perl-file-sharedir
   (package
     (name "perl-file-sharedir")
-- 
2.15.0





Information forwarded to guix-patches <at> gnu.org:
bug#29472; Package guix-patches. (Mon, 27 Nov 2017 12:56:03 GMT) Full text and rfc822 format available.

Message #11 received at 29472 <at> debbugs.gnu.org (full text, mbox):

From: Brendan Tildesley <brendan.tildesley <at> openmailbox.org>
To: 29472 <at> debbugs.gnu.org
Subject: [PATCH 2/4] gnu: Add perl-file-desktopentry.
Date: Mon, 27 Nov 2017 23:54:32 +1100
* gnu/packages/perl.scm (perl-file-desktopentry): New variable.
---
 gnu/packages/perl.scm | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index b52d6fd91..bacaaf38a 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -45,7 +45,8 @@
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages perl-web)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages freedesktop))
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages web))
 
 ;;;
 ;;; Please: Try to add new module packages in alphabetic order.
@@ -3449,6 +3450,33 @@ mechanism to locate directories for configuration, application data and cache
 data.")
     (license (package-license perl))))
 
+(define-public perl-file-desktopentry
+  (package
+    (name "perl-file-desktopentry")
+    (version "0.22")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://cpan/authors/id/M/MI/MICHIELB/"
+                           "File-DesktopEntry-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1f1maqix2kbfg2rf008m7mqnvv6nvcf9y6pcgdv2kxp2vbih370n"))))
+    (build-system perl-build-system)
+    (native-inputs
+     `(("perl-test-pod" ,perl-test-pod)
+       ("perl-test-pod-coverage" ,perl-test-pod-coverage)))
+    (propagated-inputs
+     `(("perl-file-basedir" ,perl-file-basedir)
+       ("perl-uri" ,perl-uri)))
+    (home-page "http://search.cpan.org/~michielb/File-DesktopEntry/")
+    (synopsis "Handle .desktop files")
+    (description
+     "File::Desktopentry parses .desktop files defined by the Freedesktop.org
+\"Desktop Entry\" specification.  It can also run the applications define in
+those files.")
+    (license (package-license perl))))
+
 (define-public perl-file-sharedir
   (package
     (name "perl-file-sharedir")
-- 
2.15.0





Information forwarded to guix-patches <at> gnu.org:
bug#29472; Package guix-patches. (Mon, 27 Nov 2017 12:56:04 GMT) Full text and rfc822 format available.

Message #14 received at 29472 <at> debbugs.gnu.org (full text, mbox):

From: Brendan Tildesley <brendan.tildesley <at> openmailbox.org>
To: 29472 <at> debbugs.gnu.org
Subject: [PATCH 3/4] gnu: Add perl-file-mimeinfo.
Date: Mon, 27 Nov 2017 23:54:33 +1100
* gnu/packages/perl.scm (perl-file-mimeinfo): New variable.
---
 gnu/packages/perl.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index bacaaf38a..f658b9177 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -46,6 +46,7 @@
   #:use-module (gnu packages perl-web)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gnome)
   #:use-module (gnu packages web))
 
 ;;;
@@ -3477,6 +3478,53 @@ data.")
 those files.")
     (license (package-license perl))))
 
+(define-public perl-file-mimeinfo
+  (package
+    (name "perl-file-mimeinfo")
+    (version "0.28")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://cpan/authors/id/M/MI/MICHIELB/"
+                           "File-MimeInfo-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1ipbh63bkh1r2gy5g7q4bzhki8j29mm1jkhbv60p9vwsdys5s91a"))))
+    (build-system perl-build-system)
+    ;; If the tests are fixed, add perl-test-pod, perl-test-pod-coverage, and
+    ;; perl-test-tiny as native-inputs.
+    (propagated-inputs
+     `(("shared-mime-info" ,shared-mime-info)
+       ("perl-file-desktopentry" ,perl-file-desktopentry)))
+    (arguments
+     ;; Some tests fail due to requiring the mimetype of perl files to be
+     ;; text/plain when they are actually application/x-perl.
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-programs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (for-each (lambda (prog)
+                           (wrap-program (string-append out "/bin/" prog)
+                             `("PERL5LIB" ":" prefix
+                               (,(string-append (getenv "PERL5LIB") ":" out
+                                                "/lib/perl5/site_perl")))))
+                         '("mimeopen" "mimetype")))
+             #t)))))
+    (home-page "http://search.cpan.org/dist/File-MimeInfo/")
+    (synopsis "Determine file type from the file name")
+    (description
+     "File::Mimeinfo can be used to determine the mime type of a file.  It
+tries to implement the freedesktop specification for a shared MIME database.
+
+ This package also contains two related utilities:
+@itemize
+@item mimetype: Determine a file's mimetype.
+@item mimeopen: Open files in an appropriate program according to their mimetype.
+@end itemize")
+    (license (package-license perl))))
+
 (define-public perl-file-sharedir
   (package
     (name "perl-file-sharedir")
-- 
2.15.0





Information forwarded to guix-patches <at> gnu.org:
bug#29472; Package guix-patches. (Mon, 27 Nov 2017 12:56:04 GMT) Full text and rfc822 format available.

Message #17 received at 29472 <at> debbugs.gnu.org (full text, mbox):

From: Brendan Tildesley <brendan.tildesley <at> openmailbox.org>
To: 29472 <at> debbugs.gnu.org
Subject: [PATCH 4/4] gnu: xdg-utils: Add perl-file-mimeinfo as an input.
Date: Mon, 27 Nov 2017 23:54:34 +1100
* gnu/packages/freedesktop.scm (perl-file-mimeinfo)
[input]: Add perl-file-mimeinfo.
---
 gnu/packages/freedesktop.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index cac1f67c5..a830cd93e 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -56,6 +56,7 @@
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages polkit)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -85,7 +86,8 @@
        ("w3m" ,w3m)
        ("xmlto" ,xmlto)))
     (propagated-inputs
-     `(("xprop" ,xprop) ; for Xfce detecting
+     `(("perl-file-mimeinfo" ,perl-file-mimeinfo) ; for mimeopen fallback
+       ("xprop" ,xprop) ; for Xfce detecting
        ("xset" ,xset))) ; for xdg-screensaver
     (arguments
      `(#:tests? #f   ; no check target
-- 
2.15.0





Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Tue, 28 Nov 2017 09:45:02 GMT) Full text and rfc822 format available.

Notification sent to brendan.tildesley <at> openmailbox.org:
bug acknowledged by developer. (Tue, 28 Nov 2017 09:45:02 GMT) Full text and rfc822 format available.

Message #22 received at 29472-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Brendan Tildesley <brendan.tildesley <at> openmailbox.org>
Cc: 29472-done <at> debbugs.gnu.org
Subject: Re: [bug#29472] [PATCH 1/4] gnu: Add perl-file-basedir.
Date: Tue, 28 Nov 2017 10:44:56 +0100
Hi Brendan,

I applied all 4 patches.  However I took the liberty (1) to add a bit of
@code etc. markup in descriptions, and (2) to move them to
freedesktop.scm so that perl.scm doesn’t pull in all of
freedesktop/gnome.

Thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 26 Dec 2017 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.