From e14390858839d7fd56b579d6489ea7bc88a5e530 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sun, 2 Jul 2023 15:36:22 +0200 Subject: Add GNU/Guix config files. --- guix/jd/utils.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 guix/jd/utils.scm (limited to 'guix/jd/utils.scm') diff --git a/guix/jd/utils.scm b/guix/jd/utils.scm new file mode 100644 index 0000000..5be7fa9 --- /dev/null +++ b/guix/jd/utils.scm @@ -0,0 +1,25 @@ +(define-module (jd utils) + #:export (jd-search-patches)) + +;; This code is copied and modified from (gnu packages) module. + +(define %jd-patch-path + (make-parameter + (map (lambda (directory) + (let ((jd-patch-dir (string-append directory "/jd/packages/patches"))) + (if (and (file-exists? jd-patch-dir) + (file-is-directory? jd-patch-dir)) + jd-patch-dir + directory))) + %load-path))) + +(define (jd-search-patch file-name) + "Search the patch FILE-NAME. Raise an error if not found." + (or (search-path (%jd-patch-path) file-name) + (raise (string-append file-name + ": patch not found")))) + +(define-syntax-rule (jd-search-patches file-name ...) + "Return the list of absolute file names corresponding to each +FILE-NAME found in %JD-PATCH-PATH." + (list (jd-search-patch file-name) ...)) -- cgit v1.2.3