unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* building from local (or private) git repository
@ 2019-07-08 15:52 Robert Vollmert
  2019-07-08 16:13 ` Pierre Langlois
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robert Vollmert @ 2019-07-08 15:52 UTC (permalink / raw)
  To: guix-devel

Hi all,

I realize this isn’t generally an aim for guix proper, but I’d like
to be able to build a package from a local git repository (or
optionally from a local tar ball). In my specific case, it’s while
working out the packaging of a project I intend to publish but
haven’t published yet.

What I have working so far uses local-file, as below:

(define-public puzzledb-tools
  (package
    (name "puzzledb-tools")
    (version "20190625-git")
    (source
      (local-file
        "/home/rob/puzzledb/tools"
        #:recursive? #t))
  …

That’s a bit annoying because it includes stale files that happen
to be in the directory, it doesn’t check the hash, etc. Using a
git origin with a local path doesn’t work for reasons I don’t
completely understand — I think it’s because the guix-daemon builds
in a namespace without access to the local filesystem. Perhaps there’s
a way to link the git repository into that namespace?

Any hints appreciated!

Robert

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

* Re: building from local (or private) git repository
  2019-07-08 15:52 building from local (or private) git repository Robert Vollmert
@ 2019-07-08 16:13 ` Pierre Langlois
  2019-07-08 16:39 ` Marius Bakke
  2019-07-11 16:20 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: Pierre Langlois @ 2019-07-08 16:13 UTC (permalink / raw)
  To: guix-devel

Hi Robert,

Robert Vollmert writes:

> Hi all,
>
> I realize this isn’t generally an aim for guix proper, but I’d like
> to be able to build a package from a local git repository (or
> optionally from a local tar ball). In my specific case, it’s while
> working out the packaging of a project I intend to publish but
> haven’t published yet.
>
> What I have working so far uses local-file, as below:
>
> (define-public puzzledb-tools
>   (package
>     (name "puzzledb-tools")
>     (version "20190625-git")
>     (source
>       (local-file
>         "/home/rob/puzzledb/tools"
>         #:recursive? #t))
>   …
>
> That’s a bit annoying because it includes stale files that happen
> to be in the directory, it doesn’t check the hash, etc. Using a
> git origin with a local path doesn’t work for reasons I don’t
> completely understand — I think it’s because the guix-daemon builds
> in a namespace without access to the local filesystem. Perhaps there’s
> a way to link the git repository into that namespace?
>
> Any hints appreciated!

If you're running the Guix system, you can setup a local git daemon that
serves your user's repos. Here's what I have in my config:

```
(git-daemon-service
  #:config (git-daemon-configuration
             (export-all? #t)
             (user-path ""))) ;; To allow access to '~rob/puzzledb/tools'
```

And then I /think/ you should be able to do something like:

```
(origin
  (method git-fetch)
  (uri (git-reference
        (url "git://localhost/~rob/puzzledb/tools")
        (commit "<hash>")))
  (sha256
   (base32
    "<hash>")))
```

Note that's off the top of my head, I personally use this publish
channels in my local network rather than package sources, but I can't
think why this wouldn't work too!

Pierre

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

* Re: building from local (or private) git repository
  2019-07-08 15:52 building from local (or private) git repository Robert Vollmert
  2019-07-08 16:13 ` Pierre Langlois
@ 2019-07-08 16:39 ` Marius Bakke
  2019-07-11 16:20 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: Marius Bakke @ 2019-07-08 16:39 UTC (permalink / raw)
  To: Robert Vollmert, guix-devel

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

Robert Vollmert <rob@vllmrt.net> writes:

> Hi all,
>
> I realize this isn’t generally an aim for guix proper, but I’d like
> to be able to build a package from a local git repository (or
> optionally from a local tar ball). In my specific case, it’s while
> working out the packaging of a project I intend to publish but
> haven’t published yet.
>
> What I have working so far uses local-file, as below:
>
> (define-public puzzledb-tools
>   (package
>     (name "puzzledb-tools")
>     (version "20190625-git")
>     (source
>       (local-file
>         "/home/rob/puzzledb/tools"
>         #:recursive? #t))
>   …
>
> That’s a bit annoying because it includes stale files that happen
> to be in the directory, it doesn’t check the hash, etc. Using a
> git origin with a local path doesn’t work for reasons I don’t
> completely understand — I think it’s because the guix-daemon builds
> in a namespace without access to the local filesystem. Perhaps there’s
> a way to link the git repository into that namespace?
>
> Any hints appreciated!

I typically just use (source "/some/repository"), though I don't
remember whether it automatically creates a fixed-output derivation for
the directory in question.  Probably not.

(local-file ...) should, though (I think); but you'll have to trick it
into ignoring ".git" by passing it a #:select? predicate.

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

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

* Re: building from local (or private) git repository
  2019-07-08 15:52 building from local (or private) git repository Robert Vollmert
  2019-07-08 16:13 ` Pierre Langlois
  2019-07-08 16:39 ` Marius Bakke
@ 2019-07-11 16:20 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-07-11 16:20 UTC (permalink / raw)
  To: Robert Vollmert; +Cc: guix-devel

Robert Vollmert <rob@vllmrt.net> skribis:

> What I have working so far uses local-file, as below:
>
> (define-public puzzledb-tools
>   (package
>     (name "puzzledb-tools")
>     (version "20190625-git")
>     (source
>       (local-file
>         "/home/rob/puzzledb/tools"
>         #:recursive? #t))
>   …

FWIW that’s what ‘--with-source’ does.

> That’s a bit annoying because it includes stale files that happen
> to be in the directory, it doesn’t check the hash, etc.

Like Marius wrote, you could pass #:select?

  (local-file …
              #:select? (git-predicate "/home/rob/puzzledb/tools"))

> Using a git origin with a local path doesn’t work for reasons I don’t
> completely understand — I think it’s because the guix-daemon builds in
> a namespace without access to the local filesystem. Perhaps there’s a
> way to link the git repository into that namespace?

Build processes for origins work in the global namespaces, with access
to the network and to everything.  So I think something like this should
work:

  (origin
    (method url-fetch)
    (url "/home/rob/puzzledb/tools")
    (sha256 …))

HTH!

Ludo’.

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 15:52 building from local (or private) git repository Robert Vollmert
2019-07-08 16:13 ` Pierre Langlois
2019-07-08 16:39 ` Marius Bakke
2019-07-11 16:20 ` Ludovic Courtès

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).