[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/08: import: elpa: Add updater.
From: |
Ludovic Courtès |
Subject: |
04/08: import: elpa: Add updater. |
Date: |
Wed, 21 Oct 2015 12:45:34 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit a7aac936253b7def133b935a434e692b00eccab5
Author: Ludovic Courtès <address@hidden>
Date: Wed Oct 21 12:25:06 2015 +0200
import: elpa: Add updater.
* guix/import/elpa.scm (latest-release, package-from-gnu.org?): New
procedures.
(%elpa-updater): New variable.
* guix/scripts/refresh.scm (%updaters): Add %ELPA-UPDATER.
---
guix/import/elpa.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++-
guix/scripts/refresh.scm | 6 +++-
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index d327925..37fc2b8 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <address@hidden>
+;;; Copyright © 2015 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,9 +33,12 @@
#:use-module (guix ui)
#:use-module (guix hash)
#:use-module (guix base32)
+ #:use-module (guix upstream)
+ #:use-module (guix packages)
#:use-module ((guix utils) #:select (call-with-temporary-output-file
memoize))
- #:export (elpa->guix-package))
+ #:export (elpa->guix-package
+ %elpa-updater))
(define (elpa-dependencies->names deps)
"Convert DEPS, a list of symbol/version pairs à la ELPA, to a list of
@@ -229,4 +233,47 @@ type '<elpa-package>'."
(let ((pkg (fetch-elpa-package name repo)))
(and=> pkg elpa-package->sexp)))
+
+;;;
+;;; Updates.
+;;;
+
+(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\"."
+ (define name
+ (if (string-prefix? "emacs-" package)
+ (string-drop package 6)
+ package))
+
+ (let* ((repo 'gnu)
+ (info (elpa-package-info name repo))
+ (version (match info
+ ((name raw-version . _)
+ (elpa-version->string raw-version))))
+ (url (match info
+ ((_ raw-version reqs synopsis kind . rest)
+ (package-source-url kind name version repo)))))
+ (upstream-source
+ (package package)
+ (version version)
+ (urls (list url))
+ (signature-urls (list (string-append url ".sig"))))))
+
+(define (package-from-gnu.org? package)
+ "Return true if PACKAGE is from elpa.gnu.org."
+ (match (and=> (package-source package) origin-uri)
+ ((? string? uri)
+ (let ((uri (string->uri uri)))
+ (and uri (string=? (uri-host uri) "elpa.gnu.org"))))
+ (_ #f)))
+
+(define %elpa-updater
+ ;; The ELPA updater. We restrict it to packages hosted on elpa.gnu.org
+ ;; because for other repositories, we typically grab the source elsewhere.
+ (upstream-updater 'elpa
+ package-from-gnu.org?
+ latest-release))
+
;;; elpa.scm ends here
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 8d4f26e..8e461ce 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -27,6 +27,7 @@
#:use-module (guix packages)
#:use-module (guix upstream)
#:use-module ((guix gnu-maintenance) #:select (%gnu-updater))
+ #:use-module (guix import elpa)
#:use-module (guix gnupg)
#:use-module (gnu packages)
#:use-module ((gnu packages commencement) #:select (%final-inputs))
@@ -131,8 +132,9 @@ specified with `--select'.\n"))
;;;
(define %updaters
- ;; List of "updaters" used by default.
- (list %gnu-updater))
+ ;; List of "updaters" used by default. They are consulted in this order.
+ (list %gnu-updater
+ %elpa-updater))
(define* (update-package store package #:key (key-download 'interactive))
"Update the source file that defines PACKAGE with the new version.
- branch master updated (45e1096 -> 053cfdb), Ludovic Courtès, 2015/10/21
- 01/08: http-client: '%http-cache-ttl' is really a parameter., Ludovic Courtès, 2015/10/21
- 03/08: import: elpa: Use 'http-fetch/cached' to retrieve the archive., Ludovic Courtès, 2015/10/21
- 08/08: import: cran: Avoid HTTP redirect., Ludovic Courtès, 2015/10/21
- 05/08: refresh: Add '--type' option., Ludovic Courtès, 2015/10/21
- 06/08: refresh: Remove exception catch-all., Ludovic Courtès, 2015/10/21
- 02/08: gnu-maintenance: Generalize, leading to (guix upstream)., Ludovic Courtès, 2015/10/21
- 04/08: import: elpa: Add updater.,
Ludovic Courtès <=
- 07/08: import: cran: Add updater., Ludovic Courtès, 2015/10/21