Mirror of GNU Guix
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.

56 lines
2.4 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 build svn)
  20. #:use-module (guix build utils)
  21. #:export (svn-fetch))
  22. ;;; Commentary:
  23. ;;;
  24. ;;; This is the build-side support code of (guix svn-download). It allows a
  25. ;;; Subversion repository to be cloned and checked out at a specific revision.
  26. ;;;
  27. ;;; Code:
  28. (define* (svn-fetch url revision directory
  29. #:key (svn-command "svn")
  30. (user-name #f)
  31. (password #f))
  32. "Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
  33. valid Subversion revision. Return #t on success, #f otherwise."
  34. (and (zero? (apply system* svn-command
  35. "checkout" "--non-interactive"
  36. ;; Trust the server certificate. This is OK as we
  37. ;; verify the checksum later. This can be removed when
  38. ;; ca-certificates package is added.
  39. "--trust-server-cert" "-r" (number->string revision)
  40. `(,@(if (and user-name password)
  41. (list (string-append "--username=" user-name)
  42. (string-append "--password=" password))
  43. '())
  44. ,url ,directory)))
  45. (with-directory-excursion directory
  46. (begin
  47. ;; The contents of '.svn' vary as a function of the current status
  48. ;; of the repo. Since we want a fixed output, this directory needs
  49. ;; to be taken out.
  50. (delete-file-recursively ".svn")
  51. #t))))
  52. ;;; svn.scm ends here