1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2020 Ricardo Wurmus <rekado@elephly.net>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (test-print)
20 #:use-module (guix import print)
21 #:use-module (guix build-system gnu)
22 #:use-module (guix download)
23 #:use-module (guix packages)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module ((gnu packages) #:select (search-patches))
26 #:use-module (srfi srfi-64))
28 (define-syntax-rule (define-with-source object source expr)
31 (define source 'expr)))
35 (define-with-source pkg pkg-source
41 (uri (string-append "file:///tmp/test-"
45 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
46 (build-system (@ (guix build-system gnu) gnu-build-system))
47 (home-page "http://gnu.org")
49 (description "This is a dummy package.")
50 (license license:gpl3+)))
52 (define-with-source pkg-with-inputs pkg-with-inputs-source
58 (uri (string-append "file:///tmp/test-"
62 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
63 (build-system (@ (guix build-system gnu) gnu-build-system))
64 (inputs (list (@ (gnu packages base) coreutils)
65 `(,(@ (gnu packages base) glibc) "debug")))
66 (home-page "http://gnu.org")
68 (description "This is a dummy package.")
69 (license license:gpl3+)))
71 (define-with-source pkg-with-origin-input pkg-with-origin-input-source
77 (uri (list (string-append "file:///tmp/test-"
79 (string-append "http://example.org/test-"
83 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))
84 (patches (search-patches "guile-linux-syscalls.patch"
85 "guile-relocatable.patch"))))
86 (build-system (@ (guix build-system gnu) gnu-build-system))
90 (uri "http://example.org/somefile.txt")
93 "0000000000000000000000000000000000000000000000000000"))))))
94 (home-page "http://gnu.org")
96 (description "This is a dummy package.")
97 (license license:gpl3+)))
99 (define-with-source pkg-with-origin-patch pkg-with-origin-patch-source
105 (uri (string-append "file:///tmp/test-"
109 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))
113 (uri "http://example.org/x.patch")
116 "0000000000000000000000000000000000000000000000000000")))))))
117 (build-system (@ (guix build-system gnu) gnu-build-system))
118 (home-page "http://gnu.org")
120 (description "This is a dummy package.")
121 (license license:gpl3+)))
123 (define-with-source pkg-with-arguments pkg-with-arguments-source
129 (uri (string-append "file:///tmp/test-"
133 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
134 (build-system (@ (guix build-system gnu) gnu-build-system))
136 `(#:disallowed-references (,(@ (gnu packages base) coreutils))))
137 (home-page "http://gnu.org")
139 (description "This is a dummy package.")
140 (license license:gpl3+)))
142 (define-with-source pkg-with-properties pkg-with-properties-source
148 (uri (string-append "file:///tmp/test-"
152 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
154 `((hidden? . #t) (upstream-name "test-upstream")))
155 (build-system (@ (guix build-system gnu) gnu-build-system))
156 (home-page "http://gnu.org")
158 (description "This is a dummy package.")
159 (license license:gpl3+)))
161 (test-equal "simple package"
162 `(define-public test ,pkg-source)
165 (test-equal "package with inputs"
166 `(define-public test ,pkg-with-inputs-source)
167 (package->code pkg-with-inputs))
169 (test-equal "package with origin input"
170 `(define-public test ,pkg-with-origin-input-source)
171 (package->code pkg-with-origin-input))
173 (test-equal "package with origin patch"
174 `(define-public test ,pkg-with-origin-patch-source)
175 (package->code pkg-with-origin-patch))
177 (test-equal "package with arguments"
178 `(define-public test ,pkg-with-arguments-source)
179 (package->code pkg-with-arguments))
181 (test-equal "package with properties"
182 `(define-public test ,pkg-with-properties-source)
183 (package->code pkg-with-properties))