Commit Graph

1193 Commits (b2c3640d2baa7bc929bf21880e6fb2785f5997f6)

Author SHA1 Message Date
Ludovic Courtès b2c3640d2b
tests: Gracefully skip zlib test when zlib is missing.
* tests/zlib.scm: Use 'test-skip' instead of (exit 77)
when (zlib-available?) returns false.
2019-04-16 17:30:22 +02:00
Ludovic Courtès 4aea820f09
guix build: Fix relative file name canonicalization for '--root'.
Fixes <https://bugs.gnu.org/35271>.
Reported by rendaw <7e9wc56emjakcm@s.rendaw.me>.

* guix/scripts/build.scm (register-root): When ROOT is a relative file
name, append the basename of ROOT, not ROOT itself.
* tests/guix-build.sh: Add test.
2019-04-15 16:57:12 +02:00
Ludovic Courtès bacf980c76
guix gc: Add '--list-roots'.
* guix/scripts/gc.scm (show-help, %options): Add '--list-roots'.
(guix-gc)[list-roots]: New procedure.
Handle '--list-roots'.
* tests/guix-gc.sh: Test it.
* doc/guix.texi (Invoking guix gc): Document it.
2019-04-10 17:09:47 +02:00
Ludovic Courtès 72eda0624b
Add (guix store roots).
* guix/store/roots.scm, tests/store-roots.scm: New files.
* Makefile.am (STORE_MODULES): Add guix/store/roots.scm.
(SCM_TESTS): Add tests/store-roots.scm.
2019-04-10 17:09:47 +02:00
Ludovic Courtès 1ccc0f807d
environment: '-C' creates namespaces where the user is not root.
* guix/scripts/environment.scm (launch-environment/container): Add UID
and GID.  Use them in PASSWD and GROUPS.  Pass them as #:guest-uid and
 #:guest-gid to 'call-with-container'.
* tests/guix-environment-container.sh: Test the inner UID.
In '--user' test, replace hard-coded 0 with 1000.
* doc/guix.texi (Invoking guix environment): Adjust accordingly.
2019-04-02 18:15:37 +02:00
Ludovic Courtès af76c020bf
linux-container: Make the guest UID and GID a parameter.
* gnu/build/linux-container.scm (initialize-user-namespace): Add
 #:guest-uid and #:guest-gid parameters and honor them.
(run-container): Likewise.
(call-with-container): Likewise.
* tests/containers.scm ("call-with-container, user namespace, guest UID/GID"):
New test.
2019-04-02 18:15:37 +02:00
Ludovic Courtès d2be7e3c4b
records: Support custom 'this' identifiers.
This lets record users choose an identifier other than 'this-record'.

* guix/records.scm (make-syntactic-constructor): Add #:this-identifier.
[wrap-field-value]: Honor it.
(define-record-type*): Add form with extra THIS-IDENTIFIER and honor
it.
* tests/records.scm ("define-record-type* & thunked & inherit & custom this"):
New test.
2019-03-30 11:08:39 +01:00
Ludovic Courtès 952afb6f8c
environment: Create /etc/group in containers.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>.

