Commit Graph

1055 Commits (e4752118691e41ae8307649d1abfd4739b3e4bfa)

Author SHA1 Message Date
Ludovic Courtès e475211869
database: Reset timestamps to one second after the Epoch.
Previously, store items registered in the database by this code (for
instance, store items retrieved by 'guix offload' and passed to
'restore-file-set') would have an mtime of 0 instead of 1.

This would cause problems for things like .go files: Guile would
consider them to be older than the corresponding .scm file, and
consequently it would ignore them and possibly use another (incorrect)
.go file.

Reported by Ricardo Wurmus.

* guix/store/database.scm (reset-timestamps): Pass 1, not 0, to
'utime'.
* tests/store-database.scm ("register-path"): Check the mtime of FILE
and REF.
2018-07-20 15:01:33 +02:00
Ludovic Courtès c71cd4a61f
hash: sha256 port now implements 'port-position'.
* guix/hash.scm (open-sha256-port)[position]: New variable.
[get-position]: New procedure.
Pass it to 'make-custom-binary-output-port'.
* tests/hash.scm ("open-sha256-port, hello"): Test 'port-position'.
2018-07-19 17:08:53 +02:00
Ludovic Courtès e529d46828
gexp: 'imported-files/derivation' can copy files instead of symlinking.
* guix/gexp.scm (imported-files/derivation): Add #:symlink? and honor
it.
(imported-files): Pass #:symlink? to 'imported-files/derivation'.
* tests/gexp.scm ("imported-files with file-like objects"): Add 'file=?'
and use it instead of calling 'readlink'.
2018-07-19 11:48:04 +02:00
Ludovic Courtès 8df2eca6b0
gexp: 'imported-files' no longer creates a derivation by default.
* guix/gexp.scm (gexp->derivation): Add #:import-creates-derivation?.
Pass #:derivation? to 'imported-modules' and 'compiled-modules'.  In -L
argument, check whether MODULES is a derivation.
(%not-slash): New variable.
(file-mapping->tree): New procedure.
(imported-files): Rename to...
(imported-files/derivation): ... this.
(imported-files): New procedure.  Rewrite in terms of
'interned-file-tree' when possible; add #:derivation? parameter.
(imported-modules, compiled-modules): Add #:derivation? parameter and
pass it to 'imported-files'.
* guix/packages.scm (patch-and-repack): Pass
 #:import-creates-derivation? to 'gexp->derivation'.
* tests/gexp.scm ("imported-files"): Adjust to no longer expect a
derivation.
2018-07-19 11:48:04 +02:00
Ludovic Courtès 7f11efbac7
store: Add 'add-file-tree-to-store'.
* guix/store.scm (%not-slash): New variable.
(add-file-tree-to-store, interned-file-tree): New procedures.
* tests/store.scm ("add-file-tree-to-store"): New test.
2018-07-19 11:48:04 +02:00
Ludovic Courtès b94b698d4e
serialization: Add 'write-file-tree'.
* guix/serialization.scm (write-contents-from-port): New procedure.
(write-contents): Write in terms of 'write-contents-from-port'.
(filter/sort-directory-entries, write-file-tree): New procedures.
(write-file): Rewrite in terms of 'write-file-tree'.
* tests/nar.scm ("write-file-tree + restore-file"): New test.
2018-07-19 11:48:04 +02:00
Leo Famulari 92bcccc51f
tests: Don't rely on temporary directories being permanent.
* tests/gexp.scm ("gexp->script #:module-path",
"program-file #:module-path"): Use run-with-store.
2018-07-13 17:33:45 -04:00
Ludovic Courtès 2ca299caf6
Add (guix inferior) and (guix scripts repl).
* guix/inferior.scm, guix/scripts/repl.scm, tests/inferior.scm: New
files.
* Makefile.am (MODULES): Add 'guix/scripts/repl.scm' and
'guix/inferior.scm'.
(SCM_TESTS): Add 'tests/inferior.scm'.
* doc/guix.texi (Invoking guix repl): New node.
2018-07-13 17:28:39 +02:00
Ludovic Courtès bc6e291ef0
guix package: Use relative symlinks to generations.
Reported by Roel Janssen <roel@gnu.org>
at <https://lists.gnu.org/archive/html/guix-devel/2018-07/msg00036.html>.

