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