From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykhN-000511-F1 for guix-patches@gnu.org; Wed, 21 Mar 2018 16:51:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eykhK-0003cY-9C for guix-patches@gnu.org; Wed, 21 Mar 2018 16:51:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:38409) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eykhK-0003cQ-43 for guix-patches@gnu.org; Wed, 21 Mar 2018 16:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eykhJ-0001Nc-Pd for guix-patches@gnu.org; Wed, 21 Mar 2018 16:51:01 -0400 Subject: [bug#30572] [PATCH 6/7] system: Add "guix system docker-image" command. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) In-Reply-To: <87370u6pw4.fsf@gmail.com> (Chris Marusich's message of "Wed, 21 Mar 2018 04:58:35 +0100") References: <20180222102933.4978-1-cmmarusich@gmail.com> <20180315040915.5556-1-cmmarusich@gmail.com> <20180315040915.5556-7-cmmarusich@gmail.com> <877eqal62w.fsf@gnu.org> <87370u6pw4.fsf@gmail.com> Date: Wed, 21 Mar 2018 21:50:00 +0100 Message-ID: <87o9jhf91j.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Chris Marusich Cc: 30572@debbugs.gnu.org Hi Chris, Chris Marusich skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >>> + (define json >>> + ;; Pick the guile-json package that corresponds to the Guile used = to build >>> + ;; derivations. >>> + (if (string-prefix? "2.0" (package-version (default-guile))) >>> + guile2.0-json >>> + guile-json)) >> >> I think we can use =E2=80=98guile-json=E2=80=99 unconditionally here. > > Good point. Nobody using this new code will be using Guile 2.0, Specifically, we know that derivations are built with =E2=80=98guile-final= =E2=80=99, which is now 2.2. > so we can just use guile-json unconditionally. Does that mean we can > also clean up the same conditional statement from other places in Guix > code now? Yes, indeed! >>> + (mkdir root-directory) >>> + (initialize root-directory) >>> + (build-docker-image >>> + (string-append "/xchg/" #$name) ;; The output file. >>> + (cons* root-directory >>> + (call-with-input-file (string-append "/xchg/" #$= graph) >>> + read-reference-graph)) >>> + #$os-drv >>> + #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") >>> + #:creation-time (make-time time-utc 0 1) >>> + #:transformations `((,root-directory -> ""))))))) >> >> Am I right that the whole point of passing several file names to >> =E2=80=98build-docker-image=E2=80=99 is that here we don=E2=80=99t need = to copy the whole store >> to =E2=80=98root-directory=E2=80=99, right? > > The primary reason why I made this change was because it was the > simplest way I could find to re-use the existing code. The fact that we > copy less is a nice secondary effect, but it is not the primary reason > why I structured it this way. There might be a simpler way to > accomplish this, but this way works, which I think is a good start. I > would like to commit this as-is for now. If we can figure out a simpler > way to implement the same logic, I'd be all for it, but it seems tricky. > > The original role of the "PATH" argument was surprising (for example, it > was not actually used for adding any paths to the final Docker image!). > In addition, the original code assumed that all the paths to add (loaded > from the "CLOSURE" graph file argument - not from PATH!) are store > paths, which is not true when creating a GuixSD Docker image (unless we > try to copy everything created by root-partition-initializer back into > the store). So, some of the paths I need to add are store paths, and > some of them are paths to special files outside the store, like device > files. Maybe we can copy all of this (including device files and socket > files) into a single directory in the store (or outside of the store). > I don't know. If it's possible, I agree it would be a nice improvement. > But I tried various methods, and my latest patch was the simplest method > I found that worked. I would definitely be happy if we could simplify > it even more, but I also want to move forward with this patch series. I see, thanks for taking the time to explain! I=E2=80=99m always wary about adding too many options in an interface, but = like you wrote, it may be unavoidable here. > Is it OK to commit this as-is (with just the guile-json change you > suggested above)? Yes, sure; sorry for the extra delay. We can always adjust later if we have a better idea. Thanks a lot for working on this! Ludo=E2=80=99.