* guix/profiles.scm (switch-to-generation): Use (basename generation) as
the symlink target.
* guix/scripts/package.scm (build-and-use-profile): Likewise,
use (basename name) as the symlink target.
* tests/guix-package.sh: Adjust --roll-back test accordingly.  Add
explicitly test with '-p foo/prof'.
2018-07-13 17:28:39 +02:00
Danny Milosavljevic e39a44f340
import: hackage: Evaluate "-any" and "-none" version comparison operators.
* guix/import/cabal.scm (eval-cabal): Modify.
* tests/hackage.scm (test-cabal-4): New variable and test.
(test-cabal-5): New variable and test.
(test-cabal-6): New variable and test.
2018-07-12 20:35:04 +02:00
Oleg Pykhalov 88388766f7
import: gem: Add recursive import.
* doc/guix.texi (Invoking guix import): Document gem recursive import.
* guix/import/gem.scm (gem->guix-package): Return package and dependencies
values.
(gem-recursive-import): New procedure.
* guix/scripts/import/gem.scm (show-help, %options): Add recursive option.
(guix-import-gem): Use 'gem-recursive-import'.
* tests/gem.scm (test-json): Rename to 'test-foo-json'.
("gem->guix-package"): Use 'test-foo-json'.
(test-bar-json, test-bundler-json): New variables.
("gem-recursive-import"): New test.
2018-07-11 07:08:54 +03:00
Julien Lepiller b24443bff9
guix: Add opam importer.
* guix/scripts/import.scm (importers): Add opam.
* guix/scripts/import/opam.scm: New file.
* guix/import/opam.scm: New file.
* tests/opam.scm: New file.
* Makefile.am: Add them.
* doc/guix.texi (Invoking guix import): Document it.
2018-07-10 10:11:01 +02:00
Ludovic Courtès ee75e80c05
tests: Skip 'guix-pack.sh'.
This works around a regression introduced in commit
66e9944e07 while waiting for a proper fix.

* tests/guix-pack.sh: Add "exit 77".
2018-07-05 21:35:55 +02:00
Ludovic Courtès 25c7ff6a3e
syscalls: Define AT_SYMLINK_NOFOLLOW et al.
* guix/build/syscalls.scm (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR)
(AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH): New variables.
* tests/syscalls.scm ("utime with AT_SYMLINK_NOFOLLOW"): New test.
2018-07-03 17:50:04 +02:00
Ludovic Courtès 3dbf331942
deduplication: Place link files under /gnu/store/.links.
Previously they'd always be placed next to TO-REPLACE, which would lead
to EPERM in some cases.

* guix/store/deduplication.scm (replace-with-link): Add #:swap-directory
parameter and honor it.  Add call to 'make-file-writable'.  Catch
'system-error' around 'rename-file'.
(deduplicate): Pass #:swap-directory and remove uses of
'false-if-system-error'.
* tests/store-deduplication.scm ("deduplicate"): Add 'chmod' call.
2018-07-03 00:39:11 +02:00
Ludovic Courtès 68a58775e0
system: Mapped devices needed for boot do not yield Shepherd services.
Fixes <https://bugs.gnu.org/31889>.
Reported by Taylan Kammer <taylanbayirli@gmail.com>.

