unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] guix: Support authentication when fetching from SVN.
@ 2016-06-30 13:43 Ricardo Wurmus
  2016-06-30 21:09 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2016-06-30 13:43 UTC (permalink / raw)
  To: guix-devel

* guix/svn-download.scm (<svn-reference>): Add fields for optional
credentials.
(svn-fetch): Pass credentials to build-side "svn-fetch".
* guix/build/svn.scm (svn-fetch): Pass optional credentials to svn
command.
---
 guix/build/svn.scm    | 21 ++++++++++++++-------
 guix/svn-download.scm |  8 ++++++--
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 74fe084..0506e4e 100644
--- a/guix/build/svn.scm
+++ b/guix/build/svn.scm
@@ -29,15 +29,22 @@
 ;;; Code:
 
 (define* (svn-fetch url revision directory
-                    #:key (svn-command "svn"))
+                    #:key (svn-command "svn")
+                    (username #f)
+                    (password #f))
   "Fetch REVISION from URL into DIRECTORY.  REVISION must be an integer, and a
 valid Subversion revision.  Return #t on success, #f otherwise."
-  (and (zero? (system* svn-command "checkout" "--non-interactive"
-                       ;; Trust the server certificate.  This is OK as we
-                       ;; verify the checksum later.  This can be removed when
-                       ;; ca-certificates package is added.
-                       "--trust-server-cert" "-r" (number->string revision)
-                       url directory))
+  (and (zero? (apply system* svn-command
+                     "checkout" "--non-interactive"
+                     ;; Trust the server certificate.  This is OK as we
+                     ;; verify the checksum later.  This can be removed when
+                     ;; ca-certificates package is added.
+                     "--trust-server-cert" "-r" (number->string revision)
+                     `(,@(if (and username password)
+                             (list (string-append "--username=" username)
+                                   (string-append "--password=" password))
+                             '())
+                       ,url ,directory)))
        (with-directory-excursion directory
          (begin
            ;; The contents of '.svn' vary as a function of the current status
diff --git a/guix/svn-download.scm b/guix/svn-download.scm
index d6853ca..b15e3e0 100644
--- a/guix/svn-download.scm
+++ b/guix/svn-download.scm
@@ -42,7 +42,9 @@
   svn-reference make-svn-reference
   svn-reference?
   (url      svn-reference-url)                    ; string
-  (revision svn-reference-revision))              ; number
+  (revision svn-reference-revision)               ; number
+  (username svn-reference-username (default #f))
+  (password svn-reference-password (default #f)))
 
 (define (subversion-package)
   "Return the default Subversion package."
@@ -62,7 +64,9 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
         (svn-fetch '#$(svn-reference-url ref)
                    '#$(svn-reference-revision ref)
                    #$output
-                   #:svn-command (string-append #+svn "/bin/svn"))))
+                   #:svn-command (string-append #+svn "/bin/svn")
+                   #:username #$(svn-reference-username ref)
+                   #:password #$(svn-reference-password ref))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "svn-checkout") build
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] guix: Support authentication when fetching from SVN.
  2016-06-30 13:43 [PATCH] guix: Support authentication when fetching from SVN Ricardo Wurmus
@ 2016-06-30 21:09 ` Ludovic Courtès
  2016-07-01  9:09   ` Alex Kost
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2016-06-30 21:09 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> * guix/svn-download.scm (<svn-reference>): Add fields for optional
> credentials.
> (svn-fetch): Pass credentials to build-side "svn-fetch".
> * guix/build/svn.scm (svn-fetch): Pass optional credentials to svn
> command.

[...]

> --- a/guix/svn-download.scm
> +++ b/guix/svn-download.scm
> @@ -42,7 +42,9 @@
>    svn-reference make-svn-reference
>    svn-reference?
>    (url      svn-reference-url)                    ; string
> -  (revision svn-reference-revision))              ; number
> +  (revision svn-reference-revision)               ; number
> +  (username svn-reference-username (default #f))

I think I’m old-school, but I would prefer ‘user-name’.

Otherwise LGTM, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] guix: Support authentication when fetching from SVN.
  2016-06-30 21:09 ` Ludovic Courtès
@ 2016-07-01  9:09   ` Alex Kost
  2016-07-06 10:37     ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2016-07-01  9:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-07-01 00:09 +0300) wrote:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>
>> * guix/svn-download.scm (<svn-reference>): Add fields for optional
>> credentials.
>> (svn-fetch): Pass credentials to build-side "svn-fetch".
>> * guix/build/svn.scm (svn-fetch): Pass optional credentials to svn
>> command.
>
> [...]
>
>> --- a/guix/svn-download.scm
>> +++ b/guix/svn-download.scm
>> @@ -42,7 +42,9 @@
>>    svn-reference make-svn-reference
>>    svn-reference?
>>    (url      svn-reference-url)                    ; string
>> -  (revision svn-reference-revision))              ; number
>> +  (revision svn-reference-revision)               ; number
>> +  (username svn-reference-username (default #f))
>
> I think I’m old-school, but I would prefer ‘user-name’.

I also prefer "user-name".

-- 
Alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] guix: Support authentication when fetching from SVN.
  2016-07-01  9:09   ` Alex Kost
@ 2016-07-06 10:37     ` Ricardo Wurmus
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2016-07-06 10:37 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel


Alex Kost <alezost@gmail.com> writes:

> Ludovic Courtès (2016-07-01 00:09 +0300) wrote:
>>> --- a/guix/svn-download.scm
>>> +++ b/guix/svn-download.scm
>>> @@ -42,7 +42,9 @@
>>>    svn-reference make-svn-reference
>>>    svn-reference?
>>>    (url      svn-reference-url)                    ; string
>>> -  (revision svn-reference-revision))              ; number
>>> +  (revision svn-reference-revision)               ; number
>>> +  (username svn-reference-username (default #f))
>>
>> I think I’m old-school, but I would prefer ‘user-name’.
>
> I also prefer "user-name".

I changed it to “user-name” and pushed.

Thanks!

~~ Ricardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-06 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-30 13:43 [PATCH] guix: Support authentication when fetching from SVN Ricardo Wurmus
2016-06-30 21:09 ` Ludovic Courtès
2016-07-01  9:09   ` Alex Kost
2016-07-06 10:37     ` Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).