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.
 
 
 
 
 
 

91 lines
3.3 KiB

  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (guix svn-download)
  20. #:use-module (guix records)
  21. #:use-module (guix gexp)
  22. #:use-module (guix monads)
  23. #:use-module (guix packages)
  24. #:use-module (ice-9 match)
  25. #:export (svn-reference
  26. svn-reference?
  27. svn-reference-url
  28. svn-reference-revision
  29. svn-fetch))
  30. ;;; Commentary:
  31. ;;;
  32. ;;; An <origin> method that fetches a specific revision from a Subversion
  33. ;;; repository. The repository URL and REVISION are specified with a
  34. ;;; <svn-reference> object. REVISION should be specified as a number.
  35. ;;;
  36. ;;; Code:
  37. (define-record-type* <svn-reference>
  38. svn-reference make-svn-reference
  39. svn-reference?
  40. (url svn-reference-url) ; string
  41. (revision svn-reference-revision)) ; number
  42. (define (subversion-package)
  43. "Return the default Subversion package."
  44. (let ((distro (resolve-interface '(gnu packages version-control))))
  45. (module-ref distro 'subversion)))
  46. (define* (svn-fetch store ref hash-algo hash
  47. #:optional name
  48. #:key (system (%current-system)) guile
  49. (svn (subversion-package)))
  50. "Return a fixed-output derivation in STORE that fetches REF, a
  51. <svn-reference> object. The output is expected to have recursive hash HASH of
  52. type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if
  53. #f."
  54. (define guile-for-build
  55. (match guile
  56. ((? package?)
  57. (package-derivation store guile system))
  58. (#f ; the default
  59. (let* ((distro (resolve-interface '(gnu packages commencement)))
  60. (guile (module-ref distro 'guile-final)))
  61. (package-derivation store guile system)))))
  62. (define build
  63. #~(begin
  64. (use-modules (guix build svn))
  65. (svn-fetch '#$(svn-reference-url ref)
  66. '#$(svn-reference-revision ref)
  67. #$output
  68. #:svn-command (string-append #$svn "/bin/svn"))))
  69. (run-with-store store
  70. (gexp->derivation (or name "svn-checkout") build
  71. #:system system
  72. #:local-build? #t
  73. #:hash-algo hash-algo
  74. #:hash hash
  75. #:recursive? #t
  76. #:modules '((guix build svn)
  77. (guix build utils))
  78. #:guile-for-build guile-for-build
  79. #:local-build? #t)
  80. #:guile-for-build guile-for-build
  81. #:system system))
  82. ;;; svn-download.scm ends here