* gnu/system.scm (non-boot-file-system-service)[mapped-devices-for-boot]:
New variable.
Remove dependencies of FS that are members of MAPPED-DEVICES-FOR-BOOT.
(mapped-device-user): Rename to...
(mapped-device-users): ... this.  Use 'filter' instead of 'find'.
(operating-system-user-mapped-devices)
(operating-system-boot-mapped-devices): Use 'any
file-system-needed-for-boot?' instead of looking at the first user.
* tests/system.scm ("non-boot-file-system-service"): New test.
2018-06-21 23:54:15 +02:00
Ludovic Courtès ea0a06cee2
Remove 'guix-register' and its traces.
* Makefile.am (SH_TESTS): Remove tests/guix-register.sh.
* build-aux/pre-inst-env.in (GUIX_REGISTER): Remove.
* gnu/build/install.scm (directives): Remove outdated comment.
* gnu/build/vm.scm (root-partition-initializer): Update comment.
* gnu/packages/package-management.scm (guix-register): Remove.
* guix/config.scm.in (%sbindir, %guix-register-program): Remove.
* guix/scripts/system.scm (install): Adjust docstring.
* guix/self.scm (make-config.scm): Remove #:guix.  Do not generate
%sbindir and %guix-register-program.
(specification->package): Remove "guix".
* nix/guix-register/guix-register.cc: Remove.
* nix/libstore/store-api.cc (decodeValidPathInfo): Remove.
* nix/libstore/store-api.hh (decodeValidPathInfo): Remove declaration.
* nix/local.mk (sbin_PROGRAMS, guix_register_SOURCES)
(guix_register_CPPFLAGS, guix_register_LDFLAGS): Remove.
* tests/guix-register.sh: Remove.
2018-06-14 11:17:00 +02:00
Ludovic Courtès df2f6400b1
store: Remove 'register-path'.
* guix/store.scm (register-path): Remove.
* guix/nar.scm: Use (guix store database).
* guix/scripts/system.scm: Likewise.
* tests/store-database.scm: Remove #:hide (register-path).
* tests/store.scm ("register-path"): Remove.
2018-06-14 11:17:00 +02:00
Ludovic Courtès ef1297e8c7
database: 'sqlite-register' takes a database, not a file name.
* guix/store/database.scm (sqlite-register): Remove #:db-file and add
'db' parameter.  Remove #:schema and 'parameterize'.
(register-path): Wrap 'sqlite-register' call in 'with-database' and in
'parameterize'.
* tests/store-database.scm ("new database")
("register-path with unregistered references"): Adjust accordingly.
2018-06-14 11:17:00 +02:00
Ludovic Courtès 0d0438ed8c
deduplicate: Fix a couple of thinkos.
* guix/store/deduplication.scm (get-temp-link): Turn 'args' in the 'catch'
handler into a rest argument.
(deduplicate): Use 'lstat' instead of 'file-is-directory?' to properly
handle symlinks.  When iterating over the result of 'scandir', exclude
the ".links" sub-directory.
* tests/store-deduplication.scm ("deduplicate"): Create sub-directories
and call 'deduplicate' directly on STORE.
2018-06-14 11:16:59 +02:00
Ludovic Courtès 6892f0a247
store-copy: 'read-reference-graph' returns a list of records.
The previous implementation of 'read-reference-graph' was good enough
for many use cases, but it discarded the graph structure, which is
useful information in some cases.

