unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* calculate hashes for a new packages
@ 2021-03-10 19:14 Zelphir Kaltstahl
  2021-03-10 19:21 ` Leo Famulari
  2021-03-10 21:11 ` divoplade
  0 siblings, 2 replies; 8+ messages in thread
From: Zelphir Kaltstahl @ 2021-03-10 19:14 UTC (permalink / raw)
  To: help-guix

Hello Guix Users!

How does one calculate the hash for a package one wants to add to GNU Guix?

I know 2 ways, giving me different results. One is for the repository folder and
one is for the tarball:

~~~~
guix hash --exclude-vcs --recursive .
guix hash PACKAGE-VERSION-tar.gz  # a tarball created by guile-hall
~~~~

Which one is the one I should be using for the source -> origin -> sha256 ->
base32 value in a GNU Guix package definition?

Regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl


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

* Re: calculate hashes for a new packages
  2021-03-10 19:14 calculate hashes for a new packages Zelphir Kaltstahl
@ 2021-03-10 19:21 ` Leo Famulari
  2021-03-10 20:19   ` zimoun
  2021-03-10 20:22   ` Zelphir Kaltstahl
  2021-03-10 21:11 ` divoplade
  1 sibling, 2 replies; 8+ messages in thread
From: Leo Famulari @ 2021-03-10 19:21 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: help-guix

On Wed, Mar 10, 2021 at 08:14:43PM +0100, Zelphir Kaltstahl wrote:
> How does one calculate the hash for a package one wants to add to GNU Guix?
> 
> I know 2 ways, giving me different results. One is for the repository folder and
> one is for the tarball:
> 
> ~~~~
> guix hash --exclude-vcs --recursive .
> guix hash PACKAGE-VERSION-tar.gz  # a tarball created by guile-hall

Can you clarify your question?

It seems to me that you already know the answer: You use the method that
is appropriate for your package. It depends on what kind of source code
your packages uses.


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

* Re: calculate hashes for a new packages
  2021-03-10 19:21 ` Leo Famulari
@ 2021-03-10 20:19   ` zimoun
  2021-03-10 21:00     ` Zelphir Kaltstahl
  2021-03-10 20:22   ` Zelphir Kaltstahl
  1 sibling, 1 reply; 8+ messages in thread
From: zimoun @ 2021-03-10 20:19 UTC (permalink / raw)
  To: Leo Famulari, Zelphir Kaltstahl; +Cc: help-guix

On Wed, 10 Mar 2021 at 14:21, Leo Famulari <leo@famulari.name> wrote:
> On Wed, Mar 10, 2021 at 08:14:43PM +0100, Zelphir Kaltstahl wrote:
>> How does one calculate the hash for a package one wants to add to GNU Guix?
>> 
>> I know 2 ways, giving me different results. One is for the repository folder and
>> one is for the tarball:
>> 
>> ~~~~
>> guix hash --exclude-vcs --recursive .
>> guix hash PACKAGE-VERSION-tar.gz  # a tarball created by guile-hall
>
> Can you clarify your question?
>
> It seems to me that you already know the answer: You use the method that
> is appropriate for your package. It depends on what kind of source code
> your packages uses.

Concretely, url-fetch

   guix hash PACKAGE-VERSION-tar.gz

or git-fetch (or other vcs):

   guix hash .


Maybe the question could be clarified. :-)


Cheers,
simon


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

* Re: calculate hashes for a new packages
  2021-03-10 19:21 ` Leo Famulari
  2021-03-10 20:19   ` zimoun
@ 2021-03-10 20:22   ` Zelphir Kaltstahl
  1 sibling, 0 replies; 8+ messages in thread
From: Zelphir Kaltstahl @ 2021-03-10 20:22 UTC (permalink / raw)
  To: Leo Famulari; +Cc: help-guix

Hi Leo!

On 3/10/21 8:21 PM, Leo Famulari wrote:
> On Wed, Mar 10, 2021 at 08:14:43PM +0100, Zelphir Kaltstahl wrote:
>> How does one calculate the hash for a package one wants to add to GNU Guix?
>>
>> I know 2 ways, giving me different results. One is for the repository folder and
>> one is for the tarball:
>>
>> ~~~~
>> guix hash --exclude-vcs --recursive .
>> guix hash PACKAGE-VERSION-tar.gz  # a tarball created by guile-hall
> Can you clarify your question?
>
> It seems to me that you already know the answer: You use the method that
> is appropriate for your package. It depends on what kind of source code
> your packages uses.

I have a GNU Guile package, which I created using guile-hall.

I know the 2 commands, but maybe there are others?

I don't know which one of the 2 results (they differ) from the 2 commands one
should write in ones package definition to add to guix/gnu/packages/guile.scm. I
can paste any hash there, but which one will be the correct one? Both commands
seem appropriate to me. The tarball is after all built from the sources in the
directory and I could calculate the hash of the directory, or the one of the
tarball. That is what confuses me.

Basically I am asking for a general guideline. How is it usually done? How is it
done for packages created using guile-hall?

I don't want to send in a patch with a wrong hash in the package definition,
which only costs time for anyone, who reviews.

Regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl



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

* Re: calculate hashes for a new packages
  2021-03-10 20:19   ` zimoun
