Commit Graph

4245 Commits (67fb53c0d8fe6880c2ee3c8bc1c66e297ba00cf7)

Author SHA1 Message Date
Ludovic Courtès 7c9fbf3e3d
derivations: Update 'build-derivations' docstring.
This is a followup to 7c690a4738.

* guix/derivations.scm (build-derivations): Update docstring.
2019-07-02 18:33:51 +02:00
Maxim Cournoyer 4b60ab8c00
import: pypi: Preserve package name case when forming pypi-uri.
Fixes <https://bugs.gnu.org/33046>.

* guix/build-system/python.scm (pypi-uri): Update the host URI to
"files.pythonhosted.org".
* guix/import/pypi.scm (make-pypi-sexp): Preserve the package name case when
the source URL calls for it.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer a537620054
import: pypi: Update the host URI.
* guix/build-system/python.scm (pypi-uri): Update the host URI to
"files.pythonhosted.org".
2019-07-02 10:08:00 +09:00
Maxim Cournoyer d514276b93
import: pypi: Include optional test inputs as native-inputs.
* guix/import/pypi.scm (maybe-inputs): Add INPUT-TYPE argument, and use it.
(test-section?): New predicate.
(parse-requires.txt): Collect the optional test inputs, and return them as the
second element of the returned list.
(parse-wheel-metadata): Likewise.
(guess-requirements): Adapt.
(make-pypi-sexp): Likewise, and include the test inputs requirements as native
inputs in the returned package expression.

