You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.6 KiB

Switch to Guile-Gcrypt. This removes (guix hash) and (guix pk-crypto), which now live as part of Guile-Gcrypt (version 0.1.0.) * guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm, tests/hash.scm, tests/pk-crypto.scm: Remove. * configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and LIBGCRYPT_LIBDIR assignments. * m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove. * README: Add Guile-Gcrypt to the dependencies; move libgcrypt as "required unless --disable-daemon". * doc/guix.texi (Requirements): Likewise. * gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm, guix/git.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm, guix/import/gnu.scm, guix/import/hackage.scm, guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm, guix/pki.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/pack.scm, guix/scripts/publish.scm, guix/scripts/refresh.scm, guix/scripts/substitute.scm, guix/store.scm, guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/crate.scm, tests/derivations.scm, tests/gem.scm, tests/nar.scm, tests/opam.scm, tests/pki.scm, tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm, tests/store.scm, tests/substitute.scm: Adjust imports. * gnu/system/vm.scm: Likewise. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (expression->derivation-in-linux-vm)[config]: Remove. (iso9660-image)[config]: Remove. (qemu-image)[config]: Remove. (system-docker-image)[config]: Remove. * guix/scripts/pack.scm: Adjust imports. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (self-contained-tarball)[build]: Call 'make-config.scm' without #:libgcrypt argument. (squashfs-image)[libgcrypt]: Remove. [build]: Call 'make-config.scm' without #:libgcrypt. (docker-image)[config, json]: Remove. [build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from the imported modules. * guix/self.scm (specification->package): Remove "libgcrypt", add "guile-gcrypt". (compiled-guix): Remove #:libgcrypt. [guile-gcrypt]: New variable. [dependencies]: Add it. [*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call. Add #:extensions. [*config*]: Remove #:libgcrypt from 'make-config.scm' call. (%dependency-variables): Remove %libgcrypt. (make-config.scm): Remove #:libgcrypt. * build-aux/build-self.scm (guile-gcrypt): New variable. (make-config.scm): Remove #:libgcrypt. (build-program)[fake-gcrypt-hash]: New variable. Add (gcrypt hash) to the imported modules. Adjust load path assignments. * gnu/packages/package-management.scm (guix)[propagated-inputs]: Add GUILE-GCRYPT. [arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search path.
3 years ago
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (guix import gnu)
  19. #:use-module (guix gnu-maintenance)
  20. #:use-module (guix import utils)
  21. #:use-module (guix utils)
  22. #:use-module (guix store)
  23. #:use-module (gcrypt hash)
  24. #:use-module (guix base32)
  25. #:use-module (guix upstream)
  26. #:use-module (srfi srfi-1)
  27. #:use-module (srfi srfi-11)
  28. #:use-module (srfi srfi-26)
  29. #:use-module (srfi srfi-34)
  30. #:use-module (srfi srfi-35)
  31. #:use-module (web uri)
  32. #:use-module (ice-9 match)
  33. #:use-module (ice-9 regex)
  34. #:export (gnu->guix-package))
  35. ;;; Commentary:
  36. ;;;
  37. ;;; Generate a package declaration template for the latest version of a GNU
  38. ;;; package, using meta-data available upstream for the package.
  39. ;;;
  40. ;;; Code:
  41. (define (qualified-url url)
  42. "Return a fully-qualified URL based on URL."
  43. (if (string-prefix? "/" url)
  44. (string-append "http://www.gnu.org" url)
  45. url))
  46. (define (preferred-archive-type release)
  47. "Return the preferred type of archive for downloading RELEASE."
  48. (find (cute member <> (upstream-source-archive-types release))
  49. '("xz" "lz" "bz2" "tbz2" "gz" "tgz" "Z")))
  50. (define* (gnu-package->sexp package release
  51. #:key (key-download 'interactive))
  52. "Return the 'package' sexp for the RELEASE (a <gnu-release>) of PACKAGE (a
  53. <gnu-package>), or #f upon failure. Use KEY-DOWNLOAD as the OpenPGP key
  54. download policy (see 'download-tarball' for details.)"
  55. (define name
  56. (gnu-package-name package))
  57. (define url-base
  58. ;; XXX: We assume that RELEASE's directory starts with "/gnu".
  59. (string-append "mirror:/"
  60. (match (upstream-source-urls release)
  61. ((url rest ...)
  62. (dirname (uri-path (string->uri url)))))
  63. "/" name "-"))
  64. (define archive-type
  65. (preferred-archive-type release))
  66. (define url
  67. (find (cut string-suffix? archive-type <>)
  68. (upstream-source-urls release)))
  69. (define sig-url
  70. (find (cute string-suffix? (string-append archive-type ".sig") <>)
  71. (upstream-source-signature-urls release)))
  72. (with-store store
  73. (match (download-tarball store url sig-url
  74. #:key-download key-download)
  75. ((? string? tarball)
  76. `(package
  77. (name ,name)
  78. (version ,(upstream-source-version release))
  79. (source (origin
  80. (method url-fetch)
  81. (uri (string-append ,url-base version
  82. ,(string-append ".tar." archive-type)))
  83. (sha256
  84. (base32
  85. ,(bytevector->nix-base32-string
  86. (file-sha256 tarball))))))
  87. (build-system gnu-build-system)
  88. (synopsis ,(gnu-package-doc-summary package))
  89. (description ,(gnu-package-doc-description package))
  90. (home-page ,(match (gnu-package-doc-urls package)
  91. ((head . tail) (qualified-url head))))
  92. (license find-by-yourself!)))
  93. (#f ;failure to download or authenticate the tarball
  94. #f))))
  95. (define* (gnu->guix-package name
  96. #:key (key-download 'interactive))
  97. "Return the package declaration for NAME as an s-expression. Use
  98. KEY-DOWNLOAD as the OpenPGP key download policy (see 'download-tarball' for
  99. details.)"
  100. (match (latest-release name)
  101. ((? upstream-source? release)
  102. (let ((version (upstream-source-version release)))
  103. (match (find-package name)
  104. (#f
  105. (raise (condition
  106. (&message
  107. (message "couldn't find meta-data for GNU package")))))
  108. (info
  109. (gnu-package->sexp info release #:key-download key-download)))))
  110. (_
  111. (raise (condition
  112. (&message
  113. (message
  114. "failed to determine latest release of GNU package")))))))
  115. ;;; gnu.scm ends here