chromium-extension: Compute json at argument evaluation time.
* gnu/build/chromium-extension.scm (make-chromium-extension): Make use of the make-signing-key procedure inside the argument field, making sure that it is not evaluated at file-load time. This would otherwise try to resolve gnutls when we can't guarantee it's defined because of dependency cycles. Change-Id: Ia7b13acfbca475c2df073e9a88fc8bb9264dd968master
parent
8f03a51f5c
commit
93ac4c20bf
|
@ -120,12 +120,7 @@ format."
|
||||||
when installed, will make the extension contained in PKG available as a
|
when installed, will make the extension contained in PKG available as a
|
||||||
Chromium browser extension. PKG-OUTPUT specifies which output of PKG to use."
|
Chromium browser extension. PKG-OUTPUT specifies which output of PKG to use."
|
||||||
(let* ((name (package-name pkg))
|
(let* ((name (package-name pkg))
|
||||||
(version (package-version pkg))
|
(version (package-version pkg)))
|
||||||
(private-key (make-signing-key name))
|
|
||||||
(public-key (signing-key->public-der private-key))
|
|
||||||
(checksum (file-sha256sum public-key))
|
|
||||||
(crx (make-crx private-key pkg pkg-output))
|
|
||||||
(json (crx->chromium-json crx version)))
|
|
||||||
(package
|
(package
|
||||||
(inherit pkg)
|
(inherit pkg)
|
||||||
(name (string-append name "-chromium"))
|
(name (string-append name "-chromium"))
|
||||||
|
@ -138,18 +133,24 @@ Chromium browser extension. PKG-OUTPUT specifies which output of PKG to use."
|
||||||
(arguments
|
(arguments
|
||||||
(list #:modules '((guix build utils))
|
(list #:modules '((guix build utils))
|
||||||
#:builder
|
#:builder
|
||||||
#~(begin
|
(let*
|
||||||
(use-modules (guix build utils))
|
((private-key (make-signing-key name))
|
||||||
(define (base16-char->chromium-base16 char)
|
(public-key (signing-key->public-der private-key))
|
||||||
;; Translate CHAR, a hexadecimal character, to a Chromium-style
|
(checksum (file-sha256sum public-key))
|
||||||
;; representation using the letters a-p (where a=0, p=15).
|
(crx (make-crx private-key pkg pkg-output))
|
||||||
(string-ref "abcdefghijklmnop"
|
(json (crx->chromium-json crx version)))
|
||||||
(string-index "0123456789abcdef" char)))
|
#~(begin
|
||||||
(let ((file-name (string-map base16-char->chromium-base16
|
(use-modules (guix build utils))
|
||||||
(string-take #$checksum 32)))
|
(define (base16-char->chromium-base16 char)
|
||||||
(extension-directory
|
;; Translate CHAR, a hexadecimal character, to a Chromium-style
|
||||||
(string-append #$output
|
;; representation using the letters a-p (where a=0, p=15).
|
||||||
"/share/chromium/extensions")))
|
(string-ref "abcdefghijklmnop"
|
||||||
(mkdir-p extension-directory)
|
(string-index "0123456789abcdef" char)))
|
||||||
(symlink #$json (string-append extension-directory "/"
|
(let ((file-name (string-map base16-char->chromium-base16
|
||||||
file-name ".json")))))))))
|
(string-take #$checksum 32)))
|
||||||
|
(extension-directory
|
||||||
|
(string-append #$output
|
||||||
|
"/share/chromium/extensions")))
|
||||||
|
(mkdir-p extension-directory)
|
||||||
|
(symlink #$json (string-append extension-directory "/"
|
||||||
|
file-name ".json"))))))))))
|
||||||
|
|
Reference in New Issue