* tests/pypi.scm (test-requires.txt): Include a test section in the
test-requires.txt data.
(test-requires.txt-beaker): New variable.
("parse-requires.txt"): Adapt.
("parse-requires.txt - Beaker"): New test.
("parse-wheel-metadata, with extras"): Adapt.
("parse-wheel-metadata, with extras - Jedi"): Adapt.
("pypi->guix-package, no wheel"): Re-indent, and add the expected
native-inputs.
("pypi->guix-package, wheels"): Likewise.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer f801c6215d
import: pypi: Completely mute the output of the "unzip" command.
* guix/import/pypi.scm (guess-requirements): Completely mute the output of the
"unzip" command.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer 73e8373060
import: pypi: Fix typo in docstring.
* guix/import/pypi.scm (guess-requirements): Fix typo.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer f0190a5dcd
import: pypi: Parse wheel METADATA instead of metadata.json.
With newer Wheel releases, there is no more metadata.json file; the METADATA
file should be used instead (see: https://github.com/pypa/wheel/issues/195).

This change updates our PyPI importer so that it uses the latter.

* guix/import/pypi.scm (define-module): Remove unnecessary modules and export
the PARSE-WHEEL-METADATA procedure.
(parse-wheel-metadata): Add procedure.
(guess-requirements): Use it.
* tests/pypi.scm (test-metadata): Test it.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer c799ad7276
import: pypi: Support more types of archives.
This change enables the PyPI importer to look for requirements in a source
archive of a different type than "tar.gz" or "tar.bz2".  Also, scan the source
archive to find a requires.txt file.

* guix/import/pypi.scm: (guess-requirements)[tarball-directory]: Remove procedure.
[guess-requirements-from-source]: Use COMRESSED-FILE? to determine if an
archive type is supported, and some file extension logic that chooses either
"tar" or "unzip" as the extractor.  Search for the requires.txt file in the
archive instead of using a static, expected location.
(guess-requirements): Rename the TARBALL argument to ARCHIVE, to denote the
archive format is no longer bound specifically to the Tar format.
(compute-inputs): Likewise.
* tests/pypi.scm ("pypi->guix-package, no wheel"): Mock the requires.txt at a
non-standard location.
("pypi->guix-package, no usable requirement file."): New test.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer cc9a77cd39
import: pypi: Deduplicate requirements.
* guix/import/pypi.scm (parse-requires.txt): Remove potential duplicates.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer 803fb336d6
import: pypi: Improve parsing of requirement specifications.
The previous solution was fragile and could leave unwanted characters in a
requirement name, such as '[' or ']'.

Partially fixes <https://bugs.gnu.org/33047>.

* guix/import/pypi.scm (use-modules): Export SPECIFICATION->REQUIREMENT-NAME
(%requirement-name-regexp): New variable.
(clean-requirement): Rename to...
(specification->requirement-name): this, which now uses
%requirement-name-regexp to select the requirement name from the requirement
specification.
(parse-requires.txt): Adapt.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer c4797121be
import: pypi: Do not parse optional requirements from source.
* guix/import/pypi.scm: Export PARSE-REQUIRES.TXT.
(clean-requirement): Move procedure to the top level.
(guess-requirements): Move the READ-REQUIREMENTS procedure to the top level,
and rename it to PARSE-REQUIRES.TXT.  Move the CLEAN-REQUIREMENT procedure to
the top level.  Move the COMMENT? functions inside the PARSE-REQUIRES.TXT
procedure.
(parse-requires.txt): Add a SECTION-HEADER? predicate, and use it to prevent
parsing optional requirements.

* tests/pypi.scm (test-requires-with-sections): New variable.
("parse-requires.txt, with sections"): New test.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer 01589acc5e
import: pypi: Do not consider requirements.txt files.
PyPI packages are mandated to have a setup.py file, which contains a listing
of the required dependencies.  The setuptools/distutils machinery embed
metadata in the archives they produce, which contains this information. There
is no need nor gain to collect the requirements from a "requirements.txt"
file, as it is not the true record of dependencies for PyPI packages and may
contain extraneous requirements or not exist at all.

* guix/import/pypi.scm (guess-requirements): Update comment.
[guess-requirements-from-source]: Do not attempt to parse the file
requirements.txt.  Streamline logic.
* tests/pypi.scm (test-requires.txt): Rename from test-requirements, to hint
at the file being tested.
("pypi->guix-package"): Adapt so that the fake package contains a requires.txt
file rather than a requirements.txt file.
("pypi->guix-package, wheels"): Likewise.
2019-07-02 10:07:59 +09:00
Ivan Petkov 022288ba53
guix: import: crate: fix redundant inputs list nesting
* guix/import/crate.scm (maybe-cargo-inputs): Remove one level of lists.
* guix/import/crate.scm (maybe-cargo-development-inputs): Same.
* tests/crate.scm: (crate->guix-package)[package]<#:arguments>: Remove
one level of list nesting.
2019-06-30 09:01:27 -07:00
Tobias Geerinckx-Rice 87a90486ca
download: Remove hydra from content-addressed URL list
* guix/build/download-nar.scm (urls-for-item): Remove
mirror.hydra.gnu.org.
* guix/download.scm (%content-addressed-mirrors): Likewise.
2019-06-29 14:31:23 +02:00
Tobias Geerinckx-Rice 3a8bfebed9
etc: Remove hydra.gnu.org.pub key.
* etc/substitutes/hydra.gnu.org.pub: Delete file.
* guix/self.scm (miscellaneous-files): Don't install it.
* Makefile.am (dist_pkgdata_DATA): Remove it.
* gnu/services/base.scm (%default-authorized-guix-keys): Likewise.
(hydra-key-authorization): Rename to…
(substitute-key-authorization): …this.  Adjust only call site.
2019-06-29 14:27:22 +02:00
Ludovic Courtès 08c95ba28d
ui: 'show-derivation-outputs' accepts <derivation-input> records.
* guix/ui.scm (show-derivation-outputs): Handle <derivation-input>
records.
2019-06-27 11:14:42 +02:00
Ludovic Courtès d38d4ffa10
ui: 'show-what-to-build' accepts derivation inputs.
This is a followup to f8a9f99cd6.

* guix/ui.scm (show-what-to-build)[inputs]: New variables.
[substitutable-info]: Build the derivation list from INPUTS.
Pass INPUTS to 'derivation-build-plan'.
2019-06-27 11:14:42 +02:00
Ludovic Courtès 7c690a4738
derivations: 'build-derivations' can be passed derivation inputs.
* guix/derivations.scm (build-derivations): Accept <derivation-input>
records among DERIVATIONS.
* tests/derivations.scm ("build-derivations with specific output"): Test
it.
2019-06-27 11:14:41 +02:00
Ludovic Courtès fd951cd543
derivations: 'derivation' preserves pointer equality.
* guix/derivations.scm (derivation): Check if FILE is already in
%DERIVATION-CACHE and return it if it is.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 5cf4b26d52
derivations: <derivation-input> now aggregates a <derivation>.
Consequently, the whole graph of <derivation> object is readily
available without having to go through 'read-derivation-from-file',
which could have cache misses if the requested <derivation> object had
been GC'd in the meantime.  This is an important property for the
performance of things like 'derivation-build-plan' that traverse the
derivation graph.

* guix/derivations.scm (<derivation-input>): Replace 'path' field by
'derivation'.
(derivation-input-path): Adjust accordingly.
(derivation-input-key): New procedure.
(derivation-input-output-paths): Adjust accordingly.
(coalesce-duplicate-inputs): Likewise.
(derivation-prerequisites): Use 'derivation-input-key' to compute keys
for INPUT-SET.
(derivation-build-plan): Likewise.
(read-derivation): Add optional 'read-derivation-from-file' parameter.
[make-input-drvs]: Call it.
(write-derivation)[write-input]: Adjust to new <derivation-input>.
(derivation/masked-inputs): Likewise, and remove redundant
'coalesce-duplicate-inputs' call.
(derivation)[input->derivation-input]: Change to consider only the
derivation case.  Update call to 'make-derivation-input'.
[input->source]: New procedure.
Separate sources from inputs.
(map-derivation): Adjust to new <derivation-input>.
* tests/derivations.scm ("parse & export"): Pass a second argument to
'read-derivation'.
("build-expression->derivation and derivation-prerequisites")
("derivation-prerequisites and valid-derivation-input?"): Adjust to new
<derivation-input>.
2019-06-27 11:14:41 +02:00
Ludovic Courtès a250061986
graph: Use 'derivation-input-derivation'.
* guix/scripts/graph.scm (derivation-dependencies): Use
'derivation-input-derivation'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 9844d0091e
ui: 'show-what-to-build' uses 'derivation-build-plan'.
* guix/ui.scm (show-what-to-build)[build-or-substitutable?]: Remove.
Use 'derivation-build-plan' instead of
'derivation-prerequisites-to-build', passing it all of DRV at once, and
remove 'fold2' shenanigans and postprocessing of BUILD.
2019-06-27 11:14:41 +02:00
Ludovic Courtès ba04f80e2e
derivations: Rewrite and replace 'derivations-prerequisites-to-build'.
The new 'derivation-build-plan' procedure has a more appropriate
signature: it takes a list of <derivation-inputs> instead of taking one
<derivation>.  Its body is also much simpler.

* guix/derivations.scm (derivation-build-plan): New procedure.
(derivation-prerequisites-to-build): Express in terms of
'derivation-build-plan' and mark as deprecated.
* tests/derivations.scm: Change 'derivation-prerequisites-to-build'
tests to 'derivation-build-plan' and adjust accordingly.
2019-06-27 11:14:41 +02:00
Ludovic Courtès c89985d91d
derivations: Add 'derivation-input'.
* guix/derivations.scm (derivation-input): New procedure.
* tests/grafts.scm (make-derivation-input): Remove.
("graft-derivation, unused outputs not depended on"): Use
'derivation-input'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 4311cf965c
ui: Add 'display-search-results' and use it.
* guix/ui.scm (display-search-results): New procedure.
* guix/scripts/package.scm (find-packages-by-description): Remove
'unzip2' call and return a list of pairs.
(process-query): Change to use 'display-search-results'.
* guix/scripts/system/search.scm (find-service-types): Remove 'unzip2'
call and return a list of pairs.
(guix-system-search): Use 'display-search-results'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 4593f5a654
syscalls: Add 'terminal-rows'.
* guix/build/syscalls.scm (terminal-dimension): New procedure.
(terminal-columns): Rewrite in terms of 'terminal-dimension'.
(terminal-rows): New procedure.
* tests/syscalls.scm ("terminal-rows"): New test.
2019-06-27 11:14:40 +02:00
Ludovic Courtès 8874faaaac
ui: 'relevance' considers regexps connected with a logical and.
* guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
doesn't match.
* tests/ui.scm ("package-relevance"): New test.
2019-06-27 11:14:40 +02:00
Ludovic Courtès 77c2899cd4
compile: Enable 'shadowed-toplevel' warning.
* guix/build/compile.scm (%warnings): Add 'shadowed-toplevel'.
2019-06-25 17:41:24 +02:00
Ludovic Courtès b6f5339dd0
progress: Call 'time-difference' on times of the same type.
Guile 2.2.5 and 2.9.2 would catch the issue.
This is a followup to 88bc3c89bf.

* guix/progress.scm (display-download-progress)[elapsed]: Pass
'current-time' the same type as START-TIME.
2019-06-24 23:10:13 +02:00
Ludovic Courtès bb11825f35
publish: Work around Guile 2.2.5 (web server) bug.
* guix/scripts/publish.scm: Replace (@@ (web http) read-header-line) on
Guile 2.2.5.
2019-06-24 17:50:08 +02:00
Ludovic Courtès 92359aed40
guix build: '--log-file' no longer returns several log files.
Fixes a regression introduced in
9353b199c1 whereby something like:

  guix build --log-file $(guix build -d guile)

would return two log files.  This led to a failure of 'tests/guix-build.sh'.

* guix/scripts/build.scm (guix-build): Filter out derivation file names
from ITEMS.
2019-06-23 19:53:03 +02:00
Ludovic Courtès 0f2d9c3290
guix build: Use 'warning' for warnings.
* guix/scripts/build.scm (options->derivations): Use 'warning' instead
of 'format'.
2019-06-23 19:53:03 +02:00
Giovanni Biscuolo 78407a27cf
licenses: Add Historical Permission Notice and Disclaimer license
* gnu/licenses.scm (hpnd): New variable.
2019-06-20 18:24:49 +02:00
Robert Vollmert 3149c00264
utils: canonical-newline-port: Fix handling of carriage return at buffer end.
Prior to this change the added test fails for me locally at byte
1024. It might depend on some default buffer sizes.

Fixes <https://bugs.gnu.org/35863>.

* tests/utils.scm ("canonical-newline-port-1024"): Add test.
* guix/utils.scm (canonical-newline-port): Correct comments on CR/LF.
Remove CR even when they're at the end of the buffer.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-20 14:07:01 +02:00
Ludovic Courtès aad086d871
grafts: Avoid 'query-valid-derivers' RPC.
Previously we'd make 502 'query-valid-derivers' RPCs for
"guix build vim -d", and after this patch, we don't do any.

Furthermore, the previous strategy was "stateful" in the sense that
'item->deriver' could return a derivation that is not the one that was
actually computed by this process, but an "equivalent" one (due to
fixed-output derivations); which one is chosen would depend on the state
of the store.

This in turn means that we'd have to call 'read-derivation-from-file' to
actually read .drv files (as opposed to getting them from
%DERIVATION-CACHE).  This is costly and doesn't work with
GUIX_DAEMON_SOCKET=ssh://….

* guix/grafts.scm (item->deriver): Remove.
(reference-origin): New procedure.
(cumulative-grafts): Use it instead of 'item->deriver'.
2019-06-19 22:56:27 +02:00
Ludovic Courtès 2ef22a9f37
derivations: Add 'derivation-input-derivation'.
* guix/derivations.scm (derivation-input-derivation): New procedure.
(derivation-prerequisites): Use it.
2019-06-19 22:56:27 +02:00
Ludovic Courtès 9353b199c1
guix build: '--log-file' looks for build logs of equivalent derivations.
Previously, '--log-file' would look for log files only for the current
derivation, and thus wouldn't find log files of equivalent derivations
that produce the same output.

* guix/scripts/build.scm (guix-build) <log-file?>: Replace
'derivation-file-name' by 'derivation->output-path'.
2019-06-18 16:25:09 +02:00
Marius Bakke a60dbad3bc
Merge branch 'staging' 2019-06-15 09:46:12 +02:00
Robert Vollmert ca45da9fc9
import: hackage: Handle Hackage revisions.
Hackage packages can have metadata revisions (Cabal file only) that are
not reflected in the source archive.  The Haskell build system has
support for this, but until now the Hackage importer would create a
package based on the revised Cabal file which would then build using the
old Cabal file.

Fixes <https://bugs.gnu.org/35750>.

* guix/import/cabal.scm (<cabal-package>): Add 'revision' field.
(eval-cabal): Parse 'x-revision:' property.
* guix/import/hackage.scm (read-cabal-and-hash): New procedure.
(hackage-fetch-and-hash): New procedure.
(hackage-fetch): Rewrite using 'hackage-fetch-and-hash'.
(hackage-module->sexp): Add 'cabal-hash' argument and use it to populate
the '#:cabal-revision' argument.
(hackage->guix-package): Use the new '-and-hash' functions to get the
hash of the Cabal file and pass it to 'hackage-module->sexp'.
* guix/tests/hackage.scm: Test import of Cabal file revision.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2019-06-13 22:18:52 -04:00
Robert Vollmert ed8d3f33a5
build-system/haskell: Generate Setup.hs if needed.
The default Setup.hs is boilerplate that is frequently left out of
source packages.  Several packages already add a phase to generate it,
so moving this phase to the build system is just factoring out an
existing pattern.

See <https://github.com/phadej/time-compat/issues/4>.

* guix/build/haskell-build-system.scm (generate-setuphs): New procedure.
(%standard-phases): Add it after 'unpack'.
* gnu/packages/haskell.scm (ghc-foundation, ghc-inline-c,
ghc-inline-c-cpp, ghc-rio): Remove 'arguments'.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2019-06-13 13:30:24 -04:00
Robert Vollmert 5f9f2c82e6
build-system/haskell: Fix Haddock phase docstring.
* guix/build/haskell-build-system.scm (haddock): Fix docstring.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2019-06-13 13:30:23 -04:00
Ivan Petkov 5a9ef8a960
import: crate: Define dependencies as arguments.
* guix/import/crate.scm:
(crate-fetch)[input-crates]: Rename to dev-crates.
[native-input-crates]: Rename to dev-dep-crates.
[inputs]: Rename to cargo-inputs.
[native-inputs]: Rename to cargo-development-inputs.
(maybe-cargo-inputs, maybe-cargo-development-inputs, maybe-arguments): Add
them.
(make-crate-sexp)[inputs]: Rename to cargo-inputs.
[native-inputs]: Rename to cargo-development-inputs.
[maybe-native-inputs, maybe-inputs]: Replace with maybe-arguments.
* guix/import/utils.scm: (package-names->package-inputs): Make public.  Add
docstring.
* tests/crate.scm (crate->guix-package): Update the match pattern.

Signed-off-by: Chris Marusich <cmmarusich@gmail.com>
2019-06-11 18:05:44 -07:00
Ivan Petkov d608e231e3
build-system/cargo: Don't copy source as an output.
* guix/build-system/cargo.scm: (cargo-build)[build-expression->derivation]:
Don't add "src" output.
* guix/build/cargo-build-system.scm: (install-source): Delete it.
(%standard-phases): Delete 'install-source.

Signed-off-by: Chris Marusich <cmmarusich@gmail.com>
2019-06-11 18:05:44 -07:00
Ivan Petkov efdf2ae14e
build-system/cargo: Use sources from package sources.
* guix/build/cargo-build-system.scm (crate-src?): New procedure.
(configure): Use the new procedure to expand crate tarballs in the vendor
directory.

Signed-off-by: Chris Marusich <cmmarusich@gmail.com>
2019-06-11 18:05:44 -07:00
Ivan Petkov a6ab6b7877
build-system/cargo: Expand transitive crate sources.
* guix/build/cargo: (package-cargo-inputs): Add it.
(package-cargo-development-inputs): Add it.
(crate-closure): Add it.
(expand-crate-sources): Add it.
(lower)[private-keywords]: Add #:cargo-inputs and
[bag]: Use expand-crate-sources to augment build-inputs.

Signed-off-by: Chris Marusich <cmmarusich@gmail.com>
2019-06-11 18:05:41 -07:00
Ludovic Courtès c5f66d2931
pack: Fix 'guix pack -f docker'.
Regression introduced in a0f352b30f.

* guix/scripts/pack.scm (docker-image): Check whether ENTRY-POINT is
true before returning (string-append #$profile ...).
2019-06-10 23:16:47 +02:00
Ludovic Courtès f8a9f99cd6
store: 'build-things' accepts derivation/output pairs.
This allows callers to request the substitution of a single derivation
output.

* guix/store.scm (build-things): Accept derivation/output pairs among
THINGS.
* guix/derivations.scm (build-derivations): Likewise.
* tests/store.scm ("substitute + build-things with specific output"):
New test.
* tests/derivations.scm ("build-derivations with specific output"):
New test.
* doc/guix.texi (The Store): Adjust accordingly.
2019-06-10 22:42:59 +02:00
Ludovic Courtès 416a7c69f1
ssh: Add missing import.
* guix/ssh.scm: Use (ice-9 format).
2019-06-10 22:42:52 +02:00
Ludovic Courtès 883dc11c3a
download: Update list of content-addressed mirrors.
* guix/download.scm (%content-addressed-mirrors): Change
"berlin.guixsd.org" to "ci.guix.gnu.org" and move it first.
2019-06-10 22:42:23 +02:00
Marius Bakke 0defdb636f
gnu-maintenance: Switch to ftp.mirrorservice.org for KDE updater.
mirrors.mit.edu seems no longer available over FTP.

* guix/gnu-maintenance.scm (latest-kde-release): Change from mirrors.mit.edu
to ftp.mirrorservice.org.
2019-06-10 13:58:24 +02:00
Ludovic Courtès f54cab2784
import: utils: 'specs->package-lists' correctly matches "out".
* guix/import/utils.scm (specs->package-lists): Match "out", not ("out").
2019-06-07 22:55:50 +02:00
Ludovic Courtès c0a4db6697
import: print: Honor the outputs of inputs (!).
Fixes <http://bugs.gnu.org/35893>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.

* guix/import/print.scm (package->code)[package-lists->code]: Preserve
OUT in the result.
* tests/print.scm (define-with-source): New macro.
(pkg): Use it.
(pkg-source): New variable.
(pkg-with-inputs, pkg-with-inputs-source): New variables.
("simple package"): Refer to 'pkg-source'.
("package with inputs"): New test.
2019-06-07 22:49:47 +02:00
Ludovic Courtès a0f352b30f
pack: Add '--entry-point'.
* guix/scripts/pack.scm (self-contained-tarball): Add #:entry-point and
warn when it's true.
(squashfs-image): Add #:entry-point and honor it.
(docker-image): Add #:entry-point and honor it.
(%options, show-help): Add '--entry-point'.
(guix-pack): Honor '--entry-point' and pass #:entry-point to BUILD-IMAGE.
* gnu/tests/docker.scm (run-docker-test): Test 'docker run' with the
default entry point.
(build-tarball&run-docker-test): Pass #:entry-point to 'docker-image'.
* doc/guix.texi (Invoking guix pack): Document it.
* gnu/tests/singularity.scm (run-singularity-test)["singularity run"]:
New test.
(build-tarball&run-singularity-test): Pass #:entry-point to
'squashfs-image'.
2019-06-07 09:57:19 +02:00
Robert Vollmert 5d9fe4311a
guix: git-download: Remove explicit import.
With guile-git version 0.2, repository-working-directory is no
longer private.

* guix/git-download.scm (git-file-list): Refer to public
repository-working-directory.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-06 20:35:54 +02:00
Ludovic Courtès 70a7a1b5dc
nar: Really lock store files.
Previously, 'lock-store-file' would immediately close the file
descriptor of the '.lock' file, and thus it would immediately release
the lock.

* guix/nar.scm (lock-store-file, unlock-store-file): Remove.
(finalize-store-file): Use 'lock-file' and 'unlock-file' instead.
2019-06-05 23:10:37 +02:00
Ludovic Courtès 5f0cf1df71
syscalls: 'with-lock-file' catches ENOSYS.
* guix/build/syscalls.scm (call-with-file-lock): Catch ENOSYS raised by
'lock-file'.
2019-06-05 23:10:36 +02:00
Ludovic Courtès 89ceb86ad4
syscalls: 'with-file-lock' expands to a call to 'call-with-file-lock'.
* guix/build/syscalls.scm (call-with-file-lock): New procedure.
(with-file-lock): Expand to a call to 'call-with-file-lock'.
2019-06-05 23:10:36 +02:00
Ludovic Courtès b7178c22bf
syscalls: Add 'with-file-lock' macro.
* guix/scripts/offload.scm (lock-file, unlock-file, with-file-lock):
Move to...
* guix/build/syscalls.scm: ... here.
2019-06-05 23:10:36 +02:00
Ludovic Courtès bcb7c900cc
guix package: Do not list environment variables that need to be set.
Fixes <https://bugs.gnu.org/35942>.

* guix/scripts/package.scm (display-search-paths): Rename to...
(display-search-path-hint): ... this.  Adjust callers.
Remove #:kind parameter.  Replace the list of environment variables with
an invitation to source $GUIX_PROFILE/etc/profile or run 'guix package
--search-paths'.
2019-06-05 23:10:36 +02:00
Ludovic Courtès 69962ab7a8
deprecation: Use the 'warning' procedure for diagnostics.
Until now, (guix deprecation) had its own warning mechanism, which was
inconsistent (it did not use colors, etc.)

* guix/deprecation.scm (deprecation-warning-port): Remove
(source-properties->location-string): Remove.
(warn-about-deprecation): Use 'warning' instead of 'format'.
(define-deprecated, define-deprecated/alias): Adjust docstring.
* guix/channels.scm (build-from-source): Refer to 'guix-warning-port'
instead of 'deprecation-warning-port'.
2019-06-03 23:18:47 +02:00
Ludovic Courtès 1b5ee3bdaa
Add (guix diagnostics).
* guix/ui.scm (warning, info, report-error, leave)
(location->string, guix-warning-port, program-name)
(highlight-argument, %highlight-argument, define-diagnostic)
(%warning-color, %info-color, %error-color)
(print-diagnostic-prefix): Move to...
* guix/diagnostics.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
2019-06-03 23:18:47 +02:00
Ludovic Courtès ee2691fa33
services: guix-publish: Allow for multi-compression.
This is a followup to b8fa86adfc.

* guix/deprecation.scm (warn-about-deprecation): Make public.
* gnu/services/base.scm (<guix-publish-configuration>)[compression]: New
field.
[compression-level]: Default to #f.  Add '%' to getter name.
(guix-publish-configuration-compression-level): Define as deprecated.
(default-compression): New procedure.
(guix-publish-shepherd-service)[config->compression-options]: New
procedure.
Use 'match-record' instead of 'match'.
* doc/guix.texi (Base Services): Remove 'compression-level' and document
'compression'.
2019-06-03 23:18:47 +02:00
Robert Vollmert 5b315f3ea9
guix: import: simplify recursive import
This simplifies the logic of recursive-import, intending no
major functional changes. The package import function is no
longer called twice per package. Failed imports now make it
to the package stream as '() instead of #f.

* guix/import/utils.scm (recursive-import): Simplify.

Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
2019-06-03 22:52:10 +03:00
Robert Vollmert 959c9d159d
import: hackage: Parse braced properties.
This adds partial support for Cabal properties that use curly
braces instead of the layout rule.  See for example
https://hackage.haskell.org/package/cassava/

* guix/import/cabal.scm (read-braced-value): New procedure.
(is-property): Remove.
(is-layout-property, is-braced-property): New variables.
(lex-property): Rename to...
(lex-layout-property): ... this.
(lex-braced-property, lex-property): New procedures.
(lex-token): Add call to 'lex-property'.
* guix/tests/hackage.scm: Test braced description import.
* tests/hackage.scm (test-cabal-multiline-desc): Rename to...
(test-cabal-multiline-layout): ... this.
("hackage->guix-package test multiline desc"): Rename to...
("hackage->guix-package test multiline desc (layout)"): ... this.
(test-cabal-multiline-braced): New variable.
("hackage->guix-package test multiline desc (braced)"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-02 22:16:05 +02:00
Ludovic Courtès b90ae065b5
substitute: Select the best compression methods.
When a server publishes several URLs with different compression methods,
'guix substitute' can now choose the best one among the compression
methods that it supports.

* guix/scripts/substitute.scm (<narinfo>)[uri]: Replace with...
[uris]: ... this.
[compression]: Replace with...
[compressions]: ... this.
[file-size]: Replace with...
[file-sizes]: ... this.
[file-hash]: Replace with...
[file-hashes]: ... this.
(narinfo-maker): Adjust accordingly.  Ensure 'file-sizes' and
'file-hashes' have the right length.
(assert-valid-signature, valid-narinfo?): Use the first element of
'narinfo-uris' in error messages.
(read-narinfo): Expect "URL", "Compression", "FileSize", and "FileHash"
to occur multiple times.
(display-narinfo-data): Call 'select-uri' to determine the file size.
(%compression-methods): New variable.
(supported-compression?, compresses-better?, select-uri): New
procedures.
(process-substitution): Call 'select-uri' to select the URI and
compression.
* guix/scripts/weather.scm (report-server-coverage): Account for all the
values returned by 'narinfo-file-sizes'.
* tests/substitute.scm ("substitute, narinfo with several URLs"): New
test.
2019-06-02 22:01:57 +02:00
Ludovic Courtès b8fa86adfc
publish: '--compression' can be repeated.
This allows 'guix publish' to compress and advertise multiple
compression methods from which users can choose.

* guix/scripts/publish.scm (actual-compression): Rename to...
(actual-compressions): ... this.  Expect REQUESTED to be a list, and
always return a list.
(%default-options): Remove 'compression.
(store-item->recutils): New procedure.
(narinfo-string): Change #:compression to #:compressions (plural).
Adjust accordingly.
(render-narinfo, render-narinfo/cached): Likewise.
(bake-narinfo+nar): Change #:compression to #:compressions.
[compressed-nar-size]: New procedure.
Call 'compress-nar' for each item returned by 'actual-compressions'.
Create a narinfo for each compression.
(effective-compression): New procedure.
(make-request-handler): Change #:compression to #:compressions.
Use 'effective-compression' to determine the applicable compression.
(guix-publish): Adjust handling of '--compression'.
Print a message for each compression that is enabled.
* tests/publish.scm ("/*.narinfo"): Adjust to new narinfo field
ordering.
("/*.narinfo with properly encoded '+' sign"): Likewise.
("/*.narinfo with lzip + gzip"): New test.
("with cache, lzip + gzip"): New test.
* doc/guix.texi (Invoking guix publish): Document it.
2019-06-02 22:01:57 +02:00
Ludovic Courtès e006f7493f
build-system/guile: Display progress report as expected by (guix status).
* guix/build/guile-build-system.scm (report-build-progress): Use a
format string suitable for (guix status).
2019-06-02 22:01:34 +02:00
Ludovic Courtès 30eb738366
build-system/guile: Add #:not-compiled-file-regexp.
* guix/build/guile-build-system.scm (build): Add
 #:not-compiled-file-regexp and honor it.
* guix/build-system/guile.scm (guile-build): Likewise.
(guile-cross-build): Likewise.
2019-06-02 22:01:34 +02:00
Ludovic Courtès abeb54c00b
build-system/guile: Improve reporting of 'guild compile' failures.
* guix/build/guile-build-system.scm (invoke-each)[processes]: New
variable.
[wait-for-one-process]: Check PROCESSES and update it.
[fork-and-run-command]: Update PROCESSES.
2019-06-02 22:01:34 +02:00
Ludovic Courtès b2cddc6fb1
compile: Adjust for Guile 3.
* guix/build/compile.scm (%default-optimizations): Adjust to the new
names in Guile 2.9.2.
2019-06-02 01:38:36 +02:00
Ludovic Courtès 88bc3c89bf
progress: Provide the proper type for %PROGRESS-INTERVAL.
The (srfi srfi-19) module of Guile 2.9.2 catches the wrong type.

* guix/progress.scm (%progress-interval): Change type to TIME-DURATION.
2019-06-02 01:38:36 +02:00
Ludovic Courtès 87399dfc20
lzlib: 'make-lzip-input-port' better handles end of decompression.
Suggested by Pierre Neidhardt <mail@ambrevar.xyz>.

* guix/lzlib.scm (lzread!): Call 'lz-decompress-finish' when
'feed-decoder!' returns EOF.  Call 'lz-decompress-finished?' to
determine end of compression.
2019-06-01 15:26:30 +02:00
Robert Vollmert 1cc12357a6
import: hackage: Update list of ghc-included packages.
Update the list of excepted dependencies for current ghc-8.4, based on the
release notes at
https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/8.4.3-notes.html

Particularly, this adds `text` to the list, which is a dependency of `parsec`
which was already on the list before, causing build failures with updated
versions of the `text` package.

* guix/import/hackage.scm (ghc-standard-libraries): Update list.

Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
2019-06-01 06:22:57 +02:00
Ludovic Courtès 73bddab545
publish: Factorize 'compress-nar'.
* guix/scripts/publish.scm (compress-nar): New procedure.
(bake-narinfo+nar): Use it.
2019-05-29 23:16:49 +02:00
Ludovic Courtès e84e036943
publish: Remove outdated comment.
* guix/scripts/publish.scm (make-request-handler): Remove outdated TODO.
2019-05-29 23:16:49 +02:00
Ricardo Wurmus 531940d388
import: cran: Ignore invalid packages from the system requirements.
* guix/import/cran.scm (description->package): Filter invalid packages from
the list of system requirements.
2019-05-28 23:56:59 +02:00
Ricardo Wurmus fa86654824
self: Fix unquoting.
This is a follow-up to commit dfc69e4b6d.

* guix/self.scm (whole-package): Unquote %storedir in the daemon wrapper.
2019-05-28 23:21:27 +02:00
Ludovic Courtès 35d1354fe8
publish: Display the compression method and level in use.
* guix/scripts/publish.scm (guix-publish): Use 'info' instead of
'format' for the initial message.  When COMPRESSION is true, display the
method and level in use.
2019-05-27 22:47:24 +02:00
Ludovic Courtès c131bea276
lzlib: 'lzread!' never returns more than it was asked for.
Fixes a bug whereby 'lzread!' could return more than COUNT.

* guix/lzlib.scm (lzread!): Rewrite in a semi-functional style.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 73ac9098b1
self: Add dependency on lzlib.
* guix/self.scm (compiled-guix): Pass #:lzlib to 'make-config.scm'.
(make-config.scm): Add #:lzlib and honor it.
(specification->package): Add "lzlib".
2019-05-27 22:47:24 +02:00
Ludovic Courtès 66229b04ae
publish: Add support for lzip.
* guix/scripts/publish.scm (show-help, %options): Support '-C METHOD'
and '-C METHOD:LEVEL'.
(default-compression): New procedure.
(bake-narinfo+nar): Add lzip.
(nar-response-port): Likewise.
(string->compression-type): New procedure.
(make-request-handler): Generalize /nar/gzip handler to handle /nar/lzip
as well.
* tests/publish.scm ("/nar/lzip/*"): New test.
("/*.narinfo with lzip compression"): New test.
* doc/guix.texi (Invoking guix publish): Document it.
(Requirements): Mention lzlib.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 4e48923e75
utils: Support compression and decompression with lzip.
* guix/utils.scm (lzip-port): New procedure.
(decompressed-port, compressed-port, compressed-output-port): Add 'lzip
case.
* tests/utils.scm <top level>: Call 'test-compression/decompression' for
'lzip as well.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 2a991f3ae4
lzlib: Add 'make-lzip-input-port/compressed'.
* guix/lzlib.scm (lzwrite!, make-lzip-input-port/compressed): New
procedures.
* tests/lzlib.scm ("make-lzip-input-port/compressed"): New test.
* guix/tests.scm (%seed): Export.
2019-05-27 22:47:24 +02:00
Ludovic Courtès e13354a7ca
lzlib: Adjust 'lz-compress-read' docstring.
* guix/lzlib.scm (lz-compress-read): The integer return can be zero;
adjust docstring accordingly.
2019-05-27 22:47:23 +02:00
Ludovic Courtès ad7466aafd
import: hackage: Fix Cabal test.
* guix/import/hackage.scm (hackage->guix-package): Remove call to 'memoize'.
(hackage->guix-package/m): New procedure.
(hackage-recursive-import): Use it.
* tests/hackage.scm ("hackage->guix-package test 6"): Adjust.

Co-authored-by: Robert Vollmert <rob@vllmrt.net>
2019-05-26 23:20:30 +02:00
Robert Vollmert 002d17dcaa
discovery: 'all-modules' returns modules in path order.
A particular effect of this is that if there are ambiguous
packages in a directory specified with `-L module_dir` and the
distribution, the version from `module_dir` will be loaded,
which is usually what would be expected. (E.g. for `guix build`
or `guix package -i`.)

* guix/discovery.scm (all-modules): Return modules in path order.
* tests/guix-package.sh: Test local definitions take precedence.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-05-26 23:02:02 +02:00
Ludovic Courtès dfc69e4b6d
self: 'guix-daemon' honors %localstatedir, %sysconfdir, and %storedir.
Fixes <https://bugs.gnu.org/35874>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.

Previously, the 'guix-daemon' program provided by 'guix pull' would
systematically use default directory locations for these.

* guix/self.scm (whole-package)[wrap]: Set GUIX_STATE_DIRECTORY,
GUIX_CONFIGURATION_DIRECTORY, and NIX_STORE_DIR.
2019-05-26 22:01:42 +02:00
Robert Vollmert 0607f89088
import: hackage: Recognize "BSD-3-Clause" and "PublicDomain".
* guix/import/hackage.scm (string->license): Add two licenses.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
2019-05-26 10:22:05 +02:00
Ludovic Courtès 7fcb86da2b
store: Fix 'hash-part->path' docstring.
* guix/store.scm (hash-part->path): Adjust docstring to match reality.
2019-05-26 01:34:17 +02:00
Ludovic Courtès 493375cdb2
publish: Maintain a hash-part-to-store-item mapping in cache.
Fixes <https://bugs.gnu.org/33897>.

* guix/scripts/publish.scm (hash-part-mapping-cache-file)
(hash-part->path*): New procedures.
* guix/scripts/publish.scm (render-narinfo/cached)[delete-entry]: Delete
the 'hash-part-mapping-cache-file'.
Use 'hash-part->path*' instead of 'hash-part->path'.
* tests/publish.scm ("with cache, vanishing item"): New test.
2019-05-26 01:34:17 +02:00
Ricardo Wurmus e96619baf7
import: cran: Ignore invalid packages.
* guix/import/cran.scm (invalid-packages): New variable.
(description->package): Use it.
2019-05-23 16:10:32 +02:00
Ludovic Courtès b1903b99e0
weather: Accept package specs on the command line.
Previously, non-option arguments would be ignored.  Now it puts them to
good use.

* guix/scripts/weather.scm (guix-weather)[package-list]: New procedure.
Use it.
* doc/guix.texi (Invoking guix weather): Adjust accordingly.
2019-05-22 00:09:42 +02:00
Ludovic Courtès 3f8326237d
pack: Warn when building an empty pack.
* guix/scripts/pack.scm (guix-pack): Warn when MANIFEST has zero
entries.
2019-05-22 00:09:41 +02:00
Ludovic Courtès fd214f1522
pack: Add '--root'.
* guix/scripts/pack.scm (%options, show-help): Add "--root".
(guix-pack): Honor it.
* tests/guix-pack.sh: Test it.
* doc/guix.texi (Invoking guix pack): Document it.
2019-05-22 00:09:41 +02:00
Ludovic Courtès a901574727
self: Remove unused variables.
* guix/self.scm (info-manual)[po4a, gettext]: Remove.
2019-05-20 23:23:00 +02:00
Ludovic Courtès ce10e6053b
guix system: Type-check the file or expression.
Previously, users would get a wrong-type-arg exception down the road
with an intimidating backtrace.

* guix/scripts/system.scm (process-action)[ensure-operating-system]: New
procedure.
Use it.
2019-05-16 13:24:06 +02:00
Ludovic Courtès 7ff4fde257
docker: 'build-docker-image' accepts an optional #:entry-point.
* guix/docker.scm (config): Add #:entry-point and honor it.
(build-docker-image): Likewise.
2019-05-15 16:36:21 +02:00
Arun Isaac 06c7b1f614
import: github: Sort releases before picking the latest one.
* guix/import/github.scm (latest-released-version): Sort releases before
picking the first one as the latest.
2019-05-15 13:29:50 +05:30
Arun Isaac c558772b0f
import: github: Improve readability.
* guix/import/github.scm (latest-released-version)[release->version]: Separate
out release->version as a new function.
2019-05-15 13:29:50 +05:30
Ludovic Courtès 45d41c035e
guix build: Gracefully handle invalid '--with-git-url' specs.
* guix/scripts/build.scm (transform-package-source-git-url): Add case
for when 'string-split' does not return exactly two elements.
2019-05-14 12:11:05 +02:00