Commit Graph

29 Commits

Author SHA1 Message Date
Saku Laesvuori acef524961
guix: import: stackage: Fix crash on recursive import
* guix/import/stackage.scm (lts-package-version): Call
  stackage-package-version only when the package is found.

Change-Id: Ic8d7c1b7a42a9c1a6cbba567e148706507a53ee3
Signed-off-by: Lars-Dominik Braun <lars@6xq.net>
2023-12-03 09:11:29 +01:00
Ludovic Courtès df8b3821a8
import: stackage: Updater resolves inputs lazily.
Fixes the "haskell-stackage" test in 'tests/lint.scm', which started
failing with e6223017d9 because the extra
HTTP GETs induced by the 'haskell-fetch' calls would fail.

* guix/import/stackage.scm (latest-lts-release): Call 'hackage-fetch'
and its continuation from within 'inputs', which is delayed.  Pass it
NAME-VERSION instead of HACKAGE-NAME-VERSION.
2023-06-09 14:19:14 +02:00
Ludovic Courtès e6223017d9
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.

* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-31 23:25:24 +02:00
Ludovic Courtès adf95a810d
import: Properly report "no specific version" errors.
* guix/import/cpan.scm (latest-release): Use 'raise' instead of
'error'.
* guix/import/elpa.scm (latest-release): Likewise.
* guix/import/hackage.scm (latest-release): Likewise.
* guix/import/minetest.scm (latest-minetest-release): Likewise.
* guix/import/opam.scm (latest-release): Likewise.
* guix/import/stackage.scm (latest-lts-release): Likewise.
2023-04-08 22:54:53 +02:00
Lars-Dominik Braun d06ae53013
import: hackage: Use upstream-name property.
* guix/import/hackage.scm (guix-package->hackage-name): Removed.
(latest-release): Use package-upstream-name* instead.
* guix/import/stackage.scm (latest-lts-release): Ditto.
(stackage-lts-package?): Ditto.
2023-02-26 10:20:14 +01:00
Lars-Dominik Braun eb42d18180
import: stackage: Update to release 20.5.
* guix/import/stackage.scm (%default-lts-version): Update to 20.5.
2023-02-26 10:19:36 +01:00
Ludovic Courtès 2e9c0e1ff6
import: stackage: Catch networking errors in predicate.
* guix/import/stackage.scm (stackage-lts-package?): Wrap body in
'false-if-networking-error'.
2023-01-08 16:11:45 +01:00
Lars-Dominik Braun 3c24da4260
import/utils: Pass all arguments through to package builder.
Individual importer may have additional arguments.

* guix/import/utils.scm (recursive-import): Patch all keyword arguments
through to repo->guix-package.
* guix/import/cran.scm (cran->guix-package): Add #:allow-other-keys.
* guix/import/crate.scm (crate->guix-package): Ditto.
* guix/import/egg.scm (egg->guix-package): Ditto.
* guix/import/elm.scm (elm->guix-package): Ditto.
* guix/import/gem.scm (gem->guix-package): Ditto.
* guix/import/gnu.scm (gnu->guix-package): Ditto.
* guix/import/go.scm (go-module->guix-package): Ditto.
(go-module-recursive-import): Ditto.
* guix/import/hackage.scm (hackage->guix-package): Ditto.
(hackage-recursive-import): Ditto.
* guix/import/hexpm.scm (hexpm->guix-package): Ditto.
* guix/import/minetest.scm (minetest->guix-package): Ditto.
(minetest-recursive-import): Ditto.
* guix/import/opam.scm (opam->guix-package): Ditto.
* guix/import/pypi.scm (pypi->guix-package): Ditto.
* guix/import/stackage.scm (stackage->guix-package): Ditto.
(stackage-recursive-import): Ditto.
* guix/import/texlive.scm (texlive->guix-package): Ditto.
2022-12-31 14:48:46 +01:00
Hartmut Goebel 21703b5120
import: Issue error-message if version is given.
These importer don't support importing a specific version, thus the updater
does neither.  Issue an error message in case version is given.

