all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 27284@debbugs.gnu.org
Subject: bug#27284: [PATCH 8/8] DRAFT Add (guix self) and use it when pulling.
Date: Sun, 22 Oct 2017 16:05:11 -0400	[thread overview]
Message-ID: <87lgk33q4o.fsf@gmail.com> (raw)
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")

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ès <ludo@gnu.org> writes:

> DRAFT: Module reloading doesn't work; needs more testing.
>
> Partly addresses <https://bugs.gnu.org/27284>.
>
> * 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 modules
> +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.  Return 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 DIRECTORY."
> +  (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 version
> +                 ;; 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 means 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

  reply	other threads:[~2017-10-22 20:06 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08  8:39 bug#27284: Memory leak in 'guix pull' or 'make' in guix source ng0
2017-06-08 15:02 ` ng0
2017-09-19 20:48 ` Ludovic Courtès
2017-09-20  2:40   ` Maxim Cournoyer
2017-09-20 11:42     ` Ludovic Courtès
2017-09-20 18:29       ` Maxim Cournoyer
2017-09-20 20:12         ` Ludovic Courtès
2017-09-21 14:43           ` Maxim Cournoyer
2017-09-23 18:14       ` Taylan Ulrich Bayırlı/Kammer
2017-09-24 19:44         ` Ludovic Courtès
2017-09-25 21:00           ` Maxim Cournoyer
2017-10-20 16:05   ` bug#27284: [PATCH 0/8] 'guix pull' creates several derivations Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile) Ludovic Courtès
2017-10-22 21:22       ` Maxim Cournoyer
2017-10-23  1:50         ` Ludovic Courtès
2017-10-22 21:42           ` Eric Bavier
2017-10-23  2:51             ` Ludovic Courtès
2017-10-22 22:52               ` Eric Bavier
2017-10-23  5:10                 ` Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 2/8] build: Honor make's '-j' flag Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 3/8] discovery: Move 'file-name->module-name' to (guix modules) Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 4/8] gexp: Add 'file-union' Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 5/8] gexp: Add 'directory-union' Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 6/8] union: Parametrize the symlink procedure Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 7/8] gexp: 'directory-union' has a #:quiet? parameter Ludovic Courtès
2017-10-20 16:05     ` bug#27284: [PATCH 8/8] DRAFT Add (guix self) and use it when pulling Ludovic Courtès
2017-10-22 20:05       ` Maxim Cournoyer [this message]
2017-10-27 23:49         ` Ludovic Courtès
2017-11-21 22:26     ` bug#27284: [PATCH 0/8] 'guix pull' creates several derivations Ludovic Courtès
2017-11-21 22:56       ` Ludovic Courtès
2017-12-11 10:52         ` bug#27284: [PATCH 0/4] 'guix pull' reloads modules, second try Ludovic Courtès
2017-12-11 10:52           ` bug#27284: [PATCH 1/4] gnu: Fix ambiguous 'zip' reference Ludovic Courtès
2017-12-11 10:52           ` bug#27284: [PATCH 2/4] gexp: 'computed-file' has a new #:guile parameter Ludovic Courtès
2017-12-11 10:52           ` bug#27284: [PATCH 3/4] Add (guix self) and use it when pulling Ludovic Courtès
2017-12-18 14:57             ` Ludovic Courtès
2018-03-27  9:14               ` bug#27284: ‘guix pull’ builds using multiple derivations Ludovic Courtès
2018-03-27 14:33                 ` Ludovic Courtès
2018-03-27 19:25                 ` Nils Gillmann
2018-03-27 20:51                   ` Ludovic Courtès
2018-04-08 16:37                 ` Ludovic Courtès
2018-04-09 19:53                   ` Ricardo Wurmus
2018-04-10 21:53                     ` bug#27284: ‘guix pull’ broken on Guile 2.0 Ludovic Courtès
2018-04-10 23:18                       ` bug#31117: " Ludovic Courtès
2018-04-14 17:39                         ` Ricardo Wurmus
2017-12-11 10:52           ` bug#27284: [PATCH 4/4] pull: Reload modules before doing anything else Ludovic Courtès
2017-11-12 21:33   ` bug#27284: Memory leak in 'guix pull' or 'make' in guix source Ludovic Courtès
2017-11-13  8:59     ` Ricardo Wurmus
2017-11-13  9:28       ` Ludovic Courtès
2017-11-13 14:09         ` Ricardo Wurmus
2017-11-13 17:48           ` Ricardo Wurmus
2017-11-14  7:54           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgk33q4o.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=27284@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.