From 90297811a9d6412fcf57bd6bef08ded39ac895cc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 27 Oct 2017 14:38:45 -0700 Subject: import: github: Gracefully handle multiple-URL origins. * guix/import/github.scm (latest-release)[origin-github-uri]: New procedure. Use it. --- guix/import/github.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'guix/import') diff --git a/guix/import/github.scm b/guix/import/github.scm index b249b39067..4b7d53c704 100644 --- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Ben Woodcroft +;;; Copyright © 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix import github) #:use-module (ice-9 match) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (json) #:use-module (guix utils) @@ -182,7 +184,14 @@ https://github.com/settings/tokens")) (define (latest-release pkg) "Return an for the latest release of PKG." - (let* ((source-uri (origin-uri (package-source pkg))) + (define (origin-github-uri origin) + (match (origin-uri origin) + ((? string? url) + url) ;surely a github.com URL + ((urls ...) + (find (cut string-contains <> "github.com") urls)))) + + (let* ((source-uri (origin-github-uri (package-source pkg))) (name (package-name pkg)) (newest-version (latest-released-version source-uri name))) (if newest-version -- cgit v1.2.3 From 0a2ce1ea0ad2f1269cba3f77a77bb336ba2ef0b3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 27 Oct 2017 14:43:19 -0700 Subject: import: elpa: Do not abort when failing to download the archive. * guix/import/elpa.scm (elpa-fetch-archive): Use 'http-fetch/cached' directly instead of 'call-with-downloaded-file'. This ensures we don't just abort when networking access is lacking, which is required to allow 'guix refresh -c refresh' to proceed. --- guix/import/elpa.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'guix/import') diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index 858eea88e2..45a419217c 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -80,8 +80,11 @@ NAMES (strings)." (cut string-append <> "/archive-contents")))) (if url ;; Use a relatively small TTL for the archive itself. - (parameterize ((%http-cache-ttl (* 6 3600))) - (call-with-downloaded-file url read)) + (let* ((port (http-fetch/cached (string->uri url) + #:ttl (* 6 3600))) + (data (read port))) + (close-port port) + data) (leave (G_ "~A: currently not supported~%") repo)))) (define* (call-with-downloaded-file url proc #:optional (error-thunk #f)) -- cgit v1.2.3 From 23055424f2628470a864106dbc4d4acb003399ee Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Sat, 28 Oct 2017 18:13:08 -0500 Subject: import: cpan: Propagate imported dependencies. This is most often the need for perl module dependencies. * guix/import/cpan.scm (cpan-module->sexp): 'inputs -> 'propagated-inputs. * tests/cpan.scm ("cpan->guix-package"): Adjust accordingly. --- guix/import/cpan.scm | 2 +- tests/cpan.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guix/import') diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index 6261e3e924..15b121e829 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -242,7 +242,7 @@ META." ;; have not yet had a need for cross-compiled perl ;; modules, however, so we leave it out. (convert-inputs '("configure" "build" "test"))) - ,@(maybe-inputs 'inputs + ,@(maybe-inputs 'propagated-inputs (convert-inputs '("runtime"))) (home-page ,(string-append "http://search.cpan.org/dist/" name)) (synopsis ,(assoc-ref meta "abstract")) diff --git a/tests/cpan.scm b/tests/cpan.scm index 8900716cb0..91e2cc6814 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -94,7 +94,7 @@ ('base32 (? string? hash))))) ('build-system 'perl-build-system) - ('inputs + ('propagated-inputs ('quasiquote (("perl-test-script" ('unquote 'perl-test-script))))) ('home-page "http://search.cpan.org/dist/Foo-Bar") -- cgit v1.2.3 From e4bc1727302b0e1e255ea5cf4e2ccf33cafe7296 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Sat, 28 Oct 2017 18:19:33 -0500 Subject: import: cpan: Add trailing "/" on home-page. This appeases 'guix lint', which otherwise complains about permanent redirects. * guix/import/cpan.scm (cpan-module->sexp): Add trailing "/" on home-page. * tests/cpan.scm ("cpan->guix-package"): Adjust accordingly. --- guix/import/cpan.scm | 2 +- tests/cpan.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guix/import') diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index 15b121e829..5ba1adf402 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -244,7 +244,7 @@ META." (convert-inputs '("configure" "build" "test"))) ,@(maybe-inputs 'propagated-inputs (convert-inputs '("runtime"))) - (home-page ,(string-append "http://search.cpan.org/dist/" name)) + (home-page ,(string-append "http://search.cpan.org/dist/" name "/")) (synopsis ,(assoc-ref meta "abstract")) (description fill-in-yourself!) (license ,(string->license (assoc-ref meta "license")))))) diff --git a/tests/cpan.scm b/tests/cpan.scm index 91e2cc6814..e5bd0ae3a4 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -97,7 +97,7 @@ ('propagated-inputs ('quasiquote (("perl-test-script" ('unquote 'perl-test-script))))) - ('home-page "http://search.cpan.org/dist/Foo-Bar") + ('home-page "http://search.cpan.org/dist/Foo-Bar/") ('synopsis "Fizzle Fuzz") ('description 'fill-in-yourself!) ('license 'perl-license)) -- cgit v1.2.3 From 73f33b93797383a356133a2e871af9c07f5b5376 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 29 Oct 2017 15:28:35 +0100 Subject: import: cpan: Add trailing "/" to CPAN-HOME. Prevent regression after commit e4bc1727302b0e1e255ea5cf4e2ccf33cafe7296. * guix/import/cpan.scm (cpan-home): Add trailing "/". --- guix/import/cpan.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix/import') diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index 5ba1adf402..b5dba2bc1c 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -115,7 +115,7 @@ or #f on failure. MODULE should be e.g. \"Test::Script\"" (json-fetch (string-append "https://fastapi.metacpan.org/v1/release/" name))) (define (cpan-home name) - (string-append "http://search.cpan.org/dist/" name)) + (string-append "http://search.cpan.org/dist/" name "/")) (define (cpan-source-url meta) "Return the download URL for a module's source tarball." -- cgit v1.2.3 From 6d176ad379e35b3a85da2fb74bc7d2053569602f Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 29 Oct 2017 15:51:28 +0100 Subject: import: cpan: Actually use CPAN-HOME. * guix/import/cpan.scm (cpan-module->sexp): Use the CPAN-HOME procedure. --- guix/import/cpan.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix/import') diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index b5dba2bc1c..2ef02c43a4 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Alex Sassmannshausen +;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -244,7 +245,7 @@ META." (convert-inputs '("configure" "build" "test"))) ,@(maybe-inputs 'propagated-inputs (convert-inputs '("runtime"))) - (home-page ,(string-append "http://search.cpan.org/dist/" name "/")) + (home-page ,(cpan-home name)) (synopsis ,(assoc-ref meta "abstract")) (description fill-in-yourself!) (license ,(string->license (assoc-ref meta "license")))))) -- cgit v1.2.3 From 29f7bf59d5d4d4b848eaedc6766bb4e02cae20d3 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 29 Oct 2017 15:53:23 +0100 Subject: import: cpan: Use HTTPS for home pages. * guix/import/cpan.scm (cpan-home): Use HTTPS. * tests/cpan.scm ("cpan->guix-package"): Expect it. --- guix/import/cpan.scm | 2 +- tests/cpan.scm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'guix/import') diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index 2ef02c43a4..792da0ab31 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -116,7 +116,7 @@ or #f on failure. MODULE should be e.g. \"Test::Script\"" (json-fetch (string-append "https://fastapi.metacpan.org/v1/release/" name))) (define (cpan-home name) - (string-append "http://search.cpan.org/dist/" name "/")) + (string-append "https://search.cpan.org/dist/" name "/")) (define (cpan-source-url meta) "Return the download URL for a module's source tarball." diff --git a/tests/cpan.scm b/tests/cpan.scm index e5bd0ae3a4..36712ceeb7 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Eric Bavier ;;; Copyright © 2016 Alex Sassmannshausen +;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -97,7 +98,7 @@ ('propagated-inputs ('quasiquote (("perl-test-script" ('unquote 'perl-test-script))))) - ('home-page "http://search.cpan.org/dist/Foo-Bar/") + ('home-page "https://search.cpan.org/dist/Foo-Bar/") ('synopsis "Fizzle Fuzz") ('description 'fill-in-yourself!) ('license 'perl-license)) -- cgit v1.2.3 From b5c7574b2f6fe7752b02eaaa8a745a35b3beb2a1 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 30 Oct 2017 13:28:10 +0100 Subject: Revert "import: cpan: Use HTTPS for home pages." This reverts commit 29f7bf59d5d4d4b848eaedc6766bb4e02cae20d3: HTTPS support at search.cpan.org is unreliable, at best. Don't rely on it. --- guix/import/cpan.scm | 2 +- tests/cpan.scm | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'guix/import') diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index 792da0ab31..2ef02c43a4 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -116,7 +116,7 @@ or #f on failure. MODULE should be e.g. \"Test::Script\"" (json-fetch (string-append "https://fastapi.metacpan.org/v1/release/" name))) (define (cpan-home name) - (string-append "https://search.cpan.org/dist/" name "/")) + (string-append "http://search.cpan.org/dist/" name "/")) (define (cpan-source-url meta) "Return the download URL for a module's source tarball." diff --git a/tests/cpan.scm b/tests/cpan.scm index 36712ceeb7..e5bd0ae3a4 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -1,7 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Eric Bavier ;;; Copyright © 2016 Alex Sassmannshausen -;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -98,7 +97,7 @@ ('propagated-inputs ('quasiquote (("perl-test-script" ('unquote 'perl-test-script))))) - ('home-page "https://search.cpan.org/dist/Foo-Bar/") + ('home-page "http://search.cpan.org/dist/Foo-Bar/") ('synopsis "Fizzle Fuzz") ('description 'fill-in-yourself!) ('license 'perl-license)) -- cgit v1.2.3