* How to remove output from inherited package?
@ 2024-12-26 3:10 Bodertz
2024-12-27 2:03 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
0 siblings, 1 reply; 5+ messages in thread
From: Bodertz @ 2024-12-26 3:10 UTC (permalink / raw)
To: guix-devel
In trying to create a transmission-qt package, I inherit from
transmission, remove the gtkmm dependency and the phases that deal with
moving transmission-gtk to the :gui output, and add a few qt
dependencies so that transmission-qt is built. See the package
definition below:
(define-module (bodertz transmission-qt)
#:use-module (gnu packages bittorrent)
#:use-module (gnu packages qt)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (guix utils))
(define-public transmission-qt
(package
(inherit transmission)
;; (outputs '("out"))
(name "transmission-qt")
(arguments
(substitute-keyword-arguments (package-arguments transmission)
((#:phases phases)
#~(modify-phases #$phases
(delete 'move-gui)
(delete 'glib-or-gtk-wrap)
(delete 'wrap-program)))))
(inputs (modify-inputs (package-inputs transmission)
(delete "gtkmm")
(append qtbase qttools qtsvg)))))
This works fine, except that an unnecessary transmission-qt:gui output
is created which contains license files (apologies if the email messes
up the formatting):
$ tree /gnu/store/k34zx89kvd712maqfi62spnbb5s31bqd-transmission-qt-4.0.6-gui
/gnu/store/k34zx89kvd712maqfi62spnbb5s31bqd-transmission-qt-4.0.6-gui
└── share
└── doc
└── transmission-qt-4.0.6
├── bsd-3-clause.txt
├── COPYING
├── gpl-2.0.txt
├── gpl-3.0.txt
└── mit.txt
When I uncomment the ;; outputs '("out")) line from my package
definition, I expected that it would only create the ordinary :out
output, but instead, I get this error:
$ guix build transmission-qt
[...]
builder for `/gnu/store/026fwjchyis1x99iqsgliqga284wydbc-transmission-qt-4.0.6.drv' failed to produce output path `/gnu/store/v331nyi7kqg4gi432gvhz1c719n8x7xf-transmission-qt-4.0.6-gui'
Is there a way to avoid the attempt to create a :gui output?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to remove output from inherited package?
2024-12-26 3:10 How to remove output from inherited package? Bodertz
@ 2024-12-27 2:03 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
2024-12-27 4:52 ` Bodertz
0 siblings, 1 reply; 5+ messages in thread
From: 宋文武 via Development of GNU Guix and the GNU System distribution. @ 2024-12-27 2:03 UTC (permalink / raw)
To: Bodertz; +Cc: guix-devel
Bodertz <bodertz@gmail.com> writes:
> In trying to create a transmission-qt package, I inherit from
> transmission
> [...]
> When I uncomment the ;; outputs '("out")) line from my package
> definition, I expected that it would only create the ordinary :out
> output, but instead, I get this error:
>
> $ guix build transmission-qt
> [...]
> builder for `/gnu/store/026fwjchyis1x99iqsgliqga284wydbc-transmission-qt-4.0.6.drv' failed to produce output path `/gnu/store/v331nyi7kqg4gi432gvhz1c719n8x7xf-transmission-qt-4.0.6-gui'
>
>
> Is there a way to avoid the attempt to create a :gui output?
I think you should not reuse phases from transmisison, the error came
from '#$phases', which has reference to 'gui' output. so:
...
(inherit transmission)
(name "transmission-qt")
(outputs '("out")
(arguments
(list ...)) ; instead of 'substitute-keyword-arguments'
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to remove output from inherited package?
2024-12-27 2:03 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
@ 2024-12-27 4:52 ` Bodertz
2024-12-27 6:55 ` Bodertz
2024-12-27 7:34 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
0 siblings, 2 replies; 5+ messages in thread
From: Bodertz @ 2024-12-27 4:52 UTC (permalink / raw)
To: guix-devel
宋文武 via "Development of GNU Guix and the GNU System distribution."
<guix-devel@gnu.org> writes:
> I think you should not reuse phases from transmisison, the error came
> from '#$phases', which has reference to 'gui' output. so:
>
> ...
> (inherit transmission)
> (name "transmission-qt")
> (outputs '("out")
> (arguments
> (list ...)) ; instead of 'substitute-keyword-arguments'
> ...
Hmm, you appear to be right, but I don't understand why, as I removed
the tests that referenced the :gui output: 'move-gui, 'glib-or-gtk-wrap,
and 'wrap-program.
Do you understand it? Did I miss one?
When I try to build without using any of the inherited phases, a test
fails (the transmission package included a phase to remove that test),
so for now I'm building without tests:
(define-public transmission-qt-without-arguments
(package
(inherit transmission)
(outputs '("out"))
(name "transmission-qt-without-arguments")
(arguments
(list))
(inputs (modify-inputs (package-inputs transmission)
(delete "gtkmm")
(append qtbase qttools qtsvg)))))
~ guix build transmission-qt-without-arguments --without-tests=transmission-qt-without-arguments
successfully built /gnu/store/i78ffafvchfn886b17s5vdwjqs387f98-transmission-qt-without-arguments-4.0.6.drv
Will I have to manually add back the phase that deals with removing that
test? I was hoping to avoid that sort of thing by inheriting from
transmission in the first place...
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to remove output from inherited package?
2024-12-27 4:52 ` Bodertz
@ 2024-12-27 6:55 ` Bodertz
2024-12-27 7:34 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
1 sibling, 0 replies; 5+ messages in thread
From: Bodertz @ 2024-12-27 6:55 UTC (permalink / raw)
To: guix-devel
Hmm, I see that the delete in modify-phases doesn't "actually" delete
what you tell it to, but rather just adds (delete _) to the end of the
list:
(apologies for the long text; just notice that move-gui, for example
isn't actually removed from the output, and that (delete (quote
move-gui)) is added at the end)
--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (substitute-keyword-arguments transmission-args ((#:phases phases) #~(modify-phases #$phases (delete 'move-gui) (delete 'glib-or-gtk-wrap) (delete 'wrap-program))))
$30 = (#:imported-modules ((guix build glib-or-gtk-build-system) (guix build cmake-build-system) (guix build gnu-build-system) (guix build utils) (guix build gremlin) (guix elf)) #:modules (((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) (guix build cmake-build-system) (guix build utils)) #:phases #<gexp (modify-phases #<gexp-input #<gexp (modify-phases %standard-phases (add-after (quote unpack) (quote remove-kernel-version) (lambda _ (substitute* "third-party/miniupnp/miniupnpc/updateminiupnpcstrings.sh" (("OS_VERSION=`uname -r`") "OS_VERSION=Guix")))) (replace (quote check) (lambda* (#:key tests? parallel-tests? #:allow-other-keys) (if tests? (invoke "ctest" "-E" "usesBootstrapFile" "-j" (if parallel-tests? (number->string (parallel-job-count)) "1")) (format #t "test suite not run~%")))) (add-after (quote install) (quote move-gui) (lambda* (#:key outputs #:allow-other-keys) (mkdir-p (string-append #<gexp-output gui> "/bin")) (mkdir-p (string-append #<gexp-output gui> "/share/man/man1")) (rename-file (string-append #<gexp-output out> "/bin/transmission-gtk") (string-append #<gexp-output gui> "/bin/transmission-gtk")) (for-each (lambda (dir) (rename-file (string-append #<gexp-output out> "/share/" dir) (string-append #<gexp-output gui> "/share/" dir))) (quote ("applications" "icons" "metainfo"))) (rename-file (string-append #<gexp-output out> "/share/man/man1/transmission-gtk.1") (string-append #<gexp-output gui> "/share/man/man1/transmission-gtk.1")))) (add-after (quote move-gui) (quote glib-or-gtk-wrap) (lambda* (#:key outputs #:allow-other-keys #:rest args) (apply (assoc-ref glib-or-gtk:%standard-phases (quote glib-or-gtk-wrap)) #:glib-or-gtk-wrap-excluded-outputs (list "out") args))) (add-after (quote glib-or-gtk-wrap) (quote wrap-program) (lambda* (#:key outputs #:allow-other-keys) (wrap-program (string-append #<gexp-output gui> "/bin/transmission-gtk") (quasiquote ("GDK_PIXBUF_MODULE_FILE" = ((unquote (getenv "GDK_PIXBUF_MODULE_FILE"))))))))) gnu/packages/bittorrent.scm:113:8 7f08847bfcc0>:out> (delete (quote move-gui)) (delete (quote glib-or-gtk-wrap)) (delete (quote wrap-program))) 7f088c309bd0>)
--8<---------------cut here---------------end--------------->8---
Is this the problem? Is there some way to "actually" delete the
offending entries that mention #<gexp-output gui>?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to remove output from inherited package?
2024-12-27 4:52 ` Bodertz
2024-12-27 6:55 ` Bodertz
@ 2024-12-27 7:34 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
1 sibling, 0 replies; 5+ messages in thread
From: 宋文武 via Development of GNU Guix and the GNU System distribution. @ 2024-12-27 7:34 UTC (permalink / raw)
To: Bodertz; +Cc: guix-devel
Bodertz <bodertz@gmail.com> writes:
> 宋文武 via "Development of GNU Guix and the GNU System distribution."
> <guix-devel@gnu.org> writes:
>
>> I think you should not reuse phases from transmisison, the error came
>> from '#$phases', which has reference to 'gui' output. so:
>>
>> ...
>> (inherit transmission)
>> (name "transmission-qt")
>> (outputs '("out")
>> (arguments
>> (list ...)) ; instead of 'substitute-keyword-arguments'
>> ...
>
> Hmm, you appear to be right, but I don't understand why, as I removed
> the tests that referenced the :gui output: 'move-gui, 'glib-or-gtk-wrap,
> and 'wrap-program.
>
> Do you understand it? Did I miss one?
As described in the manual (8.12 G-Expressions), gexp is used to embed
"build code" into "host code". In:
(substitute-keyword-arguments (package-arguments transmission)
((#:phases phases)
#~(modify-phases #$phases
(delete 'move-gui)
(delete 'glib-or-gtk-wrap)
(delete 'wrap-program)))))
'substitute-keywoard-arguments', 'package-arguments' and 'transmission'
will be executed by the host guile, while 'modify-phases' will be
executed by the builder of 'transmission-qt'. So in this case, the phases
have "gui" was deleted too late, if we managed to delete them before the
builder:
(substitute-keyword-arguments (package-arguments transmission)
((#:phases phases)
(modify-phases/xxx phases
(delete 'move-gui)
(delete 'glib-or-gtk-wrap)
(delete 'wrap-program)))))
That could work. But since phases of 'transmission' is a gexp object,
not a alist suitable for 'modify-phases', it not reusable now...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-27 7:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-26 3:10 How to remove output from inherited package? Bodertz
2024-12-27 2:03 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
2024-12-27 4:52 ` Bodertz
2024-12-27 6:55 ` Bodertz
2024-12-27 7:34 ` 宋文武 via Development of GNU Guix and the GNU System distribution.
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.