nonguix: binary: Add rpm unpacking
* nonguix/build/binary-build-system.scm (rpm-file?, unpack-rpm): New procedures. (binary-unpack): Use them.
This commit is contained in:
parent
9f06b18aef
commit
bfc86889fa
|
@ -3,6 +3,7 @@
|
|||
;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
|
||||
;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
|
||||
;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
|
||||
;;; Copyright © 2024 Dariqq <dariqq@posteo.net>
|
||||
|
||||
(define-module (nonguix build binary-build-system)
|
||||
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
||||
|
@ -154,6 +155,20 @@ The inputs are optional when the file is an executable."
|
|||
deb-file
|
||||
"debian-binary")))
|
||||
|
||||
(define (rpm-file? binary-file)
|
||||
(string-suffix? ".rpm" binary-file))
|
||||
|
||||
(define (unpack-rpm rpm-file)
|
||||
(invoke "bsdtar" "xvf" rpm-file)
|
||||
(delete-file rpm-file)
|
||||
;; Delete .build-id directories
|
||||
(for-each
|
||||
(lambda (dir)
|
||||
(format #t "Deleting directory ~a~%" dir)
|
||||
(delete-file-recursively dir))
|
||||
(find-files "." (lambda (f stat) (string-suffix? ".build-id" f))
|
||||
#:directories? #t)))
|
||||
|
||||
(define* (binary-unpack #:key source #:allow-other-keys)
|
||||
(let* ((files (filter (lambda (f)
|
||||
(not (string=? (basename f) "environment-variables")))
|
||||
|
@ -164,6 +179,7 @@ The inputs are optional when the file is an executable."
|
|||
(chdir "binary")
|
||||
(match binary-file
|
||||
((? deb-file?) (unpack-deb binary-file))
|
||||
((? rpm-file?) (unpack-rpm binary-file))
|
||||
(_
|
||||
(begin
|
||||
(format #t "Unknown file type: ~a~%" (basename binary-file))
|
||||
|
|
Loading…
Reference in New Issue
Block a user