From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcjVW-0006br-86 for guix-patches@gnu.org; Mon, 09 Jul 2018 23:40:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcjVT-0006RM-5Y for guix-patches@gnu.org; Mon, 09 Jul 2018 23:40:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45033) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcjVT-0006R9-12 for guix-patches@gnu.org; Mon, 09 Jul 2018 23:40:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fcjVS-0002cC-Ik for guix-patches@gnu.org; Mon, 09 Jul 2018 23:40:02 -0400 Subject: [bug#32094] [PATCH] git: Call 'url-cache-directory' outside 'update-cached-checkout' body. Resent-Message-ID: From: Oleg Pykhalov References: <20180708101935.7292-1-go.wigust@gmail.com> <87zhz0fp1l.fsf@gnu.org> Date: Tue, 10 Jul 2018 06:39:22 +0300 In-Reply-To: <87zhz0fp1l.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 09 Jul 2018 16:43:02 +0200") Message-ID: <87efgbiwt1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 32094@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Ludovic, Thank you for review. ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Oleg Pykhalov skribis: > >> * guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in >> 'cache-directory' key argument. > > =E2=80=98latest-repository-commit=E2=80=99 would need to be adjusted acco= rdingly. > > Could you do that and make sure =E2=80=98guix pull=E2=80=99 still behaves= the same as > before? When I adjusted =E2=80=98latest-repository-commit=E2=80=99 I thought about = removing =E2=80=98url-cache-directory=E2=80=99 call from =E2=80=98update-cached-chec= kout=E2=80=99 instead of moving =E2=80=98url-cache-directory=E2=80=99 call to =E2=80=98cache-directo= ry=E2=80=99 argument. I'm not sure it's possible to call =E2=80=98url-cache-directory=E2=80=99 in= argument of =E2=80=98update-cached-checkout=E2=80=99, because =E2=80=98url-cache-direct= ory=E2=80=99 requires =E2=80=98url=E2=80=99 argument which itself is the argument of =E2=80=98update-cached-checkout=E2= =80=99. (define* (url-cache-directory url #:optional (cache-directory (%repository-cache-directory))) =E2=80=A6) (define* (update-cached-checkout url #:key (ref '(branch . "origin/master")) (cache-directory (%repository-cache-directory))) =E2=80=A6) Here is an updated patch which was successfully tested with =E2=80=98guix p= ull=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-git-Call-url-cache-directory-outside-update-cached-c.patch Content-Transfer-Encoding: quoted-printable Content-Description: [PATCH] git: Call 'url-cache-directory' outside From=20b3466c2e8569c30a83e81598657706b3bbbbc282 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov 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'. =2D-- 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 =2D-- 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 [ | | ]." (with-libgit2 =2D (let* ((cache-dir (url-cache-directory url cache-directory)) =2D (cache-exists? (openable-repository? cache-dir)) + (let* ((cache-exists? (openable-repository? cache-directory)) (repository (if cache-exists? =2D (repository-open cache-dir) =2D (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 [ | | = ]." 'repository-close!) (repository-close! repository)) =20 =2D (values cache-dir (oid->string oid)))))) + (values cache-directory (oid->string oid)))))) =20 (define* (latest-repository-commit store url #:key @@ -157,12 +156,14 @@ Git repositories are kept in the cache directory spec= ified by (and (string=3D? (basename file) ".git") (eq? 'directory (stat:type stat)))) =20 =2D (let*-values (((checkout commit) =2D (update-cached-checkout url =2D #:ref ref =2D #:cache-directory cache-directo= ry)) =2D ((name) =2D (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))) =2D-=20 2.18.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAltEKmoACgkQckbhHGm3 lWkv0BAAtYI523J5DNoHjh6asqBHc8ddCRVPnUQVA4j8uKYwirsyzxiQSFACToXT xOwjKMceyWPoPnnACeN/5qb8nLVZoJEz0k+2sRsWFwhHXC+z1tpu2ETrFNeVlF0y 6yfEcRrCTgrlO2N9HNb1zs+9Jh2f2XAxcQRKWqH98kghPRF54LyWZD1astChVlD3 B1v+SYpeoZA3HreSdN0hCGXDnu/EBDlJWPkj382pD4zak4NBP/1gaWP/msBJEHBa Gjy3Awk8ivsUsnMjxTbYSyOOdAfkfOK99NKXBI0K1XZcXes/B79HfYRGSjsYj2lE utOHCd8Gm7yfvoMzrT65FG/mHoYTYjBHQueohuHmqXpsY+r4EQPaIj5uze4n8NxJ sERm1+wYTaYBztyZHhNJToSW4gE142F53ttnu+s6w96RoTKDqjTG5dSircWs8D1w MvnDFdGb4M415QMZKPfJ4+JG1YscO01e8LFyeFNAK/8ZKx1hFv1BQCa4j7bsnT40 2L+agZVqJyLwlfdGZ8qEg5GLCXjksRSN/XUwaQcFEhYn0uiwH6qBvpq54107Erfb kqzAlD4N9rVykrgUsDOwJokeTyhx71kpp7Eyf882hcgt4bDNFjKw2yMODZYBz+oA 71TAXtgrS2Luxk4R5aclsXXaHYzjrOhDxNl5qzAI3gmeRxD8Tb4= =hC1g -----END PGP SIGNATURE----- --==-=-=--