[PATCH] gs-fonts: add missing podule imports

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Ludovic Courtès
  • Sergei Trofimovich
Owner
unassigned
Submitted by
Sergei Trofimovich
Severity
normal
S
S
Sergei Trofimovich wrote on 6 May 2017 17:40
(address . guix-patches@gnu.org)(name . Sergei Trofimovich)(address . slyfox@inbox.ru)
20170506154035.23664-1-slyfox@inbox.ru
On code-updates branch 'gs-fonts' build fails as:

ice-9/psyntax.scm:1534:32: In procedure expand-macro:
ice-9/psyntax.scm:1534:32: Syntax error:
...-gs-fonts-8.11-guile-builder:1:2300: source expression failed to match
any pattern in form (%modify-phases phases* (delete (quote configure)))
builder for `/gnu/store/...-gs-fonts-8.11.drv' failed with exit code 1

* gnu/packages/ghostscript.scm (gs-fonts): add missing modules to
%modify-phases call: gnu-build-system, utils, srfi-1

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
---
gnu/packages/ghostscript.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 076046e72..33b8f51b6 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -273,6 +273,10 @@ architecture.")
(build-system gnu-build-system)
(arguments
`(#:tests? #f ; nothing to check, just files to copy
+
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))
#:phases
(modify-phases %standard-phases
(delete 'configure)
--
2.12.2
D
D
Danny Milosavljevic wrote on 7 May 2017 21:06
Re: bug#26805: [PATCH] gs-fonts: add missing module imports
(name . Sergei Trofimovich)(address . slyfox@inbox.ru)(address . 26805-done@debbugs.gnu.org)
20170507210659.139dc806@scratchpost.org
Hi Sergei,

thanks for your contribution.

I've pushed it to core-updates as 809bc3948e2441daae32dfd1beb6c1984b840315.

This causes 3198 dependent packages to rebuild, therefore I'll not push it to master (which I did for the other module import patches - because they caused a lot fewer packages to rebuild).
Closed
L
L
Ludovic Courtès wrote on 9 May 2017 12:20
Re: bug#26805: [PATCH] gs-fonts: add missing podule imports
(name . Sergei Trofimovich)(address . slyfox@inbox.ru)(address . 26805@debbugs.gnu.org)
87pofi8h6p.fsf@gnu.org
Hello!

Sergei Trofimovich <slyfox@inbox.ru> skribis:

Toggle quote (8 lines)
> On code-updates branch 'gs-fonts' build fails as:
>
> ice-9/psyntax.scm:1534:32: In procedure expand-macro:
> ice-9/psyntax.scm:1534:32: Syntax error:
> ...-gs-fonts-8.11-guile-builder:1:2300: source expression failed to match
> any pattern in form (%modify-phases phases* (delete (quote configure)))
> builder for `/gnu/store/...-gs-fonts-8.11.drv' failed with exit code 1

Any idea when this problem appeared? That’s on core-updates, right?

Toggle quote (4 lines)
> + #:modules ((guix build gnu-build-system)
> + (guix build utils)
> + (srfi srfi-1))

The first two modules are here by default (see ‘%default-modules’ in
(guix build-system gnu)), so I wonder why adding (srfi srfi-1) would
help here.

Thoughts?

Ludo’.
S
S
Sergei Trofimovich wrote on 9 May 2017 22:36
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 26805@debbugs.gnu.org)
20170509213630.7c81b553@sf
On Tue, 09 May 2017 12:20:46 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (14 lines)
> Hello!
>
> Sergei Trofimovich <slyfox@inbox.ru> skribis:
>
> > On code-updates branch 'gs-fonts' build fails as:
> >
> > ice-9/psyntax.scm:1534:32: In procedure expand-macro:
> > ice-9/psyntax.scm:1534:32: Syntax error:
> > ...-gs-fonts-8.11-guile-builder:1:2300: source expression failed to match
> > any pattern in form (%modify-phases phases* (delete (quote configure)))
> > builder for `/gnu/store/...-gs-fonts-8.11.drv' failed with exit code 1
>
> Any idea when this problem appeared? That’s on core-updates, right?

Yes, core-updates. It was caused by guile-2.0->guile-2.2 switch.

Toggle quote (10 lines)
> > + #:modules ((guix build gnu-build-system)
> > + (guix build utils)
> > + (srfi srfi-1))
>
> The first two modules are here by default (see ‘%default-modules’ in
> (guix build-system gnu)), so I wonder why adding (srfi srfi-1) would
> help here.
>
> Thoughts?

thread Andy explains syntax-rules changed the rules on how syntax-match
is done in guile-2.2: now things are matched by binding, not by name.

That means evaluation of -guile-builder needs to keep things in scope at
<some-strange-evaluation-time-i-have-no-understanding-about> :)

