Commit Graph

457 Commits

Author SHA1 Message Date
Attila Lendvai 0c21ec1c79
import: utils: Add more licenses and extend their detection.
* guix/import/utils.scm (spdx-string->license): Identify more
licenses (CC-BY-4.0, Freetype, HPND).
* guix/licenses.scm: Add a comment that mentions "MIT" so that people
who grep for MIT end up there.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-11-12 23:34:18 +01:00
Ludovic Courtès 3756ce3267
import: print: Replace packages and origins in 'arguments'.
* guix/import/print.scm (package->code)[variable-reference]
[object->code]: New procedures.
[package-lists->code]: Rewrite in terms of 'object->code'.
Pass the 'arguments' field through 'object->code'.
* tests/print.scm (pkg-with-arguments, pkg-with-arguments-source): New
variables.
("package with arguments"): New test.
2021-11-11 00:14:31 +01:00
Ludovic Courtès b2ed40c29f
import: print: Handle patches that are origins.
* guix/import/print.scm (package->code)[source->code]: Handle patches
that are origins.
* tests/print.scm (pkg-with-origin-input): Add 'patches' field.
(pkg-with-origin-patch, pkg-with-origin-patch-source): New variables.
("package with origin patch"): New test.
2021-11-11 00:14:31 +01:00
Ludovic Courtès b3240ae846
import: print: Correctly handle URI lists.
* guix/import/print.scm (package->code)[factorized-uri-code]: New
procedure.
[source->code]: Use it, and factorize URI when it's a list.
* tests/print.scm (pkg-with-origin-input): Check origin URI to a list.
2021-11-11 00:14:31 +01:00
Ludovic Courtès 04d929570a
import: print: Properly render packages with origins as inputs.
* guix/import/print.scm (package->code)[source->code]: Check whether
VERSION is true before calling 'factorize-uri'.
[package-lists->code]: Add clause for inputs that are origins.
* tests/print.scm (pkg-with-origin-input, pkg-with-origin-input-source):
New variables.
("package with origin input"): New test.
2021-11-11 00:14:31 +01:00
Ludovic Courtès 450e1dd52e
import: cran: Allow imports of a specific version.
* guix/import/cran.scm (download): Handle the case where URL is a list.
(fetch-description-from-tarball): New procedure.
(fetch-description): Add #:version parameter.  Honor it when REPOSITORY
is 'cran.  Use 'fetch-description-from-tarball' when REPOSITORY is
'bioconductor.
(description->package): SOURCE-URL may now be a list.
(cran->guix-package): Pass VERSION to 'fetch-description'.
(cran-recursive-import): Add #:version parameter.
* guix/scripts/import/cran.scm (guix-import-cran): Expect a spec rather
than a mere package name.
* doc/guix.texi (Invoking guix import): Document it.
2021-11-11 00:14:30 +01:00
Ludovic Courtès b20cd80ff1
import: pypi: Allow imports of a specific version.
* guix/import/pypi.scm (latest-version): New procedure.
(latest-source-release): Rename to...
(source-release): ... this.  Add 'version' parameter.
(latest-wheel-release): Rename to...
(wheel-release): ... this.  Add 'version' parameter.
(pypi->guix-package): Honor 'version' parameter.
(pypi-recursive-import): Add 'version' parameter and honor it.
* guix/scripts/import/pypi.scm (guix-import-pypi): Expect a spec.  Pass
it to 'package-name->name+version'.  Pass the 'version' parameter.
* tests/pypi.scm ("pypi->guix-package, no wheel"): Exercise
the #:version parameter.
* doc/guix.texi (Invoking guix import): Document it.
2021-11-11 00:14:30 +01:00
Ricardo Wurmus 22b568de43
guix: Upgrade to Bioconductor 3.14.
* guix/build-system/r.scm (bioconductor-uri): Bump Bioconductor version to
3.14.
* guix/import/cran.scm (%bioconductor-version): Same.
2021-11-07 22:34:34 +00:00
Xinglu Chen b999c80c2e
import: egg: Allow imports of a specific version.
* guix/import/egg.scm (eggs-repository): Change URL.
(egg-metadata): Accept optional #:version keyword argument.
(egg->guix-package): Accept ‘version’ argument.
(egg-recursive-import): Add ‘version’ argument and honor it.
* guix/scripts/import/egg.scm (guix-import-egg): Parse a specification instead
of just a package name.
* doc/guix.texi (Invoking guix import): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-11-07 23:10:41 +01:00
Ludovic Courtès d21353adea
import: elpa: Work around Guile 3.0.[5-7] compiler bug.
Fixes <https://issues.guix.gnu.org/49006>.
Reported by Xinglu Chen <public@yoctocell.xyz>.

