From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: bug#27284: [PATCH 8/8] DRAFT Add (guix self) and use it when pulling. Date: Sun, 22 Oct 2017 16:05:11 -0400 Message-ID: <87lgk33q4o.fsf@gmail.com> References: <87poamv2i7.fsf@gnu.org> <20171020160557.27096-1-ludo@gnu.org> <20171020160557.27096-9-ludo@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6MVb-0001pM-25 for bug-guix@gnu.org; Sun, 22 Oct 2017 16:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e6MVW-00077f-WB for bug-guix@gnu.org; Sun, 22 Oct 2017 16:06:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:47575) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e6MVW-00077U-SI for bug-guix@gnu.org; Sun, 22 Oct 2017 16:06:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20171020160557.27096-9-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cou\?\= \=\?utf-8\?Q\?rt\=C3\=A8s\=22's\?\= message of "Fri, 20 Oct 2017 18:05:57 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 27284@debbugs.gnu.org Hi Ludovic! I've read through this draft, and FWIW it looks OK to me! I've proof read the comments and identified a few typos which you'll find below. Great work! Ludovic Court=C3=A8s writes: > DRAFT: Module reloading doesn't work; needs more testing. > > Partly addresses . > > * guix/self.scm: New file. > * Makefile.am (MODULES): Add it. > * build-aux/build-self.scm (libgcrypt, zlib, gzip, bzip2, xz) > (false-if-wrong-guile, package-for-current-guile, guile-json) > (guile-ssh, guile-git, guile-bytestructures): Remove. > (build): Rewrite to simply delegate to 'compiled-guix'. > * gnu/packages.scm (%distro-root-directory): Rewrite to try difference s/difference/different/ ? [...] > +(define* (scheme-node name modules #:optional (dependencies '()) > + #:key (extra-modules '()) (extra-files '()) > + (extensions '()) > + parallel?) > + "Return a node that builds the given Scheme MODULES, and depends on > +DEPENDENCIES (a list of nodes). EXTRA-MODULES is a list of additional m= odules > +added to the source, and EXTRA-FILES is a list of additional files. > +EXTENSIONS is a set of full-blow Guile packages (e.g., 'guile-json') > that must s/full-blow/full-blown/ ? > +be present in the search path." > + (let* ((modules (append extra-modules > + (closure modules > + (node-modules/recursive dependencies)= ))) > + (module-files (map module->import modules)) > + (source (imported-files (string-append name "-source") > + (append module-files extra-files)))) > + (node name modules source dependencies > + (compiled-modules name source modules > + (map node-source dependencies) > + (map node-compiled dependencies) > + #:extensions extensions > + #:parallel? parallel?)))) > + > +(define (file-imports directory sub-directory pred) > + "List all the files matching PRED under DIRECTORY/SUB-DIRECTORY. Retu= rn a > +list of file-name/file-like object suitable as input to > 'imported-files'." s/object/objects/, s/input/inputs/ > + (map (lambda (file) > + (list (string-drop file (+ 1 (string-length directory))) > + (local-file file #:recursive? #t))) > + (find-files (string-append directory "/" sub-directory) pred))) > + > +(define (scheme-modules* directory sub-directory) > + "Return the list of module names found under SUB-DIRECTORY in DIRECTOR= Y." > + (let ((prefix (string-length directory))) > + (map (lambda (file) > + (file-name->module-name (string-drop file prefix))) > + (scheme-files (string-append directory "/" sub-directory))))) > + > +(define* (compiled-guix source #:key (version %guix-version) > + (guile-version (effective-version)) > + (libgcrypt (specification->package "libgcrypt")) > + (zlib (specification->package "zlib")) > + (gzip (specification->package "gzip")) > + (bzip2 (specification->package "bzip2")) > + (xz (specification->package "xz"))) > + "Return a file-like objects that contains a compiled Guix." s/objects/object/ ;) > + (define guile-json > + (package-for-guile guile-version > + "guile-json" > + "guile2.2-json" > + "guile2.0-json")) > + > + (define guile-ssh > + (package-for-guile guile-version > + "guile-ssh" > + "guile2.2-ssh" > + "guile2.0-ssh")) > + > + (define guile-git > + (package-for-guile guile-version > + "guile-git" > + "guile2.0-git")) > + > + > + (define dependencies > + (match (append-map (lambda (package) > + (cons (list "x" package) > + (package-transitive-inputs package))) > + (list guile-git guile-json guile-ssh)) > + (((labels packages _ ...) ...) > + packages))) > + > + (define *core-modules* > + (scheme-node "guix-core" > + '((guix) > + (guix monad-repl) > + (guix packages) > + (guix download) > + (guix discovery) > + (guix profiles) > + (guix build-system gnu) > + (guix build profiles) > + (guix build gnu-build-system)) Sorting the modules list lexicographically would be neat, here and in various places. If this seems reasonable, perhaps we could have this stylistic convention in our guidelines? > + > + ;; Provide a dummy (guix config) with the default versi= on > + ;; number, storedir, etc. This is so that "guix-core" = is the > + ;; same across all installations and doesn't need to be > + ;; rebuilt when the version changes, which in turns mea= ns we > + ;; can have substitutes for it. s/in turns/in turn/ [...] > + (define (regular? file) > + (not (member file '("." "..")))) > + > + (define (process-file file output) > + (let* ((base (string-drop-right file 4)) ;.scm > + (output (string-append output "/" base > + ".go"))) > + (compile-file file > + #:output-file output > + #:opts (optimization-options file)))) > + > + (define (report-load file total completed) > + (display #\cr) > + (format #t > + "loading...\t~5,1f% of ~d files" ;FIXME: i18n > + (* 100. (/ completed total)) total) > + (force-output)) > + > + (define (report-compilation file total completed) > + (display #\cr) > + (format #t "compiling...\t~5,1f% of ~d files" ;FIXME: i18n > + (* 100. (/ completed total)) total) > + (force-output)) > + > + (define (process-directory directory output) > + (let ((files (find-files directory "\\.scm$")) > + (prefix (+ 1 (string-length directory)))) > + ;; Hide compilation warnings. Should this be configurable? Hidden warnings don't have much chance to get addressed :) Maxim