Commit | Line | Data |
---|---|---|
233e7676 | 1 | # GNU Guix --- Functional package management for GNU |
5a573139 | 2 | # Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org> |
acc08466 | 3 | # Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> |
0afdc485 | 4 | # |
233e7676 | 5 | # This file is part of GNU Guix. |
0afdc485 | 6 | # |
233e7676 | 7 | # GNU Guix is free software; you can redistribute it and/or modify it |
0afdc485 LC |
8 | # under the terms of the GNU General Public License as published by |
9 | # the Free Software Foundation; either version 3 of the License, or (at | |
10 | # your option) any later version. | |
11 | # | |
233e7676 | 12 | # GNU Guix is distributed in the hope that it will be useful, but |
0afdc485 LC |
13 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License | |
233e7676 | 18 | # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
0afdc485 LC |
19 | |
20 | # | |
e49951eb | 21 | # Test the `guix package' command-line utility. |
0afdc485 LC |
22 | # |
23 | ||
e49951eb | 24 | guix package --version |
0afdc485 | 25 | |
24e262f0 LC |
26 | readlink_base () |
27 | { | |
28 | basename `readlink "$1"` | |
29 | } | |
30 | ||
e25234e3 | 31 | module_dir="t-guix-package-$$" |
0afdc485 | 32 | profile="t-profile-$$" |
db5a9444 LC |
33 | tmpfile="t-guix-package-file-$$" |
34 | rm -f "$profile" "$tmpfile" | |
0afdc485 | 35 | |
b1fb6634 | 36 | trap 'rm -f "$profile" "$profile.lock" "$profile-"[0-9]* "$tmpfile"; rm -rf "$module_dir" t-home-'"$$" EXIT |
7a6548cb | 37 | |
5d4b411f | 38 | # Use `-e' with a non-package expression. |
d8934360 | 39 | ! guix package --bootstrap -e + |
5d4b411f | 40 | |
aa042770 LC |
41 | # Install a store item and make sure the version and output in the manifest |
42 | # are correct. | |
43 | guix package --bootstrap -p "$profile" -i `guix build guile-bootstrap` | |
44 | test "`guix package -A guile-bootstrap | cut -f 1-2`" \ | |
45 | = "`guix package -p "$profile" -I | cut -f 1-2`" | |
46 | test "`guix package -p "$profile" -I | cut -f 3`" = "out" | |
47 | rm "$profile" | |
48 | ||
e49951eb | 49 | guix package --bootstrap -p "$profile" -i guile-bootstrap |
0afdc485 LC |
50 | test -L "$profile" && test -L "$profile-1-link" |
51 | test -f "$profile/bin/guile" | |
52 | ||
d2952326 LC |
53 | # Make sure the profile is a GC root. |
54 | guix gc --list-live | grep "`readlink "$profile-1-link"`" | |
55 | ||
1c67d639 | 56 | # Installing the same package a second time does nothing. |
e49951eb | 57 | guix package --bootstrap -p "$profile" -i guile-bootstrap |
1c67d639 LC |
58 | test -L "$profile" && test -L "$profile-1-link" |
59 | ! test -f "$profile-2-link" | |
60 | test -f "$profile/bin/guile" | |
0afdc485 | 61 | |
5a573139 LC |
62 | # Unsupported packages cannot be installed. |
63 | ! guix package -e '(begin (use-modules (guix) (gnu packages base)) (package (inherit sed) (supported-systems (list))))' -n | |
64 | case $(uname -m) in | |
65 | x86_64|i[3456]86) | |
66 | ! guix package -i novena-eeprom -n | |
67 | break;; | |
68 | *) | |
69 | ! guix package -i intelmetool -n | |
70 | break;; | |
71 | esac | |
72 | ||
477ee222 LC |
73 | # Collisions are properly flagged (in this case, 'g-wrap' propagates |
74 | # guile@2.2, which conflicts with guile@2.0.) | |
d8934360 | 75 | ! guix package --bootstrap -n -p "$profile" -i g-wrap guile@2.0 |
fc95dc4c | 76 | |
477ee222 | 77 | guix package --bootstrap -n -p "$profile" -i g-wrap guile@2.0 \ |
fc95dc4c LC |
78 | --allow-collisions |
79 | ||
5924080d | 80 | # No search path env. var. here. |
dbc31ab2 LC |
81 | guix package -p "$profile" --search-paths |
82 | guix package -p "$profile" --search-paths | grep '^export PATH=' | |
83 | test "`guix package -p "$profile" --search-paths | wc -l`" = 1 # $PATH | |
84 | ( set -e; set -x; \ | |
85 | eval `guix package --search-paths=prefix -p "$PWD/$profile"`; \ | |
86 | test "`type -P guile`" = "$PWD/$profile/bin/guile" ; \ | |
87 | type -P rm ) | |
5924080d | 88 | |
57b86237 | 89 | # Exit with 1 when a generation does not exist. |
d8934360 | 90 | ! guix package -p "$profile" --delete-generations=42 |
57b86237 LC |
91 | |
92 | # Exit with 0 when trying to delete the zeroth generation. | |
93 | guix package -p "$profile" --delete-generations=0 | |
0afdc485 | 94 | |
6447738c | 95 | # Make sure multiple arguments to -i works. |
ccabb664 | 96 | guix package --bootstrap -i guile zile -p "$profile" -n |
6447738c | 97 | |
9518856b | 98 | # Make sure the `:' syntax works. |
ecb1b610 | 99 | guix package --bootstrap -i "glibc:debug" -p "$profile" -n |
9518856b | 100 | |
aa92cf98 | 101 | # Make sure nonexistent outputs are reported. |
e49951eb | 102 | guix package --bootstrap -i "guile-bootstrap:out" -p "$profile" -n |
d8934360 EB |
103 | ! guix package --bootstrap -i "guile-bootstrap:does-not-exist" -p "$profile" -n |
104 | ! guix package --bootstrap -i "guile-bootstrap:does-not-exist" -p "$profile" | |
aa92cf98 | 105 | |
487cbb01 LC |
106 | # Make sure we get an error when trying to remove something that's not |
107 | # installed. | |
d8934360 | 108 | ! guix package --bootstrap -r something-not-installed -p "$profile" |
487cbb01 | 109 | |
64fc89b6 | 110 | # Check whether `--list-available' returns something sensible. |
03f4ef28 | 111 | guix package -p "$profile" -A 'gui.*e' | grep guile |
64fc89b6 | 112 | |
2aa6efb0 | 113 | # Check whether `--show' returns something sensible. |
3ce9aa44 | 114 | guix package --show=guile | grep "^name: guile" |
2aa6efb0 | 115 | |
1b0a86dd | 116 | # Ensure `--show' doesn't fail for packages with non-package inputs. |
5e6feee6 EB |
117 | guix package --show=texlive |
118 | ||
65216315 | 119 | # Fail for non-existent packages or package/version pairs. |
d8934360 EB |
120 | ! guix package --show=does-not-exist |
121 | ! guix package --show=emacs@42 | |
65216315 | 122 | |
1b0a86dd LC |
123 | # Search. |
124 | LC_MESSAGES=C | |
125 | export LC_MESSAGES | |
126 | test "`guix package -s "An example GNU package" | grep ^name:`" = \ | |
127 | "name: hello" | |
128 | test -z "`guix package -s "n0t4r341p4ck4g3"`" | |
129 | ||
db5a9444 LC |
130 | # Search with one and then two regexps. |
131 | # First we get printed circuit boards *and* board games. | |
132 | guix package -s '\<board\>' > "$tmpfile" | |
133 | grep '^name: pcb' "$tmpfile" | |
134 | grep '^name: gnubg' "$tmpfile" | |
135 | ||
136 | # Second we get only board games. | |
137 | guix package -s '\<board\>' -s game > "$tmpfile" | |
138 | grep -v '^name: pcb' "$tmpfile" > /dev/null | |
139 | grep '^name: gnubg' "$tmpfile" | |
140 | ||
141 | rm -f "$tmpfile" | |
142 | ||
0fb40579 LC |
143 | # Make sure deprecated packages don't show up: <https://bugs.gnu.org/30566>. |
144 | mkdir "$module_dir" | |
145 | cat > "$module_dir/foo.scm"<<EOF | |
146 | (define-module (foo) | |
147 | #:use-module (guix packages) | |
148 | #:use-module (gnu packages base)) | |
149 | ||
150 | (define-public deprecated | |
151 | (deprecated-package "fileutils" coreutils)) | |
152 | EOF | |
153 | ||
154 | guix build -L "$module_dir" -e '(@ (foo) deprecated)' -n | |
155 | test "`guix package -L "$module_dir" -s ^fileutils$ | grep ^name:`" = "" | |
156 | ||
157 | rm -rf "$module_dir" | |
158 | ||
1b0a86dd LC |
159 | # Make sure `--search' can display all the packages. |
160 | guix package --search="" > /dev/null | |
161 | ||
d7ddb257 LC |
162 | # There's no generation older than 12 months, so the following command should |
163 | # have no effect. | |
164 | generation="`readlink_base "$profile"`" | |
d8934360 | 165 | ! guix package -p "$profile" --delete-generations=12m |
d7ddb257 LC |
166 | test "`readlink_base "$profile"`" = "$generation" |
167 | ||
d26eb84d LC |
168 | # The following command should not delete the current generation, even though |
169 | # it matches the given pattern (see <http://bugs.gnu.org/19978>.) And since | |
170 | # there's nothing else to delete, it should just fail. | |
171 | guix package --list-generations -p "$profile" | |
d8934360 | 172 | ! guix package --bootstrap -p "$profile" --delete-generations=1.. |
d26eb84d LC |
173 | test "`readlink_base "$profile"`" = "$generation" |
174 | ||
c9323a4c LC |
175 | # Make sure $profile is a GC root at this point. |
176 | real_profile="`readlink -f "$profile"`" | |
d8934360 | 177 | ! guix gc -d "$real_profile" |
c9323a4c LC |
178 | test -d "$real_profile" |
179 | ||
180 | # Now, let's remove all the symlinks to $real_profile, and make sure | |
181 | # $real_profile is no longer a GC root. | |
182 | rm "$profile" "$profile"-[0-9]-link | |
183 | guix gc -d "$real_profile" | |
184 | [ ! -d "$real_profile" ] | |
185 | ||
494dc2fc LC |
186 | # Package transformations. |
187 | ||
188 | # Make sure we get the right version number when using '--with-source'. | |
189 | mkdir "$module_dir" | |
190 | emacs_tarball="$module_dir/emacs-42.5.9rc7.tar.gz" | |
191 | touch "$emacs_tarball" | |
192 | guix package -p "$profile" -i emacs --with-source="$emacs_tarball" -n \ | |
193 | 2> "$tmpfile" | |
c136da3f | 194 | grep -E 'emacs[[:blank:]]+42\.5\.9rc7' "$tmpfile" |
494dc2fc LC |
195 | rm "$emacs_tarball" "$tmpfile" |
196 | rmdir "$module_dir" | |
197 | ||
8e1907a7 LC |
198 | # Install with package transformations. |
199 | guix install --bootstrap -p "$profile" sed --with-input=sed=guile-bootstrap | |
200 | grep "sed=guile-bootstrap" "$profile/manifest" | |
201 | test "$(readlink -f "$profile/bin/guile")" \ | |
202 | = "$(guix build guile-bootstrap)/bin/guile" | |
203 | test ! -f "$profile/bin/sed" | |
204 | ||
205 | # Make sure the package transformation is preserved. | |
206 | guix package --bootstrap -p "$profile" -u | |
207 | grep "sed=guile-bootstrap" "$profile/manifest" | |
208 | test "$(readlink -f "$profile/bin/guile")" \ | |
209 | = "$(guix build guile-bootstrap)/bin/guile" | |
210 | test ! -f "$profile/bin/sed" | |
211 | rm "$profile" "$profile"-[0-9]-link | |
212 | ||
bc6e291e LC |
213 | # Profiles with a relative file name. Make sure we don't create dangling |
214 | # symlinks--see bug report at | |
215 | # <https://lists.gnu.org/archive/html/guix-devel/2018-07/msg00036.html>. | |
216 | mkdir -p "$module_dir/foo" | |
217 | ( cd "$module_dir" ; \ | |
218 | guix package --bootstrap -i guile-bootstrap -p foo/prof ) | |
219 | test -f "$module_dir/foo/prof/bin/guile" | |
220 | rm "$module_dir/foo"/* | |
221 | rmdir "$module_dir/foo" | |
222 | rmdir "$module_dir" | |
494dc2fc | 223 | |
67668155 | 224 | # |
0ec1af59 | 225 | # Try with the default profile. |
67668155 | 226 | # |
0ec1af59 LC |
227 | |
228 | XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" | |
229 | export XDG_CACHE_HOME | |
88371f0d | 230 | HOME="$PWD/t-home-$$" |
0ec1af59 LC |
231 | export HOME |
232 | ||
233 | mkdir -p "$HOME" | |
234 | ||
59c51be2 LC |
235 | # Get the canonical directory name so that 'guix package' recognizes it. |
236 | HOME="`cd $HOME; pwd -P`" | |
237 | ||
e49951eb | 238 | guix package --bootstrap -i guile-bootstrap |
0ec1af59 LC |
239 | test -L "$HOME/.guix-profile" |
240 | test -f "$HOME/.guix-profile/bin/guile" | |
24e262f0 | 241 | |
d9307267 LC |
242 | # Move to the empty profile. |
243 | default_profile="`readlink "$HOME/.guix-profile"`" | |
244 | for i in `seq 1 3` | |
245 | do | |
d2952326 LC |
246 | # Make sure the current generation is a GC root. |
247 | profile_link="`readlink "$default_profile"`" | |
248 | guix gc --list-live | grep "`readlink "$profile_link"`" | |
249 | ||
e49951eb | 250 | guix package --bootstrap --roll-back |
d9307267 LC |
251 | ! test -f "$HOME/.guix-profile/bin" |
252 | ! test -f "$HOME/.guix-profile/lib" | |
bc6e291e | 253 | test "`readlink "$default_profile"`" = "`basename $default_profile-0-link`" |
d9307267 | 254 | done |
3b9c0020 | 255 | |
88371f0d LC |
256 | # Check whether '-p ~/.guix-profile' makes any difference. |
257 | # See <http://bugs.gnu.org/17939>. | |
d8934360 EB |
258 | ! test -e "$HOME/.guix-profile-0-link" |
259 | ! test -e "$HOME/.guix-profile-1-link" | |
88371f0d | 260 | guix package --bootstrap -p "$HOME/.guix-profile" -i guile-bootstrap |
d8934360 | 261 | ! test -e "$HOME/.guix-profile-1-link" |
88371f0d | 262 | guix package --bootstrap --roll-back -p "$HOME/.guix-profile" |
d8934360 | 263 | ! test -e "$HOME/.guix-profile-0-link" |
88371f0d | 264 | |
3b9c0020 | 265 | # Extraneous argument. |
d8934360 | 266 | ! guix package install foo-bar |
1a43e4dc LC |
267 | |
268 | # Make sure the "broken pipe" doesn't yield an error. | |
269 | # Note: 'pipefail' is a Bash-specific option. | |
270 | set -o pipefail || true | |
271 | guix package -A g | head -1 2> "$HOME/err1" | |
272 | guix package -I | head -1 2> "$HOME/err2" | |
273 | test "`cat "$HOME/err1" "$HOME/err2"`" = "" | |
300868ba LC |
274 | |
275 | # Make sure '-L' extends the package module search path. | |
300868ba | 276 | mkdir "$module_dir" |
300868ba LC |
277 | |
278 | cat > "$module_dir/foo.scm"<<EOF | |
279 | (define-module (foo) | |
280 | #:use-module (guix packages) | |
281 | #:use-module (gnu packages emacs)) | |
282 | ||
283 | (define-public x | |
284 | (package (inherit emacs) | |
285 | (name "emacs-foo-bar") | |
cc346931 | 286 | (version "42.77.0"))) |
300868ba LC |
287 | EOF |
288 | ||
289 | guix package -A emacs-foo-bar -L "$module_dir" | grep 42 | |
1b846da8 | 290 | guix package -i emacs-foo-bar@42 -n -L "$module_dir" |
8689901f LC |
291 | |
292 | # Same thing using the 'GUIX_PACKAGE_PATH' environment variable. | |
293 | GUIX_PACKAGE_PATH="$module_dir" | |
294 | export GUIX_PACKAGE_PATH | |
295 | guix package -A emacs-foo-bar | grep 42 | |
1b846da8 | 296 | guix package -i emacs-foo-bar@42 -n |
ee06af5b | 297 | |
002d17dc RV |
298 | # Make sure GUIX_PACKAGE_PATH/'-L' takes precedence in case of duplicate packages. |
299 | cat > "$module_dir/bar.scm"<<EOF | |
300 | (define-module (bar) | |
301 | #:use-module (guix packages)) | |
302 | ||
303 | (define-public hello | |
304 | (package (inherit (@@ (gnu packages base) hello)) | |
305 | (synopsis "an overridden version of GNU hello"))) | |
306 | EOF | |
307 | ||
308 | guix package -i hello -n 2>&1 | grep choosing.*bar.scm | |
309 | ( unset GUIX_PACKAGE_PATH; \ | |
310 | guix package -i hello -n -L "$module_dir" 2>&1 | grep choosing.*bar.scm ) | |
311 | ||
ee06af5b LC |
312 | # Make sure patches that live under $GUIX_PACKAGE_PATH are found. |
313 | cat > "$module_dir/emacs.patch"<<EOF | |
314 | This is a fake patch. | |
315 | EOF | |
316 | cat > "$module_dir/foo.scm"<<EOF | |
317 | (define-module (foo) | |
318 | #:use-module (guix packages) | |
319 | #:use-module (gnu packages) | |
320 | #:use-module (gnu packages emacs)) | |
321 | ||
322 | (define-public x | |
323 | (package (inherit emacs) | |
324 | (source (origin (inherit (package-source emacs)) | |
325 | (patches (list (search-patch "emacs.patch"))))) | |
326 | (name "emacs-foo-bar-patched") | |
cc346931 | 327 | (version "42.42.42"))) |
5763ad92 LC |
328 | |
329 | (define-public y | |
330 | (package (inherit emacs) | |
331 | (name "super-non-portable-emacs") | |
332 | (supported-systems '("foobar64-hurd")))) | |
ee06af5b LC |
333 | EOF |
334 | guix package -i emacs-foo-bar-patched -n | |
335 | ||
223d7939 LC |
336 | # Same when -L is used. |
337 | ( unset GUIX_PACKAGE_PATH; \ | |
338 | guix package -L "$module_dir" -i emacs-foo-bar-patched -n ) | |
339 | ||
0d279400 DT |
340 | # Make sure installing from a file works. |
341 | cat > "$module_dir/package.scm"<<EOF | |
342 | (use-modules (gnu)) | |
343 | (use-package-modules bootstrap) | |
344 | ||
345 | %bootstrap-guile | |
346 | EOF | |
347 | guix package --bootstrap --install-from-file="$module_dir/package.scm" | |
348 | ||
f9c04003 LC |
349 | # Make sure an error is raised if the file doesn't return a package. |
350 | cat > "$module_dir/package.scm"<<EOF | |
351 | (use-modules (gnu packages base)) | |
352 | ||
353 | (define my-package coreutils) ;returns *unspecified* | |
354 | EOF | |
d8934360 | 355 | ! guix package --bootstrap --install-from-file="$module_dir/package.scm" |
f9c04003 LC |
356 | |
357 | rm "$module_dir/package.scm" | |
358 | ||
5763ad92 LC |
359 | # This one should not show up in searches since it's no supported on the |
360 | # current system. | |
361 | test "`guix package -A super-non-portable-emacs`" = "" | |
362 | test "`guix package -s super-non-portable-emacs | grep ^systems:`" = "systems: " | |
363 | ||
fc8fdcf5 LC |
364 | # Don't upgrade packages marked for removal: <http://bugs.gnu.org/27262>. |
365 | guix package --bootstrap -p "$profile" -i guile-bootstrap | |
366 | ||
367 | cat > "$module_dir/foo.scm"<<EOF | |
368 | (define-module (foo) | |
369 | #:use-module (guix) | |
370 | #:use-module (gnu packages bootstrap)) | |
371 | ||
372 | (define-public x | |
373 | (package (inherit %bootstrap-guile) (version "42"))) | |
374 | EOF | |
375 | ||
376 | guix package --bootstrap -p "$profile" -r guile-bootstrap -u guile | |
377 | test ! -f "$profile/bin/guile" | |
378 | guix package --bootstrap -p "$profile" --roll-back | |
379 | test -f "$profile/bin/guile" | |
380 | rm "$profile-2-link" | |
381 | ||
847391fe DP |
382 | unset GUIX_PACKAGE_PATH |
383 | ||
fc8fdcf5 | 384 | |
847391fe | 385 | # Using 'GUIX_BUILD_OPTIONS'. |
847391fe | 386 | available="`guix package -A | sort`" |
442a6ff5 | 387 | GUIX_BUILD_OPTIONS="--dry-run --no-grafts" |
847391fe DP |
388 | export GUIX_BUILD_OPTIONS |
389 | ||
390 | # Make sure $GUIX_BUILD_OPTIONS is not simply appended to the command-line, | |
391 | # which would break 'guix package -A' and similar. | |
392 | available2="`guix package -A | sort`" | |
393 | test "$available2" = "$available" | |
394 | guix package -I | |
1b676447 | 395 | |
442a6ff5 LC |
396 | # Restore '--no-grafts', which makes sure we don't end up building stuff when |
397 | # '--dry-run' is passed. | |
398 | GUIX_BUILD_OPTIONS="--no-grafts" | |
1b676447 | 399 | |
90ea8b16 LC |
400 | # Install using the "imperative model", export a manifest, instantiate it, and |
401 | # make sure we get the same profile. | |
402 | guix package --bootstrap -i guile-bootstrap --without-tests=foo | |
403 | profile_directory="$(readlink -f "$default_profile")" | |
404 | guix package --export-manifest > "$tmpfile" | |
405 | grep 'without-tests.*foo' "$tmpfile" | |
406 | guix package --rollback --bootstrap | |
407 | guix package --bootstrap -m "$tmpfile" | |
408 | test "$(readlink -f "$default_profile")" = "$profile_directory" | |
409 | guix package --export-manifest > "$tmpfile.2nd" | |
410 | cmp "$tmpfile" "$tmpfile.2nd" | |
411 | ||
412 | rm -f "$tmpfile.2nd" | |
413 | guix package --rollback --bootstrap | |
414 | ||
5f1087c4 | 415 | # Applying a manifest file. |
1b676447 DT |
416 | cat > "$module_dir/manifest.scm"<<EOF |
417 | (use-package-modules bootstrap) | |
418 | ||
419 | (packages->manifest (list %bootstrap-guile)) | |
420 | EOF | |
421 | guix package --bootstrap -m "$module_dir/manifest.scm" | |
422 | guix package -I | grep guile | |
423 | test `guix package -I | wc -l` -eq 1 | |
9fd7b050 LC |
424 | |
425 | # Export a manifest, instantiate it, and make sure we get the same profile. | |
426 | profile_directory="$(readlink -f "$default_profile")" | |
427 | guix package --export-manifest > "$tmpfile" | |
428 | guix package --rollback --bootstrap | |
429 | guix package --bootstrap -m "$tmpfile" | |
430 | test "$(readlink -f "$default_profile")" = "$profile_directory" | |
431 | ||
811b21fb LC |
432 | guix package --rollback --bootstrap |
433 | ||
bf9206d8 LC |
434 | # Applying two manifests. |
435 | cat > "$module_dir/manifest2.scm"<<EOF | |
436 | (use-modules (gnu packages bootstrap) (guix)) | |
437 | (define p (package (inherit %bootstrap-guile) (name "eliug"))) | |
438 | (packages->manifest (list p)) | |
439 | EOF | |
440 | guix package --bootstrap \ | |
441 | -m "$module_dir/manifest.scm" -m "$module_dir/manifest2.scm" | |
442 | guix package -I | grep guile | |
443 | guix package -I | grep eliug | |
444 | test `guix package -I | wc -l` -eq 2 | |
445 | guix package --rollback --bootstrap | |
446 | ||
811b21fb LC |
447 | # Applying a manifest file with inferior packages. |
448 | cat > "$module_dir/manifest.scm"<<EOF | |
449 | (use-modules (guix inferior)) | |
450 | ||
451 | (define i | |
452 | (open-inferior "$abs_top_srcdir" #:command "scripts/guix")) | |
453 | ||
454 | (let ((guile (car (lookup-inferior-packages i "guile-bootstrap")))) | |
455 | (packages->manifest (list guile))) | |
456 | EOF | |
457 | guix package --bootstrap -m "$module_dir/manifest.scm" | |
458 | guix package -I | grep guile | |
459 | test `guix package -I | wc -l` -eq 1 | |
5f1087c4 LC |
460 | |
461 | # Error reporting. | |
462 | cat > "$module_dir/manifest.scm"<<EOF | |
463 | (use-package-modules bootstrap) | |
464 | (packages->manifest | |
465 | (list %bootstrap-guile | |
466 | wonderful-package-that-does-not-exist)) | |
467 | EOF | |
468 | if guix package --bootstrap -n -m "$module_dir/manifest.scm" \ | |
469 | 2> "$module_dir/stderr" | |
470 | then false | |
471 | else | |
472 | cat "$module_dir/stderr" | |
524c9800 | 473 | grep "manifest.scm:[1-4]:.*wonderful-package.*: unbound variable" \ |
5f1087c4 LC |
474 | "$module_dir/stderr" |
475 | fi | |
387e6b9e CM |
476 | |
477 | # Verify that package outputs are included in search results. | |
478 | rm -rf "$module_dir" | |
479 | mkdir "$module_dir" | |
480 | cat > "$module_dir/foo.scm"<<EOF | |
481 | (define-module (foo) | |
482 | #:use-module (guix packages) | |
483 | #:use-module (guix build-system trivial)) | |
484 | ||
485 | (define-public dummy-package | |
486 | (package | |
487 | (name "dummy-package") | |
488 | (version "dummy-version") | |
489 | (outputs '("out" "dummy-output")) | |
490 | (source #f) | |
3972dc5d | 491 | ;; Without a real build system, the "guix package -s" command will fail. |
387e6b9e CM |
492 | (build-system trivial-build-system) |
493 | (synopsis "dummy-synopsis") | |
494 | (description "dummy-description") | |
495 | (home-page "https://dummy-home-page") | |
496 | (license #f))) | |
497 | EOF | |
498 | guix package -L "$module_dir" -s dummy-output > /tmp/out | |
499 | test "`guix package -L "$module_dir" -s dummy-output | grep ^name:`" = "name: dummy-package" | |
500 | rm -rf "$module_dir" | |
3972dc5d LC |
501 | |
502 | # Make sure we can see user profiles. | |
503 | guix package --list-profiles | grep "$profile" | |
504 | guix package --list-profiles | grep '\.guix-profile' | |
b1fb6634 JL |
505 | |
506 | # Make sure we can properly lock a profile. | |
507 | mkdir "$module_dir" | |
dac7928d LC |
508 | echo "(open-output-file \"$module_dir/ready\") (sleep 60)" \ |
509 | > "$module_dir/manifest.scm" | |
b1fb6634 JL |
510 | guix package -m "$module_dir/manifest.scm" -p "$module_dir/profile" & |
511 | pid=$! | |
dac7928d | 512 | while [ ! -f "$module_dir/ready" ] ; do sleep 0.5 ; done |
b1fb6634 JL |
513 | if guix install emacs -p "$module_dir/profile"; then kill $pid; false; else true; fi |
514 | kill $pid |