From: Brice Waegeneire <brice@waegenei.re>
To: 49649@debbugs.gnu.org
Cc: ludo@gnu.org, me@tobias.gr
Subject: [bug#49649] [PATCH v2 2/4] gnu: wireless-regdb: Reuse 'regulatory.db' signature.
Date: Sat, 25 Dec 2021 19:44:37 +0100 [thread overview]
Message-ID: <20211225184437.9457-1-brice@waegenei.re> (raw)
In-Reply-To: <20210719211528.22649-1-brice@waegenei.re>
Unlike 'regulatory.bin' (used by CRDA), we can't have a valid unsigned
'regulatory.db' (used by subsystem cfg80211). So, we reuse upstream's
signature for that file and rebuild it ourself to be sure it's
reproducible
* gnu/packages/linux.scm (wireless-regdb)[source]: Delete file
'regulatory.db'.
[arguments]: Remove 'omit-signature' phase, replace 'build' phase with
make target 'regulatory.db', add phase 'build-regulatory.bin-unsigned'
and add 'check' phase. Enable tests and parallel builds. Remove
make-flags specific to 'build-regulatory.bin-unsigned'.
[native-inputs]: Use new format and add 'openssl'.
[description]: Add reference to the cfg80211 linux subsystem.
---
gnu/packages/linux.scm | 72 +++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index e2be00679f..54f2682965 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4296,10 +4296,11 @@ (define-public wireless-regdb
(sha256
(base32
"0liagyi6ppf5w474qk9j4jz5gbvvn8mc8al1dq4b1xrgv28485ml"))
-
- ;; We're building 'regulatory.bin' by ourselves.
+ ;; We're building 'regulatory.bin' and 'regulatory.db' by
+ ;; ourselves.
(snippet '(begin
- (delete-file "regulatory.bin")
+ (map delete-file '("regulatory.bin"
+ "regulatory.db"))
#t))))
(build-system gnu-build-system)
(arguments
@@ -4310,48 +4311,47 @@ (define-public wireless-regdb
(substitute* "Makefile"
(("gzip") "gzip --no-name"))
#t))
- (add-after 'unpack 'omit-signature
+ (replace 'build
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "regulatory.db" make-flags)))
+ (add-after 'build 'build-regulatory.bin-unsigned
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "regulatory.bin"
+ (cons*
+ ;; Leave this empty so that db2bin.py doesn't try to sign
+ ;; ‘regulatory.bin’. This allows us to avoid managing a key
+ ;; pair for the whole distribution.
+ "REGDB_PRIVKEY="
+ ;; Don't generate a public key for the same reason. These are
+ ;; used as Makefile targets and can't be the empty string.
+ "REGDB_PUBCERT=/dev/null"
+ "REGDB_PUBKEY=/dev/null"
+ make-flags))))
+ ;; We check if the 'regulatory.db' we just built is the same as the
+ ;; one that got signed by upstream.
+ (replace 'check
(lambda _
- (substitute* "Makefile"
- ;; Signing requires a REGDB_PUBCERT and REGDB_PRIVKEY which we
- ;; don't provide (see below). Disable it.
- ((" regulatory\\.db\\.p7s") "")
- ;; regulatory.db is built as a dependency of regulatory.db.p7s,
- ;; but ‘make install’ depends only on the latter while installing
- ;; both (and failing). Depend on it explicitly.
- (("^install: " all) (string-append all "regulatory.db ")))
- #t))
+ (invoke "openssl" "smime"
+ "-verify" "-inform" "DER"
+ "-signer" "sforshee.x509.pem"
+ "-in" "regulatory.db.p7s" "-content" "regulatory.db"
+ "-out" "/dev/null"
+ "-CAfile" "sforshee.x509.pem")))
(delete 'configure)) ; no configure script
-
- ;; The 'all' target of the makefile depends on $(REGDB_CHANGED), which
- ;; is computed and can be equal to 'maintainer-clean'; when that
- ;; happens, we can end up deleting the 'regulatory.bin' file that we
- ;; just built. Thus, build things sequentially.
- #:parallel-build? #f
-
- #:tests? #f ; no tests
#:make-flags
(let ((out (assoc-ref %outputs "out")))
(list (string-append "PREFIX=" out)
- (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")
-
- ;; Leave this empty so that db2bin.py doesn't try to sign
- ;; ‘regulatory.bin’. This allows us to avoid managing a key
- ;; pair for the whole distribution.
- (string-append "REGDB_PRIVKEY=")
- ;; Don't generate a public key for the same reason. These are
- ;; used as Makefile targets and can't be the empty string.
- (string-append "REGDB_PUBCERT=/dev/null")
- (string-append "REGDB_PUBKEY=/dev/null")))))
- (native-inputs
- `(("python" ,python-wrapper)))
+ (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")))))
+ (native-inputs (list openssl ; to verify signature
+ python-wrapper))
(home-page
"https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
(synopsis "Wireless regulatory database")
(description
- "This package contains the wireless regulatory database for the Central
-Regulatory Database Agent (CRDA). The database contains information on
-country-specific regulations for the wireless spectrum.")
+ "This package contains the wireless regulatory database used by the Linux
+cfg80211 subsystem and the legacy Central Regulatory Database Agent (CRDA).
+The database contains information on country-specific regulations for the
+wireless spectrum.")
(license license:isc)))
(define-public lm-sensors
--
2.34.0
next prev parent reply other threads:[~2021-12-25 18:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 21:15 [bug#49649] [PATCH] gnu: Add regulatory.db in %base-firmware Brice Waegeneire
2021-07-20 13:26 ` Ludovic Courtès
2021-07-20 21:02 ` Brice Waegeneire
2021-07-20 21:56 ` Tobias Geerinckx-Rice via Guix-patches via
2021-07-23 9:11 ` Ludovic Courtès
2021-07-23 9:55 ` Tobias Geerinckx-Rice via Guix-patches via
2021-12-25 18:44 ` [bug#49649] [PATCH v2 0/4] Load wireless regulatory database in kernel Brice Waegeneire
2021-12-28 7:15 ` Leo Famulari
2021-12-31 14:29 ` Ludovic Courtès
2022-06-01 20:29 ` [bug#49649] [PATCH] gnu: Add regulatory.db in %base-firmware Ludovic Courtès
2021-12-25 18:44 ` [bug#49649] [PATCH v2 1/4] " Brice Waegeneire
2021-12-25 18:44 ` [bug#49649] [PATCH v2 3/4] gnu: wireless-regdb: Update to 2021.08.28 Brice Waegeneire
2021-12-25 18:44 ` Brice Waegeneire [this message]
2021-12-25 18:44 ` [bug#49649] [PATCH v2 4/4] gnu: crda: Describe it as obsolete Brice Waegeneire
2021-12-25 21:13 ` Leo Famulari
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=20211225184437.9457-1-brice@waegenei.re \
--to=brice@waegenei.re \
--cc=49649@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=me@tobias.gr \
/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).