* guix/import/elpa.scm (elpa-package->sexp)[melpa-recipe]: Add call to
'identity'.
2021-11-06 23:01:21 +01:00
Lars-Dominik Braun 5a9e7cdd32
import: stackage: Update to release 18.14.
* guix/import/stackage.scm (%default-lts-version): Update to 18.14.
2021-11-02 09:32:45 +01:00
Ludovic Courtès 219cf5093e
import: cran: Use the standard diagnostic procedures.
* guix/import/cran.scm (bioconductor-packages-list)
(fetch-description): Use 'warning' instead of 'format'.
2021-10-28 21:30:23 +02:00
Ludovic Courtès 7770016402
import: pypi: Remove leftover 'pk' call.
This is a followup to 7b75f90c5b.

* guix/import/pypi.scm (make-pypi-sexp)[maybe-upstream-name]: Remove
leftover 'pk' call.
2021-10-15 23:16:28 +02:00
Xinglu Chen 50d2900e76
import: pypi: Support 'input-changes'.
* guix/import/pypi.scm (latest-release): Specify the ‘input-changes’ field.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-10-15 23:16:28 +02:00
Tobias Geerinckx-Rice a1679b74c9
Revert the #51061 patch series for now.
This reverts commits f63c79bf76
..f86f7e24b39928247729020df0134e2e1c4cde62 for more chillax reviewing.

See <https://issues.guix.gnu.org/51061#32>.
2021-10-08 23:31:34 +02:00
Lars-Dominik Braun edd912a128
import: hackage: Support mirror:// URLs
* guix/import/hackage.scm (guix-package->hackage-name): Support
mirror://-style URI’s.
(hackage-package?): Ditto.
2021-10-08 09:13:52 +02:00
Lars-Dominik Braun 127828ddd7
import: stackage: Support input changes.
* guix/import/stackage.scm (latest-lts-release): Rename package to pkg
to avoid name conflict and add input-changes.
2021-10-08 09:13:51 +02:00
Lars-Dominik Braun 8b4d3a523f
import: hackage: Update GHC’s standard libraries.
* guix/import/hackage.scm (ghc-standard-libraries): Add exceptions
library.
2021-10-08 09:13:51 +02:00
Lars-Dominik Braun 75c91e6b43
import: stackage: Update %default-lts-version to 18.10.
* guix/import/stackage.scm (%default-lts-version): Update to 18.10.
2021-10-08 09:13:51 +02:00
Hartmut Goebel d780d0a2bb
import: Add hex.pm importer.
hex.pm is a package repository for Erlang and Elixir.

* guix/scripts/import.scm (importers): Add "hexpm".
* guix/scripts/import/hexpm.scm, guix/import/hexpm.scm,
  guix/hexpm-download.scm: New files.
* guix/import/utils.scm (source-spec->object): Add "hexpm-fetch" to list of
  fetch methods.
* guix/upstream.scm (package-update/hexpm-fetch): New function.
  (%method-updates) Add it.
* Makefile.am: Add them.
2021-10-07 22:35:28 +02:00
Ludovic Courtès 1327ec822f
import: crate: Gracefully handle missing license info.
Fixes <https://issues.guix.gnu.org/51048>.
Reported by Michael Zappa <me@michzappa.com>.

* guix/import/crate.scm (<crate-version>)[license]: Translate 'null to #f.
(make-crate-sexp): Handle LICENSE = #f.
2021-10-07 10:47:44 +02:00
Sarah Morgensen 834ff65e85
import: go: Recognize major version suffixes.
Do not treat major version suffixes (such as "/v3") as repository
subdirectories.  See <https://golang.org/ref/mod#major-version-suffixes>.

* guix/import/go.scm (go-module->guix-package): When determining the
unpack path, compare 'root-module-path' to 'module-path-sans-suffix'
instead of 'module-path'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-04 16:36:59 +02:00
Sarah Morgensen ac43ead774
import: go: Handle extra whitespace in "go-import" meta tags.
Some packages sites use extra whitespace in the content portion of <meta
name="go-import" ...> tags, so handle that.  Example:
<https://k8s.io/api?go-get=1>

* guix/import/go.scm (fetch-module-meta-data)[go-import->module-meta]:
Use 'string-tokenize' instead of 'string-split'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-04 16:36:59 +02:00
Maxime Devos 085a8a0cdf
import/minetest: Define an updater for mods on ContentDB.
Only detecting updates is currently supported.  To actually
perform the uppdates, a patch like
<https://issues.guix.gnu.org/50072#4> is required.

