summaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/cpan.scm32
-rw-r--r--guix/import/cran.scm27
-rw-r--r--guix/import/crate.scm10
-rw-r--r--guix/import/egg.scm10
-rw-r--r--guix/import/elpa.scm11
-rw-r--r--guix/import/gem.scm7
-rw-r--r--guix/import/git.scm39
-rw-r--r--guix/import/github.scm36
-rw-r--r--guix/import/gnome.scm47
-rw-r--r--guix/import/gnu.scm2
-rw-r--r--guix/import/hackage.scm12
-rw-r--r--guix/import/hexpm.scm9
-rw-r--r--guix/import/kde.scm61
-rw-r--r--guix/import/launchpad.scm10
-rw-r--r--guix/import/minetest.scm12
-rw-r--r--guix/import/opam.scm11
-rw-r--r--guix/import/pypi.scm14
-rw-r--r--guix/import/stackage.scm10
18 files changed, 230 insertions, 130 deletions
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 87abe9c2f1..8972b87080 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016 Alex Sassmannshausen <alex@pompo.co>
;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; 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.
;;;
@@ -29,6 +30,7 @@
#:use-module (srfi srfi-26)
#:use-module (json)
#:use-module (gcrypt hash)
+ #:use-module (guix diagnostics)
#:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix base32)
@@ -39,26 +41,7 @@
#:use-module (guix packages)
#:use-module (guix upstream)
#:use-module (guix derivations)
- #:export (cpan-dependency?
- cpan-dependency-relationship
- cpan-dependency-phase
- cpan-dependency-module
- cpan-dependency-version
-
- cpan-release?
- cpan-release-license
- cpan-release-author
- cpan-release-version
- cpan-release-module
- cpan-release-distribution
- cpan-release-download-url
- cpan-release-abstract
- cpan-release-home-page
- cpan-release-dependencies
- json->cpan-release
-
- cpan-fetch
- cpan->guix-package
+ #:export (cpan->guix-package
metacpan-url->mirror-url
%cpan-updater
@@ -324,8 +307,13 @@ in RELEASE, a <cpan-release> record."
")"))))
(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."
+ (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))
(#f #f)
(release
@@ -358,4 +346,4 @@ in RELEASE, a <cpan-release> record."
(name 'cpan)
(description "Updater for CPAN packages")
(pred cpan-package?)
- (latest latest-release)))
+ (import latest-release)))
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index a02e746417..1ed3580315 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -410,7 +411,11 @@ empty list when the FIELD cannot be found."
("tcl/tk" "tcl")
("booktabs" "texlive-booktabs")
("freetype2" "freetype")
+ ("mariadb-devel" "mariadb")
+ ("mysql56_dev" "mariadb")
("sqlite3" "sqlite")
+ ("udunits-2" "udunits")
+ ("x11" "libx11")
(_ sysname)))
(define cran-guix-name (cut guix-name "r-" <>))
@@ -689,8 +694,13 @@ s-expression corresponding to that package, or #f on failure."
(_ #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."
+ (when version
+ (error
+ (formatted-message
+ (G_ "~a provides only the latest version of each package, sorry.")
+ "CRAN")))
(define upstream-name
(package->upstream-name pkg))
@@ -709,20 +719,25 @@ s-expression corresponding to that package, or #f on failure."
(changed-inputs pkg
(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."
+ (when version
+ (error
+ (formatted-message
+ (G_ "~a provides only the latest version of each package, sorry.")
+ "bioconductor.org")))
(define upstream-name
(package->upstream-name pkg))
- (define version
+ (define latest-version
(latest-bioconductor-package-version upstream-name))
(and version
;; Bioconductor does not provide signatures.
(upstream-source
(package (package-name pkg))
- (version version)
+ (version latest-version)
(urls (bioconductor-uri upstream-name version))
(input-changes
(changed-inputs
@@ -772,13 +787,13 @@ s-expression corresponding to that package, or #f on failure."
(name 'cran)
(description "Updater for CRAN packages")
(pred cran-package?)
- (latest latest-cran-release)))
+ (import latest-cran-release)))
(define %bioconductor-updater
(upstream-updater
(name 'bioconductor)
(description "Updater for Bioconductor packages")
(pred bioconductor-package?)
- (latest latest-bioconductor-release)))
+ (import latest-bioconductor-release)))
;;; cran.scm ends here
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index c76d7e9c1a..339dbcd74c 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -354,11 +355,12 @@ look up the development dependencs for the given crate."
(define crate-package?
(url-predicate crate-url?))
-(define (latest-release package)
- "Return an <upstream-source> for the latest release of PACKAGE."
+(define* (import-release package #:key (version #f))
+ "Return an <upstream-source> for the latest release of PACKAGE. Optionally
+include a VERSION string to fetch a specific version."
(let* ((crate-name (guix-package->crate-name package))
(crate (lookup-crate crate-name))
- (version (crate-latest-version crate))
+ (version (or version (crate-latest-version crate)))
(url (crate-uri crate-name version)))
(upstream-source
(package (package-name package))
@@ -370,5 +372,5 @@ look up the development dependencs for the given crate."
(name 'crate)
(description "Updater for crates.io packages")
(pred crate-package?)
- (latest latest-release)))
+ (import import-release)))
diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index 0d6d72c465..10a40fe4f8 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -333,10 +334,11 @@ not work."
;;; Updater.
;;;
-(define (latest-release package)
- "Return an @code{<upstream-source>} for the latest release of PACKAGE."
+(define* (import-release package #:key (version #f))
+ "Return an @code{<upstream-source>} for the latest release of PACKAGE.
+Optionally include a VERSION string to fetch a specific version."
(let* ((egg-name (guix-package->egg-name package))
- (version (find-latest-version egg-name))
+ (version (or version (find-latest-version egg-name)))
(source-url (egg-uri egg-name version)))
(upstream-source
(package (package-name package))
@@ -348,6 +350,6 @@ not work."
(name 'egg)
(description "Updater for CHICKEN egg packages")
(pred egg-package?)
- (latest latest-release)))
+ (import import-release)))
;;; egg.scm ends here
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 9399f45ebc..f9e9f2de53 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -35,6 +36,7 @@
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
+ #:use-module (guix diagnostics)
#:use-module ((guix download) #:select (download-to-store))
#:use-module (guix import utils)
#:use-module (guix http-client)
@@ -400,11 +402,16 @@ type '<elpa-package>'."
(string-drop (package-name package) 6)
(package-name package))))
-(define (latest-release package)
+(define* (latest-release package #:key (version #f))
"Return an <upstream-release> for the latest release of PACKAGE."
(define name (guix-package->elpa-name 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)
(#f
;; No info, perhaps because PACKAGE is not truly an ELPA package.
@@ -444,7 +451,7 @@ type '<elpa-package>'."
(name 'elpa)
(description "Updater for ELPA packages")
(pred package-from-elpa-repository?)
- (latest latest-release)))
+ (import latest-release)))
(define elpa-guix-name (cut guix-name "emacs-" <>))
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index ad1343bff4..8ad0662628 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -173,11 +174,11 @@ package on RubyGems."
(define gem-package?
(url-prefix-predicate "https://rubygems.org/downloads/"))
-(define (latest-release package)
+(define* (import-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(let* ((gem-name (guix-package->gem-name package))
(gem (rubygems-fetch gem-name))
- (version (gem-version gem))
+ (version (or version (gem-version gem)))
(url (rubygems-uri gem-name version)))
(upstream-source
(package (package-name package))
@@ -189,7 +190,7 @@ package on RubyGems."
(name 'gem)
(description "Updater for RubyGem packages")
(pred gem-package?)
- (latest latest-release)))
+ (import import-release)))
(define* (gem-recursive-import package-name #:optional version)
(recursive-import package-name
diff --git a/guix/import/git.scm b/guix/import/git.scm
index 4cf404677c..c15943bd7c 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -146,9 +147,11 @@ version corresponding to the tag, and the cdr is the name of the tag."
tags)
entry<?))
-(define* (latest-tag url #:key prefix suffix delim pre-releases?)
+(define* (latest-tag url
+ #:key prefix suffix delim pre-releases? (version #f))
"Return the latest version and corresponding tag available from the Git
-repository at URL."
+repository at URL. Optionally include a VERSION string to fetch a specific
+version."
(define (pre-release? tag)
(any (cut regexp-exec <> tag)
%pre-release-rx))
@@ -169,13 +172,22 @@ repository at URL."
((null? versions->tags)
(git-no-valid-tags-error))
(else
- (match (last versions->tags)
- ((version . tag)
- (values version tag)))))))
-
-(define (latest-git-tag-version package)
+ (let ((versions (if version
+ (filter (match-lambda
+ ((candidate-version . tag)
+ (string=? version candidate-version)))
+ versions->tags)
+ versions->tags)))
+ (if (null? versions)
+ (values #f #f)
+ (match (last versions)
+ ((version . tag)
+ (values version tag)))))))))
+
+(define* (latest-git-tag-version package #:key (version #f))
"Given a PACKAGE, return the latest version of it and the corresponding git
-tag, or #false and #false if the latest version could not be determined."
+tag, or #false and #false if the latest version could not be determined.
+Optionally include a VERSION string to fetch a specific version."
(guard (c ((or (git-no-tags-error? c) (git-no-valid-tags-error? c))
(warning (or (package-field-location package 'source)
(package-location package))
@@ -193,6 +205,7 @@ tag, or #false and #false if the latest version could not be determined."
(url (git-reference-url (origin-uri source)))
(property (cute assq-ref (package-properties package) <>)))
(latest-tag url
+ #:version version
#:prefix (property 'release-tag-prefix)
#:suffix (property 'release-tag-suffix)
#:delim (property 'release-tag-version-delimiter)
@@ -206,12 +219,14 @@ tag, or #false and #false if the latest version could not be determined."
(git-reference? (origin-uri origin))))
(_ #f)))
-(define (latest-git-release package)
- "Return an <upstream-source> for the latest release of PACKAGE."
+(define* (import-git-release package #:key (version #f))
+ "Return an <upstream-source> for the latest release of PACKAGE.
+Optionally include a VERSION string to fetch a specific version."
(let* ((name (package-name package))
(old-version (package-version package))
(old-reference (origin-uri (package-source package)))
- (new-version new-version-tag (latest-git-tag-version package)))
+ (new-version new-version-tag
+ (latest-git-tag-version package #:version version)))
(and new-version new-version-tag
(upstream-source
(package name)
@@ -226,4 +241,4 @@ tag, or #false and #false if the latest version could not be determined."
(name 'generic-git)
(description "Updater for packages hosted on Git repositories")
(pred git-package?)
- (latest latest-git-release)))
+ (import import-git-release)))
diff --git a/guix/import/github.scm b/guix/import/github.scm
index e1a1af7133..a1bda5ec43 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -249,11 +249,13 @@ Alternatively, you can wait until your rate limit is reset, or use the
#:headers headers)))
(x x)))))))))
-(define (latest-released-version url package-name)
+(define* (latest-released-version url package-name #:key (version #f))
"Return the newest released version and its tag given a string URL like
'https://github.com/arq5x/bedtools2/archive/v2.24.0.tar.gz' and the name of
the package e.g. 'bedtools2'. Return #f (two values) if there are no
-releases."
+releases.
+
+Optionally include a VERSION string to fetch a specific version."
(define (pre-release? x)
(assoc-ref x "prerelease"))
@@ -290,16 +292,25 @@ releases."
(match (and=> (fetch-releases-or-tags url) vector->list)
(#f (values #f #f))
(json
- (match (sort (filter-map release->version
- (match (remove pre-release? json)
- (() json) ; keep everything
- (releases releases)))
- (lambda (x y) (version>? (car x) (car y))))
+ (let ((releases (filter-map release->version
+ (match (remove pre-release? json)
+ (() json) ; keep everything
+ (releases releases)))))
+ (match (if version
+ ;; Find matching release version.
+ (filter (match-lambda
+ ((candidate-version . tag)
+ (string=? version candidate-version)))
+ releases)
+ ;; Sort releases descending.
+ (sort releases
+ (lambda (x y) (version>? (car x) (car y)))))
(((latest-version . tag) . _) (values latest-version tag))
- (() (values #f #f))))))
+ (() (values #f #f)))))))
-(define (latest-release pkg)
- "Return an <upstream-source> for the latest release of PKG."
+(define* (import-release pkg #:key (version #f))
+ "Return an <upstream-source> for the latest release of PKG.
+Optionally include a VERSION string to fetch a specific version."
(define (github-uri uri)
(match uri
((? string? url)
@@ -313,7 +324,8 @@ releases."
(source-uri (github-uri original-uri))
(name (package-name pkg))
(newest-version version-tag
- (latest-released-version source-uri name)))
+ (latest-released-version source-uri name
+ #:version version)))
(if newest-version
(upstream-source
(package name)
@@ -330,6 +342,6 @@ releases."
(name 'github)
(description "Updater for GitHub packages")
(pred github-package?)
- (latest latest-release)))
+ (import import-release)))
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 9d8cd8ec76..3c5a96fdde 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -57,9 +58,10 @@ source for metadata."
name "/" relative-url))))
'("tar.lz" "tar.xz" "tar.bz2" "tar.gz")))))))
-(define (latest-gnome-release package)
+(define* (import-gnome-release package #:key (version #f))
"Return the latest release of PACKAGE, a GNOME package, or #f if it could
-not be determined."
+not be determined. Optionally include a VERSION string to fetch a specific
+version."
(define %not-dot
(char-set-complement (char-set #\.)))
@@ -88,6 +90,28 @@ https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235"
;; Some packages like "NetworkManager" have camel-case names.
(package-upstream-name package))
+ (define (find-latest-release releases)
+ (fold (match-lambda*
+ (((key . value) result)
+ (cond ((release-version? key)
+ (match result
+ (#f
+ (cons key value))
+ ((newest . _)
+ (if (version>? key newest)
+ (cons key value)
+ result))))
+ (else
+ result))))
+ #f
+ releases))
+
+ (define (find-version-release releases version)
+ (find (match-lambda
+ ((key . value)
+ (string=? key version)))
+ releases))
+
(guard (c ((http-get-error? c)
(if (= 404 (http-get-error-code c))
#f
@@ -108,20 +132,9 @@ https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235"
(match json
(#(4 releases _ ...)
(let* ((releases (assoc-ref releases upstream-name))
- (latest (fold (match-lambda*
- (((key . value) result)
- (cond ((release-version? key)
- (match result
- (#f
- (cons key value))
- ((newest . _)
- (if (version>? key newest)
- (cons key value)
- result))))
- (else
- result))))
- #f
- releases)))
+ (latest (if version
+ (find-version-release releases version)
+ (find-latest-release releases))))
(and latest
(jsonish->upstream-source upstream-name latest))))))))
@@ -130,4 +143,4 @@ https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235"
(name 'gnome)
(description "Updater for GNOME packages")
(pred (url-prefix-predicate "mirror://gnome/"))
- (latest latest-gnome-release)))
+ (import import-gnome-release)))
diff --git a/guix/import/gnu.scm b/guix/import/gnu.scm
index 2b9b71feb0..139c32a545 100644
--- a/guix/import/gnu.scm
+++ b/guix/import/gnu.scm
@@ -117,7 +117,7 @@ details.)"
(unless package
(raise (formatted-message (G_ "no GNU package found for ~a") name)))
- (match (latest-release name)
+ (match (import-release name)
((? upstream-source? release)
(let ((version (upstream-source-version release)))
(gnu-package->sexp package release #:key-download key-download)))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 878a7d2f9c..3c2cd75db4 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -30,10 +31,12 @@
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-1)
+ #:use-module (guix diagnostics)
#:use-module ((guix download) #:select (download-to-store url-fetch))
#:use-module ((guix utils) #:select (package-name->name+version
canonical-newline-port))
#:use-module (guix http-client)
+ #:use-module (guix i18n)
#:use-module (guix import utils)
#:use-module (guix import cabal)
#:use-module (guix store)
@@ -359,8 +362,13 @@ respectively."
(let ((hackage-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage/)")))
(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."
+ (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))
(cabal-meta (hackage-fetch hackage-name)))
(match cabal-meta
@@ -381,6 +389,6 @@ respectively."
(name 'hackage)
(description "Updater for Hackage packages")
(pred hackage-package?)
- (latest latest-release)))
+ (import latest-release)))
;;; cabal.scm ends here
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 2a7a9f3d82..8a009fd245 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -328,11 +328,12 @@ latest version of PACKAGE-NAME."
;;; Updater
;;;
-(define (latest-release package)
- "Return an <upstream-source> for the latest release of PACKAGE."
+(define* (import-release package #:key (version #f))
+ "Return an <upstream-source> for the latest release of PACKAGE. Optionally
+include a VERSION string to fetch a specific version."
(let* ((hexpm-name (guix-package->hexpm-name package))
(hexpm (lookup-hexpm hexpm-name))
- (version (hexpm-latest-release hexpm))
+ (version (or version (hexpm-latest-release hexpm)))
(url (hexpm-uri hexpm-name version)))
(upstream-source
(package (package-name package))
@@ -344,4 +345,4 @@ latest version of PACKAGE-NAME."
(name 'hexpm)
(description "Updater for hex.pm packages")
(pred (url-prefix-predicate hexpm-package-url))
- (latest latest-release)))
+ (import import-release)))
diff --git a/guix/import/kde.scm b/guix/import/kde.scm
index 6873418d62..3566312eca 100644
--- a/guix/import/kde.scm
+++ b/guix/import/kde.scm
@@ -28,6 +28,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (web uri)
@@ -149,42 +150,52 @@ Output:
(string-join (map version->pattern directory-parts) "/")
"/"))))
-(define (latest-kde-release package)
+(define* (import-kde-release package #:key (version #f))
"Return the latest release of PACKAGE, a KDE package, or #f if it could
-not be determined."
+not be determined. Optionally include a VERSION string to fetch a specific
+version."
+
+ (define (find-latest-archive-version archives)
+ (fold (lambda (file1 file2)
+ (if (and file2
+ (version>? (tarball-sans-extension (basename file2))
+ (tarball-sans-extension (basename file1))))
+ file2
+ file1))
+ #f
+ archives))
+
(let* ((uri (string->uri (origin-uri (package-source package))))
(path-rx (uri->kde-path-pattern uri))
(name (package-upstream-name package))
(files (download.kde.org-files))
+ ;; select archives for this package
(relevant (filter (lambda (file)
(and (regexp-exec path-rx file)
(release-file? name (basename file))))
- files)))
- (match (sort relevant (lambda (file1 file2)
- (version>? (tarball-sans-extension
- (basename file1))
- (tarball-sans-extension
- (basename file2)))))
- ((and tarballs (reference _ ...))
- (let* ((version (tarball->version reference))
- (tarballs (filter (lambda (file)
- (string=? (tarball-sans-extension
- (basename file))
- (tarball-sans-extension
- (basename reference))))
- tarballs)))
- (upstream-source
- (package name)
- (version version)
- (urls (map (lambda (file)
- (string-append "mirror://kde/" file))
- tarballs)))))
- (()
- #f))))
+ files))
+ ;; Find latest version.
+ (version (or version
+ (and (not (null? relevant))
+ (tarball->version (find-latest-archive-version relevant)))))
+ ;; Find archives matching this version.
+ (tarballs (filter (lambda (file)
+ (string=? version (tarball->version file)))
+ relevant)))
+ (match tarballs
+ (() #f)
+ (_
+ (upstream-source
+ (package name)
+ (version version)
+ (urls (map (lambda (file)
+ (string-append "mirror://kde/" file))
+ tarballs)))))))
+
(define %kde-updater
(upstream-updater
(name 'kde)
(description "Updater for KDE packages")
(pred (url-prefix-predicate "mirror://kde/"))
- (latest latest-kde-release)))
+ (import import-kde-release)))
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index aeb447b0a5..01953ea69c 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -121,8 +122,9 @@ for example, 'linuxdcpp'. Return #f if there is no releases."
(last (remove pre-release? (vector->list (assoc-ref json "entries"))))
"version"))))
-(define (latest-release pkg)
- "Return an <upstream-source> for the latest release of PKG."
+(define* (import-release pkg #:key (version #f))
+ "Return an <upstream-source> for the latest release of PKG. Optionally
+include a VERSION string to fetch a specific version."
(define (origin-launchpad-uri origin)
(match (origin-uri origin)
((? string? url) url) ; surely a Launchpad URL
@@ -132,7 +134,7 @@ for example, 'linuxdcpp'. Return #f if there is no releases."
(let* ((source-uri (origin-launchpad-uri (package-source pkg)))
(name (package-name pkg))
(repository (launchpad-repository source-uri))
- (newest-version (latest-released-version repository)))
+ (newest-version (or version (latest-released-version repository))))
(if newest-version
(upstream-source
(package name)
@@ -145,4 +147,4 @@ for example, 'linuxdcpp'. Return #f if there is no releases."
(name 'launchpad)
(description "Updater for Launchpad packages")
(pred launchpad-package?)
- (latest latest-release)))
+ (import import-release)))
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 43cfb533e2..1f1cfc834d 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,6 +26,7 @@
#:use-module (srfi srfi-2)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
+ #:use-module (guix diagnostics)
#:use-module ((guix packages) #:prefix package:)
#:use-module (guix upstream)
#:use-module (guix utils)
@@ -486,7 +488,7 @@ list of AUTHOR/NAME strings."
(and (string-prefix? "minetest-" (package:package-name pkg))
(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,
or #false if the latest release couldn't be determined."
(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 release (latest-release author/name))
(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
(release-commit release) ; not always set
;; Only continue if both the old and new version number are both
@@ -513,4 +521,4 @@ or #false if the latest release couldn't be determined."
(name 'minetest)
(description "Updater for Minetest packages on ContentDB")
(pred minetest-package?)
- (latest latest-minetest-release)))
+ (import latest-minetest-release)))
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index b4b5a6eaad..59dbb7cb8b 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; 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.
;;;
@@ -35,6 +36,7 @@
#:use-module ((guix build utils) #:select (dump-port find-files mkdir-p))
#:use-module (guix build-system)
#:use-module (guix build-system ocaml)
+ #:use-module (guix diagnostics)
#:use-module (guix http-client)
#:use-module (guix ui)
#:use-module (guix packages)
@@ -417,8 +419,13 @@ package in OPAM."
(member (build-system-name (package-build-system package)) '(dune ocaml))
(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."
+ (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))
(opam-file (opam-fetch opam-name))
(version (assoc-ref opam-file "version"))
@@ -435,4 +442,4 @@ package in OPAM."
(name 'opam)
(description "Updater for OPAM packages")
(pred opam-package?)
- (latest latest-release)))
+ (import latest-release)))
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 4760fc3dae..0e5998b36e 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -13,6 +13,7 @@
;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -556,15 +557,16 @@ source. To build it from source, refer to the upstream repository at
(string-prefix? "https://pypi.org/packages" url)
(string-prefix? "https://files.pythonhosted.org/packages" url)))))
-(define (latest-release package)
- "Return an <upstream-source> for the latest release of PACKAGE."
+(define* (import-release package #:key (version #f))
+ "Return an <upstream-source> for the latest release of PACKAGE. Optionally
+include a VERSION string to fetch a specific version."
(let* ((pypi-name (guix-package->pypi-name package))
(pypi-package (pypi-fetch pypi-name)))
(and pypi-package
(guard (c ((missing-source-error? c) #f))
(let* ((info (pypi-project-info pypi-package))
- (version (project-info-version info))
- (dist (source-release pypi-package))
+ (version (or version (project-info-version info)))
+ (dist (source-release pypi-package version))
(url (distribution-url dist)))
(upstream-source
(urls (list url))
@@ -574,7 +576,7 @@ source. To build it from source, refer to the upstream repository at
#f))
(input-changes
(changed-inputs package
- (pypi->guix-package pypi-name)))
+ (pypi->guix-package pypi-name #:version version)))
(package (package-name package))
(version version)))))))
@@ -583,4 +585,4 @@ source. To build it from source, refer to the upstream repository at
(name 'pypi)
(description "Updater for PyPI packages")
(pred pypi-package?)
- (latest latest-release)))
+ (import import-release)))
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index 49be982a7f..e54df95985 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Xinglu Chem <public@yoctocell.xyz>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -139,9 +140,14 @@ included in the Stackage LTS release."
(mlambda ()
(stackage-lts-packages
(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
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))
(version (lts-package-version (packages) hackage-name))
(name-version (hackage-name-version hackage-name version)))
@@ -175,6 +181,6 @@ PACKAGE or #f if the package is not included in the Stackage LTS release."
(name 'stackage)
(description "Updater for Stackage LTS packages")
(pred stackage-lts-package?)
- (latest latest-lts-release)))
+ (import latest-lts-release)))
;;; stackage.scm ends here