unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: 52284@debbugs.gnu.org
Cc: guix-devel@gnu.org
Subject: bug#52284: Partially unifying packages and inferior packages
Date: Sat, 04 Dec 2021 21:01:42 +0000	[thread overview]
Message-ID: <b1d6da8fe3d3afd8f04968a146cc47732eb0fa85.camel@telenet.be> (raw)

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





             reply	other threads:[~2021-12-04 21:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 21:01 Maxime Devos [this message]
2021-12-06 13:14 ` bug#52284: Partially unifying packages and inferior packages Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=b1d6da8fe3d3afd8f04968a146cc47732eb0fa85.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=52284@debbugs.gnu.org \
    --cc=guix-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).