Commit Graph

3508 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 4f89a8eec6
deduplication: Work around Guile bug in 'seek'.
Fixes <https://bugs.gnu.org/32161>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

This mostly reverts 83099892e0.

* guix/store/deduplication.scm (counting-wrapper-port): New procedure.
(nar-sha256): Use it.
2018-07-20 15:01:33 +02:00
Leo Famulari 82549f2328
build-system/go: Use invoke instead of system*.
* guix/build/go-build-system.scm (unpack, build): Use invoke.
(install-source): Unconditionally return #t.
(check): Use invoke and unconditionally return #t.
2018-07-19 19:12:54 -04:00
Ludovic Courtès 83099892e0
deduplication: Remove 'counting-wrapper-port'.
* guix/store/deduplication.scm (counting-wrapper-port): Remove.
(nar-sha256): Call 'port-position' directly on PORT.
2018-07-19 17:12:48 +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 f5db54eaa5
self: Use the new 'imported-files'.
That way, the source of most nodes is now a content-addressed store item
instead of a derivation.

* guix/self.scm (<file-mapping>): New record type.
(file-mapping-compiler): New procedure.
(scheme-node): Use 'file-mapping' instead of 'imported-files'.
(imported-files): Remove.
2018-07-19 11:48:04 +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 4d20d87b53
gexp: Remove unnecessary 'mlet'.
* guix/gexp.scm (imported-modules): Use 'let' instead of 'mlet'.
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
Christopher Baines 0d354666d3
ruby-build-system: Error or return #t from all phases.
Previously, if the tests didn't pass, the check phase would evaluate to #f,
but the package would be built sucessfully. This changes all the phases to
raise exceptions if errors are encountered, and return #t otherwise.

This involves using invoke rather than system*, so that exceptions are raised
if the program exits with a status other than 0, and also returning #t at the
end of functions.

* gnu/build/ruby-build-system.scm (unpack): Use invoke rather than system*,
and return #t at the end.
(build, check): Use invoke rather than system*.
(install): Remove the use of "and", and rewrite the error handling to raise an
exception.
(wrap): Return #t.
2018-07-15 22:19:39 +01:00
Leo Famulari 27f7cbc91d
utils: Really clean up temporary directories.
Fixes <https://bugs.gnu.org/32126>.

* guix/utils.scm (call-with-temporary-directory): Use DELETE-FILE-RECURSIVELY
instead of RMDIR.
2018-07-13 17:33:45 -04:00
Ludovic Courtès bca302c67a
pull: Display new/upgraded packages upon completion.
* guix/scripts/pull.scm (display-profile-news): New procedure.
(build-and-install): Call it.
(display-new/upgraded-packages): Add #:heading and honor it.
2018-07-13 17:28:40 +02:00
Ludovic Courtès dc733e6a12
pull: Use (guix inferior) to display new and upgraded packages.
* guix/scripts/pull.scm (display-profile-content): Call
'display-generation'.
(display-new/upgraded-packages, display-profile-content-diff): New
procedures.
(process-query)[list-generation]: Remove.
[list-generations]: New procedure.
Adjust accordingly.
* doc/guix.texi (Invoking guix pull): Update example of '-l'.
2018-07-13 17:28:40 +02: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
Oleg Pykhalov ffc3fcade3
git: Call 'url-cache-directory' outside 'update-cached-checkout'.
* guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in
'cache-directory' key argument.
(latest-repository-commit): Call 'url-cache-directory'.
2018-07-13 16:24:48 +03:00
Danny Milosavljevic e29067d22e
import: hackage: Fix typo.
* guix/import/cabal.scm (cabal-custom-setuo-name): Rename to...
(cabal-custom-setup-name): ...this.
2018-07-13 15:23:40 +02:00
Marius Bakke 49b6dc2b4e
Merge branch 'staging' 2018-07-13 00:25:45 +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
Danny Milosavljevic ecba50bb79
import: hackage: Support "-any" and "-none" version comparison operators.
* guix/import/cabal.scm (make-cabal-parser): Modify.
(is-any): New variable.
(is-none): New variable.
(lex-any): New procedure.
(lex-none): New procedure.
(lex-word): Modify.
(eval-cabal): Modify.
2018-07-12 09:06:48 +02:00
Danny Milosavljevic 314b63e0b4
import: hackage: Support "custom-setup" field.
Fixes <https://bugs.gnu.org/23961>.

