unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Phil <phil@beadling.co.uk>, Guix Devel <guix-devel@gnu.org>
Subject: Re: Help to workaround libgit2 fetch refs issue
Date: Wed, 02 Mar 2022 22:06:56 +0100	[thread overview]
Message-ID: <62b594e94117bc98c9edf0e3f8f067ccc46b10a3.camel@gmail.com> (raw)
In-Reply-To: <CAOvsyQtWUK+wXPJ2gc9p4CAYFRhydCFPGWFtGnczNbopEwt94Q@mail.gmail.com>

Hi Phil,

Am Mittwoch, dem 02.03.2022 um 18:31 +0000 schrieb Phil:
> Hi Guixers,
> 
> I raised an issue on libgit2 which effects the use of Guix with SSH
> git clones and additional references:
> https://github.com/libgit2/libgit2/issues/6183
> 
> The issue in summary is that if I want to build off a non-standard
> git reference (say, a Pull Request), then even if I update my git
> config to include that, eg:
> remote.origin.fetch=+refs/pull-
> requests/*/merge:refs/remotes/origin/pr/*
> 
> libgit2's initial clone will not pull down the extra refs, despite
> this being the behaviour of the git command line tool proper.  After
> the initial clone, the git config is adhered to.
This portion of the bug is in libgit2 and thus is for libgit2 to care
about.

> In Guix this means that the first time I build a PR it fails, and I
> have to do something like "guix build  foo | guix build foo" which is
> at best a clumsy hack, but it works!
Note that you could alternatively just use the requesting repo URL in
the git-reference.  Ah, but that would be too boring, wouldn't it?

> Whilst the proper solution will be be done in libgit2 I was thinking
> if I could quickly improve on my double-build workaround without
> having to change Guix itself here (by always fetching):
> https://github.com/guix-mirror/guix/blob/6adce1538d2df6fa2d68abc13ae94e2fa826d124/guix/git.scm#L466
> 
> If nothing else I was hoping to learn a bit more about how packages
> were compiled as the details are a bit of blindspot for me!  So my
> plan was to duplicate the git-checkout record and it's G-Exp compiler
> such that I could redirect to a modified version of  update-cached-
> checkout when the source is read from the package.
> 
> (I should also mention that the far simpler option of providing a new
> "fetch" function like url-fetch or git-fetch doesn't work for me as
> the repo I'm accessing happens to require SSH authentication and thus
> I'm using the method as outlined here: 
> http://issues.guix.gnu.org/issue/31285#4 )
> 
> So I have something like:
>     (package
>       (name "my-test-repo")
>       (version production-version)
>       (source
>        (git-checkout-x-refs
>         (url "ssh://git@bitbucket:7999/ea/my-test-repo.git")
>         (commit commit-production)))
>       (build-system python-build-system)
>       and so on....
> 
> The code I've naively duplicated is at the bottom of this e-mail - it
> builds OK, so is syntactically correct, but fails when I reference it
> in a package like above.  Having the record and git code as part of
> my local channel is wrong, I know, but I'm looking a short term
> workaround with the least disruptive footprint whilst I implement and
> then wait for release of the strategic solution, probably in libgit2.
I don't think using a new record type is the way to go.  You only want
to change the behaviour of git-fetch into git-fetch/additional-refs.

> I suspect the reason for the failure is that I'd have to import my
> new duplicated module somewhere in the Guix core code to make this
> work - i.e. having the code in the channel is never going to work?
> 
> I was wondering if anyway could confirm this and/or give me a pointer
> of where the compliation occurs (where the record in the source is
> handled and compiled into a git clone) - even if my approach is
> (quite possibly) unviable, I'd like to understand why!
The source field of a package is not thunked, so it is compiled in the
package definition itself, rather than handed off.  Note that every
hack of doing something fancyful usually invokes at least a delay form,
see e.g. the computed-origin-method used by linux-libre.  Hope that
helps.

Cheers


  reply	other threads:[~2022-03-02 21:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 18:31 Help to workaround libgit2 fetch refs issue Phil
2022-03-02 21:06 ` Liliana Marie Prikler [this message]
2022-03-03 18:20   ` Phil
2022-03-04  9:34     ` Phil
2022-03-04 17:43       ` Liliana Marie Prikler
2022-03-05 11:57         ` Phil
2022-04-30  9:28           ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62b594e94117bc98c9edf0e3f8f067ccc46b10a3.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=phil@beadling.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).