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.
This commit is contained in:
Hartmut Goebel 2022-06-24 22:01:35 +02:00
parent 9500c11c8b
commit 21703b5120
No known key found for this signature in database
GPG Key ID: 634A8DFFD3F631DF
7 changed files with 64 additions and 10 deletions

View File

@ -4,6 +4,7 @@
;;; Copyright © 2016 Alex Sassmannshausen <alex@pompo.co> ;;; Copyright © 2016 Alex Sassmannshausen <alex@pompo.co>
;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -29,6 +30,7 @@
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (json) #:use-module (json)
#:use-module (gcrypt hash) #:use-module (gcrypt hash)
#:use-module (guix diagnostics)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix base32) #:use-module (guix base32)
@ -305,8 +307,13 @@ in RELEASE, a <cpan-release> record."
")")))) ")"))))
(url-predicate (cut regexp-exec cpan-rx <>)))) (url-predicate (cut regexp-exec cpan-rx <>))))
(define (latest-release package) (define* (latest-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE." "Return an <upstream-source> for the latest release of PACKAGE."
(when version
(error
(formatted-message
(G_ "~a updater doesn't support updating to a specific version, sorry.")
"cpan")))
(match (cpan-fetch (package->upstream-name package)) (match (cpan-fetch (package->upstream-name package))
(#f #f) (#f #f)
(release (release

View File

@ -5,6 +5,7 @@
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -693,8 +694,13 @@ s-expression corresponding to that package, or #f on failure."
(_ #f))) (_ #f)))
(_ #f))))) (_ #f)))))
(define (latest-cran-release pkg) (define* (latest-cran-release pkg #:key (version #f))
"Return an <upstream-source> for the latest release of the package PKG." "Return an <upstream-source> for the latest release of the package PKG."
(when version
(error
(formatted-message
(G_ "~a provides only the latest version of each package, sorry.")
"CRAN")))
(define upstream-name (define upstream-name
(package->upstream-name pkg)) (package->upstream-name pkg))
@ -713,20 +719,25 @@ s-expression corresponding to that package, or #f on failure."
(changed-inputs pkg (changed-inputs pkg
(description->package 'cran meta))))))) (description->package 'cran meta)))))))
(define (latest-bioconductor-release pkg) (define* (latest-bioconductor-release pkg #:key (version #f))
"Return an <upstream-source> for the latest release of the package PKG." "Return an <upstream-source> for the latest release of the package PKG."
(when version
(error
(formatted-message
(G_ "~a provides only the latest version of each package, sorry.")
"bioconductor.org")))
(define upstream-name (define upstream-name
(package->upstream-name pkg)) (package->upstream-name pkg))
(define version (define latest-version
(latest-bioconductor-package-version upstream-name)) (latest-bioconductor-package-version upstream-name))
(and version (and version
;; Bioconductor does not provide signatures. ;; Bioconductor does not provide signatures.
(upstream-source (upstream-source
(package (package-name pkg)) (package (package-name pkg))
(version version) (version latest-version)
(urls (bioconductor-uri upstream-name version)) (urls (bioconductor-uri upstream-name version))
(input-changes (input-changes
(changed-inputs (changed-inputs

View File

@ -7,6 +7,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -35,6 +36,7 @@
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (srfi srfi-35) #:use-module (srfi srfi-35)
#:use-module (guix diagnostics)
#:use-module ((guix download) #:select (download-to-store)) #:use-module ((guix download) #:select (download-to-store))
#:use-module (guix import utils) #:use-module (guix import utils)
#:use-module (guix http-client) #:use-module (guix http-client)
@ -400,11 +402,16 @@ type '<elpa-package>'."
(string-drop (package-name package) 6) (string-drop (package-name package) 6)
(package-name package)))) (package-name package))))
(define (latest-release package) (define* (latest-release package #:key (version #f))
"Return an <upstream-release> for the latest release of PACKAGE." "Return an <upstream-release> for the latest release of PACKAGE."
(define name (guix-package->elpa-name package)) (define name (guix-package->elpa-name package))
(define repo (elpa-repository package)) (define repo (elpa-repository package))
(when version
(error
(formatted-message
(G_ "~a updater doesn't support updating to a specific version, sorry.")
"elpa")))
(match (elpa-package-info name repo) (match (elpa-package-info name repo)
(#f (#f
;; No info, perhaps because PACKAGE is not truly an ELPA package. ;; No info, perhaps because PACKAGE is not truly an ELPA package.

View File

@ -7,6 +7,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -30,10 +31,12 @@
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (guix diagnostics)
#:use-module ((guix download) #:select (download-to-store url-fetch)) #:use-module ((guix download) #:select (download-to-store url-fetch))
#:use-module ((guix utils) #:select (package-name->name+version #:use-module ((guix utils) #:select (package-name->name+version
canonical-newline-port)) canonical-newline-port))
#:use-module (guix http-client) #:use-module (guix http-client)
#:use-module (guix i18n)
#:use-module (guix import utils) #:use-module (guix import utils)
#:use-module (guix import cabal) #:use-module (guix import cabal)
#:use-module (guix store) #:use-module (guix store)
@ -359,8 +362,13 @@ respectively."
(let ((hackage-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage/)"))) (let ((hackage-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage/)")))
(url-predicate (cut regexp-exec hackage-rx <>)))) (url-predicate (cut regexp-exec hackage-rx <>))))
(define (latest-release package) (define* (latest-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE." "Return an <upstream-source> for the latest release of PACKAGE."
(when version
(error
(formatted-message
(G_ "~a updater doesn't support updating to a specific version, sorry.")
"hackage")))
(let* ((hackage-name (guix-package->hackage-name package)) (let* ((hackage-name (guix-package->hackage-name package))
(cabal-meta (hackage-fetch hackage-name))) (cabal-meta (hackage-fetch hackage-name)))
(match cabal-meta (match cabal-meta

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be> ;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -25,6 +26,7 @@
#:use-module (srfi srfi-2) #:use-module (srfi srfi-2)
#:use-module (srfi srfi-11) #:use-module (srfi srfi-11)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (guix diagnostics)
#:use-module ((guix packages) #:prefix package:) #:use-module ((guix packages) #:prefix package:)
#:use-module (guix upstream) #:use-module (guix upstream)
#:use-module (guix utils) #:use-module (guix utils)
@ -486,7 +488,7 @@ list of AUTHOR/NAME strings."
(and (string-prefix? "minetest-" (package:package-name pkg)) (and (string-prefix? "minetest-" (package:package-name pkg))
(assq-ref (package:package-properties pkg) 'upstream-name))) (assq-ref (package:package-properties pkg) 'upstream-name)))
(define (latest-minetest-release pkg) (define* (latest-minetest-release pkg #:key (version #f))
"Return an <upstream-source> for the latest release of the package PKG, "Return an <upstream-source> for the latest release of the package PKG,
or #false if the latest release couldn't be determined." or #false if the latest release couldn't be determined."
(define author/name (define author/name
@ -494,6 +496,12 @@ or #false if the latest release couldn't be determined."
(define contentdb-package (contentdb-fetch author/name)) ; TODO warn if #f? (define contentdb-package (contentdb-fetch author/name)) ; TODO warn if #f?
(define release (latest-release author/name)) (define release (latest-release author/name))
(define source (package:package-source pkg)) (define source (package:package-source pkg))
(when version
(error
(formatted-message
(G_ "~a updater doesn't support updating to a specific version, sorry.")
"minetest")))
(and contentdb-package release (and contentdb-package release
(release-commit release) ; not always set (release-commit release) ; not always set
;; Only continue if both the old and new version number are both ;; Only continue if both the old and new version number are both

View File

@ -4,6 +4,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021, 2022 Alice Brenon <alice.brenon@ens-lyon.fr> ;;; Copyright © 2021, 2022 Alice Brenon <alice.brenon@ens-lyon.fr>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -35,6 +36,7 @@
#:use-module ((guix build utils) #:select (dump-port find-files mkdir-p)) #:use-module ((guix build utils) #:select (dump-port find-files mkdir-p))
#:use-module (guix build-system) #:use-module (guix build-system)
#:use-module (guix build-system ocaml) #:use-module (guix build-system ocaml)
#:use-module (guix diagnostics)
#:use-module (guix http-client) #:use-module (guix http-client)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix packages) #:use-module (guix packages)
@ -417,8 +419,13 @@ package in OPAM."
(member (build-system-name (package-build-system package)) '(dune ocaml)) (member (build-system-name (package-build-system package)) '(dune ocaml))
(not (string-prefix? "ocaml4" (package-name package))))) (not (string-prefix? "ocaml4" (package-name package)))))
(define (latest-release package) (define* (latest-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE." "Return an <upstream-source> for the latest release of PACKAGE."
(when version
(error
(formatted-message
(G_ "~a updater doesn't support updating to a specific version, sorry.")
"opam")))
(and-let* ((opam-name (guix-package->opam-name package)) (and-let* ((opam-name (guix-package->opam-name package))
(opam-file (opam-fetch opam-name)) (opam-file (opam-fetch opam-name))
(version (assoc-ref opam-file "version")) (version (assoc-ref opam-file "version"))

View File

@ -4,6 +4,7 @@
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Xinglu Chem <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chem <public@yoctocell.xyz>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -139,9 +140,14 @@ included in the Stackage LTS release."
(mlambda () (mlambda ()
(stackage-lts-packages (stackage-lts-packages
(stackage-lts-info-fetch %default-lts-version))))) (stackage-lts-info-fetch %default-lts-version)))))
(lambda* (pkg) (lambda* (pkg #:key (version #f))
"Return an <upstream-source> for the latest Stackage LTS release of "Return an <upstream-source> for the latest Stackage LTS release of
PACKAGE or #f if the package is not included in the Stackage LTS release." PACKAGE or #f if the package is not included in the Stackage LTS release."
(when version
(error
(formatted-message
(G_ "~a updater doesn't support updating to a specific version, sorry.")
"stackage")))
(let* ((hackage-name (guix-package->hackage-name pkg)) (let* ((hackage-name (guix-package->hackage-name pkg))
(version (lts-package-version (packages) hackage-name)) (version (lts-package-version (packages) hackage-name))
(name-version (hackage-name-version hackage-name version))) (name-version (hackage-name-version hackage-name version)))