| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 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))
|
| 27 |
|
| 28 | (define-syntax-rule (define-with-source object source expr)
|
| 29 | (begin
|
| 30 | (define object expr)
|
| 31 | (define source 'expr)))
|
| 32 |
|
| 33 | (test-begin "print")
|
| 34 |
|
| 35 | (define-with-source pkg pkg-source
|
| 36 | (package
|
| 37 | (name "test")
|
| 38 | (version "1.2.3")
|
| 39 | (source (origin
|
| 40 | (method url-fetch)
|
| 41 | (uri (string-append "file:///tmp/test-"
|
| 42 | version ".tar.gz"))
|
| 43 | (sha256
|
| 44 | (base32
|
| 45 | "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
|
| 46 | (build-system (@ (guix build-system gnu) gnu-build-system))
|
| 47 | (home-page "http://gnu.org")
|
| 48 | (synopsis "Dummy")
|
| 49 | (description "This is a dummy package.")
|
| 50 | (license license:gpl3+)))
|
| 51 |
|
| 52 | (define-with-source pkg-with-inputs pkg-with-inputs-source
|
| 53 | (package
|
| 54 | (name "test")
|
| 55 | (version "1.2.3")
|
| 56 | (source (origin
|
| 57 | (method url-fetch)
|
| 58 | (uri (string-append "file:///tmp/test-"
|
| 59 | version ".tar.gz"))
|
| 60 | (sha256
|
| 61 | (base32
|
| 62 | "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
|
| 63 | (build-system (@ (guix build-system gnu) gnu-build-system))
|
| 64 |
|
| 65 | |
| 66 | |
| 67 | |
| 68 | (inputs (list (@ (gnu packages base) coreutils)
|
| 69 | `(,(@ (gnu packages base) gnu-make) "debug")))
|
| 70 |
|
| 71 | (home-page "http://gnu.org")
|
| 72 | (synopsis "Dummy")
|
| 73 | (description "This is a dummy package.")
|
| 74 | (license license:gpl3+)))
|
| 75 |
|
| 76 | (define-with-source pkg-with-origin-input pkg-with-origin-input-source
|
| 77 | (package
|
| 78 | (name "test")
|
| 79 | (version "1.2.3")
|
| 80 | (source (origin
|
| 81 | (method url-fetch)
|
| 82 | (uri (list (string-append "file:///tmp/test-"
|
| 83 | version ".tar.gz")
|
| 84 | (string-append "http://example.org/test-"
|
| 85 | version ".tar.gz")))
|
| 86 | (sha256
|
| 87 | (base32
|
| 88 | "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))
|
| 89 | (patches (search-patches "guile-linux-syscalls.patch"
|
| 90 | "guile-relocatable.patch"))))
|
| 91 | (build-system (@ (guix build-system gnu) gnu-build-system))
|
| 92 | (inputs
|
| 93 | `(("o" ,(origin
|
| 94 | (method url-fetch)
|
| 95 | (uri "http://example.org/somefile.txt")
|
| 96 | (sha256
|
| 97 | (base32
|
| 98 | "0000000000000000000000000000000000000000000000000000"))))))
|
| 99 | (home-page "http://gnu.org")
|
| 100 | (synopsis "Dummy")
|
| 101 | (description "This is a dummy package.")
|
| 102 | (license license:gpl3+)))
|
| 103 |
|
| 104 | (define-with-source pkg-with-origin-patch pkg-with-origin-patch-source
|
| 105 | (package
|
| 106 | (name "test")
|
| 107 | (version "1.2.3")
|
| 108 | (source (origin
|
| 109 | (method url-fetch)
|
| 110 | (uri (string-append "file:///tmp/test-"
|
| 111 | version ".tar.gz"))
|
| 112 | (sha256
|
| 113 | (base32
|
| 114 | "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))
|
| 115 | (patches
|
| 116 | (list (origin
|
| 117 | (method url-fetch)
|
| 118 | (uri "http://example.org/x.patch")
|
| 119 | (sha256
|
| 120 | (base32
|
| 121 | "0000000000000000000000000000000000000000000000000000")))))))
|
| 122 | (build-system (@ (guix build-system gnu) gnu-build-system))
|
| 123 | (home-page "http://gnu.org")
|
| 124 | (synopsis "Dummy")
|
| 125 | (description "This is a dummy package.")
|
| 126 | (license license:gpl3+)))
|
| 127 |
|
| 128 | (define-with-source pkg-with-arguments pkg-with-arguments-source
|
| 129 | (package
|
| 130 | (name "test")
|
| 131 | (version "1.2.3")
|
| 132 | (source (origin
|
| 133 | (method url-fetch)
|
| 134 | (uri (string-append "file:///tmp/test-"
|
| 135 | version ".tar.gz"))
|
| 136 | (sha256
|
| 137 | (base32
|
| 138 | "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
|
| 139 | (build-system (@ (guix build-system gnu) gnu-build-system))
|
| 140 | (arguments
|
| 141 | `(#:disallowed-references (,(@ (gnu packages base) coreutils))))
|
| 142 | (home-page "http://gnu.org")
|
| 143 | (synopsis "Dummy")
|
| 144 | (description "This is a dummy package.")
|
| 145 | (license license:gpl3+)))
|
| 146 |
|
| 147 | (define-with-source pkg-with-properties pkg-with-properties-source
|
| 148 | (package
|
| 149 | (name "test")
|
| 150 | (version "1.2.3")
|
| 151 | (source (origin
|
| 152 | (method url-fetch)
|
| 153 | (uri (string-append "file:///tmp/test-"
|
| 154 | version ".tar.gz"))
|
| 155 | (sha256
|
| 156 | (base32
|
| 157 | "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
|
| 158 | (properties
|
| 159 | `((hidden? . #t) (upstream-name "test-upstream")))
|
| 160 | (build-system (@ (guix build-system gnu) gnu-build-system))
|
| 161 | (home-page "http://gnu.org")
|
| 162 | (synopsis "Dummy")
|
| 163 | (description "This is a dummy package.")
|
| 164 | (license license:gpl3+)))
|
| 165 |
|
| 166 | (test-equal "simple package"
|
| 167 | `(define-public test ,pkg-source)
|
| 168 | (package->code pkg))
|
| 169 |
|
| 170 | (test-equal "package with inputs"
|
| 171 | `(define-public test ,pkg-with-inputs-source)
|
| 172 | (package->code pkg-with-inputs))
|
| 173 |
|
| 174 | (test-equal "package with origin input"
|
| 175 | `(define-public test ,pkg-with-origin-input-source)
|
| 176 | (package->code pkg-with-origin-input))
|
| 177 |
|
| 178 | (test-equal "package with origin patch"
|
| 179 | `(define-public test ,pkg-with-origin-patch-source)
|
| 180 | (package->code pkg-with-origin-patch))
|
| 181 |
|
| 182 | (test-equal "package with arguments"
|
| 183 | `(define-public test ,pkg-with-arguments-source)
|
| 184 | (package->code pkg-with-arguments))
|
| 185 |
|
| 186 | (test-equal "package with properties"
|
| 187 | `(define-public test ,pkg-with-properties-source)
|
| 188 | (package->code pkg-with-properties))
|
| 189 |
|
| 190 | (test-end "print")
|