The breakage is quite widespread. Danny applied 3 patches already to fix
similar problems. I have at least 5 more packages fixed (or "fixed"?) in a
similar way and more to go.

--

Sergei
-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQSZKa0VG5avZRlY01hxoe52YR/zqgUCWRIoTwAKCRBxoe52YR/z
qrGjAJ9Hbg6zvuZNstEjl3SB5wTby2L7/gCeJ1L+5gXCt5DKLhK5f+Y0xALyKko=
=PgK1
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 10 May 2017 13:53
(name . Sergei Trofimovich)(address . slyfox@inbox.ru)(address . 26805@debbugs.gnu.org)
877f1pvsfu.fsf@gnu.org
Sergei Trofimovich <slyfox@inbox.ru> skribis:

Toggle quote (33 lines)
> On Tue, 09 May 2017 12:20:46 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Hello!
>>
>> Sergei Trofimovich <slyfox@inbox.ru> skribis:
>>
>> > On code-updates branch 'gs-fonts' build fails as:
>> >
>> > ice-9/psyntax.scm:1534:32: In procedure expand-macro:
>> > ice-9/psyntax.scm:1534:32: Syntax error:
>> > ...-gs-fonts-8.11-guile-builder:1:2300: source expression failed to match
>> > any pattern in form (%modify-phases phases* (delete (quote configure)))
>> > builder for `/gnu/store/...-gs-fonts-8.11.drv' failed with exit code 1
>>
>> Any idea when this problem appeared? That’s on core-updates, right?
>
> Yes, core-updates. It was caused by guile-2.0->guile-2.2 switch.
>
>> > + #:modules ((guix build gnu-build-system)
>> > + (guix build utils)
>> > + (srfi srfi-1))
>>
>> The first two modules are here by default (see ‘%default-modules’ in
>> (guix build-system gnu)), so I wonder why adding (srfi srfi-1) would
>> help here.
>>
>> Thoughts?
>
> In http://lists.gnu.org/archive/html/guix-devel/2017-05/msg00010.html
> thread Andy explains syntax-rules changed the rules on how syntax-match
> is done in guile-2.2: now things are matched by binding, not by name.

Oooooh, right, terrible.

Toggle quote (7 lines)
> That means evaluation of -guile-builder needs to keep things in scope at
> <some-strange-evaluation-time-i-have-no-understanding-about> :)
>
> The breakage is quite widespread. Danny applied 3 patches already to fix
> similar problems. I have at least 5 more packages fixed (or "fixed"?) in a
> similar way and more to go.

What about adding (srfi srfi-1) to ‘%default-modules’ in (guix
build-system gnu)? It’s generally useful anyway.

(Alternately, we could rename SRFI-1’s ‘delete’ in (guix build utils),
so we’d still be matching a literal, but we’d have problems in places
that use both (guix build utils) and (srfi srfi-1).)

Ludo’.
S
S
Sergei Trofimovich wrote on 10 May 2017 22:41
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 26805@debbugs.gnu.org)
20170510214141.60fe16d4@sf
On Wed, 10 May 2017 13:53:41 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (7 lines)
> What about adding (srfi srfi-1) to ‘%default-modules’ in (guix
> build-system gnu)? It’s generally useful anyway.
>
> (Alternately, we could rename SRFI-1’s ‘delete’ in (guix build utils),
> so we’d still be matching a literal, but we’d have problems in places
> that use both (guix build utils) and (srfi srfi-1).)

I'd personally say the less magic reexports - the better. It's ok to go
through all of core-updates and fix missing imports.

Would be nice the all those syntactic errors could be caught with something
lighter-weight than full 'guix build'.

I'm afraid I have no idea how symbol visibility works in guix as I'm
still struggling to find which code builds and evaluates '*-guile-builder' files.

For example what is the difference between
(use-modules ....
and
(arguments '(#:modules
?

Should be one preferred over another? The latter creeps in core-updates :)

A few recent examples:
etc.

--

Sergei
-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQSZKa0VG5avZRlY01hxoe52YR/zqgUCWRN7BwAKCRBxoe52YR/z
qtR8AJwPP2TQi/gvb0Twt7gVPwVXDmYrYQCdGlqn+tD3byq6iOkhH7oj6puwP5k=
=3q5k
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 11 May 2017 22:49
(name . Sergei Trofimovich)(address . slyfox@inbox.ru)(address . 26805@debbugs.gnu.org)
87inl7nmpq.fsf@gnu.org
Hi!

Sergei Trofimovich <slyfox@inbox.ru> skribis:

Toggle quote (13 lines)
> On Wed, 10 May 2017 13:53:41 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> What about adding (srfi srfi-1) to ‘%default-modules’ in (guix
>> build-system gnu)? It’s generally useful anyway.
>>
>> (Alternately, we could rename SRFI-1’s ‘delete’ in (guix build utils),
>> so we’d still be matching a literal, but we’d have problems in places
>> that use both (guix build utils) and (srfi srfi-1).)
>
> I'd personally say the less magic reexports - the better. It's ok to go
> through all of core-updates and fix missing imports.

I wouldn’t call it “magic”. It’s just about providing a useful set of
bindings in ‘%default-modules’, to save typing essentially.

Also, for this ‘delete’ issue, I’m pretty sure we’re going to miss many
occurrences no matter what (same problem as with the ‘_’ binding from
(guix ui), which wasn’t resolved until I finally realized that renaming
it would have saved a lot of time…)

Note that there’s also the second solution above.

Thoughts?

Toggle quote (3 lines)
> Would be nice the all those syntactic errors could be caught with something
> lighter-weight than full 'guix build'.

The problem is that this is “build-side code” and we can’t really tell
much about it until we’ve assembled it in on of those -guile-builder
files.

Toggle quote (9 lines)
> I'm afraid I have no idea how symbol visibility works in guix as I'm
> still struggling to find which code builds and evaluates '*-guile-builder' files.
>
> For example what is the difference between
> (use-modules ....
> and
> (arguments '(#:modules
> ?

Hopefully the intro of the “G-Expressions” section can shed some light
on this, specifically on the build-side vs. host-side story. Otherwise
let me know. :-)

“(arguments '(#:modules …))” specifies modules in scope on the build
side.

HTH!

Ludo’.
S
S
Sergei Trofimovich wrote on 14 May 2017 18:31
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 26805@debbugs.gnu.org)
20170514173128.28e799a1@sf
On Thu, 11 May 2017 22:49:05 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (10 lines)
> Hi!
>
> Sergei Trofimovich <slyfox@inbox.ru> skribis:
>
> > On Wed, 10 May 2017 13:53:41 +0200
> > ludo@gnu.org (Ludovic Courtès) wrote:
> >
> >> What about adding (srfi srfi-1) to ‘%default-modules’ in (guix
> >> build-system gnu)? It’s generally useful anyway.

A bunch of python-guild-system based packages fail in a similar way.

I tried reexporting 'delete' from '(guix build utils)'. It works at
least for many packages I have tested. But maybe it's too broad.

Toggle diff (60 lines)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index e8efb0653..4bc55f219 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -25,21 +25,22 @@
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-60)
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 format)
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:re-export (alist-cons
- alist-delete)
+ alist-delete
+ delete)
#:export (%store-directory
store-file-name?
strip-store-file-name
package-name->name+version
parallel-job-count

directory-exists?
executable-file?
symbolic-link?
call-with-ascii-input-file

> >> (Alternately, we could rename SRFI-1’s ‘delete’ in (guix build utils),
> >> so we’d still be matching a literal, but we’d have problems in places
> >> that use both (guix build utils) and (srfi srfi-1).)
> >
> > I'd personally say the less magic reexports - the better. It's ok to go
> > through all of core-updates and fix missing imports.
>
> I wouldn’t call it “magic”. It’s just about providing a useful set of
> bindings in ‘%default-modules’, to save typing essentially.
>
> Also, for this ‘delete’ issue, I’m pretty sure we’re going to miss many
> occurrences no matter what (same problem as with the ‘_’ binding from
> (guix ui), which wasn’t resolved until I finally realized that renaming
> it would have saved a lot of time…)

Yeah. Having tried to edit 10 more packages I have to agree it's tedious
to fix each package :)

Can you explain what is the problem of renaming ‘delete’ from srfi-1 in
(guix build utils) module? How would hypothetical breakage happen?
Is it because 'delete' from srfi-1 and renamed binding srfi-1 are not
treated as the same binding by syntax rule?

> Note that there’s also the second solution above.
>
> Thoughts?


--

Sergei
-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQSZKa0VG5avZRlY01hxoe52YR/zqgUCWRiGYAAKCRBxoe52YR/z
qtPUAJ4xGaSSXjWnwp+AJmg722gl1Huj2wCeMOJg/V3BO33mqhPd1v6PL9VK2N8=
=cCyP
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 14 May 2017 22:02
(name . Sergei Trofimovich)(address . slyfox@inbox.ru)(address . 26805@debbugs.gnu.org)
87a86ftdf6.fsf@gnu.org
Hi,

Sergei Trofimovich <slyfox@inbox.ru> skribis:

Toggle quote (2 lines)
> On Thu, 11 May 2017 22:49:05 +0200

[...]

Toggle quote (4 lines)
>> >> (Alternately, we could rename SRFI-1’s ‘delete’ in (guix build utils),
>> >> so we’d still be matching a literal, but we’d have problems in places
>> >> that use both (guix build utils) and (srfi srfi-1).)

[...]

Toggle quote (5 lines)
> Can you explain what is the problem of renaming ‘delete’ from srfi-1 in
> (guix build utils) module? How would hypothetical breakage happen?
> Is it because 'delete' from srfi-1 and renamed binding srfi-1 are not
> treated as the same binding by syntax rule?

The only problem would be in packages that use both (guix build utils)
and (srfi srfi-1), *and* do (modify-phase … (delete …)). Those packages
would have a syntax error due to ‘delete’ being shadowed by SRFI-1’s
‘delete’.

It’s easy to fix them, for example by using the #:prefix option when
importing (srfi srfi-1)… but it’s also easy to miss some of the
problems.

There’s yet another option, which is to:

(define-modules (guix build utils)
#:use-module (srfi srfi-1)
#:re-export (delete))

I think that one had none of the previously-discussed drawbacks.

Thoughts? Would you like to give it a try?

Ludo’.
S
S
Sergei Trofimovich wrote on 15 May 2017 01:15
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 26805@debbugs.gnu.org)
20170515001506.4c2313d3@sf
On Sun, 14 May 2017 22:02:21 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (11 lines)
> There’s yet another option, which is to:
>
> (define-modules (guix build utils)
> …
> #:use-module (srfi srfi-1)
> #:re-export (delete))
>
> I think that one had none of the previously-discussed drawbacks.
>
> Thoughts? Would you like to give it a try?

Attached 0001-reexport-delete-symbol-bound-at-modify-phases-syntax.patch
that hopefully does exactly the same. This fix allows bootstrapping bash-minimal
and gs-fonts with #:modules patch reverted \o/

--

Sergei
From 18d1c9cf8252891c5c98ebb18a9937b5881e4ddd Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@inbox.ru>
Date: Sat, 13 May 2017 22:08:27 +0100
Subject: [PATCH] reexport 'delete' symbol bound at %modify-phases syntax match

* guix/build/utils.scm: reexport 'delete' binding
---
guix/build/utils.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (16 lines)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index e8efb0653..4bc55f219 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -32,7 +32,8 @@
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:re-export (alist-cons
- alist-delete)
+ alist-delete
+ delete)
#:export (%store-directory
store-file-name?
strip-store-file-name
--
2.13.0
-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQSZKa0VG5avZRlY01hxoe52YR/zqgUCWRjk+wAKCRBxoe52YR/z
qqJOAJ9JVAAylQo3MmFecYB+folg6glyDACfS6Lw+5vYu+J6s5JXSCfGGPzbpGs=
=5q38
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 26 May 2017 15:02
Re-exporting ‘delete’ from (guix build utils)
(name . Sergei Trofimovich)(address . slyfox@inbox.ru)(address . 26805-done@debbugs.gnu.org)
87k253wz38.fsf_-_@gnu.org
Hi Sergei,

Sergei Trofimovich <slyfox@inbox.ru> skribis:

Toggle quote (4 lines)
> Attached 0001-reexport-delete-symbol-bound-at-modify-phases-syntax.patch
> that hopefully does exactly the same. This fix allows bootstrapping bash-minimal
> and gs-fonts with #:modules patch reverted \o/

[...]

Toggle quote (7 lines)
> From 18d1c9cf8252891c5c98ebb18a9937b5881e4ddd Mon Sep 17 00:00:00 2001
> From: Sergei Trofimovich <slyfox@inbox.ru>
> Date: Sat, 13 May 2017 22:08:27 +0100
> Subject: [PATCH] reexport 'delete' symbol bound at %modify-phases syntax match
>
> * guix/build/utils.scm: reexport 'delete' binding

I added an explanatory comment and pushed as
8b14773ab6cafbd138e0c6cbfd2fc48818e2e0b5.

If there are core packages where we added #:modules ((srfi srfi-1) …),
we should probably remove it. Packages with few dependents don’t matter
much.

Thoughts?

Thank you, and apologies for the delay!

Ludo’.
Closed
?