Commit Graph

4192 Commits (d514276b93ccf168438bbd2892fbc64d5661106c)

Author SHA1 Message Date
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