Commit Graph

251 Commits

Author SHA1 Message Date
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 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
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
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
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
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
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
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
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 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
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
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
Ricardo Wurmus 6490cd31cc
guix: Update to Bioconductor 3.9.
* guix/build-system/r.scm (bioconductor-uri): Use 3.9 archive URL.
* guix/import/cran.scm (%bioconductor-version): Update to 3.9.
2019-05-06 00:14:27 +02:00
Julien Lepiller 7b1c7ecdfb
import: opam: Use dune-build-system when possible.
* guix/import/opam.scm (opam->guix-package): Detect when dune can be used.
2019-04-10 21:39:04 +02:00
Julien Lepiller 3e159dd0a4
import: opam: Add more patterns to opam file parser.
* guix/import/opam.scm: Add more patterns to peg parser.
(choice-pat choice condition-not condition-paren): New patterns.
(ground-value condition-content condition-var): Update patterns.
2019-04-10 21:38:45 +02:00
Julien Lepiller a506a4c380
import: opam: Also update dune packages.
* guix/import/opam.scm (opam-package?): Also accept packages that use the
dune build system.
2019-03-23 18:37:29 +01:00
Arun Isaac ae031d453c
import: Add Launchpad updater.
* guix/import/launchpad.scm: New file.
* Makefile.am (MODULES): Register it.
* doc/guix.texi (Invoking guix refresh): Mention the Launchpad updater.
2019-03-18 20:55:55 +05:30
ng0 47956fa0c2
Correct name and email address for ng0.
* .mailmap, Makefile.am, doc/guix.de.texi, doc/guix.fr.texi,
doc/guix.texi, etc/completion/fish/guix.fish,
gnu/packages/accessibility.scm, gnu/packages/admin.scm,
gnu/packages/audio.scm, gnu/packages/autotools.scm,
gnu/packages/cdrom.scm, gnu/packages/check.scm,
gnu/packages/cinnamon.scm, gnu/packages/compression.scm,
gnu/packages/crypto.scm, gnu/packages/databases.scm,
gnu/packages/django.scm, gnu/packages/dns.scm, gnu/packages/elixir.scm,
gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm,
gnu/packages/enlightenment.scm, gnu/packages/erlang.scm,
gnu/packages/fonts.scm, gnu/packages/fontutils.scm,
gnu/packages/forth.scm, gnu/packages/fvwm.scm, gnu/packages/games.scm,
gnu/packages/gl.scm, gnu/packages/gnome.scm, gnu/packages/gnunet.scm,
gnu/packages/gnupg.scm, gnu/packages/gnuzilla.scm, gnu/packages/gtk.scm,
gnu/packages/guile-wm.scm,gnu/packages/guile-xyz.scm,
gnu/packages/haskell-check.scm, gnu/packages/haskell-crypto.scm,
gnu/packages/haskell.scm, gnu/packages/image-viewers.scm,
gnu/packages/image.scm, gnu/packages/irc.scm,
gnu/packages/language.scm, gnu/packages/libcanberra.scm,
gnu/packages/linux.scm, gnu/packages/lisp.scm, gnu/packages/lolcode.scm,
gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/mail.scm,
gnu/packages/markup.scm, gnu/packages/mate.scm, gnu/packages/maths.scm,
gnu/packages/mc.scm, gnu/packages/messaging.scm, gnu/packages/music.scm,
gnu/packages/ncurses.scm, gnu/packages/networking.scm,
gnu/packages/nickle.scm, gnu/packages/openbox.scm, gnu/packages/pdf.scm,
gnu/packages/perl-check.scm, gnu/packages/perl.scm,
gnu/packages/python-compression.scm, gnu/packages/python-crypto.scm,
gnu/packages/python-web.scm, gnu/packages/python-xyz.scm,
gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/ruby.scm,
gnu/packages/rust.scm, gnu/packages/scheme.scm,
gnu/packages/serialization.scm, gnu/packages/shells.scm,
gnu/packages/ssh.scm, gnu/packages/suckless.scm, gnu/packages/tbb.scm,
gnu/packages/telephony.scm, gnu/packages/text-editors.scm,
gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tls.scm,
gnu/packages/tor.scm, gnu/packages/version-control.scm,
gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/web.scm,
gnu/packages/wm.scm, gnu/packages/xdisorg.scm, gnu/packages/xfce.scm,
gnu/packages/xml.scm, gnu/packages/xorg.scm, gnu/services/certbot.scm,
gnu/services/desktop.scm, gnu/services/version-control.scm,
gnu/services/web.scm, guix/import/hackage.scm, guix/licenses.scm:
Correct name and email address for ng0.

Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
2019-03-18 15:05:08 +01:00
Julien Lepiller c3a191fafd
import: opam: Work around janestreet version numbers.
janestreet reversionned its packages and prefixed them with "v". Let the
importer know about that and choose "v" versions first.

