all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Philip McGrath <philip@philipmcgrath.com>,
	Maxime Devos <maximedevos@telenet.be>,
	55248@debbugs.gnu.org
Subject: [bug#55248] [PATCH 2/7] gnu: racket: Fix out-of-source build.
Date: Thu, 05 May 2022 21:52:37 +0200	[thread overview]
Message-ID: <72f621841c62c3663ee23371a91927e975617b80.camel@gmail.com> (raw)
In-Reply-To: <fdc4193a-9f81-50d1-2656-e9781ca43991@philipmcgrath.com>

Am Donnerstag, dem 05.05.2022 um 14:53 -0400 schrieb Philip McGrath:
> Hi,
> 
> On 5/4/22 05:29, Maxime Devos wrote:
> > Philip McGrath schreef op di 03-05-2022 om 14:33 [-0400]:
> > > -       ;; help with debugging, but it confuses `install-license-
> > > files`.
> > [...]
> > > +             ;; workaround for install-license-files
> > > +             (lambda* (#:key out-of-source? #:allow-other-keys)
> > > +               (when out-of-source?
> > > +                 (with-directory-excursion ".."
> > > +                   (symlink "src"
> > > +                            (package-name->name+version
> > > +                             (strip-store-file-name
> > > #$output))))))))))
> > 
> > Surely we could fix this bug/limitation of install-license-files
> > upstream (in this case, upstream=Guix)?
> > 
> 
> I'd certainly be in favor of that! I've never edited '(guix build 
> gnu-build-system)' but I assume that would be a 'core-updates' change.
>  
It would.

> I'm also not sure what the best solution would be in general.
> 
> In Racket's specific case, the source directory for the Racket VM is 
> (relative to the repository root), "racket/src/", where other notable
> directories present include "racket/collects/" and "pkgs/". An 
> out-of-source build ends up happening in "racket/build/". The license
> files are in the source directory, which is what install-license-files
> expects, but the find-source-directory helper function fails to guess
> the location of the source directory:
I think the issue here is that we're in a chdir into the source, where
the typical assumption that there's only a single directory besides it
fails.

> >   (define (find-source-directory package)
> >     ;; For an out-of-source build, guess the source directory
> > location
> >     ;; relative to the current directory.  Return #f on failure.
> >     (match (scandir ".."
> >                     (lambda (file)
> >                       (and (not (member file '("." ".." "build")))
> >                            (file-is-directory?
> >                             (string-append "../" file)))))
> >       (()                                         ;hmm, no source
> >        #f)
> >       ((source)                                   ;only one other
> > file
> >        (string-append "../" source))
> >       ((directories ...)                          ;pick the most
> > likely one
> >        ;; This happens for example with libstdc++, which lives
> > within the GCC
> >        ;; source tree.
> >        (any (lambda (directory)
> >               (and (string-prefix? package directory)
> >                    (string-append "../" directory)))
> >             directories))))
I don't think 
  (lambda (directory)
    (and (string-prefix? package directory)
         (string-append "../" directory)))
does what we think it does.  Even so, it's debatable whether that works
for Racket.  

> Some possibilities I can imagine:
> 
>    * We could add a case to find-source-directory specifically for
>      "src".
Not a fan personally.

>    * We could change configure to communicate the location of the
>      source directory, e.g. via an environment variable, rather than
>      trying to guess.
That would work, but gratuitous environment variables could have
unexpected consequences.  However, note that the build systems
themselves already need to capture the information of where the source
directory lives!  For gnu-build-system, you could check for abs_srcdir
in the Makefile for instance.

If this ever becomes necessary (reading ahead it doesn't seem to be,
but let that if be an if), I'd suggest splitting install-license-files
into a helper procedure that assumes we're in the correct directory and
a top level procedure, that performs the guess.  This top level
procedure would need to be implemented once per build system, while the
helper could be inherited.

>    * We could change install-license-files to do more searching in
>      general, e.g. trying multiple directories or preferring a
>      directory that contains at least one match for
>      #:license-file-regexp. We'd have to consider the potential for
>      false positives, too (e.g. sibling directories with projects
>      under different licenses.)

>    * We could add an argument to install-license-files to specify the
>      directory explicitly, as a complement to #:license-file-regexp.
I would not do either.  An alternative to adding another phase is
wrapping install-license-files in a directory excursion within this
package.  That'd be less code which achieves the same thing.

> Another scenario that might be worth considering is projects that
> follow the REUSE specification[1], which I don't think would be
> handled by the current install-license-files.
I don't think we can rely on projects consistently following them,
sadly.

> But actually, for Racket, I forgot that a patch I'd sent upstream to 
> handle this in `make install` should be in 8.5, so we may not need
> this patch at all: I'll confirm before I send v2.
That is of course the best solution :)




  reply	other threads:[~2022-05-05 20:19 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 18:31 [bug#55248] [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 1/7] gnu: racket: Update to 8.5 Philip McGrath
2022-05-04  6:53   ` Liliana Marie Prikler
2022-05-05 21:49     ` Philip McGrath
2022-05-06  6:37       ` Liliana Marie Prikler
2022-05-07 18:39         ` Philip McGrath
2022-05-07 20:01           ` Maxime Devos
2022-05-03 18:33 ` [bug#55248] [PATCH 2/7] gnu: racket: Fix out-of-source build Philip McGrath
2022-05-04  9:29   ` Maxime Devos
2022-05-05 18:53     ` Philip McGrath
2022-05-05 19:52       ` Liliana Marie Prikler [this message]
2022-05-05 20:36         ` Maxime Devos
2022-05-05 20:33       ` Maxime Devos
2022-05-05 21:55         ` Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 3/7] gnu: chez-scheme: Update to 9.5.8 Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 4/7] gnu: chez-scheme: Refactor documentation phases Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 5/7] gnu: chez-scheme: Refactor configure phase and fix '--threads' Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 6/7] gnu: stex: Get machine type dynamically Philip McGrath
2022-05-04  6:58   ` Liliana Marie Prikler
2022-05-05 19:39     ` Philip McGrath
2022-05-03 18:33 ` [bug#55248] [PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic Philip McGrath
2022-05-04  7:21   ` Liliana Marie Prikler
2022-05-05 20:42     ` Philip McGrath
2022-05-06  7:08       ` Liliana Marie Prikler
2022-05-07 19:18         ` Philip McGrath
2022-05-08 20:07 ` [bug#55248] [PATCH v2 0/9] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 1/9] gnu: racket: Update to 8.5 Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 2/9] gnu: racket: Fix out-of-source build Philip McGrath
2022-05-09  3:54     ` Liliana Marie Prikler
2022-05-09  6:02       ` [bug#55248] [PATCH v3 0/9] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 1/9] gnu: racket: Update to 8.5 Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 2/9] gnu: racket: Fix out-of-source build Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 3/9] gnu: chez-scheme: Update to 9.5.8 Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 4/9] gnu: chez-scheme: Refactor documentation phases Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads' Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 6/9] gnu: stex: Get machine type dynamically Philip McGrath
2022-05-09  6:02         ` [bug#55248] [PATCH v3 7/9] gnu: chez-upstream-features-for-system: Improve implementation Philip McGrath
2022-05-09  6:21           ` Liliana Marie Prikler
2022-05-09  7:20             ` Philip McGrath
2022-05-09  7:41               ` Liliana Marie Prikler
2022-05-09  6:02         ` [bug#55248] [PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems Philip McGrath
2022-05-09  6:34           ` Liliana Marie Prikler
2022-05-09  7:55             ` Philip McGrath
2022-05-09  9:36               ` Liliana Marie Prikler
2022-05-12  5:26                 ` Philip McGrath
2022-05-12  8:04                   ` Liliana Marie Prikler
2022-05-09  6:02         ` [bug#55248] [PATCH v3 9/9] gnu: chez-scheme-for-system: Adjust for bytecode backend Philip McGrath
2022-05-09  9:44         ` [bug#55248] [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Ludovic Courtès
2022-05-12  3:50           ` Philip McGrath
2022-05-12  3:59           ` [bug#55248] [PATCH v4 1/9] gnu: racket: Update to 8.5 Philip McGrath
2022-05-12 10:32         ` bug#55248: [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8 Ludovic Courtès
2022-05-08 20:07   ` [bug#55248] [PATCH v2 3/9] gnu: chez-scheme: Update " Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 4/9] gnu: chez-scheme: Refactor documentation phases Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads' Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 6/9] gnu: stex: Get machine type dynamically Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 7/9] gnu: chez-upstream-features-for-system: Improve implementation Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 8/9] gnu: chez-scheme-for-racket: Fix supported systems Philip McGrath
2022-05-08 20:07   ` [bug#55248] [PATCH v2 9/9] gnu: chez-scheme-for-system: Adjust for bytecode backend Philip McGrath

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

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

  git send-email \
    --in-reply-to=72f621841c62c3663ee23371a91927e975617b80.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=55248@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    --cc=philip@philipmcgrath.com \
    /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 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.