From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqX8V-0004Hs-DL for guix-patches@gnu.org; Mon, 26 Feb 2018 23:45:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqX8S-0000w4-A8 for guix-patches@gnu.org; Mon, 26 Feb 2018 23:45:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqX8S-0000vm-3H for guix-patches@gnu.org; Mon, 26 Feb 2018 23:45:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqX8Q-00029X-8N for guix-patches@gnu.org; Mon, 26 Feb 2018 23:45:03 -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> <87po4rra78.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> <20180227004658.4cefda82@scratchpost.org> Date: Tue, 27 Feb 2018 05:43:59 +0100 In-Reply-To: <20180227004658.4cefda82@scratchpost.org> (Danny Milosavljevic's message of "Tue, 27 Feb 2018 00:46:58 +0100") Message-ID: <87y3jfvy7k.fsf@gmail.com> 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 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Danny Milosavljevic writes: > + (and (zero? (apply system* "tar" "-C" tmpdir "-cf" image > > Apparently this works as-is, but also here, I'd write > > + (and (zero? (apply system* "tar" "-cf" image "-C" tmpdir > > Otherwise LGTM! Good catch! I've attached a new patch that does what you suggest. =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=204bca56cc619e90b1c820c2a7f8f7a5fe1f4a8645 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..659d228aa 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" "-cf" image "-C" tmpdir `(,@%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+x3UCaFdgiRp0FAlqU4g8ACgkQ3UCaFdgi Rp1Vcw/+JiEeCQEZzjMqDP7wdhHZzUS9VXWKQ2zi7+ypsqW14kHPapuxLP+icOTp 4ntO8+9TFD3xrj8M3cuLwlSSBxapuGea9WZ/HHEqxSlLfH4c9lVdc47IZC1YnUpY wZd8/LmfJwYaiITCQtbgcsG1FFT4Zsjm1KOpyStx4W8Mfiuc2wePp71gcxAtgPlo BoizExkCBIigdaPwgE5edO/2c7o1BTW1n63ycEGr0HRKjhX0wKqw3EowWEGcLorP zVl/FoUxuZUYv3p4WEQWgMiO9Q4NPfLsJFTEEXQHdY/9q5lMCfcVQUVGAm7k3w3g d6TAus3+XvoM9irCtg/Jhstn3+vmzaBckfaBhdoVlCqhkczVw7CdSOduTtiQPcIV OgRZpQb7awHlabLTV5nbqEQKpdtXyr2IVv62pujyJDOhtiBLF94+ElJzAd9G2PLJ sTl8qNR/lARhz91R5OJbmfbRrCikcDosNTVtzvkS5GNEIVaWVSeVQqXi8TzVqZsv uiCbz1HkeCowa4r9r/djmAqGWKhEC+XdHyqmc6BCzk9ajP03GQXh6C5/bl8Gb4Vi rTxUWvwf1E2eoh+LLhY8ITLNSCozC2S1H5990S1g5QzW8kLNvJFgFuc3WhySvluf oVzu+W9aIl3To0uoBr7JpOp2EuNFM0nv4MuhPdVZ6vX22c2eOcE= =ocWZ -----END PGP SIGNATURE----- --==-=-=--