svn.scm 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2020 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
  4. ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
  5. ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (guix build svn)
  22. #:use-module (guix build utils)
  23. #:use-module (srfi srfi-34)
  24. #:export (svn-fetch))
  25. ;;; Commentary:
  26. ;;;
  27. ;;; This is the build-side support code of (guix svn-download). It allows a
  28. ;;; Subversion repository to be cloned and checked out at a specific revision.
  29. ;;;
  30. ;;; Code:
  31. (define* (svn-fetch url revision directory
  32. #:key (svn-command "svn")
  33. (recursive? #t)
  34. (user-name #f)
  35. (password #f))
  36. "Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
  37. valid Subversion revision. Return #t on success, #f otherwise."
  38. (guard (c ((invoke-error? c)
  39. (report-invoke-error c)
  40. #f))
  41. (apply invoke svn-command
  42. "export" "--non-interactive"
  43. ;; Trust the server certificate. This is OK as we
  44. ;; verify the checksum later. This can be removed when
  45. ;; ca-certificates package is added.
  46. "--trust-server-cert" "-r" (number->string revision)
  47. `(,@(if (and user-name password)
  48. (list (string-append "--username=" user-name)
  49. (string-append "--password=" password))
  50. '())
  51. ,@(if recursive?
  52. '()
  53. (list "--ignore-externals"))
  54. ,url ,directory))
  55. #t))
  56. ;;; svn.scm ends here