diff options
Diffstat (limited to 'guix/import')
-rw-r--r-- | guix/import/cran.scm | 12 | ||||
-rw-r--r-- | guix/import/github.scm | 56 |
2 files changed, 39 insertions, 29 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm index b287be6941..4763fccd36 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -128,9 +128,9 @@ package definition." (define %cran-url "https://cran.r-project.org/web/packages/") (define %bioconductor-url "https://bioconductor.org/packages/") -;; The latest Bioconductor release is 3.8. Bioconductor packages should be +;; The latest Bioconductor release is 3.9. Bioconductor packages should be ;; updated together. -(define %bioconductor-version "3.8") +(define %bioconductor-version "3.9") (define %bioconductor-packages-list-url (string-append "https://bioconductor.org/packages/" @@ -237,6 +237,11 @@ empty list when the FIELD cannot be found." "translations" "utils")) +;; The field for system dependencies is often abused to specify non-package +;; dependencies (such as c++11). This list is used to ignore them. +(define invalid-packages + (list "c++11")) + (define cran-guix-name (cut guix-name "r-" <>)) (define (needs-fortran? tarball) @@ -310,7 +315,8 @@ from the alist META, which was derived from the R package's DESCRIPTION file." (if (needs-zlib? tarball) '("zlib") '()) (map string-downcase (listify meta "SystemRequirements")))) (propagate (filter (lambda (name) - (not (member name default-r-packages))) + (not (member name (append default-r-packages + invalid-packages)))) (lset-union equal? (listify meta "Imports") (listify meta "LinkingTo") diff --git a/guix/import/github.scm b/guix/import/github.scm index 4d12339204..cdac70420a 100644 --- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -174,6 +174,29 @@ the package e.g. 'bedtools2'. Return #f if there is no releases" (define (pre-release? x) (hash-ref x "prerelease")) + (define (release->version release) + (let ((tag (or (hash-ref release "tag_name") ;a "release" + (hash-ref release "name"))) ;a tag + (name-length (string-length package-name))) + (cond + ;; some tags include the name of the package e.g. "fdupes-1.51" + ;; so remove these + ((and (< name-length (string-length tag)) + (string=? (string-append package-name "-") + (substring tag 0 (+ name-length 1)))) + (substring tag (+ name-length 1))) + ;; some tags start with a "v" e.g. "v0.25.0" + ;; where some are just the version number + ((string-prefix? "v" tag) + (substring tag 1)) + ;; Finally, reject tags that don't start with a digit: + ;; they may not represent a release. + ((and (not (string-null? tag)) + (char-set-contains? char-set:digit + (string-ref tag 0))) + tag) + (else #f)))) + (let* ((json (fetch-releases-or-tags url))) (if (eq? json #f) (if (%github-token) @@ -183,32 +206,13 @@ API when using a GitHub token") API. This may be fixed by using an access token and setting the environment variable GUIX_GITHUB_TOKEN, for instance one procured from https://github.com/settings/tokens")) - (any - (lambda (release) - (let ((tag (or (hash-ref release "tag_name") ;a "release" - (hash-ref release "name"))) ;a tag - (name-length (string-length package-name))) - (cond - ;; some tags include the name of the package e.g. "fdupes-1.51" - ;; so remove these - ((and (< name-length (string-length tag)) - (string=? (string-append package-name "-") - (substring tag 0 (+ name-length 1)))) - (substring tag (+ name-length 1))) - ;; some tags start with a "v" e.g. "v0.25.0" - ;; where some are just the version number - ((string-prefix? "v" tag) - (substring tag 1)) - ;; Finally, reject tags that don't start with a digit: - ;; they may not represent a release. - ((and (not (string-null? tag)) - (char-set-contains? char-set:digit - (string-ref tag 0))) - tag) - (else #f)))) - (match (remove pre-release? json) - (() json) ; keep everything - (releases releases)))))) + (match (sort (filter-map release->version + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases))) + version>?) + ((latest-release . _) latest-release) + (() #f))))) (define (latest-release pkg) "Return an <upstream-source> for the latest release of PKG." |