unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Packaging "single file"
@ 2019-11-04 15:04 Tanguy Le Carrour
  2019-11-04 22:37 ` Jack Hill
  0 siblings, 1 reply; 6+ messages in thread
From: Tanguy Le Carrour @ 2019-11-04 15:04 UTC (permalink / raw)
  To: Guix

Hi Guix!

I intended to ask this question later, but now that ungoogled-chromium
has been superseded by icecat, I find myself stuck!

Is it possible to package a single file? The "file" being a bash script or
a binary. Is there a package definition I can look into for an example?

I would do this for:

- A simple script, for instance `rofi-pass` (https://github.com/carnager/rofi-pass).
  It is "just" a bash script but has some dependencies that need to be installed.
  I could also clone the git repo and move the file I guess…

- A pre-build binary, for instance for `fd` (https://github.com/sharkdp/fd)
  or `geckodriver` (https://firefox-source-docs.mozilla.org/testing/geckodriver).

  * I haven't had time (yet) to package `fd` properly, but a binary is
    available for download, so it's tempting to use it. But for a reason I
    don't understand, it doesn't work on Guix System! :-(

  * I use `geckodriver` with Selenium [1] to run user interface tests. I used to
    work with the Firefox driver, but it's not packaged in Guix, so I was relying
    on chromium/chrome-driver for my tests. But I can no longer count on this!
    I haven't tried yet, but compiling this from source seems to require "a bit"
    of work. Up to now, I've always downloaded the binary [2].
    But, I guess for the same reason as for `fd`, the binary does not work
    on Guix System.

    [1]: https://docs.seleniumhq.org
    [2]: https://github.com/mozilla/geckodriver/releases

  It might be a complete misunderstanging on my part, but isn't one of the phases
  of the packaging in charge of "fixing" the binaries to work on Guix system?

Hope my question makes sense and someone can point me in the right
direction!

-- 
Tanguy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging "single file"
  2019-11-04 15:04 Packaging "single file" Tanguy Le Carrour
@ 2019-11-04 22:37 ` Jack Hill
  2019-11-05 13:04   ` Tanguy Le Carrour
  0 siblings, 1 reply; 6+ messages in thread
From: Jack Hill @ 2019-11-04 22:37 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: Guix

On Mon, 4 Nov 2019, Tanguy Le Carrour wrote:

> Hi Guix!
>
> I intended to ask this question later, but now that ungoogled-chromium
> has been superseded by icecat, I find myself stuck!
>
> Is it possible to package a single file? The "file" being a bash script or
> a binary. Is there a package definition I can look into for an example?

I've had a need to package a bash wrapper around scp, and the module with 
it is below. It it, I use the trivial-build-system, and replaced 
occurrences of commands the script calls with full store paths.

Does this help? Where are you getting stuck?

Best,
Jack

(define-module (guix-at-duke packages utils)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages ssh)
   #:use-module (guix build-system trivial)
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages))

(define-public duo-scp
   (package
    (name "duo-scp")
    (version "0")
    (source
     (origin
      (method url-fetch)
      (uri "https://gitlab.oit.duke.edu/snippets/82/raw")
      (sha256
       (base32 "1mrf5451cj8010iq76866dli1hxa31rk8i993arf9dfyzws26v2b"))
      (file-name name)))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
 	(use-modules (guix build utils))
 	(let ((source (assoc-ref %build-inputs "source"))
 	      (ssh (assoc-ref %build-inputs "openssh"))
 	      (bash (assoc-ref %build-inputs "bash"))
 	      (script "duo-scp")
 	      (out (assoc-ref %outputs "out")))
 	  (copy-file source script)
 	  (substitute* script
 		       (("/bin/bash") (string-append bash "/bin/bash"))
 		       (("scp") (string-append ssh "/bin/scp")))
 	  (chmod script #o555)
 	  (install-file script (string-append out "/bin"))))))
    (inputs
     `(("bash" ,bash)
       ("openssh" ,openssh)))
    (home-page "https://gitlab.oit.duke.edu/snippets/82/raw")
    (synopsis "User Duo Passcode with scp and login_duo")
    (description "Wrapper script for scp that prompts for a passcode
before calling scp.  This allows the user to supply a passcode from e.g. a Yubikey
to avoid getting a Duo push or phone call when talking to an ssh server that uses
the login_duo script for multifactor.")
    (license license:cc0)))

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging "single file"
  2019-11-04 22:37 ` Jack Hill
@ 2019-11-05 13:04   ` Tanguy Le Carrour
  2019-11-05 15:31     ` Jack Hill
  2019-11-06  8:12     ` Make geckodriver part of Icecat package [Was: Packaging "single file"] Tanguy Le Carrour
  0 siblings, 2 replies; 6+ messages in thread
