Patch t2 patches to remove upstreamed changes c:

This commit is contained in:
2025-12-24 16:13:09 -06:00
parent 861898b851
commit a9f3860e66

View File

@@ -1,4 +1,4 @@
(define-module (gunit packages linux) (define-module (guint packages linux)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix gexp) #:use-module (guix gexp)
@@ -68,15 +68,23 @@ to enable support for the Apple T2 security chip and related hardware.")
#~(modify-phases #$phases #~(modify-phases #$phases
(add-after 'unpack 'apply-t2-patches (add-after 'unpack 'apply-t2-patches
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(use-modules (guix build utils)) (use-modules (guix build utils)
(let ((patch-dir (assoc-ref inputs "t2-patches"))) (srfi srfi-1))
(let ((patch-files (find-files patch-dir "\\.patch$"))) (let* ((patch-dir (assoc-ref inputs "t2-patches"))
(format #t "Applying ~a T2 patches...~%" (length patch-files)) (all-patches (find-files patch-dir "\\.patch$"))
(for-each (redundant-patches '("1014" "1015" "1016" "4001" "4004" "4006"))
(lambda (patch) (patches-to-apply
(invoke "patch" "-p1" "-i" patch)) (remove (lambda (file)
(sort patch-files string<)) (any (lambda (num) (string-contains file num))
#t)))))) redundant-patches))
((#:kernel-config config) all-patches)))
(format #t "Applying ~a T2 patches (skipping redundant ones)...~%"
(length patches-to-apply))
(for-each
(lambda (patch)
(invoke "patch" "-p1" "-i" patch))
(sort patches-to-apply string<))
#t)))))
((#:kernel-config config)
#~(kernel-config-union #$config #~(kernel-config-union #$config
(kernel-config #:configs (mbp-t2-extra-options)))))))) (kernel-config #:configs (mbp-t2-extra-options))))))))