* guix/import/cpan.scm (latest-release),
  guix/import/elpa.scm (latest-release),
  guix/import/hackage.scm (latest-release),
  guix/import/minetest.scm (latest-minetest-release),
  guix/import/opam.scm (latest-release): Add #:version argument,
  issue error if version is given.
* guix/import/cran.scm (latest-cran-release): Same.
  (latest-bioconductor-release) Same. <version>: rename to <latest-version>.
* guix/import/stackage.scm (latest-lts-release): For each generated updater,
  add #:version argument and issue error if version is given.
2022-12-26 17:15:07 +01:00
Hartmut Goebel a274a6a1ac
upstream-updater: Rename record field.
The next commits will make the functions, which are currently importing the
latest version of a package, change into importing the latest or a given
version of the package (for those updaters supporting specifying a version).
Thus the name ‘latest‘ is no longer appropriate.

* guix/upstream.scm (upstream-updater) Rename field [latest] to
  [import]. (lookup-updater, package-latest-release) Adjust fieldname
  accordingly.
* guix/gnu-maintenance.scm (%gnu-updater, %gnu-ftp-updater,
  %savannah-updater, %sourceforge-updater, %xorg-updater,
  %kernel.org-updater, %generic-html-updater),
  guix/import/cpan.scm (%cpan-updater),
  guix/import/cran.scm (%cran-updater, %bioconductor-updater),
  guix/import/crate.scm (%crate-updater),
  guix/import/egg.scm (%egg-updater),
  guix/import/elpa.scm (%elpa-updater),
  guix/import/gem.scm (%gem-updater),
  guix/import/git.scm (%generic-git-updater),
  guix/import/github.scm (%github-updater),
  guix/import/gnome.scm (%gnome-updater),
  guix/import/hackage.scm (%hackage-updater),
  guix/import/hexpm.scm (%hexpm-updater),
  guix/import/kde.scm (%kde-updater),
  guix/import/launchpad.scm (%launchpad-updater),
  guix/import/minetest.scm (%minetest-updater),
  guix/import/opam.scm (%opam-updater),
  guix/import/pypi.scm (%pypi-updater),
  guix/import/stackage.scm (%stackage-updater),
  tests/import-github.scm (found-sexp)
  tests/transformations.scm ("options->transformation, with-latest"):
  Adjust fieldname accordingly.
2022-12-26 17:15:06 +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
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 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
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 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
Martin Becze bea3b17739
import: utils: 'recursive-import' accepts an optional version parameter.
This adds a key VERSION to 'recursive-import' and moves the parameter REPO to
a key. This also changes all the places that rely on 'recursive-import'.

* guix/import/utils.scm (recursive-import): Add the VERSION key. Make REPO a
  key.
  (package->definition): Add optional 'append-version?'.
* guix/scripts/import/crate.scm (guix-import-crate): Add the VERSION key.
* guix/import/crate.scm (crate->guix-package): Add the VERSION key.
  (crate-recursive-import): Pass VERSION to recursive-import, remove now
  unnecessary code.
* guix/import/cran.scm (cran->guix-package, cran-recursive-import): Change the
  REPO parameter to a key.