* guix/scripts/environment.scm (launch-environment/container): Create
GROUPS and call 'write-group'.
* tests/guix-environment-container.sh: Test it.
2019-03-26 18:11:52 +01:00
Ludovic Courtès 8a9922bdee
environment: Use (gnu build accounts) for /etc/passwd handling.
* guix/scripts/environment.scm (launch-environment/container): Remove
call to 'mock-passwd'; instantiate a <password-entry> instead.  Call
'write-passwd' to write the pasword database instead of using custom
code.
(mock-passwd): Remove.
* tests/guix-environment-container.sh: Test 'getpwuid'.
2019-03-26 18:11:52 +01:00
Ludovic Courtès cf848cc0a1
accounts: Add default value for the 'home-directory' field of <user-account>.
* gnu/system/accounts.scm (<user-account>)[home-directory]: Mark as
thunked and add a default value.
(default-home-directory): New procedure.
* doc/guix.texi (User Accounts): Remove 'home-directory' from example.
* gnu/system/examples/bare-bones.tmpl: Likewise.
* gnu/system/examples/beaglebone-black.tmpl: Likewise.
* gnu/system/examples/desktop.tmpl: Likewise.
* gnu/system/examples/docker-image.tmpl: Likewise.
* gnu/system/examples/lightweight-desktop.tmpl: Likewise.
* gnu/system/install.scm (installation-os): Likewise.
* gnu/tests.scm (%simple-os): Likewise.
* gnu/tests/install.scm (%minimal-os, %minimal-os-on-vda):
(%separate-home-os, %encrypted-root-os, %btrfs-root-os): Likewise.
* tests/accounts.scm ("allocate-passwd")
("allocate-passwd with previous state"): Likewise.
2019-03-25 23:37:06 +01:00
Ludovic Courtès abd4d6b33d
records: Allow thunked fields to refer to 'this-record'.
* guix/records.scm (this-record): New syntax parameter.
(make-syntactic-constructor)[wrap-field-value]: When F is thunked,
return a one-argument lambda instead of a thunk, and parameterize
THIS-RECORD.
(define-record-type*)[thunked-field-accessor-definition]: Pass X
to (real-get X).
* tests/records.scm ("define-record-type* & thunked & this-record")
("define-record-type* & thunked & default & this-record")
("define-record-type* & thunked & inherit & this-record"): New tests.
2019-03-25 23:37:06 +01:00
Ludovic Courtès 9c2e58564f
tests: Adjust 'guix pack -f squashfs' test.
This is a followup to 427c87d0bd.

* tests/pack.scm ("squashfs-image + localstatedir"): Expect "bin" to be
a relative symlink.
2019-03-24 00:13:53 +01:00
Ludovic Courtès 7b7e4e89c8
tests: Add missing import.
This is a followup to 22f95e028f.

* tests/scripts.scm: Use (guix tests).
2019-03-24 00:13:53 +01:00
Ludovic Courtès 2b81eac01e
graph: Add the 'reverse-bag' graph.
Suggested by Julien Lepiller.

* guix/scripts/graph.scm (%reverse-bag-node-type): New variable.
(%node-types): Add it.
* tests/graph.scm ("reverse bag DAG"): New test.
* doc/guix.texi (Invoking guix graph): Document it.
2019-03-23 18:15:36 +01:00
Ludovic Courtès 845c44012c
guix build: '--with-commit' makes recursive checkouts.
This was an omission from commit
024a6bfba9.

* guix/scripts/build.scm (transform-package-source-commit): Add
'recursive?' field to SOURCE.
* tests/scripts-build.scm ("options->transformation, with-branch")
("options->transformation, with-commit"): New tests.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 14328b81a2
guix build: Transformation options match packages by spec.
This allows us to combine several transformations on a given package, in
particular '--with-git-url' and '--with-branch'.

Previously transformations would ignore each other since they would all
take (specification->package SOURCE) as their replacement source,
compare it by identity, which doesn't work if a previous transformation
has already changed SOURCE.

