diff options
Diffstat (limited to 'guix/jd/utils.scm')
-rw-r--r-- | guix/jd/utils.scm | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ | |||
1 | (define-module (jd utils) | ||
2 | #:export (jd-search-patches)) | ||
3 | |||
4 | ;; This code is copied and modified from (gnu packages) module. | ||
5 | |||
6 | (define %jd-patch-path | ||
7 | (make-parameter | ||
8 | (map (lambda (directory) | ||
9 | (let ((jd-patch-dir (string-append directory "/jd/packages/patches"))) | ||
10 | (if (and (file-exists? jd-patch-dir) | ||
11 | (file-is-directory? jd-patch-dir)) | ||
12 | jd-patch-dir | ||
13 | directory))) | ||
14 | %load-path))) | ||
15 | |||
16 | (define (jd-search-patch file-name) | ||
17 | "Search the patch FILE-NAME. Raise an error if not found." | ||
18 | (or (search-path (%jd-patch-path) file-name) | ||
19 | (raise (string-append file-name | ||
20 | ": patch not found")))) | ||
21 | |||
22 | (define-syntax-rule (jd-search-patches file-name ...) | ||
23 | "Return the list of absolute file names corresponding to each | ||
24 | FILE-NAME found in %JD-PATCH-PATH." | ||
25 | (list (jd-search-patch file-name) ...)) | ||