* guix/import/elpa.scm (elpa->guix-package, elpa-recursive-import): Likewise.
* guix/import/gem.scm (gem->guix-package, recursive-import): Likewise.
* guix/import/opam.scm (opam-recurive-import): Likewise.
* guix/import/pypi.scm (pypi-recursive-import): Likewise.
* guix/import/stackage.scm (stackage-recursive-import): Likewise.
* guix/scripts/import/cran.scm (guix-import-cran): Likewise.
* guix/scripts/import/elpa.scm (guix-import-elpa): Likewise.
* tests/elpa.scm (eval-test-with-elpa): Likewise.
* tests/import-utils.scm (recursive-import): Likewise.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2020-12-02 22:09:23 +01:00
Timothy Sample 464b1fffb0
lint: Add 'check-haskell-stackage' checker.
* guix/lint.scm (check-haskell-stackage): New procedure.
(%network-dependent-checkers): Add 'haskell-stackage' checker.
* guix/import/hackage.scm (%hackage-url): New variable.
(hackage-source-url, hackage-cabal-url): Use it in place of a
hard-coded string.
* guix/import/stackage.scm (%stackage-url): Make it a parameter.
(stackage-lts-info-fetch): Update accordingly.
* tests/lint.scm ("hackage-stackage"): New test.
2020-11-21 22:11:36 -05:00
Robert Vollmert f0bb2662bb
guix import stackage: Default to LTS version that matches GHC.
In particular, this means that 'guix lint' won't warn to update to
versions that won't necessarily fit our package set well.

* guix/import/stackage.scm (%stackage-url): Change to "https",
avoiding redirect log messages.
(%default-lts-version): New variable.
(stackage-lts-info-fetch, stackage->guix-package,
latest-lts-release): Use it.
(lts-info-ghc-version): Remove unused procedure.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2020-11-03 15:36:59 -05:00
Tobias Geerinckx-Rice bd16cc2902
import: Fix docstring typoes.
* guix/import/cabal.scm (cabal-flags->alist): Fix typo in docstring.
* guix/import/stackage.scm (lts-info-ghc-version): Likewise.
* guix/scripts/import/hackage.scm (show-help): Likewise.
2020-09-23 04:36:59 +02:00
Tobias Geerinckx-Rice 35b00d4caa
import: stackage: Fix typo.
* guix/import/stackage.scm (latest-lts-release): Fix spelling of ‘if’.
2020-06-09 22:30:08 +02:00
Marius Bakke 2e08394b3c
import: stackage: Fix typo.
* guix/import/stackage.scm (latest-lts-release): Fix spelling of "included".
2020-06-09 20:43:36 +02:00
Vagrant Cascadian fa4867cc99
import: stackage: Fix typo.
* guix/import/stackage: Fix spelling of "version".
2019-09-23 12:06:46 -07:00
Ludovic Courtès 81c3dc3224
maint: Switch to Guile-JSON 3.x.
Guile-JSON 3.x is incompatible with Guile-JSON 1.x, which we relied on
until now: it maps JSON dictionaries to alists (instead of hash tables),
and JSON arrays to vectors (instead of lists).  This commit is about
adjusting all the existing code to this new mapping.