* guix/build/store-copy.scm (<store-info>): New record type.
(read-reference-graph): Rewrite to return a list of <store-info>.
(closure-size, populate-store): Adjust accordingly.
* gnu/services/base.scm (references-file): Adjust accordingly.
* gnu/system/vm.scm (system-docker-image): Likewise.
* guix/scripts/pack.scm (squashfs-image, docker-image): Likewise.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Likewise.
2018-06-14 11:16:58 +02:00
Ludovic Courtès f8f9f7cabc
database: Fail registration when encountering unregistered references.
* guix/store/database.scm (add-reference-sql): Remove nested SELECT.
(add-references): Expect REFERENCES to be a list of ids.
(sqlite-register): Call 'path-id' for each of REFERENCES and pass it to
'add-references'.
* tests/store-database.scm ("register-path with unregistered references"):
New test.
2018-06-14 11:16:58 +02:00
Ludovic Courtès 3931c76154
database: 'with-database' can now initialize new databases.
* nix/libstore/schema.sql: Rename to...
* guix/store/schema.sql: ... this.
* Makefile.am (nobase_dist_guilemodule_DATA): Add it.
* nix/local.mk (%D%/libstore/schema.sql.hh): Adjust accordingly.
* guix/store/database.scm (sql-schema): New variable.
(sqlite-exec, initialize-database, call-with-database): New procedures.
(with-database): Rewrite in terms of 'call-with-database'.
* tests/store-database.scm ("new database"): New test.
* guix/self.scm (compiled-guix)[*core-modules*]: Add 'schema.sql' to
 #:extra-files.
2018-06-14 11:16:58 +02:00
Ludovic Courtès c423ae8918
packages: Add 'package-patched-vulnerabilities'.
* guix/packages.scm (patch-file-name): New procedure.
(%vulnerability-regexp): New variable.
(package-patched-vulnerabilities): New procedure.
* guix/scripts/lint.scm (patch-file-name): Remove.
(check-vulnerabilities): Adjust to use
'package-patched-vulnerabilities'.
* tests/packages.scm ("package-patched-vulnerabilities"): New test.
2018-06-09 12:02:28 +02:00
Ludovic Courtès 477ee222aa
tests: Adjust 'guix package' test to "python2" name.
This is a followup to a7714d42de, which
renamed Python 2.x to "python2".

* tests/guix-package.sh: Use g-wrap and guile@2.0 when testing
collisions.
2018-06-06 14:37:35 +02:00
Ludovic Courtès a99b0ad785
tests: Adjust graph test.
This is a followup to 301a424906, which
added a dependency to sed.

* tests/graph.scm ("node-edges"): Use 'hello', not 'sed', as the example
of a package without any dependency.
2018-06-06 14:37:35 +02:00
Ludovic Courtès a13c1bf4ca
Merge branch 'master' into core-updates 2018-06-01 23:41:40 +02:00
Caleb Ristvedt bf5bf5778c
Add (guix store deduplication).
* guix/store/database.scm (register-path): Add #:deduplicate? and call
'deduplicate' when it's true.
(counting-wrapper-port, nar-sha256): Move to...
* guix/store/deduplication.scm: ... here.  New file.
* tests/store-deduplication.scm: New file.
* Makefile.am (STORE_MODULES): Add deduplication.scm.
(SCM_TESTS) [HAVE_GUILE_SQLITE3]: Add store-deduplication.scm.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2018-06-01 15:35:54 +02:00
Caleb Ristvedt 7f9d184d9b
Add (gnu store database).
* guix/config.scm.in (%store-database-directory): New variable.
* guix/store/database.scm: New file.
* tests/store-database.scm: New file.
* Makefile.am (STORE_MODULES): New variable.
(MODULES, MODULES_NOT_COMPILED): Adjust accordingly.
(SCM_TESTS) [HAVE_GUILE_SQLITE3]: Add tests/store-database.scm.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2018-06-01 15:35:32 +02:00
Ludovic Courtès 838e17d805
gexp: Add 'with-extensions'.
* guix/gexp.scm (<gexp>)[extensions]: New field.
(gexp-attribute): New procedure.
(gexp-modules): Write in terms of 'gexp-attribute'.
(gexp-extensions): New procedure.
(gexp->derivation): Add #:effective-version.
[extension-flags]: New procedure.
Honor extensions of EXP.
(current-imported-extensions): New syntax parameter.
(with-extensions): New macro.
(gexp): Honor CURRENT-IMPORTED-EXTENSIONS.
(compiled-modules): Add #:extensions and honor it.
(load-path-expression): Likewise.
(gexp->script, gexp->file): Honor extensions.
* tests/gexp.scm (%extension-package): New variable.
("gexp-extensions & ungexp")
("gexp-extensions & ungexp-splicing")
("gexp-extensions and literal Scheme object")
("gexp->derivation & with-extensions")
("program-file & with-extensions"): New tests.
* doc/guix.texi (G-Expressions): Document 'with-extensions'.
2018-06-01 15:20:54 +02:00
Ludovic Courtès ccc951cab3
pack: Adjust test to expect relative symlinks.
Reported by Chris Marusich <cmmarusich@gmail.com>.
Fixes <https://bugs.gnu.org/31560>.