* guix/import/minetest.scm
  (version-style,minetest-package?,latest-minetest-release): New procedures.
  (%minetest-updater): New updater.
* tests/minetest.scm
  (upstream-source->sexp,expected-sexp,example-package): New procedure.
  (test-release,test-no-release): New macro's.
  ("same version","new version (dotted)","new version (date)")
  ("new version (git -> dotted)","dotted->date","date->dotted")
  ("no commit informaton, no new release")
  ("minetest is not a minetest mod")
  ("technic is a minetest mod")
  ("upstream-name is required"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-02 17:16:43 +02:00
Ludovic Courtès b7d8dc5841
import: stackage: Use the standard diagnostic procedures.
* guix/import/stackage.scm (leave-with-message): Remove.
(stackage-lts-info-fetch): Use 'raise' and 'formatted-message'.
(stackage->guix-package): Likewise.
(latest-lts-release): Use 'warning' instead of 'format'.
2021-10-02 17:04:54 +02:00
Ludovic Courtès 46d15af4cb
import: stackage: Use 'define-json-mapping'.
* guix/import/stackage.scm (<stackage-lts>, <snapshot>)
(<stackage-package>): New record types and JSON mappings.
(lts-info-packages, stackage-package-name)
(stackage-package-version): Remove.
(lts-package-version): Rename 'pkgs-info' to 'packages'; assume
'packages' is a list of <stackage-package>.
(stackage->guix-package): Use 'stackage-lts-packages' instead of
'lts-info-packages'.  Rename 'packages-info' to 'packages'.
(latest-lts-release): Likewise.
(stackage-package?): Rename to...
(stackage-lts-package?): ... this.  Adjust to new API.
(%stackage-updater)[pred]: Update accordingly.
* tests/lint.scm ("haskell-stackage"): Add "snapshot" entry in JSON
snippet.
2021-10-02 17:04:50 +02:00
Xinglu Chen 7b75f90c5b
import: pypi: Honor the 'upstream-name' package property.
Previously, when a PyPI package had a “-” followed by one or more digits in
its name, e.g., “AV-98”, the importer would interpret “98” as the version of
the package and thus mistake the “AV-98” package for the “av” package on PyPI.

  $ ./pre-inst-env guix refresh av-98
  following redirection to `https://pypi.org/pypi/av/json'...
  /home/yoctocell/src/guix/gnu/packages/web-browsers.scm:914:13: av-98 would be upgraded from 1.0.1 to 8.0.3

Setting the ‘upstream-name’ property to “AV-98” would solve the problem.

  $ ./pre-inst-env guix refresh av-98
  /home/yoctocell/src/guix/gnu/packages/web-browsers.scm:914:13: 1.0.1 is already the latest version of av-98

* guix/import/pypi.scm (guix-package->pypi-name): Honor ‘upstream-name’
property.
(make-pypi-sexp): Set ‘upstream-name’ property when appropriate.
* tests/pypi.scm (test-json): Rename to ...
(test-json-1): ... this.
(test-json-2): New variable
("guix-package->pypi-name, honor 'upstream-name'"): New test.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-30 23:44:49 +02:00
Tobias Geerinckx-Rice 2f5368d678
import: minetest: Fix typos.
* guix/import/minetest.scm (elaborate-contentdb-name): Fix ‘ambiguous’
and ‘thes’ typos.
* tests/minetest.scm: Likewise for all tests.
2021-09-28 22:00:47 +02:00
Xinglu Chen 9c5e5ca1c0
import: stackage: Don’t try to update packages not available on Stackage.
Previously, the ‘hackage-package?’ predicate was used which meant that
the updater would try to update non-Stackage packages, and lead to messages
like these:

  $ guix refresh -t stackage
  warning: failed to parse https://hackage.haskell.org/package/hurl/hurl.cabal
  warning: failed to parse https://hackage.haskell.org/package/idris/idris.cabal

Since ‘hurl’ and ‘idris’ aren’t available on the current Stackage LTS release,
they should be filtered out before the Stackage updater even tries to update
them.

* stackage.scm (stackage-package?): New procedure.
(%stackage-updater): Use it.

Signed-off-by: Lars-Dominik Braun <lars@6xq.net>
2021-09-27 13:37:51 +02:00
Sarah Morgensen 281ede2e7d
import: go: Match "go-import" meta tags anywhere.
Some personal sites forget to put <meta name="go-import" ...> in a
<head> element, so look anywhere for them.

Partly fixes <https://issues.guix.gnu.org/50595>.
Reported by Stephen Paul Weber <singpolyma@singpolyma.net>.

* guix/import/go.scm (fetch-module-meta-data): Match "go-import" meta
tags anywhere in the page.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-18 23:08:32 +02:00
Sarah Morgensen b3907e304d
import: go: Improve handling of modules in VCS subdirectories.
Use the supplied module path (instead of the repository root) as the import
path for everything except source and homepage URLs.  For modules not in the
root of a VCS repository, set #:unpack-path to the repository root by default.

Partly fixes <https://issues.guix.gnu.org/50595>.
Reported by Stephen Paul Weber <singpolyma@singpolyma.net>.

* guix/import/go.scm (go-module->guix-package): Use 'module-path'
instead of 'root-module-path' for #:import-path.  Emit #:unpack-path
when #:import-path is not equal to 'root-module-path'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-18 23:08:32 +02:00
Maxime Devos 808f9ffbd3
import: minetest: Strip "v" prefixes from the version number.
This fixes one of the issues noted at <https://issues.guix.gnu.org/50425#4>.

* guix/import/minetest.scm
  (release-version): New procedure.
  (%minetest->guix-package): Call new procedure instead of release-title.
* tests/minetest.scm
  (make-package-sexp): Allow overriding the version number.
  (make-releases-json): Allow overriding the release title.
  ("conventional version number")
  ("v-prefixed version number")
  ("dates as version number"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-18 19:43:00 +02:00
Maxime Devos 8480a2a5bb
import: minetest: Delete duplicate dependencies.
This fixes one of the issues noted in <https://issues.guix.gnu.org/50425#4>.

* guix/import/minetest.scm
  (import-dependencies): Call 'delete-duplicates' on the resulting list.
* tests/minetest.scm
  ("minetest->guix-package, multiple dependencies implemented by one mod"):
  New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-18 19:42:54 +02:00
Xinglu Chen 59ee10754e
import: Add 'generic-git' updater.
* guix/git.scm (ls-remote-refs): New procedure.
* tests/git.scm ("remote-refs" "remote-refs: only tags"): New tests.
* guix/import/git.scm: New file.
* doc/guix.texi (Invoking guix refresh): Document it.
* tests/import-git.scm: New test file.
* Makefile.am (MODULES, SCM_TESTS): Register the new files.

Co-authored-by: Sarah Morgensen <iskarian@mgsn.dev>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-18 19:37:45 +02:00
Xinglu Chen a840caccae
import: cabal: Treat identifier names correctly.
* guix/import/cabal.scm (is-id): Accept the location as an argument.  Don’t
check if the identifier name is a reserved keyword unless it is the first word
on the line.
(lex-word): Adjust accordingly.
* tests/hackage ("hackage->guix-package tests flag executable"): Expect it to
pass.

Fixes: <https://issues.guix.gnu.org/25138>
Signed-off-by: Lars-Dominik Braun <lars@6xq.net>
2021-09-15 14:28:38 +02:00
Xinglu Chen 9875f9bca3
import: elpa: Don't hardcode default branch to 'master'.
Otherwise, remotes without a branch named 'master' will cause an error when
importing.

* guix/import/elpa (git-repository->origin): Fallback to HEAD instead of the
  'master' branch.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-10 17:30:55 +02:00
Sarah Morgensen e8a67f0fc4
import: go: Fix import when import path redirects.
* guix/import/go.scm (fetch-module-meta-data): If no meta entries
have a matching import prefix, return the first entry instead of #f.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-07 15:59:35 +02:00
Xinglu Chen af4fa7c00c
import: elpa: Support NonGNU ELPA.
* guix/import/elpa.scm (elpa-url): Add NonGNU ELPA URL.
* doc/guix.texi (Invoking guix import): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-07 15:59:34 +02:00
zimoun be13e2be08
import: go: Improve error handling.
* guix/import/go.scm (go-module->guix-package*): Handle errors, remove
memoize.
(go-module-recursive-import): Remove 'guard', add memoize.
* guix/scripts/import/go.scm (guix-import-go): Adjust.
* tests/go.scm: Adjust.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-01 23:41:42 +02:00
Sarah Morgensen f95bdeb93a
import: utils: Skip not found packages.
* guix/import/utils.scm (recursive-import): Skip packages when the
package returned by 'repo->guix-package' is false.
* tests/import-utils.scm: New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-01 23:41:42 +02:00
Sarah Morgensen 16579a7c57
import: go: Return false for package not found.
* guix/import/go.scm (go-module-recursive-import): Explicitly return
false when packages are not found.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-01 23:41:42 +02:00
Xinglu Chen 0508622848
build-system: chicken: Add 'egg-uri' procedure.
Once Chicken 6 gets released, we can just adjust the URL in the ‘egg-uri’
procedure, instead of having to change the URL for all the Chicken packages.
Making things a little more future-proof.

* guix/build-system/chicken.scm (egg-uri): New procedure.
* guix/import/egg.scm (egg-source-url): Adjust accordingly.
(egg->guix-package): Likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-08-30 14:38:50 +02:00
Alice BRENON fc29c80b96
guix: opam: More flexibility in the importer.
* guix/scripts/import/opam.scm: Pass all instances of --repo as a list
  to the importer.
* guix/import/opam.scm (opam-fetch): Stop expecting "expanded"
  repositories and call get-opam-repository instead to keep values
  "symbolic" as long as possible and factorize.
  (get-opam-repository): Use the same repository source as CLI opam does
  (i.e. HTTP-served index.tar.gz instead of git repositories).
  (find-latest-version): Be more flexible on the repositories structure
  instead of expecting packages/PACKAGE-NAME/PACKAGE-NAME.VERSION/.
* tests/opam.scm: Update the call to opam->guix-package since repo is
  now expected to be a list and remove the mocked get-opam-repository
  deprecated by the support for local folders by the actual
  implementation.
* doc/guix.texi: Document the new semantics and valid arguments for the
  --repo option.

Signed-off-by: Julien Lepiller <julien@lepiller.eu>
2021-08-21 00:05:21 +02:00
Maxime Devos 467e874a86
guix: Add ContentDB importer.
* guix/import/contentdb.scm: New file.
* guix/scripts/import/contentdb.scm: New file.
* tests/contentdb.scm: New file.
* Makefile.am (MODULES, SCM_TESTS): Register them.
* po/guix/POTFILES.in: Likewise.
* doc/guix.texi (Invoking guix import): Document it.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
2021-08-20 12:41:54 +02:00
Maxime Devos d08455934c
import/utils: Recognise GPL-3.0-or-later and friends.
* guix/import/utils.scm (spdx-string->license): Recognise
  GPL-N-only and GPL-N-or-later.  Likewise for LGPL and AGPL.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
2021-08-20 12:41:54 +02:00
itd 51157d474f
import/print: package->code: Fix license object.
* guix/import/print.scm (package->code)<license->code>: Update generated
licence object to match record constructor.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-07-19 19:57:51 +02:00
Maxim Cournoyer 15b4372b60
import: go: Fix indentation.
* guix/import/go.scm: Fix indentation.
2021-07-18 01:57:17 -04:00
Sarah Morgensen 793ba333c6
import: go: Upgrade go.mod parser.
Upgrade the go.mod parser to handle the full go.mod spec, and to gracefully
handle unexpected/malformed syntax.  Restructure parser usage, making the
parse tree available for other uses.

guix/import/go.scm (parse-go.mod): Parse using (ice-9 peg) instead of
regex matching for more robustness.  Return a list of directives.
(go.mod-directives): New procedure.
(go.mod-requirements): Likewise.
(go-module->guix-package): Use it.
(%go.mod-replace-directive-rx): Remove unused variable.
tests/go.scm (testing-parse-mod): Adjust accordingly.
(go.mod-requirements)
(fixture-go-mod-unparseable)
(fixture-go-mod-retract)
(fixture-go-mod-strings): New variables.
("parse-go.mod: simple")
("parse-go.mod: comments and unparseable lines")
("parse-go.mod: retract")
("parse-go.mod: raw strings and quoted strings")
("parse-go.mod: complete"): New tests.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-18 01:57:17 -04:00
Sarah Morgensen via Guix-patches via 5eba9c0960
import: go: Handle multiple go-import meta tags.
* guix/import/go.scm (fetch-module-meta-data): Parse all go-import meta
tags and return the first 'module-meta' with a matching import prefix.
[go-import->module-meta]: Extract parsing into new procedure.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-17 23:26:52 -04:00
Sarah Morgensen via Guix-patches via 59d20bcfcc
import: go: Fix parsing of pkg.go.dev licenses after site update.
* guix/import/go.scm (go-package-licenses): Find license names in
'h2 // div // *text*' elements rather than 'h2 // *text*' elements.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-17 22:13:39 -04:00