[PATCH 00/19] Refresh to specific version

  • Done
  • quality assurance status badge
Details
5 participants
  • Hartmut Goebel
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Christopher Baines
  • Maxime Devos
Owner
unassigned
Submitted by
Hartmut Goebel
Severity
normal
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:15
(address . guix-patches@gnu.org)
cover.1661691694.git.h.goebel@crazy-compilers.com
This series now implements refreshing packages to a specific version,

+@example
+$ guix refresh trytond-party
… trytond-party would be upgraded from 6.2.0 to 6.4.0
+$ guix refresh -u trytond-party@6.2.1
… trytond-party: updating from version 6.2.0 to version 6.2.1...
+@end example


The „main“ part of thhis series does the following:

* All updaters get a new keyword-argument "version"
* Updaters supporting updating to a specific version
- will pass the version on to call functions and try to update to the
specific version.
- "latest-XX-release" functions have been renamed into "import-XX-release"
to mirror the change
* Updaters not supporting updating to a specific version
- will issue an error message if a version is given.
- "latest-XX-release" functions keep the name

My plan is to squash the „main” patches into a single one after review (and
extend the commit-message from this post). WDYT?

For testing the change, please run "sh test-import-with-version.sh", which
will update one package for each importer/updater and report about those not
supporting updating to a specific version.


Hartmut Goebel (20):
upstream-updater: Rename record field.
import: cpan: Remove unused exports.
updaters: Issue error-message if version is given:
import: sourceforge: Issue error-message if version is given.
refresh: Allow updating to a specific version (gnu-maintenance)
refresh: Allow updating to a specific version (crate)
refresh: Allow updating to a specific version (egg)
refresh: Allow updating to a specific version (git)
refresh: Allow updating to a specific version (github)
refresh: Allow updating to a specific version (gnome)
refresh: Allow updating to a specific version (hexpm)
refresh: Allow updating to a specific version (kde)
refresh: Allow updating to a specific version (launchpad)
refresh: Allow updating to a specific version (pypi)
refresh: Allow updating to a specific version (script)
refresh: Allow updating to a specific version (upstream)
refresh: Allow updating to a specific version (documentation)

These patches will not go into master. Their sole purpose is to carry the code
required to test this patch.

TEMP REMOVE import: git: Restrict to non-github origins.
TEMP REMOVE upstream: Output names of importers tried.
TEMP REMOVE Add test-script for refesh-with-version

doc/guix.texi | 13 +++
guix/gnu-maintenance.scm | 152 ++++++++++++++++++++++--------------
guix/import/cpan.scm | 32 +++-----
guix/import/cran.scm | 23 ++++--
guix/import/crate.scm | 7 +-
guix/import/egg.scm | 7 +-
guix/import/elpa.scm | 11 ++-
guix/import/gem.scm | 12 ++-
guix/import/git.scm | 33 +++++---
guix/import/github.scm | 29 ++++---
guix/import/gnome.scm | 47 +++++++----
guix/import/gnu.scm | 2 +-
guix/import/hackage.scm | 12 ++-
guix/import/hexpm.scm | 6 +-
guix/import/kde.scm | 58 ++++++++------
guix/import/launchpad.scm | 7 +-
guix/import/minetest.scm | 12 ++-
guix/import/opam.scm | 11 ++-
guix/import/pypi.scm | 11 +--
guix/import/stackage.scm | 10 ++-
guix/scripts/refresh.scm | 40 +++++++---
guix/upstream.scm | 26 +++---
test-import-with-version.sh | 98 +++++++++++++++++++++++
tests/import-github.scm | 2 +-
tests/transformations.scm | 8 +-
25 files changed, 465 insertions(+), 204 deletions(-)
create mode 100644 test-import-with-version.sh


base-commit: 84d191ea30eb7d97ee3f4d62f39c811ba77bb187
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 01/20] upstream-updater: Rename record field.
(address . 57460@debbugs.gnu.org)
27f47be66e4656d8b97c3c6169dd04897fc68dbc.1661691694.git.h.goebel@crazy-compilers.com
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.
---
guix/gnu-maintenance.scm | 14 +++++++-------
guix/import/cpan.scm | 2 +-
guix/import/cran.scm | 4 ++--
guix/import/crate.scm | 2 +-
guix/import/egg.scm | 2 +-
guix/import/elpa.scm | 2 +-
guix/import/gem.scm | 2 +-
guix/import/git.scm | 2 +-
guix/import/github.scm | 2 +-
guix/import/gnome.scm | 2 +-
guix/import/hackage.scm | 2 +-
guix/import/hexpm.scm | 2 +-
guix/import/kde.scm | 2 +-
guix/import/launchpad.scm | 2 +-
guix/import/minetest.scm | 2 +-
guix/import/opam.scm | 2 +-
guix/import/pypi.scm | 2 +-
guix/import/stackage.scm | 2 +-
guix/upstream.scm | 10 +++++-----
tests/import-github.scm | 2 +-
tests/transformations.scm | 8 ++++----
21 files changed, 35 insertions(+), 35 deletions(-)

