diff mbox

doc: clarification for hashing git checkouts

Message ID 20160710215438.15418.98984@what
State New
Headers show

Commit Message

Troy Sankey July 10, 2016, 9:54 p.m. UTC
When hashing git checkouts of packages, packagers must first remove the .git
directory.  This commit adds this clarification to the "Invoking guix hash"
page in the documentation.
---
 doc/guix.texi | 3 +++
 1 file changed, 3 insertions(+)

Comments

Leo Famulari July 10, 2016, 11:16 p.m. UTC | #1
On Sun, Jul 10, 2016 at 05:54:38PM -0400, Troy Sankey wrote:
> When hashing git checkouts of packages, packagers must first remove the .git
> directory.  This commit adds this clarification to the "Invoking guix hash"
> page in the documentation.

Yes! This is one that *everybody* has to ask.

I think it would be better in section '5.1.2 origin reference', because
that is where the origin methods (url-fetch, git-fetch, etc) and the
sha256 field are documented.

In that case, it could go along with explanations of how to calculate
the hash for cvs-download, hg-download, and svn-download.

What do others think?
Pjotr Prins July 11, 2016, 12:13 a.m. UTC | #2
On Sun, Jul 10, 2016 at 07:16:30PM -0400, Leo Famulari wrote:
> On Sun, Jul 10, 2016 at 05:54:38PM -0400, Troy Sankey wrote:
> > When hashing git checkouts of packages, packagers must first remove the .git
> > directory.  This commit adds this clarification to the "Invoking guix hash"
> > page in the documentation.
> 
> Yes! This is one that *everybody* has to ask.

And only now I am understanding a problem ages ago. Would this also be
the reason for git sub-modules not to work? We don't use them, but
sometimes it would be a nice intermediate stage for writing a package
definition.

Pj.
Troy Sankey July 11, 2016, 5:33 a.m. UTC | #3
Quoting Pjotr Prins (2016-07-10 20:13:26)
> And only now I am understanding a problem ages ago. Would this also be
> the reason for git sub-modules not to work?

Pjotr,

If I'm understanding correctly, you failed to generate the hash of a git
repository containing submodules?  In that case, you may need to delete the
.git file under each submodule directory in addition to the top level .git
directory.

Hashing sources is becoming quite compilated!  I can't wait until 'guix
download' supports git, then this could be automated.

Troy
Pjotr Prins July 11, 2016, 3:36 p.m. UTC | #4
Yes, that is how I understand it previously did not work for me.
Thanks :)

On Mon, Jul 11, 2016 at 01:33:40AM -0400, Troy Sankey wrote:
> Quoting Pjotr Prins (2016-07-10 20:13:26)
> > And only now I am understanding a problem ages ago. Would this also be
> > the reason for git sub-modules not to work?
> 
> Pjotr,
> 
> If I'm understanding correctly, you failed to generate the hash of a git
> repository containing submodules?  In that case, you may need to delete the
> .git file under each submodule directory in addition to the top level .git
> directory.
> 
> Hashing sources is becoming quite compilated!  I can't wait until 'guix
> download' supports git, then this could be automated.
> 
> Troy
> 

--
Leo Famulari July 11, 2016, 4:17 p.m. UTC | #5
On Mon, Jul 11, 2016 at 01:33:40AM -0400, Troy Sankey wrote:
> Hashing sources is becoming quite compilated!  I can't wait until 'guix
> download' supports git, then this could be automated.

In that case, `guix download` would need to take a Git hash as an
argument.

In general, I think it's a good idea to avoid `guix download` when
writing packages, unless you make sure to double-check that the
package's origin field works as expected. I've submitted packages with a
bad URL that was masked because the tarball was already in my store from
`guix download`. So, now I always download my sources "by hand" and
calculate the hash from the result of that.
diff mbox

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index c9d9bd8..f9fe85a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4533,6 +4533,9 @@  hash (@pxref{Invoking guix archive}).
 @c FIXME: Replace xref above with xref to an ``Archive'' section when
 @c it exists.
 
+When hashing a git checkout, be sure to remove the git configuration
+directory (@code{rm -r .git}) as it will erroneously impact the hash.
+
 @end table
 
 @node Invoking guix import