aboutsummaryrefslogtreecommitdiff
path: root/crn/packages.scm
blob: 99649b6cc2f62c6df82f58a2dc7a23be3a64c7ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Andrew Whatson <whatson@gmail.com>
;;;
;;; This file is NOT part of GNU Guix.
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (crn packages)
  #:use-module ((gnu packages) #:prefix gnu:)
  #:use-module (guix diagnostics)
  #:use-module (guix i18n)
  #:use-module (srfi srfi-1)
  #:export (crn/search-patch
            crn/search-patches
            %patch-path))

(define (crn/search-patch file-name)
  "Search the patch FILE-NAME.  Raise an error if not found."
  (search-path (%patch-path) file-name))
  ;; (or (search-path (%patch-path) file-name)
  ;;     (raise (formatted-message (G_ "~a: patch not found")
  ;;                               file-name))))

(define-syntax-rule (crn/search-patches file-name ...)
  "Return the list of absolute file names corresponding to each
FILE-NAME found in %PATCH-PATH."
  (list (search-path
	 (cons (string-append
		(find (lambda (path) (file-exists? (string-append path "/crn/packages.scm")) %load-path))
		gnu:%patch-path))
	 file-name) ...))

(define %channel-root
  (find (lambda (path)
          (file-exists? (string-append path "/crn/packages.scm")))
        %load-path))

(define %patch-path
  (make-parameter
   (cons
    (string-append %channel-root "/crn/packages/patches")
    (gnu:%patch-path))))