* guix/import/opam.scm (find-latest-version): Work around version
rewrite from janestreet.
(opam->guix-package): Do not pass "v" to version number.
2019-02-05 22:33:13 +01:00
Julien Lepiller beee37ecdb
import: opam: Replace "_" with "-" in imported names.
* guix/import/opam.scm (ocaml-name->guix-name): Replace "_" with "-".
(opam->guix-packages): Add upstream name when we cannot guess it
properly.
2019-02-05 22:33:08 +01:00
Julien Lepiller 0f4432c620
import: opam: Fix conditions.
* guix/import/opam.scm (condition-eq, condition-neq): The first argument
can be empty.
* tests/opam.scm: Add test case.
2019-02-05 22:33:06 +01:00
Arun Isaac cb5fe915d2
import: github: Improve readability.
* guix/import/github.scm (latest-released-version): Use any and cond instead
of a recursive loop and an if-else ladder respectively.
2019-01-21 17:59:15 +05:30
Arun Isaac 6b7ea49bed
import: github: Use prereleases when package has no releases.
* guix/import/github.scm (latest-released-version): Use preleases when package
has no releases.
2019-01-21 17:59:15 +05:30
Arun Isaac 2034a231dc
import: github: Check if git URIs are GitHub URIs.
This fixes a regression introduced in 9a5091d0c1
whereby packages with git origin URIs not hosted on GitHub would be wrongly
detected as being covered under the github updater.
Reported by Efraim Flashner <efraim@flashner.co.il>.

* guix/import/github.scm (updated-github-url): Check if git URIs are GitHub
URIs.
2019-01-21 01:17:52 +05:30
Arun Isaac 9a5091d0c1
import: github: Do not update URI for packages using git-fetch.
* guix/import/github.scm (updated-github-url): Return the unchanged source URI
for packages using git-fetch.
[updated-url]: Do not handle URIs which end with ".git".
2019-01-16 20:49:14 +05:30
Ricardo Wurmus 91e05559bd
import: cran: Suggest input changes.
* guix/import/cran.scm (latest-cran-release, latest-bioconductor-release):
Return input-changes.
2019-01-12 23:35:11 +01:00
Julien Lepiller f31ce9ecf1
import: opam: Parse comments.
* guix/import/opam.scm: Add comment support in parser.
2019-01-07 22:05:51 +01:00
Julien Lepiller 755e6d4a0a
import: opam: Add updater.
* guix/import/opam.scm (%opam-updater): New variable.
2019-01-07 22:05:45 +01:00
Julien Lepiller 6090b0beb0
import: opam: Add recursive option.
* guix/script/import/opam.scm: Add recursive option.
* guix/import/opam.scm (opam->guix-package): return two values.
(opam-recursive-import): New variable.
2019-01-07 22:05:43 +01:00
Ricardo Wurmus 2a13642b65
import: cran: Default to 'cran repo.
* guix/import/cran.scm (cran-recursive-import): Default to 'cran repo.
2019-01-03 08:34:41 +01:00
Ricardo Wurmus 7bb6420c5a
import: cran: Abort if no description could be fetched.
* guix/import/cran.scm (cran->guix-package): Only proceed if a valid
description could be fetched.
2019-01-03 08:34:41 +01:00
Ricardo Wurmus 632ea817b8
import: cran: Use HTTPS.
* guix/import/cran.scm (%cran-url): Use HTTPS.
2019-01-03 08:34:41 +01:00
Ricardo Wurmus b3d0617a55
import: cran: Download tarballs only once.
* guix/import/cran.scm (download): New procedure.
(fetch-description, description->package): Use it.
2019-01-03 08:34:41 +01:00
Eric Bavier 789fc77bef
refresh: github: updates for origins using 'git-fetch'.
* guix/import/github.scm (updated-github-url): Respond with the repository url
for the 'git-fetch' fetch method.
(github-package?): Simplify boolean expression.
(github-repository, github-user-slash-repository): Strip trailing ".git" from
project if present.
(latest-release)<origin-github-uri>: Recognize a 'git-reference'.
2018-12-31 19:00:23 -06:00
Ricardo Wurmus 10a1cacb16
import: cran: Try import via CRAN if package is not on Bioconductor.
* guix/import/cran.scm (fetch-description): Return #F on failure.
(cran->guix-package): Retry from CRAN on failure to fetch description from
bioconductor.
2018-12-20 09:42:22 +01:00
Julien Lepiller cce654fabd
import: Update opam importer.
* guix/import/opam.scm: Update importer for opam 2.
* tests/opam.scm: Update tests for the opam 2 importer.
2018-12-17 21:43:51 +01:00
Ricardo Wurmus 9da4848632
guix: Update to Bioconductor 3.8.
* guix/import/cran.scm (%bioconductor-version): Update to 3.8.
* guix/build-system/r.scm (bioconductor-uri): Update archive URL.
2018-11-06 18:21:24 +01:00
Arun Isaac 69b0a847fb
import: hackage: Do not repeat inputs in native-inputs.
* guix/import/hackage.scm (hackage-module->sexp): Do not repeat inputs again
in native-inputs. native-inputs should only contain packages that are not
already listed in inputs.
2018-10-28 13:51:20 +05:30