* tests/pack.scm ("self-contained-tarball"): Rename 'guile' to 'bin'.
Expect 'bin/Guile' to be a relative symlink.
2018-06-01 15:17:41 +02:00
Ricardo Wurmus 44057a461b
tests: Fix arguments in pack test.
This is a follow-up to commit 5ffac538aa.

* tests/pack.scm (self-contained-tarball): Adjust arguments to
"self-contained-tarball".
2018-06-01 14:18:31 +02:00
Ricardo Wurmus a82eefe65a
tests: Fix arguments in pack test.
This is a follow-up to commit 5ffac538aa.

* tests/pack.scm (self-contained-tarball): Adjust arguments to
"self-contained-tarball".
2018-05-30 09:55:28 +02:00
Mark H Weaver 82b695b834
Merge branch 'master' into core-updates 2018-05-28 20:45:37 -04:00
Ludovic Courtès 9ceeca0880
system: Remove uses of the 'title' field of <file-system>.
* gnu/system/install.scm (installation-os): Remove uses of the 'title'
field of 'file-system'; use 'file-system-label' as appropriate.
* gnu/system/vm.scm (system-disk-image, system-qemu-image): Likewise.
* gnu/tests.scm (%simple-os): Likewise.
* gnu/tests/install.scm (%minimal-os, %minimal-extlinux-os)
(%minimal-os-on-vda, %separate-home-os, %separate-store-os)
(%raid-root-os, %encrypted-root-os, %btrfs-root-os): Likewise.
* gnu/build/shepherd.scm (default-mounts)[tmpfs]: Likewise.
* tests/guix-system.sh: Likewise.
* tests/system.scm (%root-fs): Likewise.
("operating-system-boot-mapped-devices, implicit dependency"): Likewise.
2018-05-28 13:24:19 +02:00
Mark H Weaver 9d10a63402
Merge branch 'master' into core-updates 2018-05-24 02:34:08 -04:00
Ludovic Courtès 7874bbbb9f
records: Insert record type ABI checks in constructors.
* guix/records.scm (print-record-abi-mismatch-error): New procedure.
<top level>: Add 'set-exception-printer!' call.
(current-abi-identifier, abi-check): New procedures.
(make-syntactic-constructor): Add #:abi-cookie parameter.  Insert calls
to 'abi-check'.
(define-record-type*)[compute-abi-cookie]: New procedure.
Use it and emit a definition of the 'current-abi-identifier' for TYPE.
* tests/records.scm ("ABI checks"): New test.
2018-05-23 10:21:02 +02:00
Mark H Weaver 0661758e13
Merge branch 'master' into core-updates 2018-05-21 13:22:32 -04:00
Ludovic Courtès 263c9941a1
uuid: 'uuid' returns #f when 'string->uuid' returns #f.
* gnu/system/uuid.scm (uuid): When STR is not a literal, return #f when
'string->uuid' returns #f.
* tests/uuid.scm ("uuid, dynamic value"): New test.
2018-05-19 00:14:52 +02:00
Ludovic Courtès ce9e684b83
tests: Skip 'tests/guix-pack.sh' when networking is missing.
The test could fail because "static-binaries.tar.xz" is missing, for
instance.

* tests/guix-pack.sh: Require a network connection to be on the safe
side.  This reverts part of 47a60325ca.
2018-05-19 00:14:51 +02:00
Ludovic Courtès 7acdecec99
tests: Adjust to new "unbound variable" messages.
This is a followup to 2d2f98efb3.

* tests/guix-system.sh: Adjust regexps to match "error:".
2018-05-19 00:14:51 +02:00
Mark H Weaver 539bf8f2c0
Merge branch 'master' into core-updates 2018-05-17 01:00:50 -04:00
Ludovic Courtès 437f62f02a
utils: Add 'version-prefix?'.
* guix/utils.scm (version-prefix?): New procedure.
* tests/utils.scm ("version-prefix?"): New test.
2018-05-13 13:29:27 +02:00
Ludovic Courtès 47a60325ca
pack: Add '--relocatable'.
* gnu/packages/aux-files/run-in-namespace.c: New file.
* Makefile.am (AUX_FILES): Add it.
* guix/scripts/pack.scm (<c-compiler>): New record type.
(c-compiler, bootstrap-c-compiler, c-compiler-compiler): New procedures.
(self-contained-tarball): Use
'relative-file-name' for the SOURCE -> TARGET symlink.
(docker-image): Add 'defmod' to please Geiser.
(wrapped-package, map-manifest-entries): New procedures.
(%options, show-help): Add --relocatable.
(guix-pack): Honor it.
2018-05-10 14:53:57 +02:00
Ludovic Courtès e00ade3fb8
profiles: Optionally use relative file names for symlink targets.
* guix/build/union.scm (symlink-relative): New procedure.
* guix/build/profiles.scm: Re-export it.
(build-profile): Add #:symlink and pass it to 'union-build'.
* guix/profiles.scm (profile-derivation): Add #:relative-symlinks?.
Pass #:symlink to 'build-profile'.
* tests/profiles.scm ("profile-derivation relative symlinks, one entry")
("profile-derivation relative symlinks, two entries"): New tests.
2018-05-10 14:53:57 +02:00
Ludovic Courtès dac1c97d13
union: Add 'relative-file-name'.
* guix/build/union.scm (%not-slash): New variable.
(relative-file-name): New procedure.
* tests/union.scm (test-relative-file-name): New macro and tests.
2018-05-10 14:53:56 +02:00
Chris Marusich ede121de42
guix: Separate the package name and version with "@", not "-".
* guix/packages.scm (package-full-name): By default, use "@" to separate
  the package name and package version.  Add an optional delimiter
  argument so that there is still a way to explicitly use a different
  delimiter.
* gnu/packages/commencement.scm (gcc-boot0) <unpack-gmp&co>: Adjust
  accordingly.
* tests/graph.scm: Adjust accordingly.
* tests/profiles.scm: Adjust accordingly.
* NEWS: Mention the change.

Fixes: <https://bugs.gnu.org/31088>.
Reported by Pierre Neidhardt <ambrevar@gmail.com>.
2018-05-08 21:55:46 -07:00
Mark H Weaver aedc6e9fc9
Merge branch 'master' into core-updates 2018-05-08 18:45:39 -04:00
Ludovic Courtès d26727a143
pack: Fix handling of '-e'.
Fixes a regression introduced in
aad16cc196.
Reported by Julien Lepiller.

* guix/scripts/pack.scm (guix-pack)[manifest-from-args]: In
'match-lambda', add clause for single packages.
* tests/guix-pack.sh: Add test for '-e'.
2018-05-07 14:04:19 +02:00
Ludovic Courtès aad16cc196
pack: Honor package transformation options.
Previously they would silently be ignored.

* guix/scripts/pack.scm (guix-pack)[manifest-from-args]: Add 'store'
parameter.  Call 'options->transformation' and use it.
Move 'with-store' and 'parameterize' around the 'let'.
* tests/guix-pack.sh: Add test using '--with-source'.
2018-05-07 10:46:07 +02:00