all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#39599] [PATCH 0/2] New build system: copy-build-system
@ 2020-02-14 12:51 Pierre Neidhardt
  2020-02-14 12:53 ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Pierre Neidhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-14 12:51 UTC (permalink / raw)
  To: 39599

This build system aims to be a more convenient alternative to the
trivial-build-system for packages that only need mere copying around.

Since it is based on the gnu-build-system, all packages necessary for archive
extraction are already included.

The new install-plan argument makes it particularly convenient to install
batches of files.

See discussion here: https://lists.gnu.org/archive/html/guix-devel/2020-01/msg00485.html.

Pierre Neidhardt (2):
  build-system: Add copy-build-system.
  gnu: gcide: Use the copy-build-system.

 Makefile.am                      |   2 +
 doc/guix.texi                    |  57 +++++++++++
 gnu/packages/dictionaries.scm    |  22 +----
 guix/build-system/copy.scm       | 145 ++++++++++++++++++++++++++++
 guix/build/copy-build-system.scm | 156 +++++++++++++++++++++++++++++++
 5 files changed, 364 insertions(+), 18 deletions(-)
 create mode 100644 guix/build-system/copy.scm
 create mode 100644 guix/build/copy-build-system.scm

-- 
2.25.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/2] build-system: Add copy-build-system.
  2020-02-14 12:51 [bug#39599] [PATCH 0/2] New build system: copy-build-system Pierre Neidhardt
@ 2020-02-14 12:53 ` Pierre Neidhardt
  2020-02-14 12:53   ` [bug#39599] [PATCH 2/2] gnu: gcide: Use the copy-build-system Pierre Neidhardt
  2020-02-14 13:39   ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Giovanni Biscuolo
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
  2020-02-20  1:06 ` Alex Griffin
  2 siblings, 2 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-14 12:53 UTC (permalink / raw)
  To: 39599

* guix/build-system/copy.scm: New file.
* guix/build/copy-build-system.scm: New file.
* Makefile.am (MODULES): Add them.
* doc/guix.texi (Build Systems): Document 'copy-build-system'.
---
 Makefile.am                      |   2 +
 doc/guix.texi                    |  57 +++++++++++
 guix/build-system/copy.scm       | 145 ++++++++++++++++++++++++++++
 guix/build/copy-build-system.scm | 156 +++++++++++++++++++++++++++++++
 4 files changed, 360 insertions(+)
 create mode 100644 guix/build-system/copy.scm
 create mode 100644 guix/build/copy-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index c6a2e6cf6c..e18c17d8b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -122,6 +122,7 @@ MODULES =					\
   guix/build-system/meson.scm			\
   guix/build-system/minify.scm			\
   guix/build-system/asdf.scm			\
+  guix/build-system/copy.scm			\
   guix/build-system/glib-or-gtk.scm		\
   guix/build-system/gnu.scm			\
   guix/build-system/guile.scm			\
@@ -169,6 +170,7 @@ MODULES =					\
   guix/build/go-build-system.scm		\
   guix/build/asdf-build-system.scm		\
   guix/build/bzr.scm				\
+  guix/build/copy-build-system.scm		\
   guix/build/git.scm				\
   guix/build/hg.scm				\
   guix/build/glib-or-gtk-build-system.scm	\
diff --git a/doc/guix.texi b/doc/guix.texi
index 42d7cfa2e8..d1ec214674 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -6159,6 +6159,63 @@ parameters available to cargo.  It will also remove an included
 if they are defined by the crate.
 @end defvr
 
+
+@defvr {Scheme Variable} copy-build-system
+@cindex (copy build system)
+This variable is exported by @code{(guix build-system copy)}.  It
+supports builds of simple packages that don't require much compiling,
+mostly just moving files around.
+
+It adds much of the @code{gnu-build-system} packages to the set of
+inputs.  Because of this, the @code{copy-build-system} does not require
+all the boilerplate code often implied by the
+@code{trivial-build-system}.
+
+To further simplify the file installation process, an
+@code{#:install-plan} argument is exposed to let the packaer specify
+which files go where.
+The install plan is a list of @code{(SOURCE TARGET [FILTERS])}.
+@code{FILTERS} are optional.
+
+@itemize
+@item When @code{SOURCE} matches a file or directory without trailing slash, install it to @code{TARGET}.
+  @itemize
+  @item If @code{TARGET} has a trailing slash, install @code{SOURCE} basename beneath @code{TARGET}.
+  @item Otherwise install @code{SOURCE} as @code{TARGET}.
+  @end itemize
+
+@item When @code{SOURCE} is a directory with a trailing slash, or when @code{FILTERS} are used,
+  the trailing slash of @code{TARGET} is implied.
+  @itemize
+  @item Without @code{FILTERS}, install the full @code{SOURCE} @emph{content} to @code{TARGET}.
+    The paths relative to @code{SOURCE} are preserved within @code{TARGET}.
+  @item With @code{FILTERS} among @code{#:include}, @code{#:include-regexp}, @code{exclude},
+    @code{#:exclude-regexp}:
+    @itemize
+      @item With @code{#:include}, install only the exact subpaths in the list.
+      @item With @code{#:include-regexp}, install subpaths matching the regexps in the list.
+      @item The @code{#:exclude} and @code{#:exclude-regexp} filters work similarly.  Without @code{#:include} flags,
+        install every subpath but the files matching the exclusion filters.
+        If both inclusions and exclusions are specified, the exclusions are done
+        on the inclusion list.
+    @end itemize
+  @end itemize
+@end itemize
+
+Examples:
+
+@itemize
+@item @code{("foo/bar" "share/my-app/")}: Install @code{bar} to @code{share/my-app/bar}.
+@item @code{("foo/bar" "share/my-app/baz")}: Install @code{bar}t o @code{share/my-app/baz}.
+@item @code{("foo/" "share/my-app")}: Install the content of @code{foo} inside @code{share/my-app},
+  e.g. install @code{foo/sub/file} to @code{share/my-app/sub/file}.
+@item @code{("foo/" "share/my-app" #:include ("sub/file"))}: Install only @code{foo/sub/file} to
+@code{share/my-app/sub/file}.
+@item @code{("foo/sub" "share/my-app" #:include ("file"))}: Install @code{foo/sub/file} to
+@code{share/my-app/file}.
+@end itemize
+
+
 @cindex Clojure (programming language)
 @cindex simple Clojure build system
 @defvr {Scheme Variable} clojure-build-system
diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm
new file mode 100644
index 0000000000..9686e7e5c2
--- /dev/null
+++ b/guix/build-system/copy.scm
@@ -0,0 +1,145 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system copy)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix derivations)
+  #:use-module (guix search-paths)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix packages)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
+  #:export (%copy-build-system-modules
+            default-glibc
+            lower
+            copy-build
+            copy-build-system))
+
+;; Commentary:
+;;
+;; Standard build procedure for simple packages that don't require much
+;; compilation, mostly just copying files around.  This is implemented as an
+;; extension of `gnu-build-system'.
+;;
+;; Code:
+
+(define %copy-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build copy-build-system)
+    ,@%gnu-build-system-modules))
+
+(define (default-glibc)
+  "Return the default glibc package."
+  ;; Do not use `@' to avoid introducing circular dependencies.
+  (let ((module (resolve-interface '(gnu packages base))))
+    (module-ref module 'glibc)))
+
+(define* (lower name
+                #:key source inputs native-inputs outputs system target
+                (glibc (default-glibc))
+                #:allow-other-keys
+                #:rest arguments)
+  "Return a bag for NAME."
+  (define private-keywords
+    '(#:source #:target #:inputs #:native-inputs))
+
+  (and (not target)                               ;XXX: no cross-compilation
+       (bag
+         (name name)
+         (system system)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '())
+                        ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'.
+                        ,@(standard-packages)))
+         (build-inputs native-inputs)
+         (outputs outputs)
+         (build copy-build)
+         (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (copy-build store name inputs
+                     #:key (guile #f)
+                     (outputs '("out"))
+                     (install-plan ''(("." (".") "./")))
+                     (search-paths '())
+                     (out-of-source? #t)
+                     (validate-runpath? #t)
+                     (patch-shebangs? #t)
+                     (strip-binaries? #t)
+                     (strip-flags ''("--strip-debug"))
+                     (strip-directories ''("lib" "lib64" "libexec"
+                                           "bin" "sbin"))
+                     (phases '(@ (guix build copy-build-system)
+                                 %standard-phases))
+                     (system (%current-system))
+                     (imported-modules %copy-build-system-modules)
+                     (modules '((guix build copy-build-system)
+                                (guix build utils))))
+  "Build SOURCE using INSTALL-PLAN, and with INPUTS."
+  (define builder
+    `(begin
+       (use-modules ,@modules)
+       (copy-build #:source ,(match (assoc-ref inputs "source")
+                               (((?  derivation? source))
+                                (derivation->output-path source))
+                               ((source)
+                                source)
+                               (source
+                                source))
+                   #:system ,system
+                   #:outputs %outputs
+                   #:inputs %build-inputs
+                   #:install-plan ,install-plan
+                   #:search-paths ',(map search-path-specification->sexp
+                                         search-paths)
+                   #:phases ,phases
+                   #:out-of-source? ,out-of-source?
+                   #:validate-runpath? ,validate-runpath?
+                   #:patch-shebangs? ,patch-shebangs?
+                   #:strip-binaries? ,strip-binaries?
+                   #:strip-flags ,strip-flags
+                   #:strip-directories ,strip-directories)))
+
+  (define guile-for-build
+    (match guile
+      ((? package?)
+       (package-derivation store guile system #:graft? #f))
+      (#f                                         ; the default
+       (let* ((distro (resolve-interface '(gnu packages commencement)))
+              (guile  (module-ref distro 'guile-final)))
+         (package-derivation store guile system #:graft? #f)))))
+
+  (build-expression->derivation store name builder
+                                #:system system
+                                #:inputs inputs
+                                #:modules imported-modules
+                                #:outputs outputs
+                                #:guile-for-build guile-for-build))
+
+(define copy-build-system
+  (build-system
+    (name 'copy)
+    (description "The standard copy build system")
+    (lower lower)))
+
+;;; copy.scm ends here
diff --git a/guix/build/copy-build-system.scm b/guix/build/copy-build-system.scm
new file mode 100644
index 0000000000..c9c8f1165b
--- /dev/null
+++ b/guix/build/copy-build-system.scm
@@ -0,0 +1,156 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build copy-build-system)
+  #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 ftw)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases
+            copy-build))
+
+;; Commentary:
+;;
+;; System for building packages that don't require much compilation, mostly
+;; only to copy files around.
+;;
+;; Code:
+
+(define* (install #:key install-plan outputs #:allow-other-keys)
+  "Copy files from the \"source\" build input to the \"out\" output according to INSTALL-PLAN.
+
+An install plan is a list of plans in the form:
+
+  (SOURCE TARGET [FILTERS])
+
+In the above, FILTERS are optional.
+
+- When SOURCE matches a file or directory without trailing slash, install it to
+  TARGET.
+  - If TARGET has a trailing slash, install SOURCE basename beneath TARGET.
+  - Otherwise install SOURCE as TARGET.
+
+- When SOURCE is a directory with a trailing slash, or when FILTERS are used,
+  the trailing slash of TARGET is implied.
+  - Without FILTERS, install the full SOURCE _content_ to TARGET.
+    The paths relative to SOURCE are preserved within TARGET.
+  - With FILTERS among `#:include`, `#:include-regexp`, `#:exclude`,
+    `#:exclude-regexp`:
+    - With `#:include`, install only the exact subpaths in the list.
+    - With `#:include-regexp`, install subpaths matching the regexps in the list.
+    - The `#:exclude*` FILTERS work similarly.  Without `#:include*` flags,
+      install every subpath but the files matching the `#:exlude*` filters.
+      If both `#:include*` and `#:exclude*` are specified, the exclusion is done
+      on the inclusion list.
+
+Examples:
+
+- `(\"foo/bar\" \"share/my-app/\")`: Install bar to \"share/my-app/bar\".
+- `(\"foo/bar\" \"share/my-app/baz\")`: Install bar to \"share/my-app/baz\".
+- `(\"foo/\" \"share/my-app\")`: Install the content of foo inside \"share/my-app\",
+  e.g. install \"foo/sub/file\" to \"share/my-app/sub/file\".
+- `(\"foo/\" \"share/my-app\" #:include (\"sub/file\"))`: Install only \"foo/sub/file\" to
+\"share/my-app/sub/file\".
+- `(\"foo/sub\" \"share/my-app\" #:include (\"file\"))`: Install \"foo/sub/file\" to
+\"share/my-app/file\"."
+  (define (install-simple source target)
+    "TARGET must point to a store location."
+    (set! target (if (string-suffix? "/" target)
+                     (string-append target (basename source))
+                     target))
+    (mkdir-p (dirname target))
+    (copy-recursively source target))
+
+  (define (install-file file target)
+    (let ((dest (string-append target
+                               (if (string-suffix? "/" target)
+                                   (string-append "/" file)
+                                   file))))
+      (format (current-output-port) "`~a' -> `~a'~%" file dest)
+      (mkdir-p (dirname dest))
+      (copy-file file dest)))
+
+  (define (make-file-predicate matches matches-regexp)
+    (if (or matches matches-regexp)
+        (lambda (file)
+          (any (lambda (pred) (pred file))
+               (append
+                (map (lambda (str)
+                       (lambda (f) (string-contains f str)))
+                     (or matches '()))
+                (map (lambda (regexp)
+                       (lambda (f) (regexp-exec (make-regexp regexp) f)))
+                     (or matches-regexp '())))))
+        (const #t)))
+
+  (define* (install-file-list source target #:key include exclude include-regexp exclude-regexp)
+    (let* ((exclusion-pred (negate (make-file-predicate exclude exclude-regexp)))
+           (inclusion-pred (make-file-predicate include include-regexp))
+           (file-list
+            (filter exclusion-pred
+                    ;; We must use switch current directory to source so
+                    ;; that `find-files' returns file paths relative to
+                    ;; source.
+                    (with-directory-excursion source
+                      (find-files "." (lambda (file _stat)
+                                        (inclusion-pred file)))))))
+      (map (cut install-file <> (if (string-suffix? "/" target)
+                                    target
+                                    (string-append target "/")))
+           file-list)))
+
+  (define* (install source target #:key include exclude include-regexp exclude-regexp)
+    (set! target (string-append (assoc-ref outputs "out") "/" target))
+    (let ((filters? (or include exclude include-regexp exclude-regexp)))
+      (when (and (not (file-is-directory? source))
+                 filters?)
+        (error "Cannot use filters when SOURCE is a file."))
+      (let ((multi-files-in-source?
+             (or (string-suffix? "/" source)
+                 (and (file-is-directory? source)
+                      filters?))))
+        (if multi-files-in-source?
+            (install-file-list source target
+                               #:include include
+                               #:exclude exclude
+                               #:include-regexp include-regexp
+                               #:exclude-regexp exclude-regexp)
+            (install-simple source target)))))
+
+  (for-each (lambda (plan) (apply install plan)) install-plan)
+  #t)
+
+(define %standard-phases
+  ;; Everything is as with the GNU Build System except for the `configure'
+  ;; , `build', `check' and `install' phases.
+  (modify-phases gnu:%standard-phases
+    (delete 'bootstrap)
+    (delete 'configure)
+    (delete 'build)
+    (delete 'check)
+    (replace 'install install)))
+
+(define* (copy-build #:key inputs (phases %standard-phases)
+                     #:allow-other-keys #:rest args)
+  "Build the given package, applying all of PHASES in order."
+  (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; copy-build-system.scm ends here
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 2/2] gnu: gcide: Use the copy-build-system.
  2020-02-14 12:53 ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Pierre Neidhardt
@ 2020-02-14 12:53   ` Pierre Neidhardt
  2020-02-14 13:39   ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Giovanni Biscuolo
  1 sibling, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-14 12:53 UTC (permalink / raw)
  To: 39599

* gnu/packages/dictionaries.scm (gcide2)[build-system]: Use the
  copy-build-system.
---
 gnu/packages/dictionaries.scm | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/dictionaries.scm b/gnu/packages/dictionaries.scm
index cd0a5db93c..d40c43f74e 100644
--- a/gnu/packages/dictionaries.scm
+++ b/gnu/packages/dictionaries.scm
@@ -31,6 +31,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
+  #:use-module (guix build-system copy)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
@@ -109,25 +110,10 @@ acronyms distributed as an info document.")
               (sha256
                (base32
                 "1n3bp91sik66z3ca7mjqbr9nck3hg5ck0c8g84xc0qnfpx5vznh2"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (arguments
-     '(#:builder (begin
-                   (use-modules (guix build utils))
-                   (let* ((src     (assoc-ref %build-inputs "source"))
-                          (tar     (assoc-ref %build-inputs "tar"))
-                          (xz      (assoc-ref %build-inputs "xz"))
-                          (out     (assoc-ref %outputs "out"))
-                          (datadir (string-append out "/share/gcide")))
-                     (set-path-environment-variable "PATH" '("bin")
-                                                    (list tar xz))
-                     (mkdir-p datadir)
-                     (invoke "tar" "-C" datadir
-                             "--strip-components=1"
-                             "-xvf" src)))
-       #:modules ((guix build utils))))
-    (native-inputs
-     `(("tar" ,tar)
-       ("xz" ,xz)))
+     '(#:install-plan
+       '(("." "share/gcide/" #:exclude ("COPYING")))))
     (synopsis "GNU Collaborative International Dictionary of English")
     (description
      "GCIDE is a free dictionary based on a combination of sources.  It can
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/2] build-system: Add copy-build-system.
  2020-02-14 12:53 ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Pierre Neidhardt
  2020-02-14 12:53   ` [bug#39599] [PATCH 2/2] gnu: gcide: Use the copy-build-system Pierre Neidhardt
@ 2020-02-14 13:39   ` Giovanni Biscuolo
  2020-02-16 13:16     ` Pierre Neidhardt
  1 sibling, 1 reply; 31+ messages in thread
From: Giovanni Biscuolo @ 2020-02-14 13:39 UTC (permalink / raw)
  To: Pierre Neidhardt, 39599

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

Pierre Neidhardt <mail@ambrevar.xyz> writes:

[...]

> diff --git a/doc/guix.texi b/doc/guix.texi
> index 42d7cfa2e8..d1ec214674 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -6159,6 +6159,63 @@ parameters available to cargo.  It will also remove an included
>  if they are defined by the crate.
>  @end defvr
>  
> +
> +@defvr {Scheme Variable} copy-build-system
> +@cindex (copy build system)
> +This variable is exported by @code{(guix build-system copy)}.  It
> +supports builds of simple packages that don't require much compiling,
> +mostly just moving files around.
> +
> +It adds much of the @code{gnu-build-system} packages to the set of
> +inputs.  Because of this, the @code{copy-build-system} does not require
> +all the boilerplate code often implied by the
> +@code{trivial-build-system}.
> +
> +To further simplify the file installation process, an
> +@code{#:install-plan} argument is exposed to let the packaer specify

s/packaer/packager

[...]

Thanks! Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/2] build-system: Add copy-build-system.
  2020-02-14 13:39   ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Giovanni Biscuolo
@ 2020-02-16 13:16     ` Pierre Neidhardt
  0 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-16 13:16 UTC (permalink / raw)
  To: Giovanni Biscuolo, 39599

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Note to myself: maybe rename "install-simple" to "install-single".

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-14 12:51 [bug#39599] [PATCH 0/2] New build system: copy-build-system Pierre Neidhardt
  2020-02-14 12:53 ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Pierre Neidhardt
@ 2020-02-17 11:12 ` Pierre Neidhardt
  2020-02-17 11:12   ` [bug#39599] [PATCH 2/4] gnu: gcide: Use the copy-build-system Pierre Neidhardt
                     ` (4 more replies)
  2020-02-20  1:06 ` Alex Griffin
  2 siblings, 5 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-17 11:12 UTC (permalink / raw)
  To: 39599

* guix/build-system/copy.scm: New file.
* guix/build/copy-build-system.scm: New file.
* Makefile.am (MODULES): Add them.
* doc/guix.texi (Build Systems): Document 'copy-build-system'.
---
 Makefile.am                      |   2 +
 doc/guix.texi                    |  58 ++++++++++++
 guix/build-system/copy.scm       | 145 ++++++++++++++++++++++++++++
 guix/build/copy-build-system.scm | 156 +++++++++++++++++++++++++++++++
 4 files changed, 361 insertions(+)
 create mode 100644 guix/build-system/copy.scm
 create mode 100644 guix/build/copy-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index c6a2e6cf6c..e18c17d8b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -122,6 +122,7 @@ MODULES =					\
   guix/build-system/meson.scm			\
   guix/build-system/minify.scm			\
   guix/build-system/asdf.scm			\
+  guix/build-system/copy.scm			\
   guix/build-system/glib-or-gtk.scm		\
   guix/build-system/gnu.scm			\
   guix/build-system/guile.scm			\
@@ -169,6 +170,7 @@ MODULES =					\
   guix/build/go-build-system.scm		\
   guix/build/asdf-build-system.scm		\
   guix/build/bzr.scm				\
+  guix/build/copy-build-system.scm		\
   guix/build/git.scm				\
   guix/build/hg.scm				\
   guix/build/glib-or-gtk-build-system.scm	\
diff --git a/doc/guix.texi b/doc/guix.texi
index 42d7cfa2e8..578ae9a43d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -6159,6 +6159,64 @@ parameters available to cargo.  It will also remove an included
 if they are defined by the crate.
 @end defvr
 
+
+@defvr {Scheme Variable} copy-build-system
+@cindex (copy build system)
+This variable is exported by @code{(guix build-system copy)}.  It
+supports builds of simple packages that don't require much compiling,
+mostly just moving files around.
+
+It adds much of the @code{gnu-build-system} packages to the set of
+inputs.  Because of this, the @code{copy-build-system} does not require
+all the boilerplate code often implied by the
+@code{trivial-build-system}.
+
+To further simplify the file installation process, an
+@code{#:install-plan} argument is exposed to let the packaer specify
+which files go where.
+The install plan is a list of @code{(SOURCE TARGET [FILTERS])}.
+@code{FILTERS} are optional.
+
+@itemize
+@item When @code{SOURCE} matches a file or directory without trailing slash, install it to @code{TARGET}.
+  @itemize
+  @item If @code{TARGET} has a trailing slash, install @code{SOURCE} basename beneath @code{TARGET}.
+  @item Otherwise install @code{SOURCE} as @code{TARGET}.
+  @end itemize
+
+@item When @code{SOURCE} is a directory with a trailing slash, or when @code{FILTERS} are used,
+  the trailing slash of @code{TARGET} is implied.
+  @itemize
+  @item Without @code{FILTERS}, install the full @code{SOURCE} @emph{content} to @code{TARGET}.
+    The paths relative to @code{SOURCE} are preserved within @code{TARGET}.
+  @item With @code{FILTERS} among @code{#:include}, @code{#:include-regexp}, @code{exclude},
+    @code{#:exclude-regexp}:
+    @itemize
+      @item With @code{#:include}, install only the paths which suffix exactly matches
+      one of the elements in the list.
+      @item With @code{#:include-regexp}, install subpaths matching the regexps in the list.
+      @item The @code{#:exclude} and @code{#:exclude-regexp} filters work similarly.  Without @code{#:include} flags,
+        install every subpath but the files matching the exclusion filters.
+        If both inclusions and exclusions are specified, the exclusions are done
+        on the inclusion list.
+    @end itemize
+  @end itemize
+@end itemize
+
+Examples:
+
+@itemize
+@item @code{("foo/bar" "share/my-app/")}: Install @code{bar} to @code{share/my-app/bar}.
+@item @code{("foo/bar" "share/my-app/baz")}: Install @code{bar}t o @code{share/my-app/baz}.
+@item @code{("foo/" "share/my-app")}: Install the content of @code{foo} inside @code{share/my-app},
+  e.g. install @code{foo/sub/file} to @code{share/my-app/sub/file}.
+@item @code{("foo/" "share/my-app" #:include ("sub/file"))}: Install only @code{foo/sub/file} to
+@code{share/my-app/sub/file}.
+@item @code{("foo/sub" "share/my-app" #:include ("file"))}: Install @code{foo/sub/file} to
+@code{share/my-app/file}.
+@end itemize
+
+
 @cindex Clojure (programming language)
 @cindex simple Clojure build system
 @defvr {Scheme Variable} clojure-build-system
diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm
new file mode 100644
index 0000000000..9686e7e5c2
--- /dev/null
+++ b/guix/build-system/copy.scm
@@ -0,0 +1,145 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system copy)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix derivations)
+  #:use-module (guix search-paths)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix packages)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
+  #:export (%copy-build-system-modules
+            default-glibc
+            lower
+            copy-build
+            copy-build-system))
+
+;; Commentary:
+;;
+;; Standard build procedure for simple packages that don't require much
+;; compilation, mostly just copying files around.  This is implemented as an
+;; extension of `gnu-build-system'.
+;;
+;; Code:
+
+(define %copy-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build copy-build-system)
+    ,@%gnu-build-system-modules))
+
+(define (default-glibc)
+  "Return the default glibc package."
+  ;; Do not use `@' to avoid introducing circular dependencies.
+  (let ((module (resolve-interface '(gnu packages base))))
+    (module-ref module 'glibc)))
+
+(define* (lower name
+                #:key source inputs native-inputs outputs system target
+                (glibc (default-glibc))
+                #:allow-other-keys
+                #:rest arguments)
+  "Return a bag for NAME."
+  (define private-keywords
+    '(#:source #:target #:inputs #:native-inputs))
+
+  (and (not target)                               ;XXX: no cross-compilation
+       (bag
+         (name name)
+         (system system)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '())
+                        ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'.
+                        ,@(standard-packages)))
+         (build-inputs native-inputs)
+         (outputs outputs)
+         (build copy-build)
+         (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (copy-build store name inputs
+                     #:key (guile #f)
+                     (outputs '("out"))
+                     (install-plan ''(("." (".") "./")))
+                     (search-paths '())
+                     (out-of-source? #t)
+                     (validate-runpath? #t)
+                     (patch-shebangs? #t)
+                     (strip-binaries? #t)
+                     (strip-flags ''("--strip-debug"))
+                     (strip-directories ''("lib" "lib64" "libexec"
+                                           "bin" "sbin"))
+                     (phases '(@ (guix build copy-build-system)
+                                 %standard-phases))
+                     (system (%current-system))
+                     (imported-modules %copy-build-system-modules)
+                     (modules '((guix build copy-build-system)
+                                (guix build utils))))
+  "Build SOURCE using INSTALL-PLAN, and with INPUTS."
+  (define builder
+    `(begin
+       (use-modules ,@modules)
+       (copy-build #:source ,(match (assoc-ref inputs "source")
+                               (((?  derivation? source))
+                                (derivation->output-path source))
+                               ((source)
+                                source)
+                               (source
+                                source))
+                   #:system ,system
+                   #:outputs %outputs
+                   #:inputs %build-inputs
+                   #:install-plan ,install-plan
+                   #:search-paths ',(map search-path-specification->sexp
+                                         search-paths)
+                   #:phases ,phases
+                   #:out-of-source? ,out-of-source?
+                   #:validate-runpath? ,validate-runpath?
+                   #:patch-shebangs? ,patch-shebangs?
+                   #:strip-binaries? ,strip-binaries?
+                   #:strip-flags ,strip-flags
+                   #:strip-directories ,strip-directories)))
+
+  (define guile-for-build
+    (match guile
+      ((? package?)
+       (package-derivation store guile system #:graft? #f))
+      (#f                                         ; the default
+       (let* ((distro (resolve-interface '(gnu packages commencement)))
+              (guile  (module-ref distro 'guile-final)))
+         (package-derivation store guile system #:graft? #f)))))
+
+  (build-expression->derivation store name builder
+                                #:system system
+                                #:inputs inputs
+                                #:modules imported-modules
+                                #:outputs outputs
+                                #:guile-for-build guile-for-build))
+
+(define copy-build-system
+  (build-system
+    (name 'copy)
+    (description "The standard copy build system")
+    (lower lower)))
+
+;;; copy.scm ends here
diff --git a/guix/build/copy-build-system.scm b/guix/build/copy-build-system.scm
new file mode 100644
index 0000000000..ea37ea0161
--- /dev/null
+++ b/guix/build/copy-build-system.scm
@@ -0,0 +1,156 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build copy-build-system)
+  #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 ftw)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases
+            copy-build))
+
+;; Commentary:
+;;
+;; System for building packages that don't require much compilation, mostly
+;; only to copy files around.
+;;
+;; Code:
+
+(define* (install #:key install-plan outputs #:allow-other-keys)
+  "Copy files from the \"source\" build input to the \"out\" output according to INSTALL-PLAN.
+
+An install plan is a list of plans in the form:
+
+  (SOURCE TARGET [FILTERS])
+
+In the above, FILTERS are optional.
+
+- When SOURCE matches a file or directory without trailing slash, install it to
+  TARGET.
+  - If TARGET has a trailing slash, install SOURCE basename beneath TARGET.
+  - Otherwise install SOURCE as TARGET.
+
+- When SOURCE is a directory with a trailing slash, or when FILTERS are used,
+  the trailing slash of TARGET is implied.
+  - Without FILTERS, install the full SOURCE _content_ to TARGET.
+    The paths relative to SOURCE are preserved within TARGET.
+  - With FILTERS among `#:include`, `#:include-regexp`, `#:exclude`,
+    `#:exclude-regexp`:
+    - With `#:include`, install only the paths which suffix exactly matches
+      one of the elements in the list.
+    - With `#:include-regexp`, install subpaths matching the regexps in the list.
+    - The `#:exclude*` FILTERS work similarly.  Without `#:include*` flags,
+      install every subpath but the files matching the `#:exlude*` filters.
+      If both `#:include*` and `#:exclude*` are specified, the exclusion is done
+      on the inclusion list.
+
+Examples:
+
+- `(\"foo/bar\" \"share/my-app/\")`: Install bar to \"share/my-app/bar\".
+- `(\"foo/bar\" \"share/my-app/baz\")`: Install bar to \"share/my-app/baz\".
+- `(\"foo/\" \"share/my-app\")`: Install the content of foo inside \"share/my-app\",
+  e.g. install \"foo/sub/file\" to \"share/my-app/sub/file\".
+- `(\"foo/\" \"share/my-app\" #:include (\"sub/file\"))`: Install only \"foo/sub/file\" to
+\"share/my-app/sub/file\".
+- `(\"foo/sub\" \"share/my-app\" #:include (\"file\"))`: Install \"foo/sub/file\" to
+\"share/my-app/file\"."
+  (define (install-simple source target)
+    "TARGET must point to a store location."
+    (set! target (if (string-suffix? "/" target)
+                     (string-append target (basename source))
+                     target))
+    (mkdir-p (dirname target))
+    (copy-recursively source target))
+
+  (define (install-file file target)
+    (let ((dest (string-append target
+                               (if (string-suffix? "/" target)
+                                   (string-append "/" file)
+                                   file))))
+      (format (current-output-port) "`~a' -> `~a'~%" file dest)
+      (mkdir-p (dirname dest))
+      (copy-file file dest)))
+
+  (define* (make-file-predicate matches matches-regexp #:optional (default-value #t))
+    (if (or matches matches-regexp)
+        (lambda (file)
+          (any (lambda (pred) (pred file))
+               (append
+                (map (lambda (str)
+                       (lambda (f) (string-suffix? str f)))
+                     (or matches '()))
+                (map (lambda (regexp)
+                       (lambda (f) (regexp-exec (make-regexp regexp) f)))
+                     (or matches-regexp '())))))
+        (const default-value)))
+
+  (define* (install-file-list source target #:key include exclude include-regexp exclude-regexp)
+    ;; We must use switch current directory to source so that `find-files'
+    ;; returns file paths relative to source.
+    (with-directory-excursion source
+      (let* ((exclusion-pred (negate (make-file-predicate exclude exclude-regexp #f)))
+             (inclusion-pred (make-file-predicate include include-regexp))
+             (file-list
+              (filter! exclusion-pred
+                       (find-files "." (lambda (file _stat)
+                                         (inclusion-pred file))))))
+        (map (cut install-file <> (if (string-suffix? "/" target)
+                                      target
+                                      (string-append target "/")))
+             file-list))))
+
+  (define* (install source target #:key include exclude include-regexp exclude-regexp)
+    (set! target (string-append (assoc-ref outputs "out") "/" target))
+    (let ((filters? (or include exclude include-regexp exclude-regexp)))
+      (when (and (not (file-is-directory? source))
+                 filters?)
+        (error "Cannot use filters when SOURCE is a file."))
+      (let ((multi-files-in-source?
+             (or (string-suffix? "/" source)
+                 (and (file-is-directory? source)
+                      filters?))))
+        (if multi-files-in-source?
+            (install-file-list source target
+                               #:include include
+                               #:exclude exclude
+                               #:include-regexp include-regexp
+                               #:exclude-regexp exclude-regexp)
+            (install-simple source target)))))
+
+  (for-each (lambda (plan) (apply install plan)) install-plan)
+  #t)
+
+(define %standard-phases
+  ;; Everything is as with the GNU Build System except for the `configure'
+  ;; , `build', `check' and `install' phases.
+  (modify-phases gnu:%standard-phases
+    (delete 'bootstrap)
+    (delete 'configure)
+    (delete 'build)
+    (delete 'check)
+    (replace 'install install)))
+
+(define* (copy-build #:key inputs (phases %standard-phases)
+                     #:allow-other-keys #:rest args)
+  "Build the given package, applying all of PHASES in order."
+  (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; copy-build-system.scm ends here
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 2/4] gnu: gcide: Use the copy-build-system.
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
@ 2020-02-17 11:12   ` Pierre Neidhardt
  2020-02-17 11:12   ` [bug#39599] [PATCH 3/4] gnu: Add clojure-wrapper Pierre Neidhardt
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-17 11:12 UTC (permalink / raw)
  To: 39599

* gnu/packages/dictionaries.scm (gcide2)[build-system]: Use the
  copy-build-system.
---
 gnu/packages/dictionaries.scm | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/dictionaries.scm b/gnu/packages/dictionaries.scm
index cd0a5db93c..d40c43f74e 100644
--- a/gnu/packages/dictionaries.scm
+++ b/gnu/packages/dictionaries.scm
@@ -31,6 +31,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
+  #:use-module (guix build-system copy)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
@@ -109,25 +110,10 @@ acronyms distributed as an info document.")
               (sha256
                (base32
                 "1n3bp91sik66z3ca7mjqbr9nck3hg5ck0c8g84xc0qnfpx5vznh2"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (arguments
-     '(#:builder (begin
-                   (use-modules (guix build utils))
-                   (let* ((src     (assoc-ref %build-inputs "source"))
-                          (tar     (assoc-ref %build-inputs "tar"))
-                          (xz      (assoc-ref %build-inputs "xz"))
-                          (out     (assoc-ref %outputs "out"))
-                          (datadir (string-append out "/share/gcide")))
-                     (set-path-environment-variable "PATH" '("bin")
-                                                    (list tar xz))
-                     (mkdir-p datadir)
-                     (invoke "tar" "-C" datadir
-                             "--strip-components=1"
-                             "-xvf" src)))
-       #:modules ((guix build utils))))
-    (native-inputs
-     `(("tar" ,tar)
-       ("xz" ,xz)))
+     '(#:install-plan
+       '(("." "share/gcide/" #:exclude ("COPYING")))))
     (synopsis "GNU Collaborative International Dictionary of English")
     (description
      "GCIDE is a free dictionary based on a combination of sources.  It can
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 3/4] gnu: Add clojure-wrapper.
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
  2020-02-17 11:12   ` [bug#39599] [PATCH 2/4] gnu: gcide: Use the copy-build-system Pierre Neidhardt
@ 2020-02-17 11:12   ` Pierre Neidhardt
  2020-02-17 11:12   ` [bug#39599] [PATCH 4/4] gnu: net-base: Use copy build system Pierre Neidhardt
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-17 11:12 UTC (permalink / raw)
  To: 39599

* gnu/packages/clojure.scm (clojure-wrapper): New variable.
---
 gnu/packages/clojure.scm | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index 9a1ceed66c..f34e4dadab 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -1,8 +1,9 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
-;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2018, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Jesse Gibbons <jgibbons2357@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system ant)
   #:use-module (guix build-system clojure)
+  #:use-module (guix build-system copy)
   #:use-module (ice-9 match))
 
 (define-public clojure
@@ -321,3 +323,29 @@ tree.
      "The @code{tools.cli} library provides Clojure programmers with tools to
 work with command-line arguments.")
     (license license:epl1.0)))
+
+(define-public clojure-wrapper
+  (package
+    (name "clojure-wrapper")
+    (version "1.10.1.507")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/clojure/brew-install.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1zipz22pszv4vls4qhxkia8gm86s1wkahr0jdbqhc46mpd8n54fz"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan
+       `(("src/main/resources/" "bin/" #:include ("clj" "clojure"))
+         ("doc/clojure.1" "share/man/man1/")
+         ("epl.html" ,,(string-append "share/doc/clojure-" (package-version clojure) "/")))))
+    (synopsis "Clojure launch scripts")
+    (description "Scripts to launch Clojure from the command line.
+Without these scripts a user would need to run jar with the Clojure jar's
+location.")
+    (home-page "https://clojure.org/")
+    (license license:epl1.0)))
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 4/4] gnu: net-base: Use copy build system.
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
  2020-02-17 11:12   ` [bug#39599] [PATCH 2/4] gnu: gcide: Use the copy-build-system Pierre Neidhardt
  2020-02-17 11:12   ` [bug#39599] [PATCH 3/4] gnu: Add clojure-wrapper Pierre Neidhardt
@ 2020-02-17 11:12   ` Pierre Neidhardt
  2020-02-17 11:48   ` [bug#39599] [PATCH 1/4] build-system: Add copy-build-system Mathieu Othacehe
  2020-02-20  9:47   ` Ricardo Wurmus
  4 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-17 11:12 UTC (permalink / raw)
  To: 39599

* gnu/packages/admin.scm (net-base)[build-system]: Use copy-build-system.
---
 gnu/packages/admin.scm | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 4780fe124e..1f384edb2c 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -54,6 +54,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -566,30 +567,12 @@ to allow automatic login and starting any app.")
              (sha256
               (base32
                "12xqjwg3p4rzmmh2iib6sigm9l29y3dgk74mmnw64k84jnbwdxl1"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder (begin
-                   (use-modules (guix build utils)
-                                (srfi srfi-26))
-
-                   (let* ((source (assoc-ref %build-inputs "source"))
-                          (tar    (assoc-ref %build-inputs "tar"))
-                          (xz     (assoc-ref %build-inputs "xz"))
-                          (output (assoc-ref %outputs "out"))
-                          (etc    (string-append output "/etc")))
-                     (setenv "PATH" (string-append xz "/bin"))
-                     (invoke (string-append tar "/bin/tar") "xvf"
-                             source)
-                     (chdir ,(string-append "netbase-" version))
-                     (mkdir-p etc)
-                     (for-each copy-file
-                               '("etc-services" "etc-protocols" "etc-rpc")
-                               (map (cut string-append etc "/" <>)
-                                    '("services" "protocols" "rpc")))
-                     #t))))
-    (native-inputs `(("tar" ,tar)
-                     ("xz" ,xz)))
+     `(#:install-plan
+       `(("etc-services" "etc/services")
+         ("etc-protocols" "etc/protocols")
+         ("etc-rpc" "etc/rpc"))))
     (synopsis "IANA protocol, port, and RPC number assignments")
     (description
      "This package provides the /etc/services, /etc/protocols, and /etc/rpc
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
                     ` (2 preceding siblings ...)
  2020-02-17 11:12   ` [bug#39599] [PATCH 4/4] gnu: net-base: Use copy build system Pierre Neidhardt
@ 2020-02-17 11:48   ` Mathieu Othacehe
  2020-02-20  9:47   ` Ricardo Wurmus
  4 siblings, 0 replies; 31+ messages in thread
From: Mathieu Othacehe @ 2020-02-17 11:48 UTC (permalink / raw)
  To: 39599


Hey Pierre,

Thanks for this patch! A few remarks below.

> +@item @code{("foo/bar" "share/my-app/baz")}: Install @code{bar}t o @code{share/my-app/baz}.
                                                                   ^
                                                                   typo

> +  (and (not target)                               ;XXX: no cross-compilation

Why don't we support cross-compilation here?

> +    (set! target (if (string-suffix? "/" target)
> +                     (string-append target (basename source))
> +                     target))

We could use let instead of set!, right?

> +  (define* (make-file-predicate matches matches-regexp #:optional (default-value #t))
> +    (if (or matches matches-regexp)
> +        (lambda (file)
> +          (any (lambda (pred) (pred file))
> +               (append
> +                (map (lambda (str)
> +                       (lambda (f) (string-suffix? str f)))
> +                     (or matches '()))
> +                (map (lambda (regexp)
> +                       (lambda (f) (regexp-exec (make-regexp regexp) f)))
> +                     (or matches-regexp '())))))
> +        (const default-value)))

You could maybe explain a bit what this function does. And how 'file'
differs from 'f'.

Thanks,

Mathieu

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-14 12:51 [bug#39599] [PATCH 0/2] New build system: copy-build-system Pierre Neidhardt
  2020-02-14 12:53 ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Pierre Neidhardt
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
@ 2020-02-20  1:06 ` Alex Griffin
  2020-02-20  8:40   ` Pierre Neidhardt
  2020-02-21  3:37   ` [bug#39599] Jack Hill
  2 siblings, 2 replies; 31+ messages in thread
From: Alex Griffin @ 2020-02-20  1:06 UTC (permalink / raw)
  To: 39599, Pierre Neidhardt

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

I had to revert your documentation changes to get Guix to compile. I think you are missing '@end defvr' somewhere. Also, I packaged PaperWM using copy-build-system as an additional test case. The patch is attached.

Good work, Pierre!
-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-gnome-shell-extension-paperwm.patch --]
[-- Type: text/x-patch; name="0001-gnu-Add-gnome-shell-extension-paperwm.patch", Size: 2579 bytes --]

From 5320c5a9e1fc0c4505328bf319cd0b010f66ebb8 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Wed, 19 Feb 2020 15:46:55 -0600
Subject: [PATCH] gnu: Add gnome-shell-extension-paperwm.

* gnu/packages/gnome-xyz.scm (gnome-shell-extension-paperwm): New variable.
---
 gnu/packages/gnome-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/gnome-xyz.scm b/gnu/packages/gnome-xyz.scm
index 7f375fefc5..06af41aea6 100644
--- a/gnu/packages/gnome-xyz.scm
+++ b/gnu/packages/gnome-xyz.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2019 Leo Prikler <leo.prikler@student.tugraz.at>
 ;;; Copyright © 2019 Alexandros Theodotou <alex@zrythm.org>
 ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@
 (define-module (gnu packages gnome-xyz)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system copy)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module ((guix licenses) #:prefix license:)
@@ -304,6 +306,32 @@ It uses ES6 syntax and claims to be more actively maintained than others.")
     (home-page "https://extensions.gnome.org/extension/2182/noannoyance/")
     (license license:gpl2)))
 
+(define-public gnome-shell-extension-paperwm
+  (package
+    (name "gnome-shell-extension-paperwm")
+    (version "34.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/paperwm/PaperWM.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1qry75f696pgmd9yzqvwhq5h6cipin2fvk7h881g29cjcpxim37a"))))
+    (build-system copy-build-system)
+    (arguments
+     '(#:install-plan
+       '(("." "share/gnome-shell/extensions/paperwm@hedning:matrix.org"
+          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
+                            "\\.xml$" "\\.compiled$")))))
+    (home-page "https://github.com/paperwm/PaperWM")
+    (synopsis "Tiled scrollable window management for GNOME Shell")
+    (description "PaperWM is an experimental GNOME Shell extension providing
+scrollable tiling of windows and per monitor workspaces.  It's inspired by paper
+notebooks and tiling window managers.")
+    (license license:gpl3)))
+
 (define-public numix-theme
   (package
     (name "numix-theme")
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20  1:06 ` Alex Griffin
@ 2020-02-20  8:40   ` Pierre Neidhardt
  2020-02-20  8:44     ` Mathieu Othacehe
  2020-02-20 15:41     ` Pierre Neidhardt
  2020-02-21  3:37   ` [bug#39599] Jack Hill
  1 sibling, 2 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-20  8:40 UTC (permalink / raw)
  To: Alex Griffin, 39599

[-- Attachment #1: Type: text/plain, Size: 100 bytes --]

Great, I'll merge tomorrow then if no one objects!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20  8:40   ` Pierre Neidhardt
@ 2020-02-20  8:44     ` Mathieu Othacehe
  2020-02-20 15:41     ` Pierre Neidhardt
  1 sibling, 0 replies; 31+ messages in thread
From: Mathieu Othacehe @ 2020-02-20  8:44 UTC (permalink / raw)
  To: 39599; +Cc: a


Hello Pierre,

> Great, I'll merge tomorrow then if no one objects!

No strong objection, but I did a few remarks here[1].

Thanks,

Mathieu

[1]: https://lists.gnu.org/archive/html/guix-patches/2020-02/msg00500.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
                     ` (3 preceding siblings ...)
  2020-02-17 11:48   ` [bug#39599] [PATCH 1/4] build-system: Add copy-build-system Mathieu Othacehe
@ 2020-02-20  9:47   ` Ricardo Wurmus
  2020-02-20 10:00     ` Pierre Neidhardt
  4 siblings, 1 reply; 31+ messages in thread
From: Ricardo Wurmus @ 2020-02-20  9:47 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 39599


Pierre Neidhardt <mail@ambrevar.xyz> writes:

> +  (define* (make-file-predicate matches matches-regexp #:optional (default-value #t))
> +    (if (or matches matches-regexp)
> +        (lambda (file)
> +          (any (lambda (pred) (pred file))
> +               (append
> +                (map (lambda (str)
> +                       (lambda (f) (string-suffix? str f)))
> +                     (or matches '()))
> +                (map (lambda (regexp)
> +                       (lambda (f) (regexp-exec (make-regexp regexp) f)))
> +                     (or matches-regexp '())))))
> +        (const default-value)))

This looks too complicated.

I think this is clearer:

--8<---------------cut here---------------start------------->8---
(define* (make-file-predicate suffixes matches-regexp #:optional (default-value #t))
  (if (or suffixes matches-regexp)
      (let* ((suffixes (or suffixes '()))
             (regexps (map make-regexp (or matches-regexp '())))
             (predicates (append
                          (map (lambda (str)
                                 (cut string-suffix? str <>))
                               suffixes)
                          (map (lambda (regexp)
                                 (cut regexp-exec regexp <>))
                               regexps))))
        (lambda (file)
          (any (cut <> file) predicates)))
      (const default-value)))
--8<---------------cut here---------------end--------------->8---

Also, as Mathieu wrote, please don’t use SET!.

-- 
Ricardo

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20  9:47   ` Ricardo Wurmus
@ 2020-02-20 10:00     ` Pierre Neidhardt
  0 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-20 10:00 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 39599

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Ricardo Wurmus <rekado@elephly.net> writes:

> --8<---------------cut here---------------start------------->8---
> (define* (make-file-predicate suffixes matches-regexp #:optional (default-value #t))
>   (if (or suffixes matches-regexp)
>       (let* ((suffixes (or suffixes '()))
>              (regexps (map make-regexp (or matches-regexp '())))
>              (predicates (append
>                           (map (lambda (str)
>                                  (cut string-suffix? str <>))
>                                suffixes)
>                           (map (lambda (regexp)
>                                  (cut regexp-exec regexp <>))
>                                regexps))))
>         (lambda (file)
>           (any (cut <> file) predicates)))
>       (const default-value)))
> --8<---------------cut here---------------end--------------->8---

Good suggestion, thanks!

The logic of this function is a bit convoluted in my opinion, but I
can't think of something simpler and just as short.  But since it's a
local function, I guess it's not a big deal.

> Also, as Mathieu wrote, please don’t use SET!.

No problem, but I don't recall seeing this message.  Where did Mathieu
write this?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20  8:40   ` Pierre Neidhardt
  2020-02-20  8:44     ` Mathieu Othacehe
@ 2020-02-20 15:41     ` Pierre Neidhardt
  2020-02-20 17:09       ` [bug#39599] " Julien Lepiller
  1 sibling, 1 reply; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-20 15:41 UTC (permalink / raw)
  To: Alex Griffin, 39599, guix-devel

[-- Attachment #1: Type: text/plain, Size: 96 bytes --]

Should we add a mention in guix pull's "news"?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20 15:41     ` Pierre Neidhardt
@ 2020-02-20 17:09       ` Julien Lepiller
  2020-02-20 18:00         ` Pierre Neidhardt
  0 siblings, 1 reply; 31+ messages in thread
From: Julien Lepiller @ 2020-02-20 17:09 UTC (permalink / raw)
  To: Pierre Neidhardt, Alex Griffin, 39599

Le 20 février 2020 10:41:06 GMT-05:00, Pierre Neidhardt <mail@ambrevar.xyz> a écrit :
>Should we add a mention in guix pull's "news"?

It feels like this is an internal change that doesn't really affect end-user experience.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20 17:09       ` [bug#39599] " Julien Lepiller
@ 2020-02-20 18:00         ` Pierre Neidhardt
  2020-02-21  9:53           ` Pierre Neidhardt
  0 siblings, 1 reply; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-20 18:00 UTC (permalink / raw)
  To: Julien Lepiller, Alex Griffin, 39599

[-- Attachment #1: Type: text/plain, Size: 62 bytes --]

Fair enough.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599]
  2020-02-20  1:06 ` Alex Griffin
  2020-02-20  8:40   ` Pierre Neidhardt
@ 2020-02-21  3:37   ` Jack Hill
  2020-02-21  3:37     ` [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm Jack Hill
  1 sibling, 1 reply; 31+ messages in thread
From: Jack Hill @ 2020-02-21  3:37 UTC (permalink / raw)
  To: 39599; +Cc: Jack Hill, Alex Griffin


Alex,

On Thu, 20 Feb 2020, Alex Griffin wrote:

> I packaged PaperWM using copy-build-system as an additional test case.

This is great! I learned about PaperWM from your patch, and I've been having
lots of fun with it.

> +     '(#:install-plan
> +       '(("." "share/gnome-shell/extensions/paperwm@hedning:matrix.org"
> +          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
> +                            "\\.xml$" "\\.compiled$")))))

Seeing "compiled" here caught my attention. Since all we are doing so far is
copying files around, I expect everything to be in source form.

In this case the compiled file is a compiled glib schema. I've prepared a
second version of the patch that removes this file in a source snippet and
compiles it from the source in a new build phase.

This is another testament to the usefulness of the copy-build-system. It would
have been much more work to make the same modification to a package that uses
the trivial-build-system. Thanks Pierre!

Best,
Jack

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm.
  2020-02-21  3:37   ` [bug#39599] Jack Hill
@ 2020-02-21  3:37     ` Jack Hill
  2020-02-21 14:34       ` Alex Griffin
  0 siblings, 1 reply; 31+ messages in thread
From: Jack Hill @ 2020-02-21  3:37 UTC (permalink / raw)
  To: 39599; +Cc: Jack Hill, Alex Griffin

* gnu/packages/gnome-xyz.scm (gnome-shell-extension-paperwm): New variable.

Co-authored-by: Alex Griffin <a@ajgrf.com>
---
 gnu/packages/gnome-xyz.scm | 39 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/gnome-xyz.scm b/gnu/packages/gnome-xyz.scm
index 7f375fefc5..59913e0602 100644
--- a/gnu/packages/gnome-xyz.scm
+++ b/gnu/packages/gnome-xyz.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2019 Leo Prikler <leo.prikler@student.tugraz.at>
 ;;; Copyright © 2019 Alexandros Theodotou <alex@zrythm.org>
 ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2020 Jack Hill <jackhill@jackhill.us>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +23,7 @@
 (define-module (gnu packages gnome-xyz)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system copy)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module ((guix licenses) #:prefix license:)
@@ -304,6 +307,42 @@ It uses ES6 syntax and claims to be more actively maintained than others.")
     (home-page "https://extensions.gnome.org/extension/2182/noannoyance/")
     (license license:gpl2)))
 
+(define-public gnome-shell-extension-paperwm
+  (package
+    (name "gnome-shell-extension-paperwm")
+    (version "34.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/paperwm/PaperWM.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1qry75f696pgmd9yzqvwhq5h6cipin2fvk7h881g29cjcpxim37a"))
+              (snippet
+               '(begin (delete-file "schemas/gschemas.compiled")))))
+    (build-system copy-build-system)
+    (arguments
+     '(#:install-plan
+       '(("." "share/gnome-shell/extensions/paperwm@hedning:matrix.org"
+          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
+                            "\\.xml$" "\\.compiled$")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'compile-schemas
+           (lambda _
+             (with-directory-excursion "schemas"
+               (invoke "make")))))))
+    (native-inputs
+     `(("glib:bin" ,glib "bin"))) ; for glib-compile-schemas
+    (home-page "https://github.com/paperwm/PaperWM")
+    (synopsis "Tiled scrollable window management for GNOME Shell")
+    (description "PaperWM is an experimental GNOME Shell extension providing
+scrollable tiling of windows and per monitor workspaces.  It's inspired by paper
+notebooks and tiling window managers.")
+    (license license:gpl3)))
+
 (define-public numix-theme
   (package
     (name "numix-theme")
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-20 18:00         ` Pierre Neidhardt
@ 2020-02-21  9:53           ` Pierre Neidhardt
  2020-02-21 10:43             ` Nicolas Goaziou
  0 siblings, 1 reply; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-21  9:53 UTC (permalink / raw)
  To: Julien Lepiller, Alex Griffin, 39599

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

Pushed!
Alex, I've included your patch.
Thanks to you all!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-21  9:53           ` Pierre Neidhardt
@ 2020-02-21 10:43             ` Nicolas Goaziou
  2020-02-21 11:07               ` Pierre Neidhardt
  2020-02-21 11:50               ` Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 2 replies; 31+ messages in thread
From: Nicolas Goaziou @ 2020-02-21 10:43 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Julien Lepiller, Alex Griffin, 39599

Hello,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Pushed!

Thank you for this useful addition!

I added a few fixes to the Texinfo part of your patch.

Moreover, the indentation is very odd there, compared to the rest of
"guix.texi". You may want to normalize it.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-21 10:43             ` Nicolas Goaziou
@ 2020-02-21 11:07               ` Pierre Neidhardt
  2020-02-21 11:43                 ` Nicolas Goaziou
  2020-02-21 11:50               ` Tobias Geerinckx-Rice via Guix-patches via
  1 sibling, 1 reply; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-21 11:07 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Julien Lepiller, Alex Griffin, 39599

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Hi Nicolas!

> I added a few fixes to the Texinfo part of your patch.

Thanks for those painful changes :D
>
> Moreover, the indentation is very odd there, compared to the rest of
> "guix.texi". You may want to normalize it.

Oh, yes, I see that.  I thought it would help with readability.  How are
we supposed to visualize nested @itemize at the moment?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-21 11:07               ` Pierre Neidhardt
@ 2020-02-21 11:43                 ` Nicolas Goaziou
  2020-02-21 12:04                   ` Pierre Neidhardt
  0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2020-02-21 11:43 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Julien Lepiller, Alex Griffin, 39599

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Oh, yes, I see that.  I thought it would help with readability.  How are
> we supposed to visualize nested @itemize at the moment?

I don't think there's a clear answer, but, IMO, for readability sake, we
should not (ab)use nested lists in a manual. 

There are three levels of such lists here. I think this is not
necessary. For example

--8<---------------cut here---------------start------------->8---
@item When @var{source} matches a file or directory without trailing slash, install it to @var{target}.
  @itemize
  @item If @var{target} has a trailing slash, install @var{source} basename beneath @var{target}.
  @item Otherwise install @var{source} as @var{target}.
  @end itemize
--8<---------------cut here---------------end--------------->8---

could be written as, e.g.,

--8<---------------cut here---------------start------------->8---
@item
When @var{source} matches a file or directory without a trailing slash,
install it to @var{target}.  More accurately, if @var{target} ends with
a slash, install @var{source} basename beneath @var{target} directory.
Otherwise install @var{source} as @var{target}.
--8<---------------cut here---------------end--------------->8---

Similarly, instead of discussing about #:include and al. in a nested
list, this could happen in a subsequent paragraph, once "source" and
"target" are clarified, i.e., after "In all cases, the paths (BTW,
shouldn't it be "file names"?) relative to @var{source} are preserved
within @var{target}."

As a side note, are you sure about: "With @code{#:include}, install all
the files which (I would use "whose" here, but I'm not a native speaker)
path suffix (isn't it "basename" or, possibly better, "base name"
instead?) exactly matches one of the elements in the given list"? Do you
really mean that a file name matching two regexps is _not_ going to be
included?

Note that I know writing documentation is tedious; I don't want to sound
negative or boring.

Regards,

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-21 10:43             ` Nicolas Goaziou
  2020-02-21 11:07               ` Pierre Neidhardt
@ 2020-02-21 11:50               ` Tobias Geerinckx-Rice via Guix-patches via
  2020-02-21 12:06                 ` Pierre Neidhardt
  1 sibling, 1 reply; 31+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-02-21 11:50 UTC (permalink / raw)
  To: Pierre Neidhardt, 39599


[-- Attachment #1.1: Type: text/plain, Size: 239 bytes --]

Pierre,

Nicolas Goaziou 写道:
> Moreover, the indentation is very odd there, compared to the 
> rest of
> "guix.texi". You may want to normalize it.

More than just odd, unfortunately.  It broke ‘guix pull’ on 
master:


[-- Attachment #1.2: Type: text/plain, Size: 1335 bytes --]

./guix.de.texi:6631: warning: @end should only appear at the 
beginning of a line
./guix.de.texi:6635: warning: @itemize should only appear at the 
beginning of a line
./guix.de.texi:6635: warning: @item should not appear in @itemize
./guix.de.texi:6635: @item outside of table or list
./guix.de.texi:6639: warning: @itemize should only appear at the 
beginning of a line
./guix.de.texi:6639: warning: @item should not appear in @itemize
./guix.de.texi:6639: @item outside of table or list
./guix.de.texi:6647: warning: @end should only appear at the 
beginning of a line
./guix.de.texi:6648: superfluous argument to @end itemize:  In all 
cases, the paths relative to @var{source} are>
Backtrace:
           3 (primitive-load 
           "/gnu/store/qsd0khinmy748z6aq23ck8lcaxr?")
In ice-9/eval.scm:
    619:8  2 (_ #f)
In ice-9/boot-9.scm:
   260:13  1 (for-each #<procedure 7ffff4f4f2a0 at 
   ice-9/eval.scm:3?> ?)
In guix/build/utils.scm:
    652:6  0 (invoke _ . _)

guix/build/utils.scm:652:6: In procedure invoke:
ERROR:
  1. &invoke-error:
      program: 
      "/gnu/store/irj21yhgls637jhhkb5yr79s76c96maq-texinfo-6.6/bin/makeinfo"
      arguments: ("./guix.de.texi" "-I" 
      "/gnu/store/ygairf8pckyzl1aplf0jxmbzr9gnhjik-doc" "-I" "." 
      "-o" "/gnu/st>
      exit-status: 1
      term-signal: #f
      stop-signal: #f

[-- Attachment #1.3: Type: text/plain, Size: 379 bytes --]


I removed *all* leading whitespace in 
af51d01a8aa8d7cf529173bdb64392f14eb21962 and this fixes the 
problem.  In future, avoid it altogether.  It clashes with the 
rest of the file even when it doesn't break anything.

If you're using some kind of fancy-texinfo-mode please disable it, 
although I wonder who writes a mode that breaks things so badly 
:-p

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-21 11:43                 ` Nicolas Goaziou
@ 2020-02-21 12:04                   ` Pierre Neidhardt
  0 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-21 12:04 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Julien Lepiller, Alex Griffin, 39599

[-- Attachment #1: Type: text/plain, Size: 2716 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Pierre Neidhardt <mail@ambrevar.xyz> writes:
>
>> Oh, yes, I see that.  I thought it would help with readability.  How are
>> we supposed to visualize nested @itemize at the moment?
>
> I don't think there's a clear answer, but, IMO, for readability sake, we
> should not (ab)use nested lists in a manual. 
>
> There are three levels of such lists here. I think this is not
> necessary. For example
>
> --8<---------------cut here---------------start------------->8---
> @item When @var{source} matches a file or directory without trailing slash, install it to @var{target}.
>   @itemize
>   @item If @var{target} has a trailing slash, install @var{source} basename beneath @var{target}.
>   @item Otherwise install @var{source} as @var{target}.
>   @end itemize
> --8<---------------cut here---------------end--------------->8---
>
> could be written as, e.g.,
>
> --8<---------------cut here---------------start------------->8---
> @item
> When @var{source} matches a file or directory without a trailing slash,
> install it to @var{target}.  More accurately, if @var{target} ends with
> a slash, install @var{source} basename beneath @var{target} directory.
> Otherwise install @var{source} as @var{target}.
> --8<---------------cut here---------------end--------------->8---

Fair enough.
The idea behind the items was to structure it like a spec that would
easily translate to code then.
(I wrote these specs before writing the code.)

> Similarly, instead of discussing about #:include and al. in a nested
> list, this could happen in a subsequent paragraph, once "source" and
> "target" are clarified, i.e., after "In all cases, the paths (BTW,
> shouldn't it be "file names"?)

I don't know.  In my opinion, "file names" is often interpreted as "base
names".  Here I mean that the full subpath of the file is preserved.
May I should use "subpath" then.

> As a side note, are you sure about: "With @code{#:include}, install all
> the files which (I would use "whose" here, but I'm not a native
> speaker)

https://en.wikipedia.org/wiki/Inanimate_whose

Actually, should be "which the" or "the files the path of which".
But all this is very pedantic :)

> path suffix (isn't it "basename" or, possibly better, "base name"
> instead?)

No, it really is "path suffix" here because it matches against the
parent directories, e.g. "foo/bar" is a valid suffix.

> exactly matches one of the elements in the given list"? Do you
> really mean that a file name matching two regexps is _not_ going to be
> included?

Indeed, that's a mistake!  Thanks!.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH 1/4] build-system: Add copy-build-system.
  2020-02-21 11:50               ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-02-21 12:06                 ` Pierre Neidhardt
  0 siblings, 0 replies; 31+ messages in thread
From: Pierre Neidhardt @ 2020-02-21 12:06 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, 39599

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> I removed *all* leading whitespace in 
> af51d01a8aa8d7cf529173bdb64392f14eb21962 and this fixes the 
> problem.  In future, avoid it altogether.  It clashes with the 
> rest of the file even when it doesn't break anything.

Thanks for the fix.

> If you're using some kind of fancy-texinfo-mode please disable it, 
> although I wonder who writes a mode that breaks things so badly 
> :-p

I don't, I just indented manually.  It was impossible to read otherwise.
Well, Texinfo is a bit tedious, I guess we have to leave with it.

Crazy that "guix pull" broke and not "make".  I wonder why "guix pull"
is so sensitive.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm.
  2020-02-21  3:37     ` [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm Jack Hill
@ 2020-02-21 14:34       ` Alex Griffin
  2020-02-21 16:22         ` Jack Hill
  0 siblings, 1 reply; 31+ messages in thread
From: Alex Griffin @ 2020-02-21 14:34 UTC (permalink / raw)
  To: Jack Hill, 39599

Jack,

Thank you, I just committed your improvements with some slight modifications!

I had noticed the issue and intended to fix it myself, but after stepping away from my computer for a while, I must have forgotten about it and sent my patch too early.

-- 
Alex Griffin

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm.
  2020-02-21 14:34       ` Alex Griffin
@ 2020-02-21 16:22         ` Jack Hill
  2020-02-21 18:48           ` Alex Griffin
  0 siblings, 1 reply; 31+ messages in thread
From: Jack Hill @ 2020-02-21 16:22 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 39599

Alex,

On Fri, 21 Feb 2020, Alex Griffin wrote:

> Thank you, I just committed your improvements with some slight 
> modifications!

Thanks for the improvements. However, I don't think this change was 
warranted:

-          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
-                            "\\.xml$" "\\.compiled$")))))
+          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$" "\\.xml$")))

I think we still want to install the gschemas.compiled file that build in 
the new compile-schemas phase.

> I had noticed the issue and intended to fix it myself, but after 
> stepping away from my computer for a while, I must have forgotten about 
> it and sent my patch too early.

No worries, I'm happy to serve as a second set of eyes.

Best,
Jack

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm.
  2020-02-21 16:22         ` Jack Hill
@ 2020-02-21 18:48           ` Alex Griffin
  2020-02-21 18:51             ` Jack Hill
  0 siblings, 1 reply; 31+ messages in thread
From: Alex Griffin @ 2020-02-21 18:48 UTC (permalink / raw)
  To: Jack Hill; +Cc: 39599

On Fri, Feb 21, 2020, at 4:22 PM, Jack Hill wrote:
> Thanks for the improvements. However, I don't think this change was 
> warranted:
> 
> -          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
> -                            "\\.xml$" "\\.compiled$")))))
> +          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$" 
> "\\.xml$")))
> 
> I think we still want to install the gschemas.compiled file that build in 
> the new compile-schemas phase.

You're right of course. I just committed the fix.

-- 
Alex Griffin

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm.
  2020-02-21 18:48           ` Alex Griffin
@ 2020-02-21 18:51             ` Jack Hill
  0 siblings, 0 replies; 31+ messages in thread
From: Jack Hill @ 2020-02-21 18:51 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 39599

On Fri, 21 Feb 2020, Alex Griffin wrote:

> On Fri, Feb 21, 2020, at 4:22 PM, Jack Hill wrote:
>> Thanks for the improvements. However, I don't think this change was
>> warranted:
>>
>> -          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
>> -                            "\\.xml$" "\\.compiled$")))))
>> +          #:include-regexp ("\\.js(on)?$" "\\.css$" "\\.ui$" "\\.png$"
>> "\\.xml$")))
>>
>> I think we still want to install the gschemas.compiled file that build in
>> the new compile-schemas phase.
>
> You're right of course. I just committed the fix.

Awesome, thanks!

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2020-02-21 18:53 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-14 12:51 [bug#39599] [PATCH 0/2] New build system: copy-build-system Pierre Neidhardt
2020-02-14 12:53 ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Pierre Neidhardt
2020-02-14 12:53   ` [bug#39599] [PATCH 2/2] gnu: gcide: Use the copy-build-system Pierre Neidhardt
2020-02-14 13:39   ` [bug#39599] [PATCH 1/2] build-system: Add copy-build-system Giovanni Biscuolo
2020-02-16 13:16     ` Pierre Neidhardt
2020-02-17 11:12 ` [bug#39599] [PATCH 1/4] " Pierre Neidhardt
2020-02-17 11:12   ` [bug#39599] [PATCH 2/4] gnu: gcide: Use the copy-build-system Pierre Neidhardt
2020-02-17 11:12   ` [bug#39599] [PATCH 3/4] gnu: Add clojure-wrapper Pierre Neidhardt
2020-02-17 11:12   ` [bug#39599] [PATCH 4/4] gnu: net-base: Use copy build system Pierre Neidhardt
2020-02-17 11:48   ` [bug#39599] [PATCH 1/4] build-system: Add copy-build-system Mathieu Othacehe
2020-02-20  9:47   ` Ricardo Wurmus
2020-02-20 10:00     ` Pierre Neidhardt
2020-02-20  1:06 ` Alex Griffin
2020-02-20  8:40   ` Pierre Neidhardt
2020-02-20  8:44     ` Mathieu Othacehe
2020-02-20 15:41     ` Pierre Neidhardt
2020-02-20 17:09       ` [bug#39599] " Julien Lepiller
2020-02-20 18:00         ` Pierre Neidhardt
2020-02-21  9:53           ` Pierre Neidhardt
2020-02-21 10:43             ` Nicolas Goaziou
2020-02-21 11:07               ` Pierre Neidhardt
2020-02-21 11:43                 ` Nicolas Goaziou
2020-02-21 12:04                   ` Pierre Neidhardt
2020-02-21 11:50               ` Tobias Geerinckx-Rice via Guix-patches via
2020-02-21 12:06                 ` Pierre Neidhardt
2020-02-21  3:37   ` [bug#39599] Jack Hill
2020-02-21  3:37     ` [bug#39599] [PATCH v2] gnu: Add gnome-shell-extension-paperwm Jack Hill
2020-02-21 14:34       ` Alex Griffin
2020-02-21 16:22         ` Jack Hill
2020-02-21 18:48           ` Alex Griffin
2020-02-21 18:51             ` Jack Hill

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.