* guix/scripts/build.scm (evaluate-replacement-specs): Adjust to produce
an alist as expected by 'package-input-rewriting/spec', with a package
spec as the first element of each pair.
(evaluate-git-replacement-specs): Likewise.
(transform-package-inputs):  Adjust accordingly and use
'package-input-rewriting/spec'.
(transform-package-inputs/graft): Likewise.
(transform-package-source-branch, transform-package-source-commit): Use
'package-input-rewriting/spec'.
(transform-package-source-git-url): Likewise, and adjust the
REPLACEMENTS alist accordingly.
(options->transformation): Iterate over OPTS instead of over
%TRANSFORMATIONS.  Invoke transformations one by one.
* tests/scripts-build.scm ("options->transformation, with-input"):
Adjust test to compare packages by name rather than by identity.
("options->transformation, with-git-url + with-branch"): New test.
2019-03-17 22:55:01 +01:00
Ludovic Courtès f258d88628
packages: Add 'package-input-rewriting/spec'.
* guix/packages.scm (package-input-rewriting/spec): New procedure.
* tests/packages.scm ("package-input-rewriting/spec")
("package-input-rewriting/spec, partial match"): New tests.
* doc/guix.texi (Defining Packages): Document it.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 880916ac52
guix build: Add '--with-git-url'.
* guix/scripts/build.scm (%not-equal): New variable.
(evaluate-git-replacement-specs): Use it instead of local variable
'not-equal'.
(transform-package-source-git-url): New procedure.
(%transformations): Add 'with-git-url'.
(%transformation-options, show-transformation-options-help): Add
'--with-git-url'.
* tests/scripts-build.scm ("options->transformation, with-git-url"):
New test.
2019-03-17 22:55:01 +01:00
Ludovic Courtès f0cc5e7e1e
booloader: Add 'invoke/quiet'.
* gnu/build/bootloader.scm (G_): New macro.
(open-pipe-with-stderr, invoke/quiet): New procedures.
* tests/build-utils.scm ("invoke/quiet, success")
("invoke/quiet, failure")
("invoke/quiet, failure, message on stderr"): New tests.
* po/guix/POTFILES.in: Add bootloader.scm.
2019-03-16 18:15:13 +01:00
Ludovic Courtès 22f95e028f
tests: Add 'with-environment-variable'.
* tests/scripts.scm (with-environment-variable): Move to...
* guix/tests.scm (with-environment-variable): ... here.
* tests/build-utils.scm ("wrap-program, one input, multiple calls"):
Use it instead of 'setenv'.
2019-03-16 18:15:09 +01:00
Ludovic Courtès 99aec37a78
pack: "-RR" produces PRoot-enabled relocatable binaries.
* gnu/packages/aux-files/run-in-namespace.c (exec_with_proot): New
function.
(main): When 'clone' fails, call 'rm_rf'.
[PROOT_PROGRAM]: When 'clone' fails, call 'exec_with_proot'.
* guix/scripts/pack.scm (wrapped-package): Add #:proot?.
[proot]: New procedure.
[build]: Compile with -DPROOT_PROGRAM when PROOT? is true.
* guix/scripts/pack.scm (%options): Set the 'relocatable?' value to
'proot when "-R" is passed several times.
(guix-pack): Pass #:proot? to 'wrapped-package'.
* tests/guix-pack-relocatable.sh: Use "-RR" on Intel systems that lack
user namespace support.
* doc/guix.texi (Invoking guix pack): Document -RR.
2019-03-15 23:27:59 +01:00
Ludovic Courtès ec600e4544
Add (gnu build accounts).
* gnu/build/accounts.scm, tests/accounts.scm: New files.
* Makefile.am (SCM_TESTS): Add tests/accounts.scm.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add build/accounts.scm.
2019-03-07 20:05:09 +01:00
Ludovic Courtès dca5821958
environment: Rename '--inherit' to '--preserve'.
Suggested by Eric Bavier and Ricardo Wurmus.

* guix/scripts/environment.scm (show-help, %options): Emit a deprecation
warning for "--inherit" and add -E/--preserve.
* tests/guix-environment.sh: Adjust accordingly.
* doc/guix.texi (Invoking guix environment): Update accordingly.
2019-03-04 15:22:59 +01:00
Ludovic Courtès bab9cc4aff
environment: Remove deprecated -E/--exec option.
* guix/scripts/environment.scm (%options): Remove "--exec", which was
deprecated in commit 1de2fe95e0 in 2015.
* tests/guix-environment.sh: Remove use of '-E'.
2019-03-04 15:22:59 +01:00
Ludovic Courtès 36754eee28
packages: Remove duplicates from package cache.
Previously the same package could appear several times if several
variables were bound to it, as is notably the case for "python"
currently.  This, in turn, would lead to obnoxious "ambiguous package
specification" messages.

