summaryrefslogtreecommitdiff
path: root/guix/import/gnu.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-11-03 00:59:28 +0100
committerLudovic Courtès <ludo@gnu.org>2015-11-03 00:59:28 +0100
commit3195e19de2f4360bdde12fccb1821dc444c95807 (patch)
tree7ffb5308df40d07fec78e2ea3b90f277e512aa98 /guix/import/gnu.scm
parentb485f756e92fdfef45c28eed4c21f895e1acd47b (diff)
import: gnu: Update to the (guix upstream) API.
This is a followup to 0a7c5a0. * guix/import/gnu.scm (preferred-archive-type): Use 'upstream-source-archive-types' instead of 'gnu-release-archive-types'. (gnu-package->sexp): Use 'upstream-source-urls' et al. Update call to 'download-tarball'. (gnu->guix-package): Use <upstream-source> instead of <gnu-release>. * guix/upstream.scm (upstream-source-archive-types): Export.
Diffstat (limited to 'guix/import/gnu.scm')
-rw-r--r--guix/import/gnu.scm30
1 files changed, 20 insertions, 10 deletions
diff --git a/guix/import/gnu.scm b/guix/import/gnu.scm
index 7160fcf7ba..834f0ae5cf 100644
--- a/guix/import/gnu.scm
+++ b/guix/import/gnu.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,11 +23,13 @@
#:use-module (guix store)
#:use-module (guix hash)
#:use-module (guix base32)
+ #:use-module (guix upstream)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
+ #:use-module (web uri)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:export (gnu->guix-package))
@@ -47,7 +49,7 @@
(define (preferred-archive-type release)
"Return the preferred type of archive for downloading RELEASE."
- (find (cute member <> (gnu-release-archive-types release))
+ (find (cute member <> (upstream-source-archive-types release))
'("xz" "lz" "bz2" "tbz2" "gz" "tgz" "Z")))
(define* (gnu-package->sexp package release
@@ -60,21 +62,29 @@
(define url-base
;; XXX: We assume that RELEASE's directory starts with "/gnu".
- (string-append "mirror:/" (gnu-release-directory release)
+ (string-append "mirror:/"
+ (match (upstream-source-urls release)
+ ((url rest ...)
+ (dirname (uri-path (string->uri url)))))
"/" name "-"))
(define archive-type
(preferred-archive-type release))
+ (define url
+ (find (cut string-suffix? archive-type <>)
+ (upstream-source-urls release)))
+
+ (define sig-url
+ (find (cute string-suffix? (string-append archive-type ".sig") <>)
+ (upstream-source-signature-urls release)))
+
(let ((tarball (with-store store
- (download-tarball store name
- (gnu-release-directory release)
- (gnu-release-version release)
- #:archive-type archive-type
+ (download-tarball store url sig-url
#:key-download key-download))))
`(package
(name ,name)
- (version ,(gnu-release-version release))
+ (version ,(upstream-source-version release))
(source (origin
(method url-fetch)
(uri (string-append ,url-base version
@@ -95,8 +105,8 @@
KEY-DOWNLOAD as the OpenPGP key download policy (see 'download-tarball' for
details.)"
(match (latest-release name)
- ((? gnu-release? release)
- (let ((version (gnu-release-version release)))
+ ((? upstream-source? release)
+ (let ((version (upstream-source-version release)))
(match (find-packages (regexp-quote name))
((info . _)
(gnu-package->sexp info release #:key-download key-download))