Toggle diff (333 lines)
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index e7edbf6656..a278903a8d 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -830,7 +830,7 @@ the directory containing its source tarball."
(name 'gnu)
(description "Updater for GNU packages")
(pred gnu-hosted?)
- (latest latest-gnu-release)))
+ (import latest-gnu-release)))
(define %gnu-ftp-updater
;; This is for GNU packages taken from alternate locations, such as
@@ -841,41 +841,41 @@ the directory containing its source tarball."
(pred (lambda (package)
(and (not (gnu-hosted? package))
(pure-gnu-package? package))))
- (latest latest-release*)))
+ (import latest-release*)))
(define %savannah-updater
(upstream-updater
(name 'savannah)
(description "Updater for packages hosted on savannah.gnu.org")
(pred (url-prefix-predicate "mirror://savannah/"))
- (latest latest-savannah-release)))
+ (import latest-savannah-release)))
(define %sourceforge-updater
(upstream-updater
(name 'sourceforge)
(description "Updater for packages hosted on sourceforge.net")
(pred (url-prefix-predicate "mirror://sourceforge/"))
- (latest latest-sourceforge-release)))
+ (import latest-sourceforge-release)))
(define %xorg-updater
(upstream-updater
(name 'xorg)
(description "Updater for X.org packages")
(pred (url-prefix-predicate "mirror://xorg/"))
- (latest latest-xorg-release)))
+ (import latest-xorg-release)))
(define %kernel.org-updater
(upstream-updater
(name 'kernel.org)
(description "Updater for packages hosted on kernel.org")
(pred (url-prefix-predicate "mirror://kernel.org/"))
- (latest latest-kernel.org-release)))
+ (import latest-kernel.org-release)))
(define %generic-html-updater
(upstream-updater
(name 'generic-html)
(description "Updater that crawls HTML pages.")
(pred html-updatable-package?)
- (latest latest-html-updatable-release)))
+ (import latest-html-updatable-release)))
;;; gnu-maintenance.scm ends here
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 87abe9c2f1..cb2d3dd410 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -358,4 +358,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 4e1ce7c010..33305d68eb 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -723,13 +723,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..51bfcd7bed 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -370,5 +370,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 latest-release)))
diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index 52196583c4..aa689f8d84 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -348,6 +348,6 @@ not work."
(name 'egg)
(description "Updater for CHICKEN egg packages")
(pred egg-package?)
- (latest latest-release)))
+ (import latest-release)))
;;; egg.scm ends here
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 9399f45ebc..1dbdff9391 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -444,7 +444,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 0e5bb7e635..81ea4e8f9c 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -183,7 +183,7 @@ package on RubyGems."
(name 'gem)
(description "Updater for RubyGem packages")
(pred gem-package?)
- (latest latest-release)))
+ (import latest-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..bb5ba4d97e 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -226,4 +226,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 latest-git-release)))
diff --git a/guix/import/github.scm b/guix/import/github.scm
index e1a1af7133..ac6ef06eda 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -330,6 +330,6 @@ releases."
(name 'github)
(description "Updater for GitHub packages")
(pred github-package?)
- (latest latest-release)))
+ (import latest-release)))
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 43966c1028..3562e17e0f 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -114,4 +114,4 @@ not be determined."
(name 'gnome)
(description "Updater for GNOME packages")
(pred (url-prefix-predicate "mirror://gnome/"))
- (latest latest-gnome-release)))
+ (import latest-gnome-release)))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 878a7d2f9c..d56f52a221 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -381,6 +381,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..3b63837393 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -344,4 +344,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 latest-release)))
diff --git a/guix/import/kde.scm b/guix/import/kde.scm
index 6873418d62..510d823a4f 100644
--- a/guix/import/kde.scm
+++ b/guix/import/kde.scm
@@ -187,4 +187,4 @@ not be determined."
(name 'kde)
(description "Updater for KDE packages")
(pred (url-prefix-predicate "mirror://kde/"))
- (latest latest-kde-release)))
+ (import latest-kde-release)))
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index aeb447b0a5..b7e0295c4e 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -145,4 +145,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 latest-release)))
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 43cfb533e2..6581013215 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -513,4 +513,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..8a5aa4d8c6 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -435,4 +435,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..3e3e949283 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -583,4 +583,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 latest-release)))
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index 49be982a7f..af9809304f 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -175,6 +175,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
diff --git a/guix/upstream.scm b/guix/upstream.scm
index cbfd1aa609..6cee6440c3 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -66,7 +66,7 @@
upstream-updater-name
upstream-updater-description
upstream-updater-predicate
- upstream-updater-latest
+ upstream-updater-import
upstream-input-change?
upstream-input-change-name
@@ -240,7 +240,7 @@ correspond to the same version."
(name upstream-updater-name)
(description upstream-updater-description)
(pred upstream-updater-predicate)
- (latest upstream-updater-latest))
+ (import upstream-updater-import))
(define (importer-modules)
"Return the list of importer modules."
@@ -271,7 +271,7 @@ correspond to the same version."
"Return an updater among UPDATERS that matches PACKAGE, or #f if none of
them matches."
(find (match-lambda
- (($ <upstream-updater> name description pred latest)
+ (($ <upstream-updater> name description pred import)
(pred package)))
updaters))
@@ -284,9 +284,9 @@ them until one of them returns an upstream source. It is the caller's
responsibility to ensure that the returned source is newer than the current
one."
(any (match-lambda
- (($ <upstream-updater> name description pred latest)
+ (($ <upstream-updater> name description pred import)
(and (pred package)
- (latest package))))
+ (import package))))
updaters))
(define* (package-latest-release* package
diff --git a/tests/import-github.scm b/tests/import-github.scm
index 4d3f8cfc7e..5100296540 100644
--- a/tests/import-github.scm
+++ b/tests/import-github.scm
@@ -92,7 +92,7 @@
(define* (found-sexp old-version old-commit tags releases)
(and=>
(call-with-releases (lambda ()
- ((upstream-updater-latest %github-updater)
+ ((upstream-updater-import %github-updater)
(example-package old-version old-commit)))
tags releases)
upstream-source->sexp))
diff --git a/tests/transformations.scm b/tests/transformations.scm
index dbfe523518..ce29b1676c 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -470,10 +470,10 @@
(name 'dummy)
(pred (const #t))
(description "")
- (latest (const (upstream-source
- (package "foo")
- (version "42.0")
- (urls '("http://example.org")))))))))
+ (import (const (upstream-source
+ (package "foo")
+ (version "42.0")
+ (urls '("http://example.org")))))))))
(let* ((p (dummy-package "foo" (version "1.0")))
(t (options->transformation
`((with-latest . "foo")))))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 02/20] import: cpan: Remove unused exports.
(address . 57460@debbugs.gnu.org)
eac00f669b5ecc67a6f22dbad03590e313064d53.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/cpan.scm(#:export): Remove unused exports.
---
guix/import/cpan.scm | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)

Toggle diff (34 lines)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index cb2d3dd410..a929dc62e3 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -39,26 +39,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
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 03/20] updaters: Issue error-message if version is given:
(address . 57460@debbugs.gnu.org)
41578ce3ed904afa3f6b6d1d6db159d70b26f605.1661691694.git.h.goebel@crazy-compilers.com
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/gem.scm(latest-release),
guix/import/hackage.scm(latest-release),
guix/import/minetest.scm(latest-minetest-release),
guix/import/opam.scm(latest-release): Add keyword argument 'version',
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 keyword argument 'version' and issue error if version is given.
---
guix/import/cpan.scm | 9 ++++++++-
guix/import/cran.scm | 19 +++++++++++++++----
guix/import/elpa.scm | 9 ++++++++-
guix/import/gem.scm | 10 +++++++++-
guix/import/hackage.scm | 10 +++++++++-
guix/import/minetest.scm | 10 +++++++++-
guix/import/opam.scm | 9 ++++++++-
guix/import/stackage.scm | 8 +++++++-
8 files changed, 73 insertions(+), 11 deletions(-)

Toggle diff (315 lines)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index a929dc62e3..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)
@@ -305,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
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 33305d68eb..eadced512f 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.
;;;
@@ -640,8 +641,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))
@@ -660,20 +666,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
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 1dbdff9391..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.
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 81ea4e8f9c..590fec3dcd 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,10 +26,12 @@
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (json)
+ #:use-module (guix diagnostics)
#:use-module ((guix download) #:prefix download:)
#:use-module (guix import utils)
#:use-module (guix import json)
#:use-module (guix packages)
+ #:use-module (guix i18n)
#:use-module (guix upstream)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix base16)
@@ -167,8 +170,13 @@ package on RubyGems."
(define gem-package?
(url-prefix-predicate "https://rubygems.org/downloads/"))
-(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.")
+ "gem")))
(let* ((gem-name (guix-package->gem-name package))
(gem (rubygems-fetch gem-name))
(version (gem-version gem))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index d56f52a221..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
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 6581013215..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
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 8a5aa4d8c6..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"))
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index af9809304f..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)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 04/20] import: sourceforge: Issue error-message if version is given.
(address . 57460@debbugs.gnu.org)
1a9944cefa8d235753b3d099e88b68c854813e8b.1661691694.git.h.goebel@crazy-compilers.com
Due to the complicated directory structure at sourceforce,
enabling the sourceforge importer to update to a specific version
is very complicated to implement. Since only 2.0% of the
packages in guix are covered by this updater I dedided to now
implement this.

* guix/gnu-maintenance.scm(latest-sourceforge-release): Issue
error-message if version is given.
---
guix/gnu-maintenance.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Toggle diff (37 lines)
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index a278903a8d..8446a59fb5 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -34,6 +34,8 @@
#:use-module ((guix http-client) #:hide (open-socket-for-uri))
#:use-module (guix ftp-client)
#:use-module (guix utils)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
#:use-module (guix memoization)
#:use-module (guix records)
#:use-module (guix upstream)
@@ -683,7 +685,7 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
#:directory directory)
(cut adjusted-upstream-source <> rewrite))))
-(define (latest-sourceforge-release package)
+(define* (latest-sourceforge-release package #:key (version #f))
"Return the latest release of PACKAGE."
(define (uri-append uri extension)
;; Return URI with EXTENSION appended.
@@ -698,6 +700,12 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
((200 302) #t)
(else #f))))
+ (when version
+ (error
+ (formatted-message
+ (G_ "Updating to a specific version is not yet implemented for ~a, sorry.")
+ "sourceforge")))
+
(let* ((name (package-upstream-name package))
(base (string-append "https://sourceforge.net/projects/"
name "/files"))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 05/20] refresh: Allow updating to a specific version (gnu-maintenance)
(address . 57460@debbugs.gnu.org)
51528a9d139e8178faa1365f49d29e55ed320ada.1661691694.git.h.goebel@crazy-compilers.com
* guix/gnu-maintenance.scm
(latest-ftp-release): Rename to (import-ftp-release),
add keyword-argument 'version'.
If version is given, try to find the respective version.
(latest-html-release): Rename to (import-html-release),
add keyword-argument 'version'.
If version is given, try to find the respective version.
(latest-gnu-release): Rename to (import-gnu-release),
add keyword-argument 'version'. Refactor to first select archives for
respective package, the find the requested or latest version, then create
the upstream-source.
(latest-release): Rename to (import-release),
add keyword-argument 'version', pass on to import-ftp-release.
(import-release*): Rename to (import-release*),
add keyword-argument 'version', pass on to latest-release.
(latest-savannah-release): Rename to (import-savannah-release),
add keword-argument version, pass on to import-html-release.
(latest-xorg-release): Rename to (import-xorg-release),
add keword-argument version, pass on to import-ftp-release.
(latest-kernel.org-release): Rename to (import-kernel.org-release),
add keyword-argument 'version', pass on to import-html-release.
(latest-html-updatable-release): Rename to (import-html-updatable-release),
add keyword-argument 'version', pass on to import-html-release.
* guix/import/gnu.scm(gnu->guix-package): Adjust function call.
---
guix/gnu-maintenance.scm | 140 +++++++++++++++++++++++----------------
guix/import/gnu.scm | 2 +-
2 files changed, 84 insertions(+), 58 deletions(-)

Toggle diff (328 lines)
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 8446a59fb5..ea3394e9e8 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -328,8 +328,9 @@ name/directory pairs."
files)
result)))))))
-(define* (latest-ftp-release project
+(define* (import-ftp-release project
#:key
+ (version #f)
(server "ftp.gnu.org")
(directory (string-append "/gnu/" project))
(file->signature (cut string-append <> ".sig")))
@@ -400,8 +401,11 @@ return the corresponding signature URL, or #f it signatures are unavailable."
;; Assume that SUBDIRS correspond to versions, and jump into the
;; one with the highest version number.
- (let* ((release (reduce latest-release #f
- (coalesce-sources releases)))
+ (let* ((release (if version
+ (car (filter (lambda (r) (string=? version (upstream-source-version r)))
+ (coalesce-sources releases)))
+ (reduce latest-release #f
+ (coalesce-sources releases))))
(result (if (and result release)
(latest-release release result)
(or release result)))
@@ -413,13 +417,15 @@ return the corresponding signature URL, or #f it signatures are unavailable."
(ftp-close conn)
result))))))
-(define* (latest-release package
+(define* (import-release package
#:key
+ (version #f)
(server "ftp.gnu.org")
(directory (string-append "/gnu/" package)))
"Return the <upstream-source> for the latest version of PACKAGE or #f.
PACKAGE must be the canonical name of a GNU package."
- (latest-ftp-release package
+ (import-ftp-release package
+ #:version version
#:server server
#:directory directory))
@@ -435,14 +441,15 @@ of EXP otherwise."
(close-port port))
#f)))
-(define (latest-release* package)
- "Like 'latest-release', but (1) take a <package> object, and (2) ignore FTP
+(define* (import-release* package #:key (version #f))
+ "Like 'import-release', but (1) take a <package> object, and (2) ignore FTP
errors that might occur when PACKAGE is not actually a GNU package, or not
hosted on ftp.gnu.org, or not under that name (this is the case for
\"emacs-auctex\", for instance.)"
(let-values (((server directory)
(ftp-server/directory package)))
- (false-if-ftp-error (latest-release (package-upstream-name package)
+ (false-if-ftp-error (import-release (package-upstream-name package)
+ #:version version
#:server server
#:directory directory))))
@@ -467,8 +474,9 @@ hosted on ftp.gnu.org, or not under that name (this is the case for
(_
links))))
-(define* (latest-html-release package
+(define* (import-html-release package
#:key
+ (version #f)
(base-url "https://kernel.org/pub")
(directory (string-append "/" package))
file->signature)
@@ -538,13 +546,17 @@ are unavailable."
(match candidates
(() #f)
((first . _)
- ;; Select the most recent release and return it.
- (reduce (lambda (r1 r2)
- (if (version>? (upstream-source-version r1)
- (upstream-source-version r2))
- r1 r2))
- first
- (coalesce-sources candidates))))))
+ (if version
+ ;; find matching release version and return it
+ (car (filter (lambda (r) (string=? version (upstream-source-version r)))
+ (coalesce-sources candidates)))
+ ;; Select the most recent release and return it.
+ (reduce (lambda (r1 r2)
+ (if (version>? (upstream-source-version r1)
+ (upstream-source-version r2))
+ r1 r2))
+ first
+ (coalesce-sources candidates)))))))
;;;
@@ -576,46 +588,55 @@ are unavailable."
(call-with-gzip-input-port port
(compose string->lines get-string-all))))))
-(define (latest-gnu-release package)
+(define* (import-gnu-release package #:key (version #f))
"Return the latest release of PACKAGE, a GNU package available via
ftp.gnu.org.
This method does not rely on FTP access at all; instead, it browses the file
list available from %GNU-FILE-LIST-URI over HTTP(S)."
+
+ (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-values (((server directory)
(ftp-server/directory package))
((name)
(package-upstream-name package)))
(let* ((files (ftp.gnu.org-files))
+ ;; select archives for this package
(relevant (filter (lambda (file)
(and (string-prefix? "/gnu" file)
(string-contains file directory)
(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://gnu/"
- (string-drop file
- (string-length "/gnu/"))))
- tarballs))
- (signature-urls (map (cut string-append <> ".sig") urls)))))
- (()
- #f)))))
+ files))
+ ;; find latest version
+ (version (or version
+ (and (not (null? relevant))
+ (tarball->version
+ (find-latest-archive-version relevant)))))
+ ;; find archives matching this version
+ (archives (filter (lambda (file)
+ (string=? version (tarball->version file)))
+ relevant)))
+ (match archives
+ (() #f)
+ (_
+ (upstream-source
+ (package name)
+ (version version)
+ (urls (map (lambda (file)
+ (string-append "mirror://gnu/"
+ (string-drop file
+ (string-length "/gnu/"))))
+ archives))
+ (signature-urls (map (cut string-append <> ".sig") urls))))))))
(define %package-name-rx
;; Regexp for a package name, e.g., "foo-X.Y". Since TeXmacs uses
@@ -668,7 +689,7 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
;; HTML (unlike <https://download.savannah.nongnu.org/releases>.)
"https://nongnu.freemirror.org/nongnu")
-(define (latest-savannah-release package)
+(define* (import-savannah-release package #:key (version #f))
"Return the latest release of PACKAGE."
(let* ((uri (string->uri
(match (origin-uri (package-source package))
@@ -680,7 +701,8 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
"mirror://savannah")))
;; Note: We use the default 'file->signature', which adds ".sig", ".asc",
;; or whichever detached signature naming scheme PACKAGE uses.
- (and=> (latest-html-release package
+ (and=> (import-html-release package
+ #:version version
#:base-url %savannah-base
#:directory directory)
(cut adjusted-upstream-source <> rewrite))))
@@ -744,21 +766,22 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
(when port
(close-port port))))))
-(define (latest-xorg-release package)
+(define* (import-xorg-release package #:key (version #f))
"Return the latest release of PACKAGE."
(let ((uri (string->uri (origin-uri (package-source package)))))
(false-if-ftp-error
- (latest-ftp-release
+ (import-ftp-release
(package-name package)
+ #:version version
#:server "ftp.freedesktop.org"
#:directory
(string-append "/pub/xorg/" (dirname (uri-path uri)))))))
-(define (latest-kernel.org-release package)
+(define* (import-kernel.org-release package #:key (version #f))
"Return the latest release of PACKAGE, the name of a kernel.org package."
(define %kernel.org-base
;; This URL and sub-directories thereof are nginx-generated directory
- ;; listings suitable for 'latest-html-release'.
+ ;; listings suitable for 'import-html-release'.
"https://mirrors.edge.kernel.org/pub")
(define (file->signature file)
@@ -772,7 +795,8 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
(directory (dirname (uri-path uri)))
(rewrite (url-prefix-rewrite %kernel.org-base
"mirror://kernel.org")))
- (and=> (latest-html-release package
+ (and=> (import-html-release package
+ #:version version
#:base-url %kernel.org-base
#:directory directory
#:file->signature file->signature)
@@ -801,7 +825,7 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
(or (assoc-ref (package-properties package) 'release-monitoring-url)
(http-url? package)))))
-(define (latest-html-updatable-release package)
+(define* (import-html-updatable-release package #:key (version #f))
"Return the latest release of PACKAGE. Do that by crawling the HTML page of
the directory containing its source tarball."
(let* ((uri (string->uri
@@ -817,10 +841,12 @@ the directory containing its source tarball."
""
(dirname (uri-path uri))))
(package (package-upstream-name package)))
+
(catch #t
(lambda ()
(guard (c ((http-get-error? c) #f))
- (latest-html-release package
+ (import-html-release package
+ #:version version
#:base-url base
#:directory directory)))
(lambda (key . args)
@@ -838,7 +864,7 @@ the directory containing its source tarball."
(name 'gnu)
(description "Updater for GNU packages")
(pred gnu-hosted?)
- (import latest-gnu-release)))
+ (import import-gnu-release)))
(define %gnu-ftp-updater
;; This is for GNU packages taken from alternate locations, such as
@@ -849,14 +875,14 @@ the directory containing its source tarball."
(pred (lambda (package)
(and (not (gnu-hosted? package))
(pure-gnu-package? package))))
- (import latest-release*)))
+ (import import-release*)))
(define %savannah-updater
(upstream-updater
(name 'savannah)
(description "Updater for packages hosted on savannah.gnu.org")
(pred (url-prefix-predicate "mirror://savannah/"))
- (import latest-savannah-release)))
+ (import import-savannah-release)))
(define %sourceforge-updater
(upstream-updater
@@ -870,20 +896,20 @@ the directory containing its source tarball."
(name 'xorg)
(description "Updater for X.org packages")
(pred (url-prefix-predicate "mirror://xorg/"))
- (import latest-xorg-release)))
+ (import import-xorg-release)))
(define %kernel.org-updater
(upstream-updater
(name 'kernel.org)
(description "Updater for packages hosted on kernel.org")
(pred (url-prefix-predicate "mirror://kernel.org/"))
- (import latest-kernel.org-release)))
+ (import import-kernel.org-release)))
(define %generic-html-updater
(upstream-updater
(name 'generic-html)
(description "Updater that crawls HTML pages.")
(pred html-updatable-package?)
- (import latest-html-updatable-release)))
+ (import import-html-updatable-release)))
;;; gnu-maintenance.scm ends here
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)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 06/20] refresh: Allow updating to a specific version (crate)
(address . 57460@debbugs.gnu.org)
389c12814d8768fbdd34772442c48c8fa2aa5690.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/crate.scm(latest-release): Rename to (import-release),
add keyword-argument 'version'.
If version is given, return an upstream-source for this version.
---
guix/import/crate.scm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Toggle diff (35 lines)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 51bfcd7bed..339eccd687 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,11 @@ look up the development dependencs for the given crate."
(define crate-package?
(url-predicate crate-url?))
-(define (latest-release package)
+(define* (import-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(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 +371,5 @@ look up the development dependencs for the given crate."
(name 'crate)
(description "Updater for crates.io packages")
(pred crate-package?)
- (import latest-release)))
+ (import import-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 07/20] refresh: Allow updating to a specific version (egg)
(address . 57460@debbugs.gnu.org)
f3e36ab9541043e5228a2f1d3f24cde9f131e598.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/egg.scm(latest-release): Rename to (import-release),
add keyword-argument 'version'.
If version is given, return an upstream-source for this version.
---
guix/import/egg.scm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Toggle diff (35 lines)
diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index aa689f8d84..3897de5acf 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,10 @@ not work."
;;; Updater.
;;;
-(define (latest-release package)
+(define* (import-release package #:key (version #f))
"Return an @code{<upstream-source>} for the latest release of PACKAGE."
(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 +349,6 @@ not work."
(name 'egg)
(description "Updater for CHICKEN egg packages")
(pred egg-package?)
- (import latest-release)))
+ (import import-release)))
;;; egg.scm ends here
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 08/20] refresh: Allow updating to a specific version (git)
(address . 57460@debbugs.gnu.org)
cd2a0330ffcfba32e8be11e0c8f53f0bc7b2fc7c.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/git.scm
(latest-tag): Add keyword-argument 'version'. If version is given, try to
find the respective version tag.
(latest-git-tag-version): Add keyword-argument 'version' and pass it on to
called functions.
(latest-releease) Rename to (import-release), add keyword-argument 'version'
and pass it on to called functions.
---
guix/import/git.scm | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)

Toggle diff (78 lines)
diff --git a/guix/import/git.scm b/guix/import/git.scm
index bb5ba4d97e..fdac51edfd 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,7 +147,8 @@ 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."
(define (pre-release? tag)
@@ -169,11 +171,18 @@ 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 ((version-to-pick
+ (if version
+ (filter (lambda (vt) (string=? version (car vt)))
+ versions->tags)
+ versions->tags)))
+ (if (null? version-to-pick)
+ (values #f #f)
+ (match (last version-to-pick)
+ ((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."
(guard (c ((or (git-no-tags-error? c) (git-no-valid-tags-error? c))
@@ -193,6 +202,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 +216,13 @@ tag, or #false and #false if the latest version could not be determined."
(git-reference? (origin-uri origin))))
(_ #f)))
-(define (latest-git-release package)
+(define* (import-git-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(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 +237,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?)
- (import latest-git-release)))
+ (import import-git-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 09/20] refresh: Allow updating to a specific version (github)
(address . 57460@debbugs.gnu.org)
bbee73e7e792cfc217ea6d7d7583ac81b1b0a541.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/github.scm(latest-released-version): Add keyword-argument
'version'. If version is given, try to find the respective release.
(latest-releease) Rename to (import-release), add keyword-argument 'version'
and pass it on to latest-released-version.
---
guix/import/github.scm | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)

Toggle diff (62 lines)
diff --git a/guix/import/github.scm b/guix/import/github.scm
index ac6ef06eda..facdc96e24 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -249,7 +249,7 @@ 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
@@ -290,15 +290,21 @@ 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 (lambda (x) (string=? version (car x)))
+ 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)
+(define* (import-release pkg #:key (version #f))
"Return an <upstream-source> for the latest release of PKG."
(define (github-uri uri)
(match uri
@@ -313,7 +319,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 +337,6 @@ releases."
(name 'github)
(description "Updater for GitHub packages")
(pred github-package?)
- (import latest-release)))
+ (import import-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 10/20] refresh: Allow updating to a specific version (gnome)
(address . 57460@debbugs.gnu.org)
772d6b613a69ae950b657d94a51019928fdfca5b.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/gnome.scm(latest-gnome-release): Rename
to (import-gnome-release), add keyword-argument 'version'. If version is
given, try to find the respective version
[find-latest-release]: New function, based on former code.
[find-version-release]: New function.
---
guix/import/gnome.scm | 47 ++++++++++++++++++++++++++++---------------
1 file changed, 31 insertions(+), 16 deletions(-)

Toggle diff (84 lines)
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 3562e17e0f..496c253969 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -54,7 +55,7 @@ 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."
(define %not-dot
@@ -72,6 +73,31 @@ not be determined."
;; Some packages like "NetworkManager" have camel-case names.
(package-upstream-name package))
+ (define (find-latest-release releases)
+ (fold (match-lambda*
+ (((key . value) result)
+ (cond ((even-minor-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)
+ (fold (match-lambda*
+ (((key . value) result)
+ (if (string=? key version)
+ (cons key value)
+ result)))
+ #f
+ releases))
+
(guard (c ((http-get-error? c)
(if (= 404 (http-get-error-code c))
#f
@@ -92,20 +118,9 @@ not be determined."
(match json
(#(4 releases _ ...)
(let* ((releases (assoc-ref releases upstream-name))
- (latest (fold (match-lambda*
- (((key . value) result)
- (cond ((even-minor-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))))))))
@@ -114,4 +129,4 @@ not be determined."
(name 'gnome)
(description "Updater for GNOME packages")
(pred (url-prefix-predicate "mirror://gnome/"))
- (import latest-gnome-release)))
+ (import import-gnome-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 11/20] refresh: Allow updating to a specific version (hexpm)
(address . 57460@debbugs.gnu.org)
84d6e3731a5c8ac6a76c9810356f478c25b1d8d2.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/hexpm.scm(latest-release): Rename to (import-release),
add keyword-argument 'version'.
If version is given, return an upstream-source for this version.
---
guix/import/hexpm.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (26 lines)
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 3b63837393..652df5dd0e 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -328,11 +328,11 @@ latest version of PACKAGE-NAME."
;;; Updater
;;;
-(define (latest-release package)
+(define* (import-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(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 +344,4 @@ latest version of PACKAGE-NAME."
(name 'hexpm)
(description "Updater for hex.pm packages")
(pred (url-prefix-predicate hexpm-package-url))
- (import latest-release)))
+ (import import-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 12/20] refresh: Allow updating to a specific version (kde)
(address . 57460@debbugs.gnu.org)
bdcfa7d7cac5c071c98da3df1ac4090d152a9394.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/kde.scm(latest-kde-release): Rename to (import-kde-release), add
keyword-argument 'version'. Rework the code to not sort the relevant files,
but just find the requested or latest version.
[find-latest-archive-version]: New function.
---
guix/import/kde.scm | 58 ++++++++++++++++++++++++++-------------------
1 file changed, 34 insertions(+), 24 deletions(-)

Toggle diff (90 lines)
diff --git a/guix/import/kde.scm b/guix/import/kde.scm
index 510d823a4f..d364e44edb 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,51 @@ 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."
+
+ (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
+ (archives (filter (lambda (file)
+ (string=? version (tarball->version file)))
+ relevant)))
+ (match archives
+ (() #f)
+ (_
+ (upstream-source
+ (package name)
+ (version version)
+ (urls (map (lambda (file)
+ (string-append "mirror://kde/" file))
+ archives)))))))
+
(define %kde-updater
(upstream-updater
(name 'kde)
(description "Updater for KDE packages")
(pred (url-prefix-predicate "mirror://kde/"))
- (import latest-kde-release)))
+ (import import-kde-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 13/20] refresh: Allow updating to a specific version (launchpad)
(address . 57460@debbugs.gnu.org)
d607893f675549746491064b1b62f0ec4ad49e93.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/launchpad.scm(latest-release): Rename to (import-release),
add keyword-argument 'version'.
If version is given, return an upstream-source for this version.
---
guix/import/launchpad.scm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Toggle diff (38 lines)
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index b7e0295c4e..2112eefe1d 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,7 +122,7 @@ 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)
+(define* (import-release pkg #:key (version #f))
"Return an <upstream-source> for the latest release of PKG."
(define (origin-launchpad-uri origin)
(match (origin-uri origin)
@@ -132,7 +133,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 +146,4 @@ for example, 'linuxdcpp'. Return #f if there is no releases."
(name 'launchpad)
(description "Updater for Launchpad packages")
(pred launchpad-package?)
- (import latest-release)))
+ (import import-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 14/20] refresh: Allow updating to a specific version (pypi)
(address . 57460@debbugs.gnu.org)
ffbb897e4896073dc8de035ba375140e47ef7b64.1661691694.git.h.goebel@crazy-compilers.com
* guix/import/pypi.scm(latest-release): Rename to (import-release),
add keyword-argument 'version' and pass it on to called functions.
---
guix/import/pypi.scm | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

Toggle diff (48 lines)
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 3e3e949283..1ab48de71b 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,15 @@ 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)
+(define* (import-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(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 +575,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 +584,4 @@ source. To build it from source, refer to the upstream repository at
(name 'pypi)
(description "Updater for PyPI packages")
(pred pypi-package?)
- (import latest-release)))
+ (import import-release)))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 15/20] refresh: Allow updating to a specific version (script)
(address . 57460@debbugs.gnu.org)
c92a92ef44327cf8da217629c7b50a216dc2917f.1661691694.git.h.goebel@crazy-compilers.com
* guix/scripts/refresh.scm(options->packages)[args-packages]: Handle version
specification in package name arguments.
(update-package): Add keyword-argument 'version' and pass it on to called
functions.
(guix-refresh): When updating, pass the specified version (if any) to
update-package.
[package-list-without-versions, package-list-with-versions]: New functions.
---
guix/scripts/refresh.scm | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)

Toggle diff (100 lines)
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 14329751f8..441e71a6e4 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -224,7 +225,8 @@ update would trigger a complete rebuild."
(('argument . spec)
;; Take either the specified version or the
;; latest one.
- (specification->package spec))
+ (let* ((name version (package-name->name+version spec)))
+ (list (specification->package name) version)))
(('expression . exp)
(read/eval-package-expression exp))
(_ #f))
@@ -298,7 +300,7 @@ update would trigger a complete rebuild."
(G_ "no updater for ~a~%")
(package-name package)))
-(define* (update-package store package updaters
+(define* (update-package store package version updaters
#:key (key-download 'interactive) warn?)
"Update the source file that defines PACKAGE with the new version.
KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed
@@ -307,7 +309,7 @@ warn about packages that have no matching updater."
(if (lookup-updater package updaters)
(let ((version output source
(package-update store package updaters
- #:key-download key-download))
+ #:key-download key-download #:version version))
(loc (or (package-field-location package 'version)
(package-location package))))
(when version
@@ -523,6 +525,18 @@ all are dependent packages: ~{~a~^ ~}~%")
(lists
(concatenate lists))))
+ (define (package-list-without-versions packages)
+ (map (match-lambda
+ ((package version) package)
+ (package package))
+ packages))
+
+ (define (package-list-with-versions packages)
+ (map (match-lambda
+ ((package version) (list package version))
+ (package (list package #f)))
+ packages))
+
(let* ((opts (parse-options))
(update? (assoc-ref opts 'update?))
(updaters (options->updaters opts))
@@ -540,12 +554,13 @@ all are dependent packages: ~{~a~^ ~}~%")
(with-error-handling
(with-store store
(run-with-store store
+ (begin
(mlet %store-monad ((packages (options->packages opts)))
(cond
(list-dependent?
- (list-dependents packages))
+ (list-dependents (package-list-without-versions packages)))
(list-transitive?
- (list-transitive packages))
+ (list-transitive (package-list-without-versions packages)))
(update?
(parameterize ((%openpgp-key-server
(or (assoc-ref opts 'key-server)
@@ -558,13 +573,16 @@ all are dependent packages: ~{~a~^ ~}~%")
(string-append (config-directory)
"/upstream/trustedkeys.kbx"))))
(for-each
- (cut update-package store <> updaters
- #:key-download key-download
- #:warn? warn?)
- packages)
+ (cut apply
+ (lambda (package version)
+ (update-package store package version updaters
+ #:key-download key-download
+ #:warn? warn?))
+ <>)
+ (values (package-list-with-versions packages)))
(return #t)))
(else
(for-each (cut check-for-package-update <> updaters
#:warn? warn?)
- packages)
- (return #t)))))))))
+ (package-list-without-versions packages))
+ (return #t))))))))))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 16/20] refresh: Allow updating to a specific version (upstream)
(address . 57460@debbugs.gnu.org)
02bbc32e2c9955e4bcbe535c38cafba4bc6034bc.1661691694.git.h.goebel@crazy-compilers.com
* guix/upstream.scm(package-latest-release): Add keyword-argument 'version'
and pass it on to the updater's 'import' function.
(package-update): add keyword-argument 'version' and pass it on to
package-latest-release. Differentiate the error message issued when
no package was found, depending on whether version was given or not.
---
guix/upstream.scm | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

Toggle diff (63 lines)
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 6cee6440c3..faffb3347a 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -277,7 +278,8 @@ them matches."
(define* (package-latest-release package
#:optional
- (updaters (force %updaters)))
+ (updaters (force %updaters))
+ #:key (version #f))
"Return an upstream source to update PACKAGE, a <package> object, or #f if
none of UPDATERS matches PACKAGE. When several updaters match PACKAGE, try
them until one of them returns an upstream source. It is the caller's
@@ -286,7 +288,7 @@ one."
(any (match-lambda
(($ <upstream-updater> name description pred import)
(and (pred package)
- (import package))))
+ (import package #:version version))))
updaters))
(define* (package-latest-release* package
@@ -490,13 +492,13 @@ SOURCE, an <upstream-source>."
(define* (package-update store package
#:optional (updaters (force %updaters))
- #:key (key-download 'interactive))
+ #:key (key-download 'interactive) (version #f))
"Return the new version, the file name of the new version tarball, and input
changes for PACKAGE; return #f (three values) when PACKAGE is up-to-date;
raise an error when the updater could not determine available releases.
KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed
values: 'always', 'never', and 'interactive' (default)."
- (match (package-latest-release package updaters)
+ (match (package-latest-release package updaters #:version version)
((? upstream-source? source)
(if (version>? (upstream-source-version source)
(package-version package))
@@ -520,8 +522,11 @@ this method: ~s")
(values #f #f #f)))
(#f
;; Warn rather than abort so that other updates can still take place.
- (warning (G_ "updater failed to determine available releases for ~a~%")
- (package-name package))
+ (if version
+ (warning (G_ "updater failed to find release ~a@~a~%")
+ (package-name package) version)
+ (warning (G_ "updater failed to determine available releases for ~a~%")
+ (package-name package)))
(values #f #f #f))))
(define* (update-package-source package source hash)
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 17/20] refresh: Allow updating to a specific version (documentation)
(address . 57460@debbugs.gnu.org)
8e4201238e61596c397823bfac5f46d09498ccc8.1661691694.git.h.goebel@crazy-compilers.com
---
doc/guix.texi | 13 +++++++++++++
1 file changed, 13 insertions(+)

Toggle diff (26 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 7bce8a567c..c459fa6d4d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13747,6 +13747,19 @@ gnu/packages/multiprecision.scm:40:12: 6.1.2 is already the latest version of gm
@end table
+If for some reason you don't want to update to the latest version,
+you can update to a specific version by passing a package specification.
+However, not all updaters support this.
+
+@example
+$ guix refresh trytond-party
+gnu/packages/tryton.scm:2101:13: trytond-party would be upgraded from 6.2.0 to 6.4.0
+$ guix refresh -u trytond-party@@6.2.1
+@dots{}
+gnu/packages/tryton.scm:2101:13: trytond-party: updating from version 6.2.0 to version 6.2.1...
+@dots{}
+@end example
+
Sometimes the upstream name differs from the package name used in Guix,
and @command{guix refresh} needs a little help. Most updaters honor the
@code{upstream-name} property in package definitions, which can be used
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 18/20] TEMP REMOVE import: git: Restrict to non-github origins.
(address . 57460@debbugs.gnu.org)
0ba96b5f2dfd841ab080e7a3373b6e335b62fd59.1661691695.git.h.goebel@crazy-compilers.com
This commit will be dropped and not be committed to the main branch!

'guix refresh -t generic-git' reported a lot of packages which are hosted at
github and are already handled by the github updater. So whether the package
is updates using the github updater or the generic-git updater would be
non-deterministic.

And indeed 'guix refresh --list-updaters' without this change reported 31.2%
for the github updater and 34.9% for the generic-git updater. With this
patch, it's only 3.7% for the generic-git updater. (Still the sum of the
percent-values is 112%, anyhow better then the 146% prior to this change.)

Beside these statistical issues, this patch has another effect: If the github
updater fails to pick a (later) version the generic-git updater was
triggered. Anyhow: Why should the generic-git updater be able to find
a (later) version, if the github updater did not?

* guix/import/github.scm: Export 'github-package?'.
* guix/import/git.scm(git-package?): Also check for not github-package?.
---
guix/import/git.scm | 4 +++-
guix/import/github.scm | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)

Toggle diff (37 lines)
diff --git a/guix/import/git.scm b/guix/import/git.scm
index fdac51edfd..02a851655d 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -25,6 +25,7 @@
#:use-module (guix git)
#:use-module (guix git-download)
#:use-module (guix i18n)
+ #:use-module ((guix import github) #:select (github-package?))
#:use-module (guix packages)
#:use-module (guix upstream)
#:use-module (guix utils)
@@ -213,7 +214,8 @@ tag, or #false and #false if the latest version could not be determined."
(match (package-source package)
((? origin? origin)
(and (eq? (origin-method origin) git-fetch)
- (git-reference? (origin-uri origin))))
+ (git-reference? (origin-uri origin))
+ (not (github-package? package))))
(_ #f)))
(define* (import-git-release package #:key (version #f))
diff --git a/guix/import/github.scm b/guix/import/github.scm
index facdc96e24..01aa23ba15 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -42,7 +42,7 @@
#:use-module (guix http-client)
#:use-module (web uri)
#:use-module (web response)
- #:export (%github-api %github-updater))
+ #:export (%github-api %github-updater github-package?))
;; For tests.
(define %github-api (make-parameter "https://api.github.com"))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 19/20] TEMP REMOVE upstream: Output names of importers tried.
(address . 57460@debbugs.gnu.org)
bd6b176bd6faf51285d3461610fead8b9a70b436.1661691695.git.h.goebel@crazy-compilers.com
This commit will be dropped and not be committed to the main branch!
---
guix/upstream.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/guix/upstream.scm b/guix/upstream.scm
index faffb3347a..4a6b37bbf2 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -288,6 +288,7 @@ one."
(any (match-lambda
(($ <upstream-updater> name description pred import)
(and (pred package)
+ (display (string-append "trying importer " (symbol->string name) "\n"))
(import package #:version version))))
updaters))
--
2.30.4
H
H
Hartmut Goebel wrote on 28 Aug 2022 15:18
[PATCH 20/20] TEMP REMOVE Add test-script for refesh-with-version
(address . 57460@debbugs.gnu.org)
62dad0b7bef5982202eb8c512e15271355e0db86.1661691695.git.h.goebel@crazy-compilers.com
This commit will be dropped and not be committed to the main branch!
---
test-import-with-version.sh | 98 +++++++++++++++++++++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 test-import-with-version.sh

Toggle diff (106 lines)
diff --git a/test-import-with-version.sh b/test-import-with-version.sh
new file mode 100644
index 0000000000..3aa09dda68
--- /dev/null
+++ b/test-import-with-version.sh
@@ -0,0 +1,98 @@
+echo -n "Number of importers: "
+ls guix/import/*.scm | wc -l
+
+echo -n "Number of updaters : "
+grep upstream-updater guix/import/*.scm | wc -l
+
+echo
+
+PKGS=()
+# chicken see below
+PKGS+=("crate rust-sequoia-openpgp@1.7.0")
+PKGS+=("generic-git remmina@1.4.25") # (import/git)
+PKGS+=("generic-html xclock@1.1.0") # (gnu-maintenance)
+PKGS+=("github libwacom@1.12") #
+PKGS+=("gnome gtranslator@41.0")
+PKGS+=("gnu help2man@1.49.1") # (gnu-maintenance)
+PKGS+=("gnu-ftp libgpg-error@1.43") # (gnu-maintenance)
+# hexpm see below
+PKGS+=("kde plasma-framework@5.96.0")
+PKGS+=("kernel.org iw@5.3") # (gnu-maintenance) = html
+PKGS+=("launchpad soundconverter@4.0.0") # will fail due to changed archive filename
+PKGS+=("pypi trytond-party@6.4.0")
+PKGS+=("savannah libpipeline@1.5.4") # (gnu-maintenance) = html
+PKGS+=("xorg libxi@1.7.99.2") # (gnu-maintenance) = ftp
+
+
+for pkg in "${PKGS[@]}" ; do
+ echo "------------------------------------------" $pkg
+ pkg=${pkg//* }
+ nv=${pkg%@*}
+ ./pre-inst-env guix refresh $nv
+ ./pre-inst-env guix refresh -u $pkg
+ make make-go 2> /dev/null # avoid "source file newer" messages
+done
+
+echo
+echo
+echo
+echo "=============================================="
+echo 'For these packages there is no newer version between the current one in guix'
+echo 'and the later one available upstream. Thus we need to "downgrade" the'
+echo 'version first. And to show that I specific version will be fetched, we'
+echo '"refresh" to an older version.'
+echo "---------------------------------------------"
+echo
+
+PKGS=()
+PKGS+=("egg chicken-srfi-13@0.3")
+PKGS+=("hexpm erlang-relx@4.5.0")
+# HACK
+sed -i -e s/"0\.3\.2"/"0.0.0"/ gnu/packages/chicken.scm
+sed -i -e s/"4\.6\.0"/"0.0.0"/ gnu/packages/erlang.scm
+make make-go 2> /dev/null # avoid "source file newer" messages
+
+for pkg in "${PKGS[@]}" ; do
+ echo "---------------------------------------------" $pkg
+ pkg=${pkg//* }
+ nv=${pkg%@*}
+ ./pre-inst-env guix refresh -u $pkg
+ ./pre-inst-env guix refresh $nv
+ make make-go 2> /dev/null # avoid "source file newer" messages
+done
+
+function try_fail () {
+ pkg=$1 ; shift
+ repo=$1 ; shift
+ echo "---------------------------------------------" $repo $pkg
+ echo -- " shall fail since" $repo $1
+ ./pre-inst-env guix refresh -u $pkg
+ echo
+}
+
+echo
+echo
+echo "=============================================="
+echo 'These updates issue an error when trying to update to a specific version:'
+try_fail r-tximeta@1.5.4 'bioconductor (cran.scm)' 'repo supports latest version only'
+try_fail r-sungeo@0.2.290 'cran' 'repo supports latest version only'
+try_fail perl-socket-msghdr@0.10 'cpan' 'importer does not support version'
+try_fail emacs-vertico-posframe@0.5.9 'elpa' 'importer does not support version'
+try_fail ruby-commander@4.5.0 'gem' 'importer does not support version'
+try_fail ghc-singleton-bool@0.2.3 'hackage' 'importer does not support version'
+try_fail minetest-advtrains@2.5.0 'minetest' 'importer does not support version'
+try_fail ocaml-cudf@0.11 'opam' 'importer does not support version'
+try_fail xplanet@1.4.0 'sourceforge (gnu-maintenance)' 'to complicated to implement'
+
+echo
+echo
+echo "=============================================="
+echo 'These importers do not have an updater:'
+echo -- ' - json -- n/a'
+echo -- ' - elm -- has no updater and "elm-package-origin" sources are hosted at github'
+# try_fail elm-http@2.0.0 elm 'has no updater'
+try_fail texlive-sourcecodepro@60101 'texlive' 'has no updater'
+echo
+echo "=============================================="
+echo 'For these importers the updater is not yet implemented:'
+echo -- ' - stackage --- unclear how to handle LTS version'
--
2.30.4
M
M
Maxime Devos wrote on 28 Aug 2022 15:22
Re: [bug#57460] [PATCH 04/20] import: sourceforge: Issue error-message if version is given.
392d10a0-d55c-4333-d6d6-d60dde5ad644@telenet.be
On 28-08-2022 15:18, Hartmut Goebel wrote:
Toggle quote (5 lines)
> Due to the complicated directory structure at sourceforce,
> enabling the sourceforge importer to update to a specific version
> is very complicated to implement. Since only 2.0% of the
> packages in guix are covered by this updater I dedided to now
> implement this.
Nitpick: now -> not?
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 28 Aug 2022 15:26
Re: [bug#57460] [PATCH 15/20] refresh: Allow updating to a specific version (script)
3832a297-7c6d-f821-95e6-7d3af6510d19@telenet.be
On 28-08-2022 15:18, Hartmut Goebel wrote:
Toggle quote (2 lines)
> + (let* ((name version (package-name->name+version spec)))
> + (list (specification->package name) version)))
Nitpick: there is only a single clause, so 'let' would suffice, no need
for let*.
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 28 Aug 2022 15:30
Re: [bug#57460] [PATCH 00/19] Refresh to specific version
4dce17c0-edab-0a75-9c97-5fac350913df@telenet.be
On 28-08-2022 15:15, Hartmut Goebel wrote:
Toggle quote (2 lines)
> This series now implements refreshing packages to a specific version,
> see <https://lists.gnu.org/archive/html/guix-devel/2022-07/msg00061.html>.
I have looked at the patches and they all seem reasonable to me
(although not verified locally) -- only two nitpicks but they don't
affect the semantics at all.
Greetings,
Maxime.
Attachment: OpenPGP_signature
L
L
Liliana Marie Prikler wrote on 28 Aug 2022 19:26
Re: [PATCH 18/20] TEMP REMOVE import: git: Restrict to non-github origins.
74a0af4d45d36a6b757429ceb181fa8e06392431.camel@gmail.com
Am Sonntag, dem 28.08.2022 um 15:18 +0200 schrieb Hartmut Goebel:
Toggle quote (2 lines)
> Anyhow: Why should the generic-git updater be able to find
> a (later) version, if the github updater did not?
Because someone at Microsoft could mess up the API in a way that yields
empty results while keeping regular git unchanged. I think fallbacks
are nice to have, they are already rare enough to find in Guix.

Toggle quote (5 lines)
> And indeed 'guix refresh --list-updaters' without this change
> reported 31.2% for the github updater and 34.9% for the generic-git
> updater. With this patch, it's only 3.7% for the generic-git
> updater. (Still the sum of the percent-values is 112%, anyhow better
> then the 146% prior to this change.)
Perhaps instead of generating a lazy sum, we should (via an appropriate
option) generate a histogram counting/reporting the packages covered by
0,1,2,... updaters.

Cheers
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:17
Re: bug#57460: [PATCH 00/19] Refresh to specific version
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
87fsghdtbz.fsf_-_@gnu.org
Hi,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (4 lines)
> * guix/gnu-maintenance.scm
> (latest-ftp-release): Rename to (import-ftp-release),
> add keyword-argument 'version'.

Nipick: should be “Rename to 'import-ftp-release' and add #:version
argument.” (Likewise below.)

Toggle quote (1 lines)
> * guix/import/gnu.scm(gnu->guix-package): Adjust function call.
^
Missing space.

Toggle quote (4 lines)
> + (let* ((release (if version
> + (car (filter (lambda (r) (string=? version (upstream-source-version r)))
> + (coalesce-sources releases)))

As you probably know, ‘car’ is frowned upon (info "(guix) Data Types and
Pattern Matching"). Instead, you probably want to write:

(find (lambda (upstream)
(string=? (upstream-source-version upstream) version))
(coalesce-sources releases))

Otherwise LGTM.

Ludo’.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:19
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
87bkr5dt8q.fsf_-_@gnu.org
For the commit subject line, please use something like:

import: crate: Allow updates to a specific version.

(When in doubt about the subject prefix, check ‘git log’ on the file.)

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (3 lines)
> * guix/import/crate.scm(latest-release): Rename to (import-release),
> add keyword-argument 'version'.

Same comment as before.

Otherwise LGTM.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:24
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
877d1tdt0q.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (8 lines)
> * guix/import/git.scm
> (latest-tag): Add keyword-argument 'version'. If version is given, try to
> find the respective version tag.
> (latest-git-tag-version): Add keyword-argument 'version' and pass it on to
> called functions.
> (latest-releease) Rename to (import-release), add keyword-argument 'version'
> and pass it on to called functions.

(Same comment as before.)

Toggle quote (5 lines)
> +(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."

Please augment the docstring to explain the meaning of #:version.

Toggle quote (6 lines)
> + (let ((version-to-pick
> + (if version
> + (filter (lambda (vt) (string=? version (car vt)))
> + versions->tags)
> + versions->tags)))

Rather:

(let ((versions (if version
(filter (match-lambda
((candidate-version . tag)
(string=? version candidate-version)))
versions->tag)
versions->tag)))
(if (null? versions) …))

Toggle quote (4 lines)
> + (match (last version-to-pick)
> + ((version . tag)
> + (values version tag)))))))))

Please adjust the indentation of the ‘match’ form so it matches what is
done elsewhere.

Otherwise LGTM.

Ludo’.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:26
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
8735chdsxw.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (5 lines)
> * guix/import/github.scm(latest-released-version): Add keyword-argument
> 'version'. If version is given, try to find the respective release.
> (latest-releease) Rename to (import-release), add keyword-argument 'version'
> and pass it on to latest-released-version.

(Same comment as before.)

Toggle quote (10 lines)
> - (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)))))

Please reindent the ‘match’ form as above.

Toggle quote (5 lines)
> + (match (if version
> + ;; find matching release version
> + (filter (lambda (x) (string=? version (car x)))
> + releases)

Same as earlier: prefer ‘match-lambda’ over ‘car’.

Otherwise LGTM.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:29
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
87y1u9ce8b.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (6 lines)
> * guix/import/gnome.scm(latest-gnome-release): Rename
> to (import-gnome-release), add keyword-argument 'version'. If version is
> given, try to find the respective version
> [find-latest-release]: New function, based on former code.
> [find-version-release]: New function.

[...]

Toggle quote (12 lines)
> + (define (find-latest-release releases)
> + (fold (match-lambda*
> + (((key . value) result)
> + (cond ((even-minor-version? key)
> + (match result
> + (#f
> + (cons key value))
> + ((newest . _)
> + (if (version>? key newest)
> + (cons key value)
> + result))))

Please reindent ‘match’ as it was.

Toggle quote (9 lines)
> + (define (find-version-release releases version)
> + (fold (match-lambda*
> + (((key . value) result)
> + (if (string=? key version)
> + (cons key value)
> + result)))
> + #f
> + releases))

I guess we could start at the first match instead of traversing all the
list, no? How about:

(define (find-version-release releases version)
(find (match-lambda
((key . value)
(string=? key version)))
releases))

?

Otherwise LGTM.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:34
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
87tu4xcdz6.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (5 lines)
> * guix/import/kde.scm(latest-kde-release): Rename to (import-kde-release), add
> keyword-argument 'version'. Rework the code to not sort the relevant files,
> but just find the requested or latest version.
> [find-latest-archive-version]: New function.

(Same comment.)
[...]

Toggle quote (9 lines)
> + ;; find latest version
> + (version (or version
> + (and (not (null? relevant))
> + (tarball->version (find-latest-archive-version relevant)))))
> + ;; find archives matching this version
> + (archives (filter (lambda (file)
> + (string=? version (tarball->version file)))
> + relevant)))

I think you can remove the comments or make them proper sentences
(capitalized and with a period). I’d prefer to keep the name ‘tarballs’
rather than ‘archives’ because it’s less ambiguous IMO.

Toggle quote (4 lines)
> + (match archives
> + (() #f)
> + (_

Please reindent it as it was.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:45
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
87h70xcdha.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (8 lines)
> * guix/scripts/refresh.scm(options->packages)[args-packages]: Handle version
> specification in package name arguments.
> (update-package): Add keyword-argument 'version' and pass it on to called
> functions.
> (guix-refresh): When updating, pass the specified version (if any) to
> update-package.
> [package-list-without-versions, package-list-with-versions]: New functions.

[...]

Toggle quote (7 lines)
> (('argument . spec)
> ;; Take either the specified version or the
> ;; latest one.
> - (specification->package spec))
> + (let* ((name version (package-name->name+version spec)))
> + (list (specification->package name) version)))

That changes the semantics of ‘guix refresh’. Until now, “guix refresh
guile@2.0” or “guix refresh -l guile@2.0” would look specifically at
Guile 2.0. Now, “guix refresh -l guile@2.0” would report dependents of
Guile 3.0.

So instead of reusing the version string that shows up here, I’d suggest
adding a new command-line option, say -T/--target-version. The downside
is that it wouldn’t work when multiple packages are specified on the
command line.

Another option would be to introduce special syntax, like an equal sign:

guix refresh guile=3.0.4
guix refresh guile@2.0=2.0.8

For that we’d introduce a new ‘specification->package-update’ that would
return a <package-update> record with two fields: the package to
upgrade, and the target version.

WDYT?

Toggle quote (12 lines)
> + (define (package-list-without-versions packages)
> + (map (match-lambda
> + ((package version) package)
> + (package package))
> + packages))
> +
> + (define (package-list-with-versions packages)
> + (map (match-lambda
> + ((package version) (list package version))
> + (package (list package #f)))
> + packages))

I always find it a bad sign when one has to write specific list-fiddling
procedures; usually it indicates we’re missing a record type or
something.

Ludo’.
L
L
Ludovic Courtès wrote on 24 Sep 2022 11:48
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)
87czblcdbv.fsf_-_@gnu.org
Hi!

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (9 lines)
> On 28-08-2022 15:15, Hartmut Goebel wrote:
>
>> This series now implements refreshing packages to a specific version,
>> see <https://lists.gnu.org/archive/html/guix-devel/2022-07/msg00061.html>.
>
> I have looked at the patches and they all seem reasonable to me
> (although not verified locally) -- only two nitpicks but they don't
> affect the semantics at all.

I had some further comments as you saw, but most of them are cosmetic.
:-) I think this patch series is a much welcome improvement, and it’s
almost ready.

The one thing that needs to be sorted out is the version syntax in ‘guix
refresh’, but it sounds like we should be able to do that without too
much difficulty.

Apologies for the delay in reviewing, and thanks for this work!

Ludo’.
M
M
Maxime Devos wrote on 24 Sep 2022 12:25
Re: [bug#57460] [PATCH 00/19] Refresh to specific version
(address . 57460@debbugs.gnu.org)
3b25bbdf-b92d-732a-11df-28b28c52a63c@telenet.be
On 24-09-2022 11:29, Ludovic Courtès wrote:
Toggle quote (23 lines)
> Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
>
>> * guix/import/gnome.scm(latest-gnome-release): Rename
>> to (import-gnome-release), add keyword-argument 'version'. If version is
>> given, try to find the respective version
>> [find-latest-release]: New function, based on former code.
>> [find-version-release]: New function.
>
> [...]
>
>> + (define (find-latest-release releases)
>> + (fold (match-lambda*
>> + (((key . value) result)
>> + (cond ((even-minor-version? key)
>> + (match result
>> + (#f
>> + (cons key value))
>> + ((newest . _)
>> + (if (version>? key newest)
>> + (cons key value)
>> + result))))
>
> Please reindent ‘match’ as it was.
"guix style" is IMO not usable here
(https://issues.guix.gnu.org/58040: "guix style" puts closing
parentheses on the wrong line").
Toggle quote (19 lines)
>> + (define (find-version-release releases version)
>> + (fold (match-lambda*
>> + (((key . value) result)
>> + (if (string=? key version)
>> + (cons key value)
>> + result)))
>> + #f
>> + releases))
>
> I guess we could start at the first match instead of traversing all the
> list, no? How about:
>
> (define (find-version-release releases version)
> (find (match-lambda
> ((key . value)
> (string=? key version)))
> releases))
>
> ?
(1) according to "guix style", this should be
(define (find-version-release releases version)
(find (match-lambda
((key . value) (string=? key version))) releases))
(2) Isn't this an inline definition of 'assoc' (except for replacing
equal? by string=?)?
(use-modules (srfi srfi-1)) ; the third argument is only documented in
SRFI-1 Asosciation Lists
(define (find-version-release releases version)
(assoc version releases string=?)
Some code duplication can be avoided here.
Greetings,
Maxime.
Attachment: OpenPGP_signature
L
L
Ludovic Courtès wrote on 24 Sep 2022 18:31
(name . Maxime Devos)(address . maximedevos@telenet.be)
87v8pc68f7.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (4 lines)
> "guix style" is IMO not usable here
> (<https://issues.guix.gnu.org/58040>: "guix style" puts closing
> parentheses on the wrong line").

‘guix style’ has shortcomings, which is why I didn’t mention it.
Initially it had a much narrower scope though. :-)

Ludo’.
H
H
Hartmut Goebel wrote on 1 Nov 2022 16:58
Re: bug#57460: [PATCH 00/19] Refresh to specific version
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 57460@debbugs.gnu.org)
e179efe1-44aa-4000-d052-8e170d115a2e@crazy-compilers.com
Hi Ludo,

attached please find a new patch addressing this and implementing a
record time. (Thanks for the tip, this makes the code muche easier.)

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
Attachment: file
H
H
Hartmut Goebel wrote on 1 Nov 2022 17:02
(name . Ludovic Courtès)(address . ludo@gnu.org)
cc9cd0cd-665a-cc24-7512-6663b0d36cbf@crazy-compilers.com
Am 24.09.22 um 11:48 schrieb Ludovic Courtès:
Toggle quote (4 lines)
> The one thing that needs to be sorted out is the version syntax in ‘guix
> refresh’, but it sounds like we should be able to do that without too
> much difficulty.

I addresses this and just submitted an updated version (of this change
only).

Although I'd prefer '==' two equal-signs instead of just one to be
future-proof for the case we want to add other specifiers ('<', '<=',
'>=', >')

Toggle quote (2 lines)
> Apologies for the delay in reviewing, and thanks for this work!

Never mind, I was busy anyway ;-)

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
L
L
Ludovic Courtès wrote on 22 Nov 2022 08:33
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
871qpvjve5.fsf_-_@gnu.org
Hi Hartmut

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (13 lines)
> From c748a25193d8f9ee29b9d281f542fb1d0d3f4ec1 Mon Sep 17 00:00:00 2001
> Message-Id: <c748a25193d8f9ee29b9d281f542fb1d0d3f4ec1.1667318125.git.h.goebel@crazy-compilers.com>
> From: Hartmut Goebel <h.goebel@crazy-compilers.com>
> Date: Fri, 24 Jun 2022 20:40:57 +0200
> Subject: [PATCH v2] refresh: Allow updating to a specific version.
>
> * guix/scripts/refresh.scm (options->packages)[args-packages]: Handle version
> specification in package name arguments.
> (update-package): Add #:version argument and pass it on to called functions.
> (guix-refresh): When updating, pass the specified version (if any) to
> update-package.
> [package-list-without-versions, package-list-with-versions]: New functions.

Thanks for this updated patch!


[...]

Toggle quote (5 lines)
> -(define (options->packages opts)
> +(define (options->package-specs opts)
> "Return the list of packages requested by OPTS, honoring options like
> '--recursive'."

In Guix, “package spec” refers to the syntax that
‘specification->package’ accepts, like “guile” or “guile@2.2”. So we’ll
have to use another name throughout. How about “update spec” or
“refresh spec” for the string, and just “update” for the record?

Toggle quote (5 lines)
> +(define-record-type* <package-spec> package-spec make-package-spec
> + package-spec?
> + (package package-spec-package) ; package
> + (target package-spec-target)) ; target version

Since there are just two fields, it may be simpler to use SRFI-9:

(define-record-type <update>
(update package version)
update?
(package update-package)
(version update-version))

Thanks,
Ludo’.
C
C
Christopher Baines wrote on 23 Nov 2022 10:11
tag 57460 moreinfo
(address . control@debbugs.gnu.org)
87r0xuox13.fsf@cbaines.net
tags 57460 + moreinfo
quit
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 00/18] Refresh to specific version
(address . 57460@debbugs.gnu.org)(name . Ludovic Courtes)(address . ludo@gnu.org)
cover.1671527962.git.h.goebel@crazy-compilers.com
Hi Ludo,

I now at last found time for updating the patch series. Following is the
complete series as I would push it.

Toggle quote (5 lines)
> In Guix, “package spec” refers to the syntax that
> ‘specification->package’ accepts, like “guile” or “guile@2.2”. So we’ll
> have to use another name throughout. How about “update spec” or
> “refresh spec” for the string, and just “update” for the record?

Using "update" resulted in a conflict with the existing "update-package"
function. Using "refesh" would have names the accessor "refresh-package",
which sounds irritating for me (same for "update". Thus I decided to call the
record "update-spec" and the function "update-string->update.spec" (the name
is use only once).

WDYT?

Toggle quote (2 lines)
> Since there are just two fields, it may be simpler to use SRFI-9:

Done.

I also tested the patches with (an updated version of) the test-script I
posted in the first version of the series.


Hartmut Goebel (18):
upstream-updater: Rename record field.
import: cpan: Remove unused exports.
import: Issue error-message if version is given.
import: sourceforge: Issue error-message if version is given.
gnu-maintenance: Allow updating to a specific version.
import: crate: Allow updating to a specific version.
import: egg: Allow updating to a specific version.
import: gem: Allow updating to a specific version.
import: git: Allow updating to a specific version.
import: github: Allow updating to a specific version.
import: gnome: Allow updating to a specific version.
import: hexpm: Allow updating to a specific version.
import: kde: Allow updating to a specific version.
import: launchpad: Allow updating to a specific version.
import: pypi: Allow updating to a specific version.
refresh: Allow updating to a specific version.
upstream: Allow updating to a specific version.
doc: Describe how to update to a specific version.

doc/guix.texi | 19 ++++
guix/gnu-maintenance.scm | 183 ++++++++++++++++++++++++--------------
guix/import/cpan.scm | 32 +++----
guix/import/cran.scm | 23 +++--
guix/import/crate.scm | 10 ++-
guix/import/egg.scm | 10 ++-
guix/import/elpa.scm | 11 ++-
guix/import/gem.scm | 7 +-
guix/import/git.scm | 39 +++++---
guix/import/github.scm | 36 +++++---
guix/import/gnome.scm | 47 ++++++----
guix/import/gnu.scm | 2 +-
guix/import/hackage.scm | 12 ++-
guix/import/hexpm.scm | 9 +-
guix/import/kde.scm | 61 +++++++------
guix/import/launchpad.scm | 10 ++-
guix/import/minetest.scm | 12 ++-
guix/import/opam.scm | 11 ++-
guix/import/pypi.scm | 14 +--
guix/import/stackage.scm | 10 ++-
guix/scripts/refresh.scm | 49 +++++++---
guix/upstream.scm | 25 +++---
tests/import-github.scm | 2 +-
tests/transformations.scm | 8 +-
24 files changed, 416 insertions(+), 226 deletions(-)


base-commit: d241517d2cadac3122301b6260c0dfc9f3b383d6
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 01/18] upstream-updater: Rename record field.
(address . 57460@debbugs.gnu.org)
563370ec45490a38b9bb4d4ba0a797dfd76ad807.1671527962.git.h.goebel@crazy-compilers.com
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.
---
guix/gnu-maintenance.scm | 14 +++++++-------
guix/import/cpan.scm | 2 +-
guix/import/cran.scm | 4 ++--
guix/import/crate.scm | 2 +-
guix/import/egg.scm | 2 +-
guix/import/elpa.scm | 2 +-
guix/import/gem.scm | 2 +-
guix/import/git.scm | 2 +-
guix/import/github.scm | 2 +-
guix/import/gnome.scm | 2 +-
guix/import/hackage.scm | 2 +-
guix/import/hexpm.scm | 2 +-
guix/import/kde.scm | 2 +-
guix/import/launchpad.scm | 2 +-
guix/import/minetest.scm | 2 +-
guix/import/opam.scm | 2 +-
guix/import/pypi.scm | 2 +-
guix/import/stackage.scm | 2 +-
guix/upstream.scm | 10 +++++-----
tests/import-github.scm | 2 +-
tests/transformations.scm | 8 ++++----
21 files changed, 35 insertions(+), 35 deletions(-)

Toggle diff (333 lines)
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 2881a6be43..3067ee18b3 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -848,7 +848,7 @@ the directory containing its source tarball."
(name 'gnu)
(description "Updater for GNU packages")
(pred gnu-hosted?)
- (latest latest-gnu-release)))
+ (import latest-gnu-release)))
(define %gnu-ftp-updater
;; This is for GNU packages taken from alternate locations, such as
@@ -859,41 +859,41 @@ the directory containing its source tarball."
(pred (lambda (package)
(and (not (gnu-hosted? package))
(pure-gnu-package? package))))
- (latest latest-release*)))
+ (import latest-release*)))
(define %savannah-updater
(upstream-updater
(name 'savannah)
(description "Updater for packages hosted on savannah.gnu.org")
(pred (url-prefix-predicate "mirror://savannah/"))
- (latest latest-savannah-release)))
+ (import latest-savannah-release)))
(define %sourceforge-updater
(upstream-updater
(name 'sourceforge)
(description "Updater for packages hosted on sourceforge.net")
(pred (url-prefix-predicate "mirror://sourceforge/"))
- (latest latest-sourceforge-release)))
+ (import latest-sourceforge-release)))
(define %xorg-updater
(upstream-updater
(name 'xorg)
(description "Updater for X.org packages")
(pred (url-prefix-predicate "mirror://xorg/"))
- (latest latest-xorg-release)))
+ (import latest-xorg-release)))
(define %kernel.org-updater
(upstream-updater
(name 'kernel.org)
(description "Updater for packages hosted on kernel.org")
(pred (url-prefix-predicate "mirror://kernel.org/"))
- (latest latest-kernel.org-release)))
+ (import latest-kernel.org-release)))
(define %generic-html-updater
(upstream-updater
(name 'generic-html)
(description "Updater that crawls HTML pages.")
(pred html-updatable-package?)
- (latest latest-html-updatable-release)))
+ (import latest-html-updatable-release)))
;;; gnu-maintenance.scm ends here
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 87abe9c2f1..cb2d3dd410 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -358,4 +358,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 48fbc1dccb..473d8c4f5b 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -776,13 +776,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..51bfcd7bed 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -370,5 +370,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 latest-release)))
diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index 0d6d72c465..2ad48c3399 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -348,6 +348,6 @@ not work."
(name 'egg)
(description "Updater for CHICKEN egg packages")
(pred egg-package?)
- (latest latest-release)))
+ (import latest-release)))
;;; egg.scm ends here
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 9399f45ebc..1dbdff9391 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -444,7 +444,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..1c6c55baa6 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -189,7 +189,7 @@ package on RubyGems."
(name 'gem)
(description "Updater for RubyGem packages")
(pred gem-package?)
- (latest latest-release)))
+ (import latest-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..bb5ba4d97e 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -226,4 +226,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 latest-git-release)))
diff --git a/guix/import/github.scm b/guix/import/github.scm
index e1a1af7133..ac6ef06eda 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -330,6 +330,6 @@ releases."
(name 'github)
(description "Updater for GitHub packages")
(pred github-package?)
- (latest latest-release)))
+ (import latest-release)))
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 9d8cd8ec76..09c6dbbd0d 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -130,4 +130,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 latest-gnome-release)))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 878a7d2f9c..d56f52a221 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -381,6 +381,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..3b63837393 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -344,4 +344,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 latest-release)))
diff --git a/guix/import/kde.scm b/guix/import/kde.scm
index 6873418d62..510d823a4f 100644
--- a/guix/import/kde.scm
+++ b/guix/import/kde.scm
@@ -187,4 +187,4 @@ not be determined."
(name 'kde)
(description "Updater for KDE packages")
(pred (url-prefix-predicate "mirror://kde/"))
- (latest latest-kde-release)))
+ (import latest-kde-release)))
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index aeb447b0a5..b7e0295c4e 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -145,4 +145,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 latest-release)))
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 43cfb533e2..6581013215 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -513,4 +513,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..8a5aa4d8c6 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -435,4 +435,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..3e3e949283 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -583,4 +583,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 latest-release)))
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index 49be982a7f..af9809304f 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -175,6 +175,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
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 32736940aa..3b576898ec 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -66,7 +66,7 @@
upstream-updater-name
upstream-updater-description
upstream-updater-predicate
- upstream-updater-latest
+ upstream-updater-import
upstream-input-change?
upstream-input-change-name
@@ -241,7 +241,7 @@ correspond to the same version."
(name upstream-updater-name)
(description upstream-updater-description)
(pred upstream-updater-predicate)
- (latest upstream-updater-latest))
+ (import upstream-updater-import))
(define (importer-modules)
"Return the list of importer modules."
@@ -272,7 +272,7 @@ correspond to the same version."
"Return an updater among UPDATERS that matches PACKAGE, or #f if none of
them matches."
(find (match-lambda
- (($ <upstream-updater> name description pred latest)
+ (($ <upstream-updater> name description pred import)
(pred package)))
updaters))
@@ -285,9 +285,9 @@ them until one of them returns an upstream source. It is the caller's
responsibility to ensure that the returned source is newer than the current
one."
(any (match-lambda
- (($ <upstream-updater> name description pred latest)
+ (($ <upstream-updater> name description pred import)
(and (pred package)
- (latest package))))
+ (import package))))
updaters))
(define* (package-latest-release* package
diff --git a/tests/import-github.scm b/tests/import-github.scm
index 4d3f8cfc7e..5100296540 100644
--- a/tests/import-github.scm
+++ b/tests/import-github.scm
@@ -92,7 +92,7 @@
(define* (found-sexp old-version old-commit tags releases)
(and=>
(call-with-releases (lambda ()
- ((upstream-updater-latest %github-updater)
+ ((upstream-updater-import %github-updater)
(example-package old-version old-commit)))
tags releases)
upstream-source->sexp))
diff --git a/tests/transformations.scm b/tests/transformations.scm
index 47b1fc650d..5c136e1d48 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -488,10 +488,10 @@
(name 'dummy)
(pred (const #t))
(description "")
- (latest (const (upstream-source
- (package "foo")
- (version "42.0")
- (urls '("http://example.org")))))))))
+ (import (const (upstream-source
+ (package "foo")
+ (version "42.0")
+ (urls '("http://example.org")))))))))
(let* ((p (dummy-package "foo" (version "1.0")))
(t (options->transformation
`((with-latest . "foo")))))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 03/18] import: Issue error-message if version is given.
(address . 57460@debbugs.gnu.org)
88e627ef28e4025b8cb670461f827c59c1b89276.1671527962.git.h.goebel@crazy-compilers.com
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.
---
guix/import/cpan.scm | 9 ++++++++-
guix/import/cran.scm | 19 +++++++++++++++----
guix/import/elpa.scm | 9 ++++++++-
guix/import/hackage.scm | 10 +++++++++-
guix/import/minetest.scm | 10 +++++++++-
guix/import/opam.scm | 9 ++++++++-
guix/import/stackage.scm | 8 +++++++-
7 files changed, 64 insertions(+), 10 deletions(-)

Toggle diff (275 lines)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index a929dc62e3..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)
@@ -305,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
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 473d8c4f5b..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.
;;;
@@ -693,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))
@@ -713,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
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 1dbdff9391..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.
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index d56f52a221..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
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 6581013215..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
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 8a5aa4d8c6..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"))
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index af9809304f..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)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 04/18] import: sourceforge: Issue error-message if version is given.
(address . 57460@debbugs.gnu.org)
4233f0aa1b008ba00d1d9630aef291e45bc2c59d.1671527962.git.h.goebel@crazy-compilers.com
Due to the complicated directory structure at sourceforce,
enabling the sourceforge importer to update to a specific version
is very complicated to implement. Since only 2.0% of the
packages in guix are covered by this updater I dedided to not
implement this.

* guix/gnu-maintenance.scm (latest-sourceforge-release): Add #:version
argument. Issue error-message if version is given.
---
guix/gnu-maintenance.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Toggle diff (37 lines)
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 3067ee18b3..e414de8e28 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -37,6 +37,8 @@
#:autoload (guix download) (%mirrors)
#:use-module (guix ftp-client)
#:use-module (guix utils)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
#:use-module (guix memoization)
#:use-module (guix records)
#:use-module (guix upstream)
@@ -705,7 +707,7 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
#:base-url %savannah-base
#:directory directory)))
-(define (latest-sourceforge-release package)
+(define* (latest-sourceforge-release package #:key (version #f))
"Return the latest release of PACKAGE."
(define (uri-append uri extension)
;; Return URI with EXTENSION appended.
@@ -720,6 +722,12 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
((200 302) #t)
(else #f))))
+ (when version
+ (error
+ (formatted-message
+ (G_ "Updating to a specific version is not yet implemented for ~a, sorry.")
+ "sourceforge")))
+
(let* ((name (package-upstream-name package))
(base (string-append "https://sourceforge.net/projects/"
name "/files"))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 02/18] import: cpan: Remove unused exports.
(address . 57460@debbugs.gnu.org)
ac0ef6df5dca1d1f5f264254822bf029bf4275ed.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/cpan.scm (#:export): Remove unused exports.
---
guix/import/cpan.scm | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)

Toggle diff (34 lines)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index cb2d3dd410..a929dc62e3 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -39,26 +39,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
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 05/18] gnu-maintenance: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
215e393122cd3b18318ed1d5893af64d995b248e.1671527962.git.h.goebel@crazy-compilers.com
* guix/gnu-maintenance.scm
(latest-ftp-release): Rename to … (import-ftp-release) … this,
add #:version argument.
If version is given, try to find the respective version.
(latest-html-release): Rename to … (import-html-release) … this,
add #:version argument.
If version is given, try to find the respective version.
(latest-gnu-release): Rename to … (import-gnu-release) … this,
add #:version argument. Refactor to first select archives for
respective package, the find the requested or latest version, then create
the upstream-source.
(latest-release): Rename to … (import-release) … this,
add #:version argument, pass on to … (import-ftp-release) … this.
(import-release*): Rename to … (import-release*) … this,
add #:version argument, pass on to … (latest-release) … this.
(latest-savannah-release): Rename to … (import-savannah-release) … this,
add keword-argument version, pass on to … (import-html-release) … this.
(latest-xorg-release): Rename to … (import-xorg-release) … this,
add keword-argument version, pass on to … (import-ftp-release) … this.
(latest-kernel.org-release): Rename to … (import-kernel.org-release) … this,
add #:version argument, pass on to … (import-html-release) … this.
(latest-html-updatable-release): Rename to … (import-html-updatable-release)
… this, add #:version argument, pass on to … (import-html-release) … this.
* guix/import/gnu.scm(gnu->guix-package): Adjust function call.
---
guix/gnu-maintenance.scm | 171 ++++++++++++++++++++++++---------------
guix/import/gnu.scm | 2 +-
2 files changed, 105 insertions(+), 68 deletions(-)

Toggle diff (372 lines)
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index e414de8e28..e26702599d 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -333,14 +333,17 @@ name/directory pairs."
files)
result)))))))
-(define* (latest-ftp-release project
+(define* (import-ftp-release project
#:key
+ (version #f)
(server "ftp.gnu.org")
(directory (string-append "/gnu/" project))
(file->signature (cut string-append <> ".sig")))
"Return an <upstream-source> for the latest release of PROJECT on SERVER
-under DIRECTORY, or #f. Use FTP-OPEN and FTP-CLOSE to open (resp. close) FTP
-connections; this can be useful to reuse connections.
+under DIRECTORY, or #f. Optionally include a VERSION string to fetch a specific version.
+
+Use FTP-OPEN and FTP-CLOSE to open (resp. close) FTP connections; this can be
+useful to reuse connections.
FILE->SIGNATURE must be a procedure; it is passed a source file URL and must
return the corresponding signature URL, or #f it signatures are unavailable."
@@ -407,8 +410,12 @@ return the corresponding signature URL, or #f it signatures are unavailable."
;; Assume that SUBDIRS correspond to versions, and jump into the
;; one with the highest version number.
- (let* ((release (reduce latest-release #f
- (coalesce-sources releases)))
+ (let* ((release (if version
+ (find (lambda (upstream)
+ (string=? (upstream-source-version upstream) version))
+ (coalesce-sources releases))
+ (reduce latest-release #f
+ (coalesce-sources releases))))
(result (if (and result release)
(latest-release release result)
(or release result)))
@@ -420,13 +427,16 @@ return the corresponding signature URL, or #f it signatures are unavailable."
(ftp-close conn)
result))))))
-(define* (latest-release package
+(define* (import-release package
#:key
+ (version #f)
(server "ftp.gnu.org")
(directory (string-append "/gnu/" package)))
"Return the <upstream-source> for the latest version of PACKAGE or #f.
-PACKAGE must be the canonical name of a GNU package."
- (latest-ftp-release package
+PACKAGE must be the canonical name of a GNU package. Optionally include a
+VERSION string to fetch a specific version."
+ (import-ftp-release package
+ #:version version
#:server server
#:directory directory))
@@ -442,14 +452,15 @@ of EXP otherwise."
(close-port port))
#f)))
-(define (latest-release* package)
- "Like 'latest-release', but (1) take a <package> object, and (2) ignore FTP
+(define* (import-release* package #:key (version #f))
+ "Like 'import-release', but (1) take a <package> object, and (2) ignore FTP
errors that might occur when PACKAGE is not actually a GNU package, or not
hosted on ftp.gnu.org, or not under that name (this is the case for
\"emacs-auctex\", for instance.)"
(let-values (((server directory)
(ftp-server/directory package)))
- (false-if-ftp-error (latest-release (package-upstream-name package)
+ (false-if-ftp-error (import-release (package-upstream-name package)
+ #:version version
#:server server
#:directory directory))))
@@ -474,14 +485,18 @@ hosted on ftp.gnu.org, or not under that name (this is the case for
(_
links))))
-(define* (latest-html-release package
+(define* (import-html-release package
#:key
+ (version #f)
(base-url "https://kernel.org/pub")
(directory (string-append "/" package))
file->signature)
"Return an <upstream-source> for the latest release of PACKAGE (a string) on
-SERVER under DIRECTORY, or #f. BASE-URL should be the URL of an HTML page,
-typically a directory listing as found on 'https://kernel.org/pub'.
+SERVER under DIRECTORY, or #f. Optionally include a VERSION string to fetch a
+specific version.
+
+BASE-URL should be the URL of an HTML page, typically a directory listing as
+found on 'https://kernel.org/pub'.
When FILE->SIGNATURE is omitted or #f, guess the detached signature file name,
if any. Otherwise, FILE->SIGNATURE must be a procedure; it is passed a source
@@ -554,13 +569,18 @@ are unavailable."
(match candidates
(() #f)
((first . _)
- ;; Select the most recent release and return it.
- (reduce (lambda (r1 r2)
- (if (version>? (upstream-source-version r1)
- (upstream-source-version r2))
- r1 r2))
- first
- (coalesce-sources candidates))))))
+ (if version
+ ;; find matching release version and return it
+ (find (lambda (upstream)
+ (string=? (upstream-source-version upstream) version))
+ (coalesce-sources candidates))
+ ;; Select the most recent release and return it.
+ (reduce (lambda (r1 r2)
+ (if (version>? (upstream-source-version r1)
+ (upstream-source-version r2))
+ r1 r2))
+ first
+ (coalesce-sources candidates)))))))
;;;
@@ -592,9 +612,9 @@ are unavailable."
(call-with-gzip-input-port port
(compose string->lines get-string-all))))))
-(define (latest-gnu-release package)
+(define* (import-gnu-release package #:key (version #f))
"Return the latest release of PACKAGE, a GNU package available via
-ftp.gnu.org.
+ftp.gnu.org. Optionally include a VERSION string to fetch a specific version.
This method does not rely on FTP access at all; instead, it browses the file
list available from %GNU-FILE-LIST-URI over HTTP(S)."
@@ -604,42 +624,50 @@ list available from %GNU-FILE-LIST-URI over HTTP(S)."
(define (better-tarball? tarball1 tarball2)
(string=? (file-extension tarball1) archive-type))
+ (define (find-latest-tarball-version tarballs)
+ (fold (lambda (file1 file2)
+ (if (and file2
+ (version>? (tarball-sans-extension (basename file2))
+ (tarball-sans-extension (basename file1))))
+ file2
+ file1))
+ #f
+ tarballs))
+
(let-values (((server directory)
(ftp-server/directory package))
((name)
(package-upstream-name package)))
(let* ((files (ftp.gnu.org-files))
+ ;; select tarballs for this package
(relevant (filter (lambda (file)
(and (string-prefix? "/gnu" file)
(string-contains file directory)
(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://gnu/"
- (string-drop file
- (string-length "/gnu/"))))
+ files))
+ ;; find latest version
+ (version (or version
+ (and (not (null? relevant))
+ (tarball->version
+ (find-latest-tarball-version relevant)))))
+ ;; find tarballs 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://gnu/"
+ (string-drop file
+ (string-length "/gnu/"))))
;; Sort so that the tarball with the same compression
;; format as currently used in PACKAGE comes first.
(sort tarballs better-tarball?)))
- (signature-urls (map (cut string-append <> ".sig") urls)))))
- (()
- #f)))))
+ (signature-urls (map (cut string-append <> ".sig") urls))))))))
(define %package-name-rx
;; Regexp for a package name, e.g., "foo-X.Y". Since TeXmacs uses
@@ -693,8 +721,9 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
;; HTML (unlike <https://download.savannah.nongnu.org/releases>.)
"https://de.freedif.org/savannah/")
-(define (latest-savannah-release package)
- "Return the latest release of PACKAGE."
+(define* (import-savannah-release package #:key (version #f))
+ "Return the latest release of PACKAGE. Optionally include a VERSION string
+to fetch a specific version."
(let* ((uri (string->uri
(match (origin-uri (package-source package))
((? string? uri) uri)
@@ -703,12 +732,14 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
(directory (dirname (uri-path uri))))
;; Note: We use the default 'file->signature', which adds ".sig", ".asc",
;; or whichever detached signature naming scheme PACKAGE uses.
- (latest-html-release package
+ (import-html-release package
+ #:version version
#:base-url %savannah-base
#:directory directory)))
(define* (latest-sourceforge-release package #:key (version #f))
- "Return the latest release of PACKAGE."
+ "Return the latest release of PACKAGE. Optionally include a VERSION string
+to fetch a specific version."
(define (uri-append uri extension)
;; Return URI with EXTENSION appended.
(build-uri (uri-scheme uri)
@@ -766,21 +797,24 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
(when port
(close-port port))))))
-(define (latest-xorg-release package)
- "Return the latest release of PACKAGE."
+(define* (import-xorg-release package #:key (version #f))
+ "Return the latest release of PACKAGE. Optionally include a VERSION string
+to fetch a specific version."
(let ((uri (string->uri (origin-uri (package-source package)))))
(false-if-ftp-error
- (latest-ftp-release
+ (import-ftp-release
(package-name package)
+ #:version version
#:server "ftp.freedesktop.org"
#:directory
(string-append "/pub/xorg/" (dirname (uri-path uri)))))))
-(define (latest-kernel.org-release package)
- "Return the latest release of PACKAGE, the name of a kernel.org package."
+(define* (import-kernel.org-release package #:key (version #f))
+ "Return the latest release of PACKAGE, the name of a kernel.org package.
+Optionally include a VERSION string to fetch a specific version."
(define %kernel.org-base
;; This URL and sub-directories thereof are nginx-generated directory
- ;; listings suitable for 'latest-html-release'.
+ ;; listings suitable for 'import-html-release'.
"https://mirrors.edge.kernel.org/pub")
(define (file->signature file)
@@ -792,7 +826,8 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
((uri mirrors ...) uri))))
(package (package-upstream-name package))
(directory (dirname (uri-path uri))))
- (latest-html-release package
+ (import-html-release package
+ #:version version
#:base-url %kernel.org-base
#:directory directory
#:file->signature file->signature)))
@@ -819,9 +854,10 @@ GNOME packages; EMMS is included though, because its releases are on gnu.org."
(or (assoc-ref (package-properties package) 'release-monitoring-url)
(http-url? package)))))
-(define (latest-html-updatable-release package)
+(define* (import-html-updatable-release package #:key (version #f))
"Return the latest release of PACKAGE. Do that by crawling the HTML page of
-the directory containing its source tarball."
+the directory containing its source tarball. Optionally include a VERSION
+string to fetch a specific version."
(let* ((uri (string->uri
(match (origin-uri (package-source package))
((? string? url) url)
@@ -838,7 +874,8 @@ the directory containing its source tarball."
(catch #t
(lambda ()
(guard (c ((http-get-error? c) #f))
- (latest-html-release package
+ (import-html-release package
+ #:version version
#:base-url base
#:directory directory)))
(lambda (key . args)
@@ -856,7 +893,7 @@ the directory containing its source tarball."
(name 'gnu)
(description "Updater for GNU packages")
(pred gnu-hosted?)
- (import latest-gnu-release)))
+ (import import-gnu-release)))
(define %gnu-ftp-updater
;; This is for GNU packages taken from alternate locations, such as
@@ -867,14 +904,14 @@ the directory containing its source tarball."
(pred (lambda (package)
(and (not (gnu-hosted? package))
(pure-gnu-package? package))))
- (import latest-release*)))
+ (import import-release*)))
(define %savannah-updater
(upstream-updater
(name 'savannah)
(description "Updater for packages hosted on savannah.gnu.org")
(pred (url-prefix-predicate "mirror://savannah/"))
- (import latest-savannah-release)))
+ (import import-savannah-release)))
(define %sourceforge-updater
(upstream-updater
@@ -888,20 +925,20 @@ the directory containing its source tarball."
(name 'xorg)
(description "Updater for X.org packages")
(pred (url-prefix-predicate "mirror://xorg/"))
- (import latest-xorg-release)))
+ (import import-xorg-release)))
(define %kernel.org-updater
(upstream-updater
(name 'kernel.org)
(description "Updater for packages hosted on kernel.org")
(pred (url-prefix-predicate "mirror://kernel.org/"))
- (import latest-kernel.org-release)))
+ (import import-kernel.org-release)))
(define %generic-html-updater
(upstream-updater
(name 'generic-html)
(description "Updater that crawls HTML pages.")
(pred html-updatable-package?)
- (import latest-html-updatable-release)))
+ (import import-html-updatable-release)))
;;; gnu-maintenance.scm ends here
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)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 06/18] import: crate: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
a42318b1f0c403a18078ca27cd15e1e6963b3385.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/crate.scm (latest-release): Rename to 'import-release',
add #:version argument.
If version is given, return an upstream-source for this version.
---
guix/import/crate.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (37 lines)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 51bfcd7bed..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?)
- (import latest-release)))
+ (import import-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 07/18] import: egg: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
b90e0aec75f62b8066ee840684c422c00e1be5c0.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/egg.scm (latest-release): Rename to 'import-release',
add #:version argument.
If version is given, return an upstream-source for this version.
---
guix/import/egg.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (37 lines)
diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index 2ad48c3399..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?)
- (import latest-release)))
+ (import import-release)))
;;; egg.scm ends here
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 08/18] import: gem: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
3d65acf2575c85dd5964d35e5d199e7ec6898ce0.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/gem.scm (latest-release): Rename to 'import-release',
add #:version argument.
If version is given, return an upstream-source for this version.
---
guix/import/gem.scm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Toggle diff (37 lines)
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 1c6c55baa6..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?)
- (import latest-release)))
+ (import import-release)))
(define* (gem-recursive-import package-name #:optional version)
(recursive-import package-name
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 09/18] import: git: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
db29d7a6f37dfc4130a3e18639bb1a4fe2bf5db0.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/git.scm
(latest-tag): Add #:version argument. If version is given, try to
find the respective version tag.
(latest-git-tag-version): Add #:version argument and pass it on to
called functions.
(latest-releease) Rename to 'import-release', add #:version argument
and pass it on to called functions.
---
guix/import/git.scm | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)

Toggle diff (89 lines)
diff --git a/guix/import/git.scm b/guix/import/git.scm
index bb5ba4d97e..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?)
- (import latest-git-release)))
+ (import import-git-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 10/18] import: github: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
9344624489973aad01dfb6f2ed3c072e29964610.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/github.scm (latest-released-version): Add #:version argument.
If version is given, try to find the respective release.
(latest-releease) Rename to 'import-release', add #:version argument
and pass it on to 'latest-released-version'.
---
guix/import/github.scm | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)

Toggle diff (74 lines)
diff --git a/guix/import/github.scm b/guix/import/github.scm
index ac6ef06eda..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?)
- (import latest-release)))
+ (import import-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 11/18] import: gnome: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
424e88881eb29ea85b2bc2aa0da95cc0fb8a7aac.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/gnome.scm (latest-gnome-release): Rename
to 'import-gnome-release', add #:version argument. If version is
given, try to find the respective version
[find-latest-release]: New function, based on former code.
[find-version-release]: New function.
---
guix/import/gnome.scm | 47 +++++++++++++++++++++++++++----------------
1 file changed, 30 insertions(+), 17 deletions(-)

Toggle diff (86 lines)
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 09c6dbbd0d..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/"))
- (import latest-gnome-release)))
+ (import import-gnome-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 12/18] import: hexpm: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
d9120015dc588d31c203a2bfadf43b8827ae69a8.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/hexpm.scm (latest-release): Rename to 'import-release',
add #:version argument.
If version is given, return an upstream-source for this version.
---
guix/import/hexpm.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 3b63837393..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))
- (import latest-release)))
+ (import import-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 13/18] import: kde: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
18bade2491a673e87847d531c66119fc1478dd4d.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/kde.scm (latest-kde-release): Rename to 'import-kde-release',
add #:version argument. Rework the code to not sort the relevant files,
but just find the requested or latest version.
[find-latest-archive-version]: New function.
---
guix/import/kde.scm | 61 ++++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 25 deletions(-)

Toggle diff (92 lines)
diff --git a/guix/import/kde.scm b/guix/import/kde.scm
index 510d823a4f..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/"))
- (import latest-kde-release)))
+ (import import-kde-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 14/18] import: launchpad: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
2b7d35f5b7052dab718e6e4c1c9407f1560bf63f.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/launchpad.scm (latest-release): Rename to 'import-release',
add #:version argument.
If version is given, return an upstream-source for this version.
---
guix/import/launchpad.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (41 lines)
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index b7e0295c4e..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?)
- (import latest-release)))
+ (import import-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 15/18] import: pypi: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
2167633f20f8537b163574c0d1cc5b0c59368998.1671527962.git.h.goebel@crazy-compilers.com
* guix/import/pypi.scm (latest-release): Rename to 'import-release',
add #:version argument and pass it on to called functions.
---
guix/import/pypi.scm | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

Toggle diff (50 lines)
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 3e3e949283..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?)
- (import latest-release)))
+ (import import-release)))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 16/18] refresh: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
33d5dc74aa743c1588644b861fbe095cd761300d.1671527962.git.h.goebel@crazy-compilers.com
* guix/scripts/refresh.scm (options->packages)[args-packages]: Handle version
specification in package name arguments.
(update-package): Add #:version argument and pass it on to called functions.
(guix-refresh): When updating, pass the specified version (if any) to
update-package.
[package-list-without-versions, package-list-with-versions]: New functions.
---
guix/scripts/refresh.scm | 49 ++++++++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 12 deletions(-)

Toggle diff (123 lines)
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 14329751f8..e0b94ce48d 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -46,6 +47,7 @@
#:use-module (ice-9 vlist)
#:use-module (ice-9 format)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-37)
#:use-module (srfi srfi-71)
@@ -181,7 +183,7 @@ specified with `--select'.\n"))
(newline)
(show-bug-report-information))
-(define (options->packages opts)
+(define (options->update-specs opts)
"Return the list of packages requested by OPTS, honoring options like
'--recursive'."
(define core-package?
@@ -224,7 +226,7 @@ update would trigger a complete rebuild."
(('argument . spec)
;; Take either the specified version or the
;; latest one.
- (specification->package spec))
+ (update-specification->update-spec spec))
(('expression . exp)
(read/eval-package-expression exp))
(_ #f))
@@ -254,6 +256,25 @@ update would trigger a complete rebuild."
(with-monad %store-monad
(return packages))))
+
+;;;
+;;; Utilities.
+;;;
+
+(define-record-type <update-spec>
+ (update-spec package version)
+ update?
+ (package update-spec-package)
+ (version update-spec-version))
+
+(define (update-specification->update-spec spec)
+ "Given SPEC, a package name like \"guile@2.0=2.0.8\", return a <update>
+record with two fields: the package to upgrade, and the target version."
+ (match (string-rindex spec #\=)
+ (#f (update-spec (specification->package spec) #f))
+ (idx (update-spec (specification->package (substring spec 0 idx))
+ (substring spec (1+ idx))))))
+
;;;
;;; Updates.
@@ -298,7 +319,7 @@ update would trigger a complete rebuild."
(G_ "no updater for ~a~%")
(package-name package)))
-(define* (update-package store package updaters
+(define* (update-package store package version updaters
#:key (key-download 'interactive) warn?)
"Update the source file that defines PACKAGE with the new version.
KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed
@@ -307,7 +328,7 @@ warn about packages that have no matching updater."
(if (lookup-updater package updaters)
(let ((version output source
(package-update store package updaters
- #:key-download key-download))
+ #:key-download key-download #:version version))
(loc (or (package-field-location package 'version)
(package-location package))))
(when version
@@ -540,12 +561,12 @@ all are dependent packages: ~{~a~^ ~}~%")
(with-error-handling
(with-store store
(run-with-store store
- (mlet %store-monad ((packages (options->packages opts)))
+ (mlet %store-monad ((update-specs (options->update-specs opts)))
(cond
(list-dependent?
- (list-dependents packages))
+ (list-dependents (map update-spec-package update-specs)))
(list-transitive?
- (list-transitive packages))
+ (list-transitive (map update-spec-package update-specs)))
(update?
(parameterize ((%openpgp-key-server
(or (assoc-ref opts 'key-server)
@@ -558,13 +579,17 @@ all are dependent packages: ~{~a~^ ~}~%")
(string-append (config-directory)
"/upstream/trustedkeys.kbx"))))
(for-each
- (cut update-package store <> updaters
- #:key-download key-download
- #:warn? warn?)
- packages)
+ (lambda (update)
+ (update-package store
+ (update-spec-package update)
+ (update-spec-version update)
+ updaters
+ #:key-download key-download
+ #:warn? warn?))
+ update-specs)
(return #t)))
(else
(for-each (cut check-for-package-update <> updaters
#:warn? warn?)
- packages)
+ (map update-spec-package update-specs))
(return #t)))))))))
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 17/18] upstream: Allow updating to a specific version.
(address . 57460@debbugs.gnu.org)
f6194cc208b5895cf1410a8921e87533133ed6d0.1671527962.git.h.goebel@crazy-compilers.com
* guix/upstream.scm(package-latest-release): Add keyword-argument 'version'
and pass it on to the updater's 'import' function.
(package-update): add keyword-argument 'version' and pass it on to
package-latest-release. Differentiate the error message issued when
no package was found, depending on whether version was given or not.
---
guix/upstream.scm | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

Toggle diff (63 lines)
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 3b576898ec..f3ab9ab78b 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -278,7 +279,8 @@ them matches."
(define* (package-latest-release package
#:optional
- (updaters (force %updaters)))
+ (updaters (force %updaters))
+ #:key (version #f))
"Return an upstream source to update PACKAGE, a <package> object, or #f if
none of UPDATERS matches PACKAGE. When several updaters match PACKAGE, try
them until one of them returns an upstream source. It is the caller's
@@ -287,7 +289,7 @@ one."
(any (match-lambda
(($ <upstream-updater> name description pred import)
(and (pred package)
- (import package))))
+ (import package #:version version))))
updaters))
(define* (package-latest-release* package
@@ -494,13 +496,13 @@ SOURCE, an <upstream-source>."
(define* (package-update store package
#:optional (updaters (force %updaters))
- #:key (key-download 'interactive))
+ #:key (key-download 'interactive) (version #f))
"Return the new version, the file name of the new version tarball, and input
changes for PACKAGE; return #f (three values) when PACKAGE is up-to-date;
raise an error when the updater could not determine available releases.
KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed
values: 'always', 'never', and 'interactive' (default)."
- (match (package-latest-release package updaters)
+ (match (package-latest-release package updaters #:version version)
((? upstream-source? source)
(if (version>? (upstream-source-version source)
(package-version package))
@@ -524,8 +526,11 @@ this method: ~s")
(values #f #f #f)))
(#f
;; Warn rather than abort so that other updates can still take place.
- (warning (G_ "updater failed to determine available releases for ~a~%")
- (package-name package))
+ (if version
+ (warning (G_ "updater failed to find release ~a@~a~%")
+ (package-name package) version)
+ (warning (G_ "updater failed to determine available releases for ~a~%")
+ (package-name package)))
(values #f #f #f))))
(define* (update-package-source package source hash)
--
2.30.6
H
H
Hartmut Goebel wrote on 20 Dec 2022 10:34
[PATCH v3 18/18] doc: Describe how to update to a specific version.
(address . 57460@debbugs.gnu.org)
2b905274a868aa9f0d015b8b688e1526172a63da.1671527962.git.h.goebel@crazy-compilers.com
---
doc/guix.texi | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Toggle diff (32 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index c031c8d880..8bca0e1098 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13932,6 +13932,25 @@ gnu/packages/multiprecision.scm:40:12: 6.1.2 is already the latest version of gm
@end table
+If for some reason you don't want to update to the latest version,
+you can update to a specific version
+by appending an equal-sign and the desired version number
+to the package specification.
+However, not all updaters support this.
+
+@example
+$ guix refresh trytond-party
+gnu/packages/guile.scm:392:2: guile would be upgraded from 3.0.3 to 3.0.5
+$ guix refresh -u guile=3.0.4
+@dots{}
+gnu/packages/guile.scm:392:2: guile: updating from version 3.0.3 to version 3.0.4...
+@dots{}
+$ guix refresh -u guile@@2.0=2.0.12
+@dots{}
+gnu/packages/guile.scm:147:2: guile: updating from version 2.0.10 to version 2.0.12...
+@dots{}
+@end example
+
Sometimes the upstream name differs from the package name used in Guix,
and @command{guix refresh} needs a little help. Most updaters honor the
@code{upstream-name} property in package definitions, which can be used
--
2.30.6
L
L
Ludovic Courtès wrote on 23 Dec 2022 23:42
Re: bug#57460: [PATCH 00/19] Refresh to specific version
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
87bkntzqqb.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (4 lines)
> ---
> doc/guix.texi | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)

Please add a commit log.

Toggle quote (6 lines)
> +If for some reason you don't want to update to the latest version,
> +you can update to a specific version
> +by appending an equal-sign and the desired version number
> +to the package specification.
> +However, not all updaters support this.

s/equal-sign/equal sign/

(You might want to “fill” the paragraph too, to avoid those spurious
line breaks.)

Maybe replace the last sentence with something more practical like:

Note that not all updaters support this; an error is reported when an
updater cannot refresh to the specified version.

Ludo’.
L
L
Ludovic Courtès wrote on 23 Dec 2022 23:45
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 57460@debbugs.gnu.org)
877cyhzqll.fsf_-_@gnu.org
Hi,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (13 lines)
>> In Guix, “package spec” refers to the syntax that
>> ‘specification->package’ accepts, like “guile” or “guile@2.2”. So we’ll
>> have to use another name throughout. How about “update spec” or
>> “refresh spec” for the string, and just “update” for the record?
>
> Using "update" resulted in a conflict with the existing "update-package"
> function. Using "refesh" would have names the accessor "refresh-package",
> which sounds irritating for me (same for "update". Thus I decided to call the
> record "update-spec" and the function "update-string->update.spec" (the name
> is use only once).
>
> WDYT?

Sounds good!

Toggle quote (7 lines)
>> Since there are just two fields, it may be simpler to use SRFI-9:
>
> Done.
>
> I also tested the patches with (an updated version of) the test-script I
> posted in the first version of the series.

Excellent. I posted suggestions for the last patch (doc); you can
adjust it and push the whole series.

Thank you!

Ludo’.
H
H
Hartmut Goebel wrote on 26 Dec 2022 17:42
(address . 57460-close@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
821d8798-70d2-dbd8-59fe-25a8a406720c@crazy-compilers.com
Hi,

Many thanks for the review. I followed your latest suggestions. and
pushed as 7c476873e0300711bf92668cf01abd28f7295ead

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
?
Your comment

This issue is archived.

To comment on this conversation send an email to 57460@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57460
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch