modify-phases: detect invalid phase addition

  • Open
  • quality assurance status badge
Details
2 participants
  • Gábor Boskovits
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Ricardo Wurmus
Severity
normal
R
R
Ricardo Wurmus wrote on 7 Sep 2018 23:50
(address . bug-guix@gnu.org)
877ejxm0z9.fsf@elephly.net
It is possible to add a build phase to a non-existing phase without an
error. The new build phase will simply not be executed.

This is problematic when an inherited package augments the original
package’s phases and the original package is changed. Imagine that the
parent package’s “pre-configure” phase is removed:

((#:phases original-phases)
`(modify-phases ,original-phases
(add-after 'pre-configure 'patch-this
(lambda _ …))))

This would cause the “patch-this” phase in the child package to be
skipped without warning.

This kind of thing can be especially confusing in the bootstrap, which
makes heavy use of inheritance.

--
Ricardo
G
G
Gábor Boskovits wrote on 10 Sep 2018 10:38
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 32661@debbugs.gnu.org)
CAE4v=phrpqog=3nQfXbwbrZjCFU3Acst_+k4aBRHNfPgE4NzBA@mail.gmail.com
Ricardo Wurmus <rekado@elephly.net> ezt írta (id?pont: 2018. szept. 7., P
23:51):

Toggle quote (18 lines)
> It is possible to add a build phase to a non-existing phase without an
> error. The new build phase will simply not be executed.
>
> This is problematic when an inherited package augments the original
> package’s phases and the original package is changed. Imagine that the
> parent package’s “pre-configure” phase is removed:
>
> ((#:phases original-phases)
> `(modify-phases ,original-phases
> (add-after 'pre-configure 'patch-this
> (lambda _ …))))
>
> This would cause the “patch-this” phase in the child package to be
> skipped without warning.
>
> This kind of thing can be especially confusing in the bootstrap, which
> makes heavy use of inheritance.
>
It would be nice to fix this. Also I have noticed that it is easier to make
mistakes when inheritance is involved, but these tend to only break derived
packages. I am not aware of a facility to make it easier to build all
derived packages. Am I missing something? I guess this would be a useful
tool, but not sure about implementation.

Toggle quote (8 lines)
>
> --
> Ricardo
>
>
>
>
>
Attachment: file
?