svn.scm 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2020, 2023 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. ;; Disable keyword substitutions (keywords are CVS-like strings
  48. ;; like "$Date$", "$Id$", and so on) for two reasons: (1) some
  49. ;; expansions depend on the local time zone, and (2) SWH disables
  50. ;; it in its archive for this very reason.
  51. "--ignore-keywords"
  52. `(,@(if (and user-name password)
  53. (list (string-append "--username=" user-name)
  54. (string-append "--password=" password))
  55. '())
  56. ,@(if recursive?
  57. '()
  58. (list "--ignore-externals"))
  59. ,url ,directory))
  60. #t))
  61. ;;; svn.scm ends here