all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body.
@ 2018-07-08 10:19 Oleg Pykhalov
  2018-07-08 10:24 ` Oleg Pykhalov
  2018-07-09 14:43 ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Oleg Pykhalov @ 2018-07-08 10:19 UTC (permalink / raw)
  To: 32094

* guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in
'cache-directory' key argument.
---
 guix/git.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/guix/git.scm b/guix/git.scm
index 9e89cc006..c5912170b 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -114,7 +114,8 @@ OID (roughly the commit hash) corresponding to REF."
                                  #:key
                                  (ref '(branch . "origin/master"))
                                  (cache-directory
-                                  (%repository-cache-directory)))
+                                  (url-cache-directory
+                                   (%repository-cache-directory))))
   "Update the cached checkout of URL to REF in CACHE-DIRECTORY.  Return two
 values: the cache directory name, and the SHA1 commit (a string) corresponding
 to REF.
@@ -122,11 +123,10 @@ to REF.
 REF is pair whose key is [branch | commit | tag] and value the associated
 data, respectively [<branch name> | <sha1> | <tag name>]."
   (with-libgit2
-   (let* ((cache-dir     (url-cache-directory url cache-directory))
-          (cache-exists? (openable-repository? cache-dir))
+   (let* ((cache-exists? (openable-repository? cache-directory))
           (repository    (if cache-exists?
-                             (repository-open cache-dir)
-                             (clone* url cache-dir))))
+                             (repository-open cache-directory)
+                             (clone* url cache-directory))))
      ;; Only fetch remote if it has not been cloned just before.
      (when cache-exists?
        (remote-fetch (remote-lookup repository "origin")))
@@ -138,7 +138,7 @@ data, respectively [<branch name> | <sha1> | <tag name>]."
                               'repository-close!)
          (repository-close! repository))
 
-       (values cache-dir (oid->string oid))))))
+       (values cache-directory (oid->string oid))))))
 
 (define* (latest-repository-commit store url
                                    #:key
-- 
2.18.0

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

* [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body.
  2018-07-08 10:19 [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body Oleg Pykhalov
@ 2018-07-08 10:24 ` Oleg Pykhalov
  2018-07-09 14:43 ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Oleg Pykhalov @ 2018-07-08 10:24 UTC (permalink / raw)
  To: 32094

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Hello Guix,

I want this change to use 'url-cache-directory' with a custom named
cache directory.  Without the patch cache directory will be renamed by
'url-cache-directory' procedure.

