* bug#52284: Partially unifying packages and inferior packages
@ 2021-12-04 21:01 Maxime Devos
2021-12-06 13:14 ` Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: Maxime Devos @ 2021-12-04 21:01 UTC (permalink / raw)
To: 52284; +Cc: guix-devel
X-Debbugs-CC: guix-devel@gnu.org
Hi guix,
There have been some bug reports with as root cause that inferior packages aren't
packages. I think that root cause is a bug. To resolve this, there was some talk on
using GOOP classes, or define-gexp-compiler-style polymorphism for package-native-inputs
etc., but these come with a complexity and time cost.
At the end of this e-mail, there is some untested code for turning an inferior
package into an equivalent package. If it's properly integrated into (guix inferior),
we could mostly do away with the inferior-package?/package? distinction,
by letting lookup-inferior-package and the like return ‘proper’ packages, albeit
with a weird build system and ignoring inheritance.
To be clear, I won't be working on this, but the idea seemed to nice to not send it.
Greetings,
Maxime
(define inferior-package-build-system
(build-system
(name 'inferior)
(description "Build things via an inferior")
(lower lower)))
(define* (lower name #:key inferior-package system target #:allow-other-keys)
(bag ;; TODO(?): package transformations using bags won't work!
(name name) ; ignored
(system system) ; ignored
(target target) ; ignored
(arguments '()) ; ignored
(build (lambda _
(inferior-package->derivation inferior-package system #:target target)))))
(define (inferior-inputs->inputs inferior-inputs)
(map (match-lamda
((label inf . rest)
`(,label ,(inferior-package->package inf) ,@rest)))
inferior-inputs))
(define (inferior-package->package inf)
;; TODO: somehow make sure no inheritance happens on this package
(package
(name (inferior-package-name inf))
(version (inferior-package-version inf))
(replacement (and=> (inferior-package-replacement inf) inferior-package->package))
(source #f) ; TODO
(build-system inferior-package-build-system)
(arguments `(#:inferior-package ,inf))
(synopsis (inferior-package-synopsis inf))
(description (inferior-package-description inf))
(home-page (inferior-package-home-page inf))
(location (inferior-package-location inf))
(inputs (map inferior-inputs->inputs (inferior-package-inputs inf)))
(native-inputs (map inferior-inputs->inputs (inferior-package-native-inputs inf)))
(propagated-inputs (map inferior-inputs->inputs (inferior-package-propagated-inputs inf)))
(transitive-propagated-inputs (map inferior-inputs->inputs (inferior-package-transitive-propagated-inputs inf)))
(native-search-paths (propagated-package-native-search-paths inf))
(search-paths (propagated-package-search-paths inf))
(license #f)) ; TODO
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#52284: Partially unifying packages and inferior packages
2021-12-04 21:01 bug#52284: Partially unifying packages and inferior packages Maxime Devos
@ 2021-12-06 13:14 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2021-12-06 13:14 UTC (permalink / raw)
To: Maxime Devos; +Cc: guix-devel, 52284
Hi,
Maxime Devos <maximedevos@telenet.be> skribis:
> (define (inferior-package->package inf)
> ;; TODO: somehow make sure no inheritance happens on this package
> (package
> (name (inferior-package-name inf))
> (version (inferior-package-version inf))
> (replacement (and=> (inferior-package-replacement inf) inferior-package->package))
> (source #f) ; TODO
> (build-system inferior-package-build-system)
> (arguments `(#:inferior-package ,inf))
> (synopsis (inferior-package-synopsis inf))
> (description (inferior-package-description inf))
> (home-page (inferior-package-home-page inf))
> (location (inferior-package-location inf))
> (inputs (map inferior-inputs->inputs (inferior-package-inputs inf)))
> (native-inputs (map inferior-inputs->inputs (inferior-package-native-inputs inf)))
> (propagated-inputs (map inferior-inputs->inputs (inferior-package-propagated-inputs inf)))
> (transitive-propagated-inputs (map inferior-inputs->inputs (inferior-package-transitive-propagated-inputs inf)))
> (native-search-paths (propagated-package-native-search-paths inf))
> (search-paths (propagated-package-search-paths inf))
> (license #f)) ; TODO
That’s a clever hack!
Longer-term, I think it would be nice(r) to use a type hierarchy somehow
so <inferior-package> instances can truly be used anywhere a <package>
is expected.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-06 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-04 21:01 bug#52284: Partially unifying packages and inferior packages Maxime Devos
2021-12-06 13:14 ` Ludovic Courtès
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.