@ 2021-03-10 21:00     ` Zelphir Kaltstahl
  2021-03-10 21:47       ` zimoun
  2021-03-19 13:09       ` Joshua Branson
  0 siblings, 2 replies; 8+ messages in thread
From: Zelphir Kaltstahl @ 2021-03-10 21:00 UTC (permalink / raw)
  To: zimoun, Leo Famulari; +Cc: help-guix

Hello Zimoun!

On 3/10/21 9:19 PM, zimoun wrote:
> On Wed, 10 Mar 2021 at 14:21, Leo Famulari <leo@famulari.name> wrote:
>> On Wed, Mar 10, 2021 at 08:14:43PM +0100, Zelphir Kaltstahl wrote:
>>> How does one calculate the hash for a package one wants to add to GNU Guix?
>>>
>>> I know 2 ways, giving me different results. One is for the repository folder and
>>> one is for the tarball:
>>>
>>> ~~~~
>>> guix hash --exclude-vcs --recursive .
>>> guix hash PACKAGE-VERSION-tar.gz  # a tarball created by guile-hall
>> Can you clarify your question?
>>
>> It seems to me that you already know the answer: You use the method that
>> is appropriate for your package. It depends on what kind of source code
>> your packages uses.
> Concretely, url-fetch
>
>    guix hash PACKAGE-VERSION-tar.gz
>
> or git-fetch (or other vcs):
>
>    guix hash .
>
>
> Maybe the question could be clarified. :-)
>
>
> Cheers,
> simon

Ah, I think I get it now:

If I for example created a tag for the version of my package and creation of the
tag caused the VCS host to create a tarball as release, I could go the url-fetch
way and then I would use `guix hash` on the tarball, which is the release
tarball, but if there is no release tarball addressable using a URL, I would use
the git-fetch way, which means GNU Guix would have to verify the downloaded
repository, so I calculate the hash using the other way.

So it all depends on what I specify in my package description, about how GNU
Guix is to retrieve my package.

Regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl



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

* Re: calculate hashes for a new packages
  2021-03-10 19:14 calculate hashes for a new packages Zelphir Kaltstahl
  2021-03-10 19:21 ` Leo Famulari
@ 2021-03-10 21:11 ` divoplade
  1 sibling, 0 replies; 8+ messages in thread
From: divoplade @ 2021-03-10 21:11 UTC (permalink / raw)
  To: Zelphir Kaltstahl, help-guix

Hello,

Le mercredi 10 mars 2021 à 20:14 +0100, Zelphir Kaltstahl a écrit :
> How does one calculate the hash for a package one wants to add to GNU
> Guix?

My method is: take any hash from any package, change the first digit
(if it’s 0, then write 1; if it’s 1, write 0), and try to build your
package. You will have an error message with the actual hash value,
whatever the download method is :)



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

* Re: calculate hashes for a new packages
  2021-03-10 21:00     ` Zelphir Kaltstahl
@ 2021-03-10 21:47       ` zimoun
  2021-03-19 13:09       ` Joshua Branson
  1 sibling, 0 replies; 8+ messages in thread
From: zimoun @ 2021-03-10 21:47 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: help-guix

On Wed, 10 Mar 2021 at 22:01, Zelphir Kaltstahl
<zelphirkaltstahl@posteo.de> wrote:

> So it all depends on what I specify in my package description, about how GNU
> Guix is to retrieve my package.

Yes, as Leo pointed it out. :-)  The method depends on the package
source method to retrieve your package.

All the best,
simon


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

* Re: calculate hashes for a new packages
  2021-03-10 21:00     ` Zelphir Kaltstahl
  2021-03-10 21:47       ` zimoun
@ 2021-03-19 13:09       ` Joshua Branson
  1 sibling, 0 replies; 8+ messages in thread
From: Joshua Branson @ 2021-03-19 13:09 UTC (permalink / raw)
  To: Zelphir Kaltstahl; +Cc: zimoun, Leo Famulari, help-guix

Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:

> Hello Zimoun!
>
> Ah, I think I get it now:
>
> If I for example created a tag for the version of my package and creation of the
> tag caused the VCS host to create a tarball as release, I could go the url-fetch
> way and then I would use `guix hash` on the tarball, which is the release
> tarball, but if there is no release tarball addressable using a URL, I would use
> the git-fetch way, which means GNU Guix would have to verify the downloaded
> repository, so I calculate the hash using the other way.

I personally use guix download https://path/to/tarball.  That outputs
the hash for me.  :)  Please note that I have never added or fixed a
patch for guix.  

>
> So it all depends on what I specify in my package description, about how GNU
> Guix is to retrieve my package.
>
> Regards,
> Zelphir

-- 
Joshua Branson (joshuaBPMan in #guix)
Sent from Emacs and Gnus
  https://gnucode.me
  https://video.hardlimit.com/accounts/joshua_branson/video-channels
  https://propernaming.org
  "You can have whatever you want, as long as you help
enough other people get what they want." - Zig Ziglar
  


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

end of thread, other threads:[~2021-03-19 13:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 19:14 calculate hashes for a new packages Zelphir Kaltstahl
2021-03-10 19:21 ` Leo Famulari
2021-03-10 20:19   ` zimoun
2021-03-10 21:00     ` Zelphir Kaltstahl
2021-03-10 21:47       ` zimoun
2021-03-19 13:09       ` Joshua Branson
2021-03-10 20:22   ` Zelphir Kaltstahl
2021-03-10 21:11 ` divoplade

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git