From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqLaN-0005Kl-ML for guix-patches@gnu.org; Mon, 26 Feb 2018 11:25:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqLaI-0006F8-ND for guix-patches@gnu.org; Mon, 26 Feb 2018 11:25:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54035) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqLaI-0006En-Gv for guix-patches@gnu.org; Mon, 26 Feb 2018 11:25:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqLaI-0004k2-76 for guix-patches@gnu.org; Mon, 26 Feb 2018 11:25:02 -0500 Subject: [bug#30572] [PATCH 4/7] docker: Allow the use of a custom temporary directory. Resent-Message-ID: From: Chris Marusich References: <20180222103528.5108-1-cmmarusich@gmail.com> <20180222103528.5108-4-cmmarusich@gmail.com> <20180226014859.4f7fe37c@scratchpost.org> Date: Mon, 26 Feb 2018 17:23:55 +0100 In-Reply-To: <20180226014859.4f7fe37c@scratchpost.org> (Danny Milosavljevic's message of "Mon, 26 Feb 2018 01:48:59 +0100") Message-ID: <87po4rra78.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; 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: Danny Milosavljevic Cc: 30572@debbugs.gnu.org, Chris Marusich --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Danny Milosavljevic writes: > Hmm, I have a slight preference for not magically adding "/docker-image" = here > but rather adding it in the caller and in the default. Good idea. Here's a new version of Patch 4/7 which does what you suggest! What do you think? =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-docker-Allow-the-use-of-a-custom-temporary-directory.patch Content-Transfer-Encoding: quoted-printable From=20dcb8dfd9c6c12f585ec9b64fb42489ce5b4fa9ae Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Mon, 19 Feb 2018 05:45:03 +0100 Subject: [PATCH 4/8] docker: Allow the use of a custom temporary directory. * guix/docker.scm: (build-docker-image): Add #:tmpdir keyword argument. =2D-- guix/docker.scm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/guix/docker.scm b/guix/docker.scm index 060232148..305e8273b 100644 =2D-- a/guix/docker.scm +++ b/guix/docker.scm @@ -106,7 +106,8 @@ return \"a\"." #:key closure compressor (symlinks '()) (system (utsname:machine (uname))) =2D (creation-time (current-time time-utc))) + (creation-time (current-time time-utc)) + (tmpdir "/tmp/docker-image")) "Write to IMAGE a Docker image archive from the given store PATH. The i= mage contains the closure of PATH, as specified in CLOSURE (a file produced by #:references-graphs). SYMLINKS must be a list of (SOURCE -> TARGET) tuples @@ -115,9 +116,13 @@ to PATH. SYSTEM is a GNU triplet (or prefix thereof) = of the system the binaries at PATH are for; it is used to produce metadata in the image. =20 Use COMPRESSOR, a command such as '(\"gzip\" \"-9n\"), to compress IMAGE. = Use =2DCREATION-TIME, a SRFI-19 time-utc object, as the creation time in metada= ta." =2D (let ((directory "/tmp/docker-image") ;temporary working dir= ectory =2D (closure (canonicalize-path closure)) +CREATION-TIME, a SRFI-19 time-utc object, as the creation time in metadata. + +TMPDIR is the name of the temporary working directory to use. This can be +useful if you need to use a specific temporary directory, for example beca= use +the default temporary directory lies on a file system with insufficient +space." + (let ((closure (canonicalize-path closure)) (id (docker-id path)) (time (date->string (time-utc->date creation-time) "~4")) (arch (let-syntax ((cond* (syntax-rules () @@ -133,9 +138,9 @@ CREATION-TIME, a SRFI-19 time-utc object, as the creati= on time in metadata." ("arm" "arm") ("mips64" "mips64le"))))) ;; Make sure we start with a fresh, empty working directory. =2D (mkdir directory) + (mkdir-p tmpdir) =20 =2D (and (with-directory-excursion directory + (and (with-directory-excursion tmpdir (mkdir id) (with-directory-excursion id (with-output-to-file "VERSION" @@ -174,10 +179,10 @@ CREATION-TIME, a SRFI-19 time-utc object, as the crea= tion time in metadata." (lambda () (scm->json (repositories path id))))) =20 =2D (and (zero? (apply system* "tar" "-C" directory "-cf" image + (and (zero? (apply system* "tar" "-C" tmpdir "-cf" image `(,@%tar-determinism-options ,@(if compressor (list "-I" (string-join compressor)) '()) "."))) =2D (begin (delete-file-recursively directory) #t))))) + (begin (delete-file-recursively tmpdir) #t))))) =2D-=20 2.15.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlqUNJsACgkQ3UCaFdgi Rp16vA//WmhUXdY/MsWaP3Sj/diyuHtxXvpBjwC6LNLdWBsmFolE4ZkiJ0gTR3+P ZoLbuKRluphmaRTz1yhVk4/GrTgRI9NY6NhhZOCE/PONk9SGt4lCmsarq1xoe8/5 4UZ5BsuaEbUEUWPlPetaE6BuciKm/YRjUK/RJebusVCLCHdmDMuH80H/rwIlb0Od hQXnyYcKNkfBWF0LK7kyW+SZUQ4KS9PTiMDk8YTeW8Qw0jsl3WN/aQCH+hXVnH9K 4f3NbHbvwg4uRnZsOxpRrgfI7TGng7DrQh1fwmA+u7xVwhncxl56oomAn2j79jqx GzhsY2x+ROlw6vMqXS3UeUECKwfohcZHyCJSlecwWDdqaz6qFIvTlw7nc50GRdFc +g5LSjfDNtQ30+C68oBUzcDXXBee3+1KJ5GgOiib6FlCJOU3EQE7/Pjej0LepMug CwRv2u1Tjm1JNebQdfIkLq1+mxhdVegUUBrfuyD1FRu/47uQKn4e1iZ/U8i9NT/a yFKuduRE/Y8EzFT3o8S54d36T6jMONcbm6Pm+hmxOtf2JGkadXpOBc0E4xIdeghm UpoRwogqA54BQRcAfwWfb3wcoYljxpPQ3dmKXnLDS4jK4LSZ81ktcHAwxFa4VSpH g6c7SlCJcfnbEi90mEYZ79Tr74yWEvDOaSt4YO2f9IxsBZsB3TA= =8D8s -----END PGP SIGNATURE----- --==-=-=--