Thanks,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body.
  2018-07-08 10:19 [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body Oleg Pykhalov
  2018-07-08 10:24 ` Oleg Pykhalov
@ 2018-07-09 14:43 ` Ludovic Courtès
  2018-07-10  3:39   ` Oleg Pykhalov
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2018-07-09 14:43 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 32094

Hi Oleg,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

> * guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in
> 'cache-directory' key argument.

‘latest-repository-commit’ would need to be adjusted accordingly.

Could you do that and make sure ‘guix pull’ still behaves the same as
before?

Thanks,
Ludo’.

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

* [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body.
  2018-07-09 14:43 ` Ludovic Courtès
@ 2018-07-10  3:39   ` Oleg Pykhalov
  2018-07-11 10:01     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg Pykhalov @ 2018-07-10  3:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32094


[-- Attachment #1.1: Type: text/plain, Size: 1411 bytes --]

Hello Ludovic,

Thank you for review.

ludo@gnu.org (Ludovic Courtès) writes:

> Oleg Pykhalov <go.wigust@gmail.com> skribis:
>
>> * guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in
>> 'cache-directory' key argument.
>
> ‘latest-repository-commit’ would need to be adjusted accordingly.
>
> Could you do that and make sure ‘guix pull’ still behaves the same as
> before?

When I adjusted ‘latest-repository-commit’ I thought about removing
‘url-cache-directory’ call from ‘update-cached-checkout’ instead of
moving ‘url-cache-directory’ call to ‘cache-directory’ argument.

I'm not sure it's possible to call ‘url-cache-directory’ in argument of
‘update-cached-checkout’, because ‘url-cache-directory’ requires ‘url’
argument which itself is the argument of ‘update-cached-checkout’.

(define* (url-cache-directory url
                              #:optional (cache-directory
                                          (%repository-cache-directory)))
  …)

(define* (update-cached-checkout url
                                 #:key
                                 (ref '(branch . "origin/master"))
                                 (cache-directory
                                  (%repository-cache-directory)))
  …)

Here is an updated patch which was successfully tested with ‘guix pull’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: [PATCH] git: Call 'url-cache-directory' outside --]
[-- Type: text/x-patch, Size: 2745 bytes --]

From b3466c2e8569c30a83e81598657706b3bbbbc282 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sun, 8 Jul 2018 13:15:41 +0300
Subject: [PATCH] git: Call 'url-cache-directory' outside
 'update-cached-checkout'.

* guix/git.scm (update-cached-checkout): Remove 'url-cache-directory' call.
(latest-repository-commit): Call 'url-cache-directory'.
---
 guix/git.scm | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/guix/git.scm b/guix/git.scm
index 9e89cc006..297b086ad 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -122,11 +122,10 @@ to REF.
 REF is pair whose key is [branch | commit | tag] and value the associated
 data, respectively [<branch name> | <sha1> | <tag name>]."
   (with-libgit2
-   (let* ((cache-dir     (url-cache-directory url cache-directory))
-          (cache-exists? (openable-repository? cache-dir))
+   (let* ((cache-exists? (openable-repository? cache-directory))
           (repository    (if cache-exists?
-                             (repository-open cache-dir)
-                             (clone* url cache-dir))))
+                             (repository-open cache-directory)
+                             (clone* url cache-directory))))
      ;; Only fetch remote if it has not been cloned just before.
      (when cache-exists?
        (remote-fetch (remote-lookup repository "origin")))
@@ -138,7 +137,7 @@ data, respectively [<branch name> | <sha1> | <tag name>]."
                               'repository-close!)
          (repository-close! repository))
 
-       (values cache-dir (oid->string oid))))))
+       (values cache-directory (oid->string oid))))))
 
 (define* (latest-repository-commit store url
                                    #:key
@@ -157,12 +156,14 @@ Git repositories are kept in the cache directory specified by
     (and (string=? (basename file) ".git")
          (eq? 'directory (stat:type stat))))
 
-  (let*-values (((checkout commit)
-                 (update-cached-checkout url
-                                         #:ref ref
-                                         #:cache-directory cache-directory))
-                ((name)
-                 (url+commit->name url commit)))
+  (let*-values
+      (((checkout commit)
+        (update-cached-checkout url
+                                #:ref ref
+                                #:cache-directory
+                                (url-cache-directory url cache-directory)))
+       ((name)
+        (url+commit->name url commit)))
     (values (add-to-store store name #t "sha256" checkout
                           #:select? (negate dot-git?))
             commit)))
-- 
2.18.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body.
  2018-07-10  3:39   ` Oleg Pykhalov
@ 2018-07-11 10:01     ` Ludovic Courtès
  2018-07-13 13:26       ` bug#32094: " Oleg Pykhalov
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2018-07-11 10:01 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 32094

Hi Oleg,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Oleg Pykhalov <go.wigust@gmail.com> skribis:
>>
>>> * guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in
>>> 'cache-directory' key argument.
>>
>> ‘latest-repository-commit’ would need to be adjusted accordingly.
>>
>> Could you do that and make sure ‘guix pull’ still behaves the same as
>> before?
>
> When I adjusted ‘latest-repository-commit’ I thought about removing
> ‘url-cache-directory’ call from ‘update-cached-checkout’ instead of
> moving ‘url-cache-directory’ call to ‘cache-directory’ argument.
>
> I'm not sure it's possible to call ‘url-cache-directory’ in argument of
> ‘update-cached-checkout’, because ‘url-cache-directory’ requires ‘url’
> argument which itself is the argument of ‘update-cached-checkout’.

Yes, you can do that:

(define* (update-cached-checkout url
                                 #:key
                                 (ref '(branch . "origin/master"))
                                 (cache-directory
                                  (url-cache-directory
                                   url (%repository-cache-directory))))
  …)                                 

(You’d get a warning about ‘url’ being unbound if it didn’t work.)

Could you make this last change?  And then I think we’re all set.

Thank you,
Ludo’.

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

* bug#32094: [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body.
  2018-07-11 10:01     ` Ludovic Courtès
@ 2018-07-13 13:26       ` Oleg Pykhalov
  0 siblings, 0 replies; 6+ messages in thread
From: Oleg Pykhalov @ 2018-07-13 13:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32094, 32094-done

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Hello Ludovic,

ludo@gnu.org (Ludovic Courtès) writes:

[…]

>> I'm not sure it's possible to call ‘url-cache-directory’ in argument of
>> ‘update-cached-checkout’, because ‘url-cache-directory’ requires ‘url’
>> argument which itself is the argument of ‘update-cached-checkout’.
>
> Yes, you can do that:
>
> (define* (update-cached-checkout url
>                                  #:key
>                                  (ref '(branch . "origin/master"))
>                                  (cache-directory
>                                   (url-cache-directory
>                                    url (%repository-cache-directory))))
>   …)                                 
>
> (You’d get a warning about ‘url’ being unbound if it didn’t work.)

Ah, thank you for pointing it out.

> Could you make this last change?  And then I think we’re all set.

OK, added.  I tested second time successfully with:
--8<---------------cut here---------------start------------->8---
./pre-inst-env env GUIX_PACKAGE_PATH= guix pull
--8<---------------cut here---------------end--------------->8---

Pushed as ffc3fcade3f7d2c7d26b2fe5245902e6407f9c93

Thanks,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2018-07-13 13:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-08 10:19 [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body Oleg Pykhalov
2018-07-08 10:24 ` Oleg Pykhalov
2018-07-09 14:43 ` Ludovic Courtès
2018-07-10  3:39   ` Oleg Pykhalov
2018-07-11 10:01     ` Ludovic Courtès
2018-07-13 13:26       ` bug#32094: " Oleg Pykhalov

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.