* m4/guix.m4 (GUIX_CHECK_GUILE_JSON): New macro.
* configure.ac: Use it.
* doc/guix.texi (Requirements): Mention the Guile-JSON version.
* guix/git-download.scm (git-fetch)[guile-json]: Use GUILE-JSON-3.
* guix/import/cpan.scm (string->license): Expect vectors instead of
lists.
(module->dist-name): Use 'json-fetch' instead of 'json-fetch-alist'.
(cpan-fetch): Likewise.
* guix/import/crate.scm (crate-fetch): Likewise, and call 'vector->list'
for DEPS.
* guix/import/gem.scm (rubygems-fetch): Likewise.
* guix/import/json.scm (json-fetch-alist): Remove.
* guix/import/pypi.scm (pypi-fetch): Use 'json-fetch' instead of
'json-fetch-alist'.
(latest-source-release, latest-wheel-release): Call 'vector->list' on
RELEASES.
* guix/import/stackage.scm (stackage-lts-info-fetch): Use 'json-fetch'
instead of 'json-fetch-alist'.
(lts-package-version): Use 'vector->list'.
* guix/import/utils.scm (hash-table->alist): Remove.
(alist->package): Pass 'vector->list' on the inputs fields, and default
to the empty vector.
* guix/scripts/import/json.scm (guix-import-json): Remove call to
'hash-table->alist'.
* guix/swh.scm (define-json-reader): Expect pair? or null? instead of
hash-table?.
[extract-field]: Use 'assoc-ref' instead of 'hash-ref'.
(json->branches): Use 'map' instead of 'hash-map->list'.
(json->checksums): Likewise.
(json->directory-entries, origin-visits): Call 'vector->list' on the
result of 'json->scm'.
* tests/import-utils.scm ("alist->package with dependencies"): New test.
* gnu/installer.scm (build-compiled-file)[builder]: Use GUILE-JSON-3.
* gnu/installer.scm (installer-program)[installer-builder]: Likewise.
* gnu/installer/locale.scm (iso639->iso639-languages): Use 'assoc-ref'
instead of 'hash-ref', and pass vectors through 'vector->list'.
(iso3166->iso3166-territories): Likewise.
* gnu/system/vm.scm (system-docker-image)[build]: Use GUILE-JSON-3.
* guix/docker.scm (manifest, config): Adjust for Guile-JSON 3.
* guix/scripts/pack.scm (docker-image)[build]: Use GUILE-JSON-3.
* guix/import/github.scm (fetch-releases-or-tags): Update docstring.
(latest-released-version): Use 'assoc-ref' instead of 'hash-ref'.  Pass
the result of 'fetch-releases-or-tags' to 'vector->list'.
* guix/import/launchpad.scm (latest-released-version): Likewise.
2019-07-25 00:16:41 +02:00
Timothy Sample 127586adfb
guix: import: stackage: Fix JSON accessors.
* guix/import/stackage.scm (lts-info-ghc-version, lst-info-packages): Use
assoc-ref for accessing parsed JSON.
2018-10-01 12:12:08 +02:00
Ricardo Wurmus a3ece51a29
import: stackage: Support recursive importing.
* guix/import/hackage.scm (hackage-name->package-name): Export procedure.
* guix/import/stackage.scm (lts-info-packages-lts-info): Fix match expression.
(stackage-recursive-import): New procedure.
(stackage->guix-package): Memoize results.
* guix/scripts/import/stackage.scm (show-help, %options,
guix-import-stackage): Support recursive importing.
* doc/guix.texi (Invoking guix import): Document option.
2018-08-30 15:22:06 +02:00
Jelle Licht 3edf0d53a4
import: json: Consolidate duplicate json-fetch functionality.
* guix/import/json.scm (json-fetch): Return a list or hash table.
  (json-fetch-alist): New procedure.
* guix/import/github.scm (json-fetch*): Remove.
  (latest-released-version): Use json-fetch.
* guix/import/cpan.scm (module->dist-name): Use json-fetch-alist.
  (cpan-fetch): Likewise.
* guix/import/crate.scm (crate-fetch): Likewise.
* guix/import/gem.scm (rubygems-fetch): Likewise.
* guix/import/pypi.scm (pypi-fetch): Likewise.
* guix/import/stackage.scm (stackage-lts-info-fetch): Likewise.
2018-06-10 22:15:12 +02:00
Federico Beffa 57075ade97
import: stackage: Avoid using (guix ui) in importer code.
* guix/import/stackage.scm (stackage->guix-package, stackage-lts-info-fetch):
  Raise 'message' condition instead of using 'leave' from (guix ui).
* guix/scripts/import/stackage.scm (guix-import-stackage): Handle conditions.
2017-02-14 08:38:45 +01:00
Federico Beffa bc5844d149
import: Add stackage importer and updater.
* guix/import/stackage.scm: New file.
* guix/scripts/import/stackage.scm: New file.
* Makefile.am (MODULES): Add new files.
* guix/scripts/import.scm (importers): Add "stackage".
* guix/scripts/refresh.scm (%updaters): Add %stackage-updater.
* doc/guix.texi (Invoking 'guix import'): Document the importer.
  (Invoking 'guix refresh'): Add stackage to option --type valid values.
* guix/import/hackage.scm (guix-package->hackage-name, hackage-fetch,
  hackage-source-url, hackage-cabal-url, hackage-package?): Export them.
2017-02-09 19:36:08 +01:00