From: Tanguy Le Carrour @ 2019-11-05 13:04 UTC (permalink / raw)
  To: Jack Hill; +Cc: Guix

Hi Jack!


Le 11/04, Jack Hill a écrit :
> On Mon, 4 Nov 2019, Tanguy Le Carrour wrote:
> > I intended to ask this question later, but now that ungoogled-chromium
> > has been superseded by icecat, I find myself stuck!
> > 
> > Is it possible to package a single file? The "file" being a bash script or
> > a binary. Is there a package definition I can look into for an example?
> 
> I've had a need to package a bash wrapper around scp, and the module with it
> is below. It it, I use the trivial-build-system, and replaced occurrences of
> commands the script calls with full store paths.
> 
> Does this help?

It's a perfect example! Thanks! I'll do the same for rofi-pass!


> Where are you getting stuck?

I'm stuck with my UI tests! :-(

I was relying on `chromedriver` (packaged with ungoogled-chromium), but now
that it's been deprecated… I'm stuck! ^_^'

`geckodriver` is not packaged with icecat. This is why I wanted to a)
download it or b) package it.

The problem is that a) the version I download does not work (a problem
specific to Guix System, I guess, that would be solved by packaging…
another wild guess) and b) it's a bit of work to package.

But, all of sudden, I wonder if `geckodriver` could not be part of
icecat, like `chromedriver` was part of ungoogled-chromium?!
 

> (define-module (guix-at-duke packages utils)
>   #:use-module (gnu packages bash)
>   #:use-module (gnu packages ssh)
>   #:use-module (guix build-system trivial)
>   #:use-module (guix download)
>   #:use-module ((guix licenses) #:prefix license:)
>   #:use-module (guix packages))
> 
> (define-public duo-scp
>   (package
>    (name "duo-scp")
>    (version "0")
>    (source
>     (origin
>      (method url-fetch)
>      (uri "https://gitlab.oit.duke.edu/snippets/82/raw")
>      (sha256
>       (base32 "1mrf5451cj8010iq76866dli1hxa31rk8i993arf9dfyzws26v2b"))
>      (file-name name)))
>    (build-system trivial-build-system)
>    (arguments
>     `(#:modules ((guix build utils))
>       #:builder
>       (begin
> 	(use-modules (guix build utils))
> 	(let ((source (assoc-ref %build-inputs "source"))
> 	      (ssh (assoc-ref %build-inputs "openssh"))
> 	      (bash (assoc-ref %build-inputs "bash"))
> 	      (script "duo-scp")
> 	      (out (assoc-ref %outputs "out")))
> 	  (copy-file source script)
> 	  (substitute* script
> 		       (("/bin/bash") (string-append bash "/bin/bash"))
> 		       (("scp") (string-append ssh "/bin/scp")))
> 	  (chmod script #o555)
> 	  (install-file script (string-append out "/bin"))))))
>    (inputs
>     `(("bash" ,bash)
>       ("openssh" ,openssh)))
>    (home-page "https://gitlab.oit.duke.edu/snippets/82/raw")
>    (synopsis "User Duo Passcode with scp and login_duo")
>    (description "Wrapper script for scp that prompts for a passcode
> before calling scp.  This allows the user to supply a passcode from e.g. a Yubikey
> to avoid getting a Duo push or phone call when talking to an ssh server that uses
> the login_duo script for multifactor.")
>    (license license:cc0)))


Thanks again for the snippet!

-- 
Tanguy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Packaging "single file"
  2019-11-05 13:04   ` Tanguy Le Carrour
@ 2019-11-05 15:31     ` Jack Hill
  2019-11-06  8:12     ` Make geckodriver part of Icecat package [Was: Packaging "single file"] Tanguy Le Carrour
  1 sibling, 0 replies; 6+ messages in thread
From: Jack Hill @ 2019-11-05 15:31 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: Guix

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

On Tue, 5 Nov 2019, Tanguy Le Carrour wrote:

> Le 11/04, Jack Hill a écrit :
>>
>> Does this help?
>
> It's a perfect example! Thanks! I'll do the same for rofi-pass!

Yay, you're welcome. Unfortunatly, I don't have the experience with web 
testing to be helpful there.

Best,
Jack

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Make geckodriver part of Icecat package [Was: Packaging "single file"]
  2019-11-05 13:04   ` Tanguy Le Carrour
  2019-11-05 15:31     ` Jack Hill
@ 2019-11-06  8:12     ` Tanguy Le Carrour
  2019-11-13  8:16       ` Tanguy Le Carrour
  1 sibling, 1 reply; 6+ messages in thread
From: Tanguy Le Carrour @ 2019-11-06  8:12 UTC (permalink / raw)
  To: Guix

Hi Guix,

As Jack answered my first question, I've changed the topic and rephrased
my questions for clarity.


Le 11/05, Tanguy Le Carrour a écrit :
> Le 11/04, Jack Hill a écrit :
> > On Mon, 4 Nov 2019, Tanguy Le Carrour wrote:
> > > I intended to ask this question later, but now that ungoogled-chromium
> > > has been superseded by icecat, I find myself stuck!
> > […]
> > Where are you getting stuck?
> 
> I'm stuck with my UI tests! :-(
> 
> I was relying on `chromedriver` (packaged with ungoogled-chromium), but now
> that it's been deprecated… I'm stuck! ^_^'
> 
> `geckodriver` is not packaged with icecat. This is why I wanted to a)
> download it or b) package it.
> 
> The problem is that a) the version I download does not work (a problem
> specific to Guix System, I guess, that would be solved by packaging…
> another wild guess) and b) it's a bit of work to package.
> 
> But, all of sudden, I wonder if `geckodriver` could not be part of
> icecat, like `chromedriver` was part of ungoogled-chromium?!

1) could geckodriver be built and distributed with icecat? or
2) should I work on packaging it? or
3) is there a way to package the pre-built binary?

Regards,

-- 
Tanguy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Make geckodriver part of Icecat package [Was: Packaging "single file"]
  2019-11-06  8:12     ` Make geckodriver part of Icecat package [Was: Packaging "single file"] Tanguy Le Carrour
@ 2019-11-13  8:16       ` Tanguy Le Carrour
  0 siblings, 0 replies; 6+ messages in thread
From: Tanguy Le Carrour @ 2019-11-13  8:16 UTC (permalink / raw)
  To: Guix

Hi Guix,

Le 11/06, Tanguy Le Carrour a écrit :
> Le 11/05, Tanguy Le Carrour a écrit :
> > But, all of sudden, I wonder if `geckodriver` could not be part of
> > icecat, like `chromedriver` was part of ungoogled-chromium?!
> 
> 1) could geckodriver be built and distributed with icecat? or
> 2) should I work on packaging it? or
> 3) is there a way to package the pre-built binary?

Sorry to see that I'm the only one having the problem! :-(

Anyhow, thanks to the discussion about profiles, I found a solution!
Actually, a workaround: go back in time where `ungoogled-chromium` was
available and install it in a dedicated profile! Profiles are very handy, indeed! :-)

If the discussion around icecat/geckodriver comes up again in a near (or
distant) future, I'd still be very much interested!

Regards,

-- 
Tanguy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-13  8:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 15:04 Packaging "single file" Tanguy Le Carrour
2019-11-04 22:37 ` Jack Hill
2019-11-05 13:04   ` Tanguy Le Carrour
2019-11-05 15:31     ` Jack Hill
2019-11-06  8:12     ` Make geckodriver part of Icecat package [Was: Packaging "single file"] Tanguy Le Carrour
2019-11-13  8:16       ` Tanguy Le Carrour

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).