summaryrefslogtreecommitdiff
path: root/guix/upstream.scm
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2020-05-24 22:17:30 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2021-10-07 22:35:28 +0200
commitd780d0a2bbd1cdb7b688b3933ec6d6a1eb27e150 (patch)
tree36c6829899926d022ebdc35b610a0ebbad5cc54f /guix/upstream.scm
parentf63c79bf7674df012517f8e9148f94c611e35f32 (diff)
downloadguix-patches-d780d0a2bbd1cdb7b688b3933ec6d6a1eb27e150.tar
guix-patches-d780d0a2bbd1cdb7b688b3933ec6d6a1eb27e150.tar.gz
import: Add hex.pm importer.
hex.pm is a package repository for Erlang and Elixir. * guix/scripts/import.scm (importers): Add "hexpm". * guix/scripts/import/hexpm.scm, guix/import/hexpm.scm, guix/hexpm-download.scm: New files. * guix/import/utils.scm (source-spec->object): Add "hexpm-fetch" to list of fetch methods. * guix/upstream.scm (package-update/hexpm-fetch): New function. (%method-updates) Add it. * Makefile.am: Add them.
Diffstat (limited to 'guix/upstream.scm')
-rw-r--r--guix/upstream.scm20
1 files changed, 19 insertions, 1 deletions
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 632e9ebc4f..f1fb84eb45 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -24,6 +24,10 @@
#:use-module (guix discovery)
#:use-module ((guix download)
#:select (download-to-store url-fetch))
+ #:use-module ((guix hexpm-download)
+ #:select (hexpm-fetch))
+ #:use-module ((guix extracting-download)
+ #:select (download-to-store/extract))
#:use-module (guix gnupg)
#:use-module (guix packages)
#:use-module (guix diagnostics)
@@ -430,9 +434,23 @@ SOURCE, an <upstream-source>."
#:key-download key-download)))
(values version tarball source))))))
+(define* (package-update/hexpm-fetch store package source
+ #:key key-download)
+ "Return the version, tarball, and SOURCE, to update PACKAGE to
+SOURCE, an <upstream-source>."
+ (match source
+ (($ <upstream-source> _ version urls signature-urls)
+ (let* ((url (first urls))
+ (name (or (origin-file-name (package-source package))
+ (string-append (basename url) ".gz")))
+ (tarball (download-to-store/extract
+ store url "contents.tar.gz" name)))
+ (values version tarball source)))))
+
(define %method-updates
;; Mapping of origin methods to source update procedures.
- `((,url-fetch . ,package-update/url-fetch)))
+ `((,url-fetch . ,package-update/url-fetch)
+ (,hexpm-fetch . ,package-update/hexpm-fetch)))
(define* (package-update store package
#:optional (updaters (force %updaters))