* guix/import/cabal.scm (make-cabal-parser): Modify.
(is-custom-setup): New variable.
(lex-custom-setup): New procedure.
(is-id): Modify.
(lex-version): Modify.
(<cabal-custom-setup>): New record type.
(eval-cabal): Modify.
(dependencies): Add parameter.
2018-07-12 09:06:48 +02:00
Jan Nieuwenhuizen e8e1f295f1
gexp: Allow bytevector as content of `plain-file'.
This allows for using a package source directly from git, doing something like

    (define (command->bytevector command)
      (let ((port (apply open-pipe* OPEN_READ command)))
        (let ((output (get-bytevector-all port)))
          (close-port port)
          output)))

    (define-public hello-git
      (package
        (name "hello")
        (version "git")
        (source (let* ((commit "stable-2.0")
                       (content (command->bytevector
                                 `("git" "archive" "--format" "tar" "--prefix"
                                   ,(string-append commit "/") ,commit)))
                       (file-name (string-append "hello-" commit)))
                  (plain-file file-name content)))
        ...
        ))

* guix/gexp.scm (<plain-file>): Also allow bytevector content.
(plain-file-compiler): Handle bytevector content.
* doc/guix.texi (G-Expressions): Describe plain-file now also taking
bytevectors.
2018-07-12 06:22:04 +02:00
Jan Nieuwenhuizen f3a422511f
store: Add `binary-file'.
* guix/store.scm (binary-file): New function.
* doc/guix.texi (The Store Monad): Describe binary-file.
2018-07-12 06:22:04 +02:00
Ludovic Courtès daf76c7cd5
gnu-maintenance: Get GNU metadata from rec files.
Suggested by Mike Gerwitz <mtg@gnu.org>.

* guix/gnu-maintenance.scm (%package-list-url): Use the .rec file.
(%package-description-url): Likewise.
(official-gnu-packages)[read-records]: Skip record descriptors.
Rename fields to use underscores instead of hyphens.
2018-07-11 16:07: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
Danny Milosavljevic a59b0fa2d7
build-system/haskell: Make phases fail on error.
* guix/build/haskell-build-system.scm (configure): Make it fail on error.
(run-setuphs): Make it fail on error.
2018-07-11 02:45:53 +02:00
Ludovic Courtès dc013aff81
ui: Fix typo.
* guix/ui.scm (display-profile-content-diff): Fix typo in docstring.
2018-07-11 00:53:04 +02:00
Ludovic Courtès 78d55b703d
profiles: Introduce 'profile-search-paths' and use it.
* guix/profiles.scm (profile-search-paths): New procedure.
* guix/scripts/environment.scm (evaluate-search-paths): Remove.
(create-environment): Replace 'paths' with 'manifest'.  Use
'profile-search-paths' instead of 'evaluate-search-paths'.
(show-search-paths): Likewise.
(launch-environment): Replace 'paths' with 'manifest'.  Make 'pure?' a
keyword parameter.
(launch-environment/fork, launch-environment/container): Likewise.
(guix-environment): Remove 'paths' variable.  Adjust callers of the
above procedures accordingly.
2018-07-11 00:52:36 +02:00
Ludovic Courtès 10f0a40c16
environment: Simplify code by using manifests internally.
* guix/scripts/environment.scm (strip-input-name)
(package+propagated-inputs, package-or-package+output?)
(compact): Remove.
(inputs->profile-derivation): Rename to...
(manifest->derivation): ... this.  Replace 'inputs' parameter with
'manifest'.
(input->manifest-entry): New procedure.
(package-environment-inputs): Rewrite to return a list of manifest
entries.
(options/resolve-packages): Rewrite to return a manifest.
(guix-environment): Remove 'inputs'.  Define 'paths' in terms of
'manifest-search-paths'.
2018-07-11 00:52:36 +02:00
Ludovic Courtès f03df3ee75
profiles: Factorize 'manifest-search-paths'.
* guix/profiles.scm (manifest-search-paths): New procedure.
(profile-derivation)[builder]: Use it.
* guix/build/profiles.scm (build-etc/profile): Remove $PATH.
2018-07-11 00:52:36 +02: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
Marius Bakke 873325b030
Merge branch 'master' into staging 2018-07-08 23:58:22 +02:00
Kyle Meyer 85c3fbf5de
ui: Add -V as short option for --version.
* guix/ui.scm (run-guix): Add -V as the short option for --version for
consistency with most commands.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-07-07 18:10:31 +02:00
Kyle Meyer 7ede577a5f
scripts: Add missing -V option to commands that document it.
* guix/scripts/container.scm (guix-container):
* guix/scripts/import.scm (guix-import):
* guix/scripts/substitute.scm (guix-substitute): Add -V as the short option
for --version to match show-help's description.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-07-07 18:10:31 +02:00
Kyle Meyer 7a369f6d2f
weather: Fix pasto in --version output.
* guix/scripts/weather.scm (%options): Correct the command name passed to
show-version-and-exit.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-07-07 18:10:31 +02:00
Ludovic Courtès 5adb2df0a2
pack: Use guile-for-build for the target system.
Until now, running "guix pack -s i686-linux" on an x86_64-linux machine,
for instance, would use an x86_64 guile for module derivations.  This
was OK until now, but would break when passing "--localstatedir" due to
the introduction of guile-sqlite3: we'd be using the i686 guile-sqlite3
along with the x86_64 guile.

* guix/scripts/pack.scm (guix-pack): Pass the 'system option from OPTS
to 'package-derivation'.
2018-07-05 13:35:21 +02:00
Ludovic Courtès 5b0c648a7c
profiles: 'info-dir-file' hook now produces 'dir.LANG' files.
Previously, entries for 'guix.fr.info' would end up in 'dir', above the
'guix.info' entries; consequently, running 'info guix' would actually
open 'guix.fr.info', which was confusing for non-French readers.

* guix/profiles.scm (info-dir-file)[glibc-utf8-locales]: New variable.
[build](info-file-language): New procedure.
(install-info): Use it, to create 'dir.LANG' files.
Set GUIX_LOCPATH.
2018-07-04 10:52:59 +02:00
Ludovic Courtès 86eee976f5
Revert "packages: Optimize 'package-transitive-supported-systems'."
This reverts commit 24420f5ffa.

This broke 'package-transitive-supported-systems', which would return
the union of supported systems instead of the intersection.
2018-07-03 17:50:04 +02:00
Ludovic Courtès f3f1d0a557
guix system: Make 'init' idempotent again.
This fixes a regression introduced in
df2f6400b1fbc282ef4d6dd7124ea1c17adc23c2: since the new
'register-path' (actually 'reset-timestamps') would make files
read-only, 'delete-file-recursively' would fail to delete them.  Thus,
re-running 'guix system init' on an already-populated store would fail
with a 'delete-file' EPERM.

* guix/scripts/system.scm (copy-item): Use 'lstat' instead of
'file-exists?'.  Call 'make-file-writable' on each directory below
DEST.
2018-07-03 17:50:04 +02:00
Ludovic Courtès 90b144d22d
ui: Report file names in 'system-error' exceptions from 'delete-file'.
* guix/ui.scm (delete-file): New error-reporting wrapper.
2018-07-03 17:50:04 +02:00
Ludovic Courtès e5e5119855
database: 'reset-timestamps' now correctly handles symlinks.
* guix/store/database.scm (reset-timestamps): Use 'utime' with
AT_SYMLINK_NOFOLLOW for symlinks.
2018-07-03 17:50:04 +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 a5b34d9d24
deduplication: Remove 'false-if-system-error', now unused.
* guix/store/deduplication.scm (false-if-system-error): Remove.
2018-07-03 17:50:04 +02:00
Oleg Pykhalov ae6fa00af0
import: elpa: Check if 'fetch-elpa-package' rest argument is null.
* guix/import/elpa.scm (fetch-elpa-package): Check if 'rest' is null.
2018-07-03 07:19:13 +03: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 af2f8ae5f1
deduplication: Fix incorrect use of 'throw'.
* guix/store/deduplication.scm (get-temp-link): In handler, fix call to
'throw'.
2018-07-03 00:39:11 +02:00
Ludovic Courtès 71bf6cb700
guix system: init: Check the available space before copying.
* guix/scripts/system.scm (copy-closure): Call 'query-path-info*' on
TO-COPY and REFS.  Compute the total size.  Call 'check-available-space'.
2018-07-03 00:39:11 +02:00
Ludovic Courtès 8120b23e51
ui: Make 'check-available-space' public.
* guix/ui.scm (check-available-space): Add optional 'directory'
parameter, defaulting to (%store-prefix).  Honor it.  Make public.
2018-07-03 00:39:10 +02:00