bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#40272: linux-module-build-system don't support an inferior package a


From: Maxime Devos
Subject: bug#40272: linux-module-build-system don't support an inferior package as a kernel
Date: Mon, 02 Aug 2021 19:12:18 +0200
User-agent: Evolution 3.34.2

Brice Waegeneire schreef op zo 01-08-2021 om 22:59 [+0200]:
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> In procedure package-name: Wrong type argument: #<inferior-package 
> linux-libre@5.12.19 7f8aed887420>
> --8<---------------cut here---------------end--------------->8---
> 
> > If we want to go further, we’ll have to end up with GOOPS…
> > [...]
> 
> Building a parent class of <package> and <inferior-package> looks really
> involved to just fix this issue.  Is there another way, or are we forced to
> use GOOPS in that case?

Going full GOOPS isn't necessary.  Something like 'define-gexp-compiler'
could be useful here, to make 'package-inputs' and the like support
inferior packages.  More specifically, something like this:

;; In (guix packages)
(define %inputs-hashtable (make-hash-table 2))

(define (package-inputs package)
  ;; Fast path: package is actually a <package>
  (if (eq? (struct-vtable package) <package>)
      (%package-inputs package) ; expects a <package>
      ((hashq-ref %inputs-hashtable (struct-vtable package)) package)))

;; In (guix inferior):
(hashq-set! %inputs-hashtable <inferior-package> %inferior-package-inputs)

and likewise for native-inputs, propagated-inputs, name, version, ...
(some macroology is recommended).

Or, simpler, but less extensible (but probably good enough):

(define-module (guix packages)
  [...]
  #:autoload (guix inferior) (inferior-package-inputs [...]))

[...]
(define (package-inputs package)
  (cond ((package? package) (%package-inputs package)) 
        ((inferior-package? package) (inferior-package-inputs package))
        (#t (error (G_ "tried to use 'package-inputs' on a non-package object 
~a") package))))

The idea of both suggestions is to let 'package-name', 'package-native-inputs',
... work on both regular <package> and <inferior-package> objects.

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]