summaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/crate.scm2
-rw-r--r--guix/import/hackage.scm14
-rw-r--r--guix/import/print.scm11
-rw-r--r--guix/import/stackage.scm25
4 files changed, 31 insertions, 21 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index f87c89163c..8c2b76cab4 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -167,7 +167,7 @@ and LICENSE."
(maybe-cargo-development-inputs
cargo-development-inputs)))
(home-page ,(match home-page
- (() "")
+ ('null "")
(_ home-page)))
(synopsis ,synopsis)
(description ,(beautify-description description))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 35c67cad8d..6ca4f65cb0 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -40,7 +40,8 @@
#:use-module (guix upstream)
#:use-module (guix packages)
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
- #:export (hackage->guix-package
+ #:export (%hackage-url
+ hackage->guix-package
hackage-recursive-import
%hackage-updater
@@ -92,20 +93,23 @@
(define package-name-prefix "ghc-")
+(define %hackage-url
+ (make-parameter "https://hackage.haskell.org"))
+
(define (hackage-source-url name version)
"Given a Hackage package NAME and VERSION, return a url to the source
tarball."
- (string-append "https://hackage.haskell.org/package/" name
- "/" name "-" version ".tar.gz"))
+ (string-append (%hackage-url) "/package/"
+ name "/" name "-" version ".tar.gz"))
(define* (hackage-cabal-url name #:optional version)
"Given a Hackage package NAME and VERSION, return a url to the corresponding
.cabal file on Hackage. If VERSION is #f or missing, the url for the latest
version is returned."
(if version
- (string-append "https://hackage.haskell.org/package/"
+ (string-append (%hackage-url) "/package/"
name "-" version "/" name ".cabal")
- (string-append "https://hackage.haskell.org/package/"
+ (string-append (%hackage-url) "/package/"
name "/" name ".cabal")))
(define (hackage-name->package-name name)
diff --git a/guix/import/print.scm b/guix/import/print.scm
index 11cc218285..d21ce57aeb 100644
--- a/guix/import/print.scm
+++ b/guix/import/print.scm
@@ -74,7 +74,7 @@ when evaluated."
(define (source->code source version)
(let ((uri (origin-uri source))
(method (origin-method source))
- (sha256 (origin-sha256 source))
+ (hash (origin-hash source))
(file-name (origin-file-name source))
(patches (origin-patches source)))
`(origin
@@ -82,9 +82,12 @@ when evaluated."
(uri (string-append ,@(match (factorize-uri uri version)
((? string? uri) (list uri))
(factorized factorized))))
- (sha256
- (base32
- ,(format #f "~a" (bytevector->nix-base32-string sha256))))
+ ,(if (equal? (content-hash-algorithm hash) 'sha256)
+ `(sha256 (base32 ,(bytevector->nix-base32-string
+ (content-hash-value hash))))
+ `(hash (content-hash ,(bytevector->nix-base32-string
+ (content-hash-value hash))
+ ,(content-hash-algorithm hash))))
;; FIXME: in order to be able to throw away the directory prefix,
;; we just assume that the patch files can be found with
;; "search-patches".
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index ee12108815..77cc6350cb 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -30,7 +30,8 @@
#:use-module (guix memoization)
#:use-module (guix packages)
#:use-module (guix upstream)
- #:export (stackage->guix-package
+ #:export (%stackage-url
+ stackage->guix-package
stackage-recursive-import
%stackage-updater))
@@ -39,12 +40,11 @@
;;; Stackage info fetcher and access functions
;;;
-(define %stackage-url "http://www.stackage.org")
+(define %stackage-url
+ (make-parameter "https://www.stackage.org"))
-(define (lts-info-ghc-version lts-info)
- "Returns the version of the GHC compiler contained in LTS-INFO."
- (and=> (assoc-ref lts-info "snapshot")
- (cut assoc-ref <> "ghc")))
+;; Latest LTS version compatible with GHC 8.6.5.
+(define %default-lts-version "14.27")
(define (lts-info-packages lts-info)
"Returns the alist of packages contained in LTS-INFO."
@@ -57,9 +57,10 @@
;; "Retrieve the information about the LTS Stackage release VERSION."
(memoize
(lambda* (#:optional (version ""))
- (let* ((url (if (string=? "" version)
- (string-append %stackage-url "/lts")
- (string-append %stackage-url "/lts-" version)))
+ (let* ((url (string-append (%stackage-url)
+ "/lts-" (if (string-null? version)
+ %default-lts-version
+ version)))
(lts-info (json-fetch url)))
(if lts-info
(reverse lts-info)
@@ -90,7 +91,7 @@
(lambda* (package-name ; upstream name
#:key
(include-test-dependencies? #t)
- (lts-version "")
+ (lts-version %default-lts-version)
(packages-info
(lts-info-packages
(stackage-lts-info-fetch lts-version))))
@@ -119,7 +120,9 @@ included in the Stackage LTS release."
;;;
(define latest-lts-release
- (let ((pkgs-info (mlambda () (lts-info-packages (stackage-lts-info-fetch)))))
+ (let ((pkgs-info
+ (mlambda () (lts-info-packages
+ (stackage-lts-info-fetch %default-lts-version)))))
(lambda* (package)
"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."