* gnu/packages.scm (generate-package-cache)[expand-cache]: Change RESULT
to RESULT+SEEN and adjust accordingly.
Call 'first' on the result of 'fold-module-public-variables*'.
* tests/packages.scm ("fold-available-packages with/without cache"):
Check for lack of duplicates in FROM-CACHE.
2019-02-16 01:00:08 +01:00
Ludovic Courtès e6e599fa01
environment: Add '--inherit'.
* guix/scripts/environment.scm (purify-environment): Add 'white-list'
parameter and honor it.
(create-environment): Add #:white-list parameter and honor it.
(launch-environment): Likewise.
(launch-environment/fork): Likewise.
(show-help, %options): Add '--inherit'.
(guix-environment): Define 'white-list' and pass it to
'launch-environment/fork'.
* tests/guix-environment.sh: Test '--inherit'.
* doc/guix.texi (Invoking guix environment): Document it.
2019-02-16 01:00:08 +01:00
Ludovic Courtès 739380542d
inferior: Add 'inferior-available-packages'.
* guix/inferior.scm (inferior-available-packages): New procedure.
* tests/inferior.scm ("inferior-available-packages"): New test.
2019-02-12 23:30:16 +01:00
Ludovic Courtès 487cbb0164
profiles: Raise an error for unmatched patterns.
Previously, "guix package -r something-not-installed" would silently
complete.  Now an error is raised.

* guix/profiles.scm (&unmatched-pattern-error): New condition type.
(manifest-matching-entries): Rewrite to raise an error when one of
PATTERNS is not matched.
* guix/ui.scm (call-with-error-handling): Handle 'unmatched-pattern-error?'.
* tests/guix-package.sh: Add test.
* tests/profiles.scm ("manifest-matching-entries"): Don't try to remove
unmatched pattern.
("manifest-matching-entries, no match"): New test.
("manifest-transaction-effects"): Remove 'remove' field.
2019-02-07 15:46:45 +01:00
Ludovic Courtès d591242808
daemon: Emit a 'build-succeeded' event in check mode.
Until now, something like "guix build sed -v1 --check" would not get a
'build-succeeded' event, which in turn meant that the spinner would not
be erased upon build completion.

* nix/libstore/build.cc (DerivationGoal::registerOutputs): When
'buildMode' is bmCheck and 'settings.printBuildTrace' emit a
"@ build-succeeded" trace upon success.
* tests/store.scm ("build-succeeded trace in check mode"): New test.
2019-02-06 23:06:18 +01:00
Julien Lepiller 0f4432c620
import: opam: Fix conditions.
* guix/import/opam.scm (condition-eq, condition-neq): The first argument
can be empty.
* tests/opam.scm: Add test case.
2019-02-05 22:33:06 +01:00
Ludovic Courtès ba514b601b
status: Keep track of the current build phase.
* guix/status.scm (<build>)[phase]: New field.
(%phase-start-rx): New variable.
(update-build): Add clause to match %PHASE-START-RX and adjust the
'phase' field accordingly.
* tests/status.scm ("compute-status, build phase"): Add test
2019-02-05 12:03:25 +01:00
Ludovic Courtès a87d66f371
daemon: Rename 'NIX_STATE_DIR' and 'NIX_DB_DIR' environment variables.
Fixes <https://bugs.gnu.org/22459>.
Reported by Jeff Mickey <j@codemac.net>.

* guix/config.scm.in (%state-directory): Change NIX_STATE_DIR to
GUIX_STATE_DIRECTORY.
(%store-database-directory): Change NIX_DB_DIR to
GUIX_DATABASE_DIRECTORY.
* nix/libstore/globals.cc (Settings::processEnvironment): Likewise.
* guix/self.scm (make-config.scm): Likewise.
* build-aux/build-self.scm (make-config.scm): Likewise.
* build-aux/test-env.in: Likewise.
* tests/derivations.scm ("derivation #:leaked-env-vars"): Likewise.
* tests/guix-build.sh (GUIX_DAEMON_SOCKET): Likewise.
* tests/guix-daemon.sh (socket): Likewise.
2019-02-04 00:03:30 +01:00
Ludovic Courtès 73a8681a16
status: Keep track of build completion as reported by build tools.
* guix/status.scm (<build>)[completion]: New field.
(build): Add #:completion parameter.
(%percentage-line-rx, %fraction-line-rx): New variables.
(update-build): New procedure.
(compute-status): Add 'build-log' case.
* tests/status.scm ("compute-status, build completion"): New test.
2019-01-29 12:09:52 +01:00
Ludovic Courtès 976ef2d978
status: Record more information about builds.
* guix/status.scm (<build>): New record type.
(build, matching-build): New procedures.
(compute-status): Adjust to manipulate <build> records instead of
derivation file names in 'build-status-builds-completed' and
'build-status-building'.
(build-event-output-port)[process-line]: Use 'string-split' to preserve
spaces.
* tests/status.scm ("compute-status, builds + substitutes")
("compute-status, missing events"): Adjust to expect <build> records.
Produce complete "build-started" events.
("compute-status, multiplexed build output"): Likewise, and remove
"bar.drv" from 'builds-completed'.
2019-01-29 12:09:52 +01:00
Ludovic Courtès ea6fb108f6
upstream: Temporarily skip failing test.
* tests/upstream.scm ("coalesce-sources same version"): Skip.
2019-01-28 23:13:40 +01:00
Ludovic Courtès 3e223a22a7
packages: Add 'package-closure'.
* guix/packages.scm (package-closure): New procedure.
* tests/packages.scm ("package-closure"): New test.
2019-01-25 14:06:37 +01:00
Ludovic Courtès 2c5ee9bba4
tests: Remove duplicate field initializers.
Fixes a regression introduced in
c2dcff41c2, whereby many tests in
'tests/packages.scm' would trigger a syntax error due to duplicate field
intializers in forms like:

  (dummy-package "foo" (version "0"))

* guix/tests.scm (dummy-package, dummy-origin): Rewrite to inherit from
a base record.  This restores the semantics from before
c2dcff41c2.
* tests/services.scm ("instantiate-missing-services, indirect"): Remove
duplicate 'extensions' field.
2019-01-24 20:47:21 +01:00
Ludovic Courtès c2dcff41c2
records: Detect duplicate field initializers.
* guix/records.scm (report-duplicate-field-specifier): New procedure.
(make-syntactic-constructor): Call it.
* tests/records.scm ("define-record-type* & duplicate initializers"):
New test.

Co-authored-by: Mark H Weaver <mhw@netris.org>
2019-01-22 23:04:05 +01:00
Ludovic Courtès f61e6e5238
tests: Adjust for removal of 'device' field in <bootloader-configuration>.
This is a followup to commit 5f7467f046.

* tests/guix-system.sh: For <bootloader-configuration> records, use
'target' rather than 'device'.
2019-01-21 23:09:55 +01:00
Ludovic Courtès f9e8a12379
store: Rename '&nix-error' to '&store-error'.
* guix/store.scm (&nix-error): Rename to...
(&store-error): ... this, and adjust users.
(&nix-connection-error): Rename to...
(&store-connection-error): ... this, and adjust users.
(&nix-protocol-error): Rename to...
(&store-protocol-error): ... this, adjust users.
(&nix-error, &nix-connection-error, &nix-protocol-error): Define these
condition types and their getters as deprecrated aliases.
* build-aux/run-system-tests.scm, guix/derivations.scm,
guix/grafts.scm, guix/scripts/challenge.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/scripts/offload.scm, guix/serialization.scm,
guix/ssh.scm, guix/tests.scm, guix/ui.scm,
tests/derivations.scm, tests/gexp.scm, tests/guix-daemon.sh,
tests/packages.scm, tests/store.scm, doc/guix.texi: Adjust to use the
new names.
2019-01-21 23:09:55 +01:00
Ludovic Courtès 1fafc383b1
inferior: 'gexp->derivation-in-inferior' honors EXP's load path.
Previously the imported modules and extensions of EXP would be missing
from the load path of 'guix repl'.

* guix/inferior.scm (gexp->derivation-in-inferior)[script]: New
variable.
[trampoline]: Write (primitive-load #$script) to PIPE.  Add #$output.
* tests/channels.scm ("channel-instances->manifest")[depends?]: Check
for requisites rather than direct references.
Adjust callers accordingly.
2019-01-20 17:57:14 +01:00
Ludovic Courtès ed75bdf35c
channels: Don't pull from the same channel more than once.
Previous 'channel-instance->manifest' would call
'latest-channel-derivation', which could trigger another round of
'latest-repository-commit' for no good reason.

* guix/channels.scm (resolve-dependencies): New procedure.
(channel-instance-derivations)[edges]: New variable.
[instance->derivation]: New procedure.
* tests/channels.scm (make-instance): Use 'checkout->channel-instance'
instead of 'channel-instance'.
("channel-instances->manifest"): New test.
2019-01-20 17:57:14 +01:00
Efraim Flashner 3b98522b28
tests: More adjustments to python.scm split.
This is a followup to 44d10b1f72.

* tests/lint.scm: Update imports.
2019-01-20 11:49:10 +02:00
Ludovic Courtès 38b77f3464
profiles: Allow a profile to be added as an entry of another profile.
* guix/build/profiles.scm (build-etc/profile): When 'OUTPUT/etc/profile'
already exists, delete it first.
(build-profile): Likewise for 'OUTPUT/manifest'.
* tests/profiles.scm ("profile in profile"): New test.
2019-01-20 01:42:11 +01:00
Ludovic Courtès 2d17a904ac
tests: Adjust to python.scm split.
This is a followup to 44d10b1f72.

* tests/profiles.scm ("package->manifest-entry, search paths"): Adjust
module name for PYTHON2-MATPLOTLIB.
2019-01-20 01:42:11 +01:00
Ludovic Courtès 9fe3f11398
serialization: 'restore-file' errors out upon non-convertible file names.
Fixes <https://bugs.gnu.org/33603>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/serialization.scm (port-conversion-strategy): New variable.
(restore-file): Parameterize it.
* tests/nar.scm ("restore-file with non-UTF8 locale"): New test.
2019-01-18 17:51:34 +01:00
Ludovic Courtès 0ea939fb79
guix package: '--list-available' can use data from the cache.
* gnu/packages.scm (fold-available-packages): New procedure.
* guix/scripts/package.scm (process-query): Use it instead of
'fold-packages'.
* tests/packages.scm ("fold-available-packages with/without cache"):
New test.
2019-01-15 20:24:09 +01:00
Ludovic Courtès ee8099f5b6
edit: Use 'specification->location' to read information from the cache.
That way 'guix edit' doesn't need to load any package module.

* gnu/packages.scm (find-package-locations, specification->location):
New procedures.
* guix/scripts/edit.scm (package->location-specification): Rename to...
(location->location-specification): ... this.  Expect a location object
instead of a package.
(guix-edit): Use 'specification->location' instead of
'specification->package'.
* tests/packages.scm ("find-package-locations")
("find-package-locations with cache")
("specification->location"): New tests.
2019-01-15 20:24:09 +01:00
Ludovic Courtès 5fbdc9a5aa
channels: Compute a package cache and use it.
* gnu/packages.scm (cache-is-authoritative?, load-package-cache)
(cache-lookup, generate-package-cache): New procedures.
(%package-cache-file): New variable.
(find-packages-by-name): Rename to...
(find-packages-by-name/direct): ... this.
(find-packages-by-name): Rewrite to use the package cache when
'cache-is-authoritative?' returns true.
* tests/packages.scm ("find-packages-by-name + version, with cache")
("find-packages-by-name with cache"): New tests.
* guix/channels.scm (package-cache-file): New procedure.
(%channel-profile-hooks): New variable.
(channel-instances->derivation): Use it in #:hooks.
* guix/scripts/package.scm (build-and-use-profile): Add #:hooks and
honor it.
* guix/scripts/pull.scm (build-and-install): Pass #:hooks to
UPDATE-PROFILE.
2019-01-15 20:24:09 +01:00
Ludovic Courtès 465a0d65ae
guix package: Avoid 'find-newest-available-packages'.
* guix/scripts/package.scm (transaction-upgrade-entry): Use
'find-best-packages-by-name' instead of
'find-newest-available-packages'.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades")
("transaction-upgrade-entry, one upgrade")
("transaction-upgrade-entry, superseded package"): Adjust accordingly.
2019-01-15 20:24:09 +01:00