diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-04-14 21:40:20 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-04-15 00:32:18 +0200 |
commit | 7d27a0259bc7a37c04b17ffc2953837fcc3e75ff (patch) | |
tree | c4128169bccde428937d5844c0547c7e3b6059a9 | |
parent | 85c7e8e611be1bdc2eed47e61e9ff45d92ab293d (diff) | |
download | guix-7d27a0259bc7a37c04b17ffc2953837fcc3e75ff.tar guix-7d27a0259bc7a37c04b17ffc2953837fcc3e75ff.tar.gz |
upstream: Pass a package object to updaters.
* guix/upstream.scm (package-update-path): Pass PACKAGE to
'latest-release'.
* guix/gnu-maintenance.scm (latest-release*)
(latest-gnome-release, latest-xorg-release): Adjust accordingly.
* guix/import/cran.scm (latest-cran-release):
(latest-bioconductor-release): Likewise.
* guix/import/elpa.scm (latest-release): Likewise.
* guix/import/gem.scm (latest-release): Likewise.
* guix/import/github.scm (latest-release): Likewise.
* guix/import/hackage.scm (latest-release): Likewise.
* guix/import/pypi.scm (latest-release): Likewise.
-rw-r--r-- | guix/gnu-maintenance.scm | 11 | ||||
-rw-r--r-- | guix/import/cran.scm | 11 | ||||
-rw-r--r-- | guix/import/elpa.scm | 14 | ||||
-rw-r--r-- | guix/import/gem.scm | 10 | ||||
-rw-r--r-- | guix/import/github.scm | 10 | ||||
-rw-r--r-- | guix/import/hackage.scm | 10 | ||||
-rw-r--r-- | guix/import/pypi.scm | 10 | ||||
-rw-r--r-- | guix/upstream.scm | 6 |
8 files changed, 35 insertions, 47 deletions
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm index 9d720ca030..f97f2d1692 100644 --- a/guix/gnu-maintenance.scm +++ b/guix/gnu-maintenance.scm @@ -33,7 +33,6 @@ #:use-module (guix records) #:use-module (guix upstream) #:use-module (guix packages) - #:use-module (gnu packages) #:export (gnu-package-name gnu-package-mundane-name gnu-package-copyright-holder @@ -435,7 +434,7 @@ of EXP otherwise." "Like 'latest-release', but 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.)" - (false-if-ftp-error (latest-release package))) + (false-if-ftp-error (latest-release (package-name package)))) (define %package-name-rx ;; Regexp for a package name, e.g., "foo-X.Y". Since TeXmacs uses @@ -493,10 +492,10 @@ elpa.gnu.org, and all the GNOME packages." (even-minor-version? (or version name)))) (false-if-ftp-error - (latest-ftp-release package + (latest-ftp-release (package-name package) #:server "ftp.gnome.org" #:directory (string-append "/pub/gnome/sources/" - (match package + (match (package-name package) ("gconf" "GConf") (x x))) @@ -528,10 +527,10 @@ elpa.gnu.org, and all the GNOME packages." (define (latest-xorg-release package) "Return the latest release of PACKAGE, the name of an X.org package." - (let ((uri (string->uri (origin-uri (package-source (specification->package package)))))) + (let ((uri (string->uri (origin-uri (package-source package))))) (false-if-ftp-error (latest-ftp-release - package + (package-name package) #:server "ftp.freedesktop.org" #:directory (string-append "/pub/xorg/" (dirname (uri-path uri))))))) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 562917c0a0..69485bc88d 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> -;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,7 +32,6 @@ #:use-module ((guix build-system r) #:select (cran-uri bioconductor-uri)) #:use-module (guix upstream) #:use-module (guix packages) - #:use-module (gnu packages) #:export (cran->guix-package bioconductor->guix-package %cran-updater @@ -240,7 +239,7 @@ s-expression corresponding to that package, or #f on failure." "Return an <upstream-source> for the latest release of PACKAGE." (define upstream-name - (package->upstream-name (specification->package package))) + (package->upstream-name package)) (define meta (fetch-description %cran-url upstream-name)) @@ -249,7 +248,7 @@ s-expression corresponding to that package, or #f on failure." (let ((version (assoc-ref meta "Version"))) ;; CRAN does not provide signatures. (upstream-source - (package package) + (package (package-name package)) (version version) (urls (cran-uri upstream-name version)))))) @@ -257,7 +256,7 @@ s-expression corresponding to that package, or #f on failure." "Return an <upstream-source> for the latest release of PACKAGE." (define upstream-name - (package->upstream-name (specification->package package))) + (package->upstream-name package)) (define meta (fetch-description %bioconductor-svn-url upstream-name)) @@ -266,7 +265,7 @@ s-expression corresponding to that package, or #f on failure." (let ((version (assoc-ref meta "Version"))) ;; Bioconductor does not provide signatures. (upstream-source - (package package) + (package (package-name package)) (version version) (urls (bioconductor-uri upstream-name version)))))) diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index 529de4f232..ccc4063a53 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> -;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -239,13 +239,11 @@ type '<elpa-package>'." ;;; (define (latest-release package) - "Return an <upstream-release> for the latest release of PACKAGE. PACKAGE -may be a Guix package name such as \"emacs-debbugs\" or an upstream name such -as \"debbugs\"." + "Return an <upstream-release> for the latest release of PACKAGE." (define name - (if (string-prefix? "emacs-" package) - (string-drop package 6) - package)) + (if (string-prefix? "emacs-" (package-name package)) + (string-drop (package-name package) 6) + (package-name package))) (let* ((repo 'gnu) (info (elpa-package-info name repo)) @@ -256,7 +254,7 @@ as \"debbugs\"." ((_ raw-version reqs synopsis kind . rest) (package-source-url kind name version repo))))) (upstream-source - (package package) + (package (package-name package)) (version version) (urls (list url)) (signature-urls (list (string-append url ".sig")))))) diff --git a/guix/import/gem.scm b/guix/import/gem.scm index b46622f00d..fc06b0d748 100644 --- a/guix/import/gem.scm +++ b/guix/import/gem.scm @@ -32,7 +32,6 @@ #:use-module (guix licenses) #:use-module (guix base32) #:use-module (guix build-system ruby) - #:use-module (gnu packages) #:export (gem->guix-package %gem-updater)) @@ -171,15 +170,14 @@ package on RubyGems." ((source-url ...) (any rubygems-url? source-url)))))) -(define (latest-release guix-package) - "Return an <upstream-source> for the latest release of GUIX-PACKAGE." - (let* ((gem-name (guix-package->gem-name - (specification->package guix-package))) +(define (latest-release package) + "Return an <upstream-source> for the latest release of PACKAGE." + (let* ((gem-name (guix-package->gem-name package)) (metadata (rubygems-fetch gem-name)) (version (assoc-ref metadata "version")) (url (rubygems-uri gem-name version))) (upstream-source - (package guix-package) + (package (package-name package)) (version version) (urls (list url))))) diff --git a/guix/import/github.scm b/guix/import/github.scm index c696dcb363..29116d79f0 100644 --- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -25,7 +25,6 @@ #:use-module (guix import utils) #:use-module (guix packages) #:use-module (guix upstream) - #:use-module (gnu packages) #:use-module (web uri) #:export (%github-updater)) @@ -175,15 +174,14 @@ https://github.com/settings/tokens")) (if (eq? (string-ref tag 0) #\v) (substring tag 1) tag))))))))) -(define (latest-release guix-package) - "Return an <upstream-source> for the latest release of GUIX-PACKAGE." - (let* ((pkg (specification->package guix-package)) - (source-uri (origin-uri (package-source pkg))) +(define (latest-release pkg) + "Return an <upstream-source> for the latest release of PKG." + (let* ((source-uri (origin-uri (package-source pkg))) (name (package-name pkg)) (newest-version (latest-released-version source-uri name))) (if newest-version (upstream-source - (package pkg) + (package name) (version newest-version) (urls (list (updated-github-url pkg newest-version)))) #f))) ; On GitHub but no proper releases diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm index 640ead24f3..f07f453e11 100644 --- a/guix/import/hackage.scm +++ b/guix/import/hackage.scm @@ -23,7 +23,6 @@ #:use-module (srfi srfi-26) #:use-module (srfi srfi-11) #:use-module (srfi srfi-1) - #:use-module (gnu packages) #:use-module ((guix download) #:select (download-to-store url-fetch)) #:use-module ((guix utils) #:select (package-name->name+version canonical-newline-port)) @@ -269,10 +268,9 @@ respectively." ((source-url ...) (any haskell-url? source-url)))))) -(define (latest-release guix-package) - "Return an <upstream-source> for the latest release of GUIX-PACKAGE." - (let* ((hackage-name (guix-package->hackage-name - (specification->package guix-package))) +(define (latest-release package) + "Return an <upstream-source> for the latest release of PACKAGE." + (let* ((hackage-name (guix-package->hackage-name package)) (cabal-meta (hackage-fetch hackage-name))) (match cabal-meta (#f @@ -283,7 +281,7 @@ respectively." ((_ *** ("version" (version))) (let ((url (hackage-source-url hackage-name version))) (upstream-source - (package guix-package) + (package (package-name package)) (version version) (urls (list url)))))))) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 8ae4948147..de30f4bea6 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -40,7 +40,6 @@ #:use-module (guix upstream) #:use-module (guix licenses) #:use-module (guix build-system python) - #:use-module (gnu packages) #:use-module (gnu packages python) #:export (pypi->guix-package %pypi-updater)) @@ -248,16 +247,15 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." ((source-url ...) (any pypi-url? source-url)))))) -(define (latest-release guix-package) - "Return an <upstream-source> for the latest release of GUIX-PACKAGE." +(define (latest-release package) + "Return an <upstream-source> for the latest release of PACKAGE." (guard (c ((missing-source-error? c) #f)) - (let* ((pypi-name (guix-package->pypi-name - (specification->package guix-package))) + (let* ((pypi-name (guix-package->pypi-name package)) (metadata (pypi-fetch pypi-name)) (version (assoc-ref* metadata "info" "version")) (url (assoc-ref (latest-source-release metadata) "url"))) (upstream-source - (package guix-package) + (package (package-name package)) (version version) (urls (list url)))))) diff --git a/guix/upstream.scm b/guix/upstream.scm index 02c50c06c8..167c9ff89a 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -128,11 +128,11 @@ them matches." updaters)) (define (package-update-path package updaters) - "Return an upstream source to update PACKAGE to, or #f if no update is -needed or known." + "Return an upstream source to update PACKAGE, a <package> object, or #f if +no update is needed or known." (match (lookup-updater package updaters) ((? procedure? latest-release) - (match (latest-release (package-name package)) + (match (latest-release package) ((and source ($ <upstream-source> name version)) (and (version>? version (package-version package)) source)) |