all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Checksum error on manual package install
@ 2019-07-02 11:08 Lorem Ipsum
  2019-07-02 19:31 ` Julien Lepiller
  2019-07-02 19:47 ` Leo Famulari
  0 siblings, 2 replies; 5+ messages in thread
From: Lorem Ipsum @ 2019-07-02 11:08 UTC (permalink / raw)
  To: help-guix

Hi,

I am trying to install a non-packaged piece of software, [[
https://nomacs.org/][nomacs]].  It
seems that through the paradigm of Guix, this is to be done with ~guix
package~ rather than with ~make~ etc.  Or, put differently, to install
an application which is not in the package repos, I need to package it
myself.  Am I correct in my understanding?

I have read through "[[
https://www.gnu.org/software/guix/manual/en/html_node/Defining-Packages.html][Section
6.2 Defining Packages]]", as well as the
blog post "[[
https://www.gnu.org/software/guix/blog/2018/a-packaging-tutorial-for-guix/][A
packaging tutorial for Guix]]", and followed along at home.
I was successful in packaging and installing "my-hello.scm".  It seems
to me that packaging ~nomacs~ should be as simple as replacing the
relevant pieces within the "my-hello.scm" template.

#+begin_src scheme :file my-nomacs.scm
(use-modules (guix packages)
         (guix download)
         (guix build-system gnu)
         (guix licenses))

(package
   (name "nomacs")
   (version "3.12")
   (source (origin
        (method url-fetch)
        (uri (string-append "https://github.com/nomacs/nomacs/archive/"
version
                ".tar.gz"))
        (sha256
         (base32

"f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff"))))
   (build-system gnu-build-system)
   (synopsis "Open source image viewer")
   (description
    "nomacs is a free, open source image viewer, which supports
multiple platforms. You can use it for viewing all common image
formats including RAW and psd images.")
   (home-page "https://nomacs.org")
   (license gpl3+))
#+end_src

However, when I try to install, I get an error about invalid base32:
#+begin_src sh
$ guix package --install-from-file=my-nomacs.scm

guix package: error: exception thrown: #<condition
&invalid-base32-character [character: #\e string:
"f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff"]
23ee2a0>
#+end_src

Here is how I obtained that hash:
#+begin_src sh
$ wget https://github.com/nomacs/nomacs/archive/3.12.tar.gz
--2019-07-02 06:36:39--
https://github.com/nomacs/nomacs/archive/3.12.tar.gz
Resolving github.com (github.com)... 192.30.253.112
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/nomacs/nomacs/tar.gz/3.12 [following]
--2019-07-02 06:36:40--
https://codeload.github.com/nomacs/nomacs/tar.gz/3.12
Resolving codeload.github.com (codeload.github.com)... 140.82.113.9
Connecting to codeload.github.com (codeload.github.com)|140.82.113.9|:443...
connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘3.12.tar.gz.1’

3.12.tar.gz.1           [    <=>             ]   1.66M  2.54MB/s    in 0.7s

2019-07-02 06:36:41 (2.54 MB/s) - ‘3.12.tar.gz.1’ saved [1736648]

$ sha256sum 3.12.tar.gz
f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff
3.12.tar.gz
#+end_src

This is where I'm stuck.  I know that the hash needs to be base32 and
that the hash returned by ~sha256sum~ is not that.  I would think this
wouldn't matter since the Guile script calls ~base32~.

I'm unsure how to proceed.  Any advice would be appreciated!

Thank you,
Matt

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

* Re: Checksum error on manual package install
  2019-07-02 11:08 Checksum error on manual package install Lorem Ipsum
@ 2019-07-02 19:31 ` Julien Lepiller
  2019-07-03  2:31   ` ison
  2019-07-02 19:47 ` Leo Famulari
  1 sibling, 1 reply; 5+ messages in thread
From: Julien Lepiller @ 2019-07-02 19:31 UTC (permalink / raw)
  To: help-guix, Lorem Ipsum

Le 2 juillet 2019 13:08:01 GMT+02:00, Lorem Ipsum <dolorsitatem@gmail.com> a écrit :
>Hi,
>
>I am trying to install a non-packaged piece of software, [[
>https://nomacs.org/][nomacs]].  It
>seems that through the paradigm of Guix, this is to be done with ~guix
>package~ rather than with ~make~ etc.  Or, put differently, to install
>an application which is not in the package repos, I need to package it
>myself.  Am I correct in my understanding?
>
>I have read through "[[
>https://www.gnu.org/software/guix/manual/en/html_node/Defining-Packages.html][Section
>6.2 Defining Packages]]", as well as the
>blog post "[[
>https://www.gnu.org/software/guix/blog/2018/a-packaging-tutorial-for-guix/][A
>packaging tutorial for Guix]]", and followed along at home.
>I was successful in packaging and installing "my-hello.scm".  It seems
>to me that packaging ~nomacs~ should be as simple as replacing the
>relevant pieces within the "my-hello.scm" template.
>
>#+begin_src scheme :file my-nomacs.scm
>(use-modules (guix packages)
>         (guix download)
>         (guix build-system gnu)
>         (guix licenses))
>
>(package
>   (name "nomacs")
>   (version "3.12")
>   (source (origin
>        (method url-fetch)
>        (uri (string-append "https://github.com/nomacs/nomacs/archive/"
>version
>                ".tar.gz"))
>        (sha256
>         (base32
>
>"f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff"))))
>   (build-system gnu-build-system)
>   (synopsis "Open source image viewer")
>   (description
>    "nomacs is a free, open source image viewer, which supports
>multiple platforms. You can use it for viewing all common image
>formats including RAW and psd images.")
>   (home-page "https://nomacs.org")
>   (license gpl3+))
>#+end_src
>
>However, when I try to install, I get an error about invalid base32:
>#+begin_src sh
>$ guix package --install-from-file=my-nomacs.scm
>
>guix package: error: exception thrown: #<condition
>&invalid-base32-character [character: #\e string:
>"f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff"]
>23ee2a0>
>#+end_src
>
>Here is how I obtained that hash:
>#+begin_src sh
>$ wget https://github.com/nomacs/nomacs/archive/3.12.tar.gz
>--2019-07-02 06:36:39--
>https://github.com/nomacs/nomacs/archive/3.12.tar.gz
>Resolving github.com (github.com)... 192.30.253.112
>Connecting to github.com (github.com)|192.30.253.112|:443... connected.
>HTTP request sent, awaiting response... 302 Found
>Location: https://codeload.github.com/nomacs/nomacs/tar.gz/3.12
>[following]
>--2019-07-02 06:36:40--
>https://codeload.github.com/nomacs/nomacs/tar.gz/3.12
>Resolving codeload.github.com (codeload.github.com)... 140.82.113.9
>Connecting to codeload.github.com
>(codeload.github.com)|140.82.113.9|:443...
>connected.
>HTTP request sent, awaiting response... 200 OK
>Length: unspecified [application/x-gzip]
>Saving to: ‘3.12.tar.gz.1’
>
>3.12.tar.gz.1           [    <=>             ]   1.66M  2.54MB/s    in
>0.7s
>
>2019-07-02 06:36:41 (2.54 MB/s) - ‘3.12.tar.gz.1’ saved [1736648]
>
>$ sha256sum 3.12.tar.gz
>f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff
>3.12.tar.gz
>#+end_src
>
>This is where I'm stuck.  I know that the hash needs to be base32 and
>that the hash returned by ~sha256sum~ is not that.  I would think this
>wouldn't matter since the Guile script calls ~base32~.
>
>I'm unsure how to proceed.  Any advice would be appreciated!
>
>Thank you,
>Matt

Hi,

Nice work! You should use guix download to get the right hash, like so: "guix download 3.12.tar.gz". You can also put the hash of another package, see it fail and it will give you the hash it got instead.

There are other good practices you didn't follow, but they are not required to get your package to work: github tarballs are auto-generated and can change from time to time, so it's best to use git-fetch instead, since it will always give you the same content. You should also use (file-name …) so the store item for the source gets a meaningful name. There are already a lot of examples of that in guix sources.

Good luck for your packaging effort!

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

* Re: Checksum error on manual package install
  2019-07-02 11:08 Checksum error on manual package install Lorem Ipsum
  2019-07-02 19:31 ` Julien Lepiller
@ 2019-07-02 19:47 ` Leo Famulari
       [not found]   ` <CAHa1oyBC5X3A+S95W39q47PpU03kDj4K9E3m13eRY9t4y4WfJw@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Leo Famulari @ 2019-07-02 19:47 UTC (permalink / raw)
  To: Lorem Ipsum; +Cc: help-guix

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

On Tue, Jul 02, 2019 at 11:08:01AM +0000, Lorem Ipsum wrote:
> $ sha256sum 3.12.tar.gz
> f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff
> 
> This is where I'm stuck.  I know that the hash needs to be base32 and
> that the hash returned by ~sha256sum~ is not that.  I would think this
> wouldn't matter since the Guile script calls ~base32~.

The hash needs to be calculated with `guix hash`, not `sha256sum`. For
example, `guix hash 3.12.tar.gz`.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Fwd: Checksum error on manual package install
       [not found]   ` <CAHa1oyBC5X3A+S95W39q47PpU03kDj4K9E3m13eRY9t4y4WfJw@mail.gmail.com>
@ 2019-07-02 20:45     ` Lorem Ipsum
  0 siblings, 0 replies; 5+ messages in thread
From: Lorem Ipsum @ 2019-07-02 20:45 UTC (permalink / raw)
  To: help-guix

---------- Forwarded message ---------
From: Lorem Ipsum <dolorsitatem@gmail.com>
Date: Tue, Jul 2, 2019 at 4:44 PM
Subject: Re: Checksum error on manual package install
To: Leo Famulari <leo@famulari.name>


That works and I see where I missed it in the docs.  Thank you!

On Tue, Jul 2, 2019 at 3:47 PM Leo Famulari <leo@famulari.name> wrote:

> On Tue, Jul 02, 2019 at 11:08:01AM +0000, Lorem Ipsum wrote:
> > $ sha256sum 3.12.tar.gz
> > f4a32169e6c0cb939971da2732e4d67c6e2e649506da1b55bfc94963a26280ff
> >
> > This is where I'm stuck.  I know that the hash needs to be base32 and
> > that the hash returned by ~sha256sum~ is not that.  I would think this
> > wouldn't matter since the Guile script calls ~base32~.
>
> The hash needs to be calculated with `guix hash`, not `sha256sum`. For
> example, `guix hash 3.12.tar.gz`.
>

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

* Re: Checksum error on manual package install
  2019-07-02 19:31 ` Julien Lepiller
@ 2019-07-03  2:31   ` ison
  0 siblings, 0 replies; 5+ messages in thread
From: ison @ 2019-07-03  2:31 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: help-guix

On Tue, Jul 02, 2019 at 09:31:22PM +0200, Julien Lepiller wrote:
> Nice work! You should use guix download to get the right hash, like so: "guix download 3.12.tar.gz". You can also put the hash of another package, see it fail and it will give you the hash it got instead.

Additionally you can pass the URL directly to "guix download" so you don't have to worry about saving it to disk first or deleting it later.

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

end of thread, other threads:[~2019-07-03  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02 11:08 Checksum error on manual package install Lorem Ipsum
2019-07-02 19:31 ` Julien Lepiller
2019-07-03  2:31   ` ison
2019-07-02 19:47 ` Leo Famulari
     [not found]   ` <CAHa1oyBC5X3A+S95W39q47PpU03kDj4K9E3m13eRY9t4y4WfJw@mail.gmail.com>
2019-07-02 20:45     ` Fwd: " Lorem Ipsum

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.