GNU bug report logs - #45190
[PATCH 0/1] Add pinentry-rofi

Previous Next

Package: guix-patches;

Reported by: Fredrik Salomonsson <plattfot <at> posteo.net>

Date: Sat, 12 Dec 2020 02:21:01 UTC

Severity: normal

Tags: patch

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

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 45190 in the body.
You can then email your comments to 45190 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#45190; Package guix-patches. (Sat, 12 Dec 2020 02:21:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fredrik Salomonsson <plattfot <at> posteo.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 12 Dec 2020 02:21:01 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: guix-patches <at> gnu.org
Cc: Fredrik Salomonsson <plattfot <at> posteo.net>
Subject: [PATCH 0/1] Add pinentry-rofi
Date: Fri, 11 Dec 2020 18:19:54 -0800
Add pinentry program that is using rofi to input the passphrase.

Fredrik Salomonsson (1):
  gnu: Add pinentry-rofi.

 gnu/packages/gnupg.scm | 81 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

-- 
2.29.2





Information forwarded to guix-patches <at> gnu.org:
bug#45190; Package guix-patches. (Sat, 12 Dec 2020 02:32:01 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: 45190 <at> debbugs.gnu.org
Cc: Fredrik Salomonsson <plattfot <at> posteo.net>
Subject: [PATCH 1/1] gnu: Add pinentry-rofi.
Date: Fri, 11 Dec 2020 18:31:03 -0800
* gnu/packages/gnupg.scm (pinentry-rofi): New variable.
---
 gnu/packages/gnupg.scm | 81 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 3620efea3a..dad6a1de81 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2018, 2019 Marius Bakke <mbakke <at> fastmail.com>
 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe <at> gmail.com>
+;;; Copyright © 2020 Fredrik Salomonsson <plattfot <at> posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -67,6 +68,7 @@
   #:use-module (gnu packages tor)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -892,6 +894,85 @@ passphrase when @code{gpg} is run and needs it.")))
 @dfn{Enlightenment Foundation Libraries} (EFL) that allows users to enter a
 passphrase when @code{gpg} is run and needs it.")))
 
+(define-public pinentry-rofi
+  (package
+  (name "pinentry-rofi")
+  (version "2.0.1")
+  (source (origin
+            (method git-fetch)
+            (uri (git-reference
+                  (url "https://github.com/plattfot/pinentry-rofi/")
+                  (commit version)))
+            (file-name (git-file-name name version))
+            (sha256
+             (base32 "044bnldz7k74s873jwsjgff176l1jsvpbaka7d1wcj8b5pwqv2av"))))
+  (build-system gnu-build-system)
+  (arguments
+    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing
+      #:modules
+      ((ice-9 match)
+       (ice-9 ftw)
+       ,@%gnu-build-system-modules)
+      #:phases
+      (modify-phases
+        %standard-phases
+        (add-after
+          'install
+          'hall-wrap-binaries
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let* ((compiled-dir
+                     (lambda (out version)
+                       (string-append out "/lib/guile/" version "/site-ccache")))
+                   (uncompiled-dir
+                     (lambda (out version)
+                       (string-append
+                         out
+                         "/share/guile/site"
+                         (if (string-null? version) "" "/")
+                         version)))
+                   (dep-path
+                     (lambda (env modules path)
+                       (list env
+                             ":"
+                             'prefix
+                             (cons modules
+                                   (map (lambda (input)
+                                          (string-append
+                                            (assoc-ref inputs input)
+                                            path))
+                                        ,''("rofi"))))))
+                   (out (assoc-ref outputs "out"))
+                   (bin (string-append out "/bin/"))
+                   (site (uncompiled-dir out "")))
+              (match (scandir site)
+                     (("." ".." version)
+                      (for-each
+                        (lambda (file)
+                          (wrap-program
+                            (string-append bin file)
+                            (dep-path
+                              "GUILE_LOAD_PATH"
+                              (uncompiled-dir out version)
+                              (uncompiled-dir "" version))
+                            (dep-path
+                              "GUILE_LOAD_COMPILED_PATH"
+                              (compiled-dir out version)
+                              (compiled-dir "" version))))
+                        ,''("pinentry-rofi"))
+                      #t))))))))
+  (native-inputs
+    `(("autoconf" ,autoconf)
+      ("automake" ,automake)
+      ("pkg-config" ,pkg-config)
+      ("texinfo" ,texinfo)))
+  (inputs `(("guile" ,guile-3.0)))
+  (propagated-inputs `(("rofi" ,rofi)))
+  (synopsis "Rofi GUI for GnuPG's passphrase input")
+  (description "Simple pinentry GUI using rofi that allows users to enter a
+passphrase when required by @code{gpg} or other software.")
+  (home-page "https://github.com/plattfot/pinentry-rofi/")
+  (license license:gpl3+)))
+
 (define-public pinentry
   (package (inherit pinentry-gtk2)
     (name "pinentry")))
-- 
2.29.2





Information forwarded to guix-patches <at> gnu.org:
bug#45190; Package guix-patches. (Sun, 03 Jan 2021 21:19:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Fredrik Salomonsson <plattfot <at> posteo.net>
Cc: 45190 <at> debbugs.gnu.org
Subject: Re: [bug#45190] [PATCH 1/1] gnu: Add pinentry-rofi.
Date: Sun, 03 Jan 2021 22:18:01 +0100
Hi Fredrik,

Fredrik Salomonsson <plattfot <at> posteo.net> skribis:

> * gnu/packages/gnupg.scm (pinentry-rofi): New variable.

Overall LGTM, with some minor issues highlighted below:

> +(define-public pinentry-rofi
> +  (package
> +  (name "pinentry-rofi")

Indentation is off here (should be offset by two).

> +  (arguments
> +    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing

Hmm the ‘strip’ phase should not fail.  Are you sure this is necessary?

> +      #:phases
> +      (modify-phases
> +        %standard-phases
> +        (add-after
> +          'install
> +          'hall-wrap-binaries

Nitpick: please indent as in other files.

> +          (lambda* (#:key inputs outputs #:allow-other-keys)
> +            (let* ((compiled-dir
> +                     (lambda (out version)
> +                       (string-append out "/lib/guile/" version "/site-ccache")))
> +                   (uncompiled-dir
> +                     (lambda (out version)
> +                       (string-append
> +                         out
> +                         "/share/guile/site"
> +                         (if (string-null? version) "" "/")
> +                         version)))
> +                   (dep-path
> +                     (lambda (env modules path)
> +                       (list env
> +                             ":"
> +                             'prefix
> +                             (cons modules
> +                                   (map (lambda (input)
> +                                          (string-append
> +                                            (assoc-ref inputs input)
> +                                            path))
> +                                        ,''("rofi"))))))
> +                   (out (assoc-ref outputs "out"))
> +                   (bin (string-append out "/bin/"))
> +                   (site (uncompiled-dir out "")))
> +              (match (scandir site)
> +                     (("." ".." version)
> +                      (for-each
> +                        (lambda (file)
> +                          (wrap-program
> +                            (string-append bin file)
> +                            (dep-path
> +                              "GUILE_LOAD_PATH"
> +                              (uncompiled-dir out version)
> +                              (uncompiled-dir "" version))
> +                            (dep-path
> +                              "GUILE_LOAD_COMPILED_PATH"
> +                              (compiled-dir out version)
> +                              (compiled-dir "" version))))
> +                        ,''("pinentry-rofi"))
> +                      #t))))))))

Since I think you’re also upstream :-), how about adding something like
that at the top of the installed executable:

  (eval-when (load expand eval)
    (set! %load-path (cons "@moddir@" %load-path))
    (set! %laod-compiled-path (cons "@godir@" %load-compiled-path)))

?

> +  (propagated-inputs `(("rofi" ,rofi)))

It’s best to avoid propagating.  Perhaps you can replace the “rofi”
string in ‘pinentry-rofi’ by “/gnu/store/…/bin/rofi” in a post-install
phase?

> +  (synopsis "Rofi GUI for GnuPG's passphrase input")
> +  (description "Simple pinentry GUI using rofi that allows users to enter a
> +passphrase when required by @code{gpg} or other software.")

Please make it a full sentence.  Also, to give context, perhaps replace
“rofi” by “the Rofi application launcher”.

Could you send an updated patch?

Thanks in advance and sorry for the delay!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#45190; Package guix-patches. (Sat, 09 Jan 2021 01:48:02 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: 45190 <at> debbugs.gnu.org
Cc: Fredrik Salomonsson <plattfot <at> posteo.net>
Subject: [PATCH v2] gnu: Add pinentry-rofi.
Date: Fri,  8 Jan 2021 17:47:07 -0800
* gnu/packages/gnupg.scm (pinentry-rofi): New variable.
---
 gnu/packages/gnupg.scm | 73 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 3620efea3a..c2ebefc203 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2018, 2019 Marius Bakke <mbakke <at> fastmail.com>
 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe <at> gmail.com>
+;;; Copyright © 2020 Fredrik Salomonsson <plattfot <at> posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -67,6 +68,7 @@
   #:use-module (gnu packages tor)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -892,6 +894,77 @@ passphrase when @code{gpg} is run and needs it.")))
 @dfn{Enlightenment Foundation Libraries} (EFL) that allows users to enter a
 passphrase when @code{gpg} is run and needs it.")))
 
+(define-public pinentry-rofi
+  (package
+    (name "pinentry-rofi")
+    (version "2.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/plattfot/pinentry-rofi/")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "044bnldz7k74s873jwsjgff176l1jsvpbaka7d1wcj8b5pwqv2av"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules
+       ((ice-9 match)
+        (ice-9 ftw)
+        ,@%gnu-build-system-modules)
+       #:phases
+       (modify-phases
+           %standard-phases
+         (add-after 'install 'hall-wrap-binaries
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((compiled-dir
+                     (lambda (out version)
+                       (string-append out "/lib/guile/" version "/site-ccache")))
+                    (uncompiled-dir
+                     (lambda (out version)
+                       (string-append
+                        out
+                        "/share/guile/site"
+                        (if (string-null? version) "" "/")
+                        version)))
+                    (dep-path
+                     (lambda (env path)
+                       (list env ":" 'prefix (list path))))
+                    (out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin/"))
+                    (site (uncompiled-dir out "")))
+               (match (scandir site)
+                 (("." ".." version)
+                  (for-each
+                   (lambda (file)
+                     (wrap-program
+                         (string-append bin file)
+                       (dep-path
+                        "PATH"
+                        (string-append (assoc-ref inputs "rofi") "/bin"))
+                       (dep-path
+                        "GUILE_LOAD_PATH"
+                        (uncompiled-dir out version))
+                       (dep-path
+                        "GUILE_LOAD_COMPILED_PATH"
+                        (compiled-dir out version))))
+                   ,''("pinentry-rofi"))
+                  #t))))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("pkg-config" ,pkg-config)
+       ("texinfo" ,texinfo)))
+    (inputs `(("guile" ,guile-3.0)
+              ("rofi" ,rofi)))
+    (synopsis "Rofi GUI for GnuPG's passphrase input")
+    (description "Pinentry-rofi is a simple graphical user interface for
+passphrase or PIN when required by @code{gpg} or other software.  It is using
+the Rofi application launcher as the user interface.  Which makes it combined
+with @code{rofi-pass} a good front end for @code{password-store}.")
+    (home-page "https://github.com/plattfot/pinentry-rofi/")
+    (license license:gpl3+)))
+
 (define-public pinentry
   (package (inherit pinentry-gtk2)
     (name "pinentry")))
-- 
2.29.2





Information forwarded to guix-patches <at> gnu.org:
bug#45190; Package guix-patches. (Sat, 09 Jan 2021 02:15:01 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 45190 <at> debbugs.gnu.org
Subject: Re: [bug#45190] [PATCH 1/1] gnu: Add pinentry-rofi.
Date: Fri, 08 Jan 2021 18:14:01 -0800
Hi Ludovic,

Ludovic Courtès <ludo <at> gnu.org> writes:

>> +(define-public pinentry-rofi
>> +  (package
>> +  (name "pinentry-rofi")
>
> Indentation is off here (should be offset by two).

Fixed in v2.

>> +  (arguments
>> +    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing
>
> Hmm the ‘strip’ phase should not fail.  Are you sure this is necessary?

It was failing with a warning as there are no binaries to strip. But
it's not an error so I removed this in v2.

>> +      #:phases
>> +      (modify-phases
>> +        %standard-phases
>> +        (add-after
>> +          'install
>> +          'hall-wrap-binaries
>
> Nitpick: please indent as in other files.

Fixed in v2.

> Since I think you’re also upstream :-), how about adding something like
> that at the top of the installed executable:
>
>   (eval-when (load expand eval)
>     (set! %load-path (cons "@moddir@" %load-path))
>     (set! %laod-compiled-path (cons "@godir@" %load-compiled-path)))
>
> ?

Yup, I'm upstream as well. I don't mind adding that, just need to know
what it solves :). I'm guessing that it removes the need to wrap the
executable, is that correct?

And are the "@moddir@" and "@godir@" expected to be expanded by
automake? I tested to just add it in the source code and automake did
nothing with them.

For now I left it out in v2 as I'm a bit unsure of it.

>> +  (propagated-inputs `(("rofi" ,rofi)))

> It’s best to avoid propagating.  Perhaps you can replace the “rofi”
> string in ‘pinentry-rofi’ by “/gnu/store/…/bin/rofi” in a post-install
> phase?

Is there a rule of thumb or something to know when to use propagating
inputs? I'm a bit confused when to use is it. Is it just when dealing
with libraries? What are the downsides of using propagating inputs?
Apologize if this is already mentioned in the manual. Only sections I
could find that mentions propagated inputs are section 5.2 and 8.2.1.

Anyway this is fixed in v2, I added the rofi's binary path to PATH for
the wrapper of pinentry-rofi. 

>> +  (synopsis "Rofi GUI for GnuPG's passphrase input")
>> +  (description "Simple pinentry GUI using rofi that allows users to enter a
>> +passphrase when required by @code{gpg} or other software.")
>
> Please make it a full sentence.  Also, to give context, perhaps replace
> “rofi” by “the Rofi application launcher”.

I fleshed out the description in v2, let me know if it sounds better.

> Could you send an updated patch?

All updates should be in PATCH v2

> Thanks in advance and sorry for the delay!

Thank you for reviewing my patch and no worries about the delay.

-- 
s/Fred[re]+i[ck]+/Fredrik/g




Information forwarded to guix-patches <at> gnu.org:
bug#45190; Package guix-patches. (Wed, 13 Jan 2021 15:26:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Fredrik Salomonsson <plattfot <at> posteo.net>
Cc: 45190 <at> debbugs.gnu.org
Subject: Re: bug#45190: [PATCH 0/1] Add pinentry-rofi
Date: Wed, 13 Jan 2021 16:24:56 +0100
Hi,

Fredrik Salomonsson <plattfot <at> posteo.net> skribis:

>>> +  (arguments
>>> +    `(#:strip-binaries? #f ;; Has no binaries and the strip phase is failing
>>
>> Hmm the ‘strip’ phase should not fail.  Are you sure this is necessary?
>
> It was failing with a warning as there are no binaries to strip. But
> it's not an error so I removed this in v2.

Right, it’s just a warning, due to the fact that .go files are ELF but
the ‘strip’ command doesn’t know what to do with them.

>> Since I think you’re also upstream :-), how about adding something like
>> that at the top of the installed executable:
>>
>>   (eval-when (load expand eval)
>>     (set! %load-path (cons "@moddir@" %load-path))
>>     (set! %laod-compiled-path (cons "@godir@" %load-compiled-path)))
>>
>> ?
>
> Yup, I'm upstream as well. I don't mind adding that, just need to know
> what it solves :). I'm guessing that it removes the need to wrap the
> executable, is that correct?
>
> And are the "@moddir@" and "@godir@" expected to be expanded by
> automake? I tested to just add it in the source code and automake did
> nothing with them.

It’s replaced provided ‘configure.ac’ defines them and AC_SUBSTs them,
along these lines (here they have a longer name):

  https://notabug.org/guile-zstd/guile-zstd/src/master/configure.ac#L43

>> It’s best to avoid propagating.  Perhaps you can replace the “rofi”
>> string in ‘pinentry-rofi’ by “/gnu/store/…/bin/rofi” in a post-install
>> phase?
>
> Is there a rule of thumb or something to know when to use propagating
> inputs? I'm a bit confused when to use is it. Is it just when dealing
> with libraries? What are the downsides of using propagating inputs?
> Apologize if this is already mentioned in the manual. Only sections I
> could find that mentions propagated inputs are section 5.2 and 8.2.1.

In general, propagated inputs should be avoided as they “pollute” the
user’s profile (you install X and find yourself with X, Y, and Z).

The preferred method in situations like this is to patch the source so
it uses absolute file names for commands.

Thanks for sending an updated patch!

Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 13 Jan 2021 15:27:02 GMT) Full text and rfc822 format available.

Notification sent to Fredrik Salomonsson <plattfot <at> posteo.net>:
bug acknowledged by developer. (Wed, 13 Jan 2021 15:27:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Fredrik Salomonsson <plattfot <at> posteo.net>
Cc: 45190-done <at> debbugs.gnu.org
Subject: Re: bug#45190: [PATCH 0/1] Add pinentry-rofi
Date: Wed, 13 Jan 2021 16:26:22 +0100
Fredrik Salomonsson <plattfot <at> posteo.net> skribis:

> * gnu/packages/gnupg.scm (pinentry-rofi): New variable.

Applied, thanks!

> +               (match (scandir site)
> +                 (("." ".." version)
> +                  (for-each
> +                   (lambda (file)
> +                     (wrap-program
> +                         (string-append bin file)
> +                       (dep-path
> +                        "PATH"
> +                        (string-append (assoc-ref inputs "rofi") "/bin"))
> +                       (dep-path
> +                        "GUILE_LOAD_PATH"
> +                        (uncompiled-dir out version))
> +                       (dep-path
> +                        "GUILE_LOAD_COMPILED_PATH"
> +                        (compiled-dir out version))))
> +                   ,''("pinentry-rofi"))

As I wrote, it’ll be nicer when this is handled upstream, but we can
adjust it on the next release.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Feb 2021 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 181 days ago.

Previous Next


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