diff mbox series

[bug#65351,4/7] gnu: cgit: Use G-expressions.

Message ID fe494363a504e03759722317eaa6ab15f58fb625.1692348727.git.arunisaac@systemreboot.net
State New
Headers show
Series [bug#65351,1/7] gnu: cgit: Make git-source a native input. | expand

Commit Message

Arun Isaac Aug. 18, 2023, 9:03 a.m. UTC
* gnu/packages/version-control.scm (cgit)[arguments]: Rewrite using
G-expressions.
---
 gnu/packages/version-control.scm | 120 +++++++++++++++----------------
 1 file changed, 60 insertions(+), 60 deletions(-)

Comments

Liliana Marie Prikler Aug. 18, 2023, 5:04 p.m. UTC | #1
Am Freitag, dem 18.08.2023 um 10:03 +0100 schrieb Arun Isaac:
> * gnu/packages/version-control.scm (cgit)[arguments]: Rewrite using
> G-expressions.
> ---
>  gnu/packages/version-control.scm | 120 +++++++++++++++--------------
> --
>  1 file changed, 60 insertions(+), 60 deletions(-)
> 
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-
> control.scm
> index 73c4d8f2df..e2afd92286 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -1039,66 +1039,66 @@ (define-public cgit
>                 
> "193d990ym10qlslk0p8mjwp2j6rhqa7fq0y1iff65lvbyv914pss"))))
>      (build-system gnu-build-system)
>      (arguments
> -     '(#:tests? #f ; XXX: fail to build the in-source git.
> -       #:test-target "test"
> -       #:make-flags '("CC=gcc" "SHELL_PATH=sh")
> -       #:phases
> -       (modify-phases %standard-phases
> -         (add-after 'unpack 'unpack-git
> -           (lambda* (#:key inputs #:allow-other-keys)
> -             ;; Unpack the source of git into the 'git' directory.
> -             (invoke "tar" "--strip-components=1" "-C" "git" "-xf"
> -                     (assoc-ref inputs "git-source"))))
> -         (add-after 'unpack 'patch-absolute-file-names
> -           (lambda* (#:key inputs #:allow-other-keys)
> -             (define (quoted-file-name input path)
> -               (string-append "\"" input path "\""))
> -             (substitute* "ui-snapshot.c"
> -               (("\"gzip\"")
> -                (quoted-file-name (assoc-ref inputs "gzip")
> "/bin/gzip"))
> -               (("\"bzip2\"")
> -                (quoted-file-name (assoc-ref inputs "bzip2")
> "/bin/bzip2"))
> -               (("\"xz\"")
> -                (quoted-file-name (assoc-ref inputs "xz")
> "/bin/xz")))
> -
> -             (substitute* "filters/about-formatting.sh"
> -               (("$\\(dirname $0\\)") (string-append (assoc-ref
> outputs "out")
> -                                                    
> "/lib/cgit/filters"))
> -               (("\\| tr") (string-append "| " (which "tr"))))
> -
> -             (substitute* "filters/html-converters/txt2html"
> -               (("sed") (which "sed")))
> -
> -             (substitute* "filters/html-converters/man2html"
> -               (("groff") (which "groff")))
> -
> -             (substitute* "filters/html-converters/rst2html"
> -               (("rst2html\\.py") (which "rst2html.py")))))
> -         (delete 'configure) ; no configure script
> -         (add-after 'build 'build-man
> -           (lambda* (#:key make-flags #:allow-other-keys)
> -             (apply invoke "make" "doc-man" make-flags)))
> -         (replace 'install
> -           (lambda* (#:key make-flags outputs #:allow-other-keys)
> -             (let ((out (assoc-ref outputs "out")))
> -               (apply invoke
> -                      "make" "install" "install-man"
> -                      (string-append "prefix=" out)
> -                      (string-append "CGIT_SCRIPT_PATH=" out
> "/share/cgit")
> -                      make-flags)
> -               ;; Move the platform-dependent 'cgit.cgi' into lib to
> get it
> -               ;; stripped.
> -               (rename-file (string-append out
> "/share/cgit/cgit.cgi")
> -                            (string-append out
> "/lib/cgit/cgit.cgi")))))
> -         (add-after 'install 'wrap-python-scripts
> -           (lambda* (#:key outputs #:allow-other-keys)
> -             (for-each
> -              (lambda (file)
> -                (wrap-program (string-append (assoc-ref outputs
> "out")
> -                                             "/lib/cgit/filters/"
> file)
> -                  `("GUIX_PYTHONPATH" ":" prefix (,(getenv
> "GUIX_PYTHONPATH")))))
> -              '("syntax-highlighting.py"
> -                "html-converters/md2html")))))))
> +     (list #:tests? #f ; XXX: fail to build the in-source git.
You probably want a line break after list, because you're tending to
the column limit pretty hard.
> +           #:test-target "test"
> +           #:make-flags #~(list "CC=gcc" "SHELL_PATH=sh")
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'unpack-git
> +                 (lambda* (#:key inputs #:allow-other-keys)
> +                   ;; Unpack the source of git into the 'git'
> directory.
> +                   (invoke "tar" "--strip-components=1" "-C" "git"
> "-xf"
> +                           (assoc-ref inputs "git-source"))))
> +               (add-after 'unpack 'patch-absolute-file-names
> +                 (lambda* (#:key inputs #:allow-other-keys)
> +                   (define (quoted-file-name input path)
> +                     (string-append "\"" input path "\""))
> +                   (substitute* "ui-snapshot.c"
> +                     (("\"gzip\"")
> +                      (quoted-file-name (assoc-ref inputs "gzip")
> "/bin/gzip"))
> +                     (("\"bzip2\"")
> +                      (quoted-file-name (assoc-ref inputs "bzip2")
> "/bin/bzip2"))
> +                     (("\"xz\"")
> +                      (quoted-file-name (assoc-ref inputs "xz")
> "/bin/xz")))
> +
> +                   (substitute* "filters/about-formatting.sh"
> +                     (("$\\(dirname $0\\)") (string-append (assoc-
> ref outputs "out")
> +                                                          
> "/lib/cgit/filters"))
> +                     (("\\| tr") (string-append "| " (which "tr"))))
> +
> +                   (substitute* "filters/html-converters/txt2html"
> +                     (("sed") (which "sed")))
> +
> +                   (substitute* "filters/html-converters/man2html"
> +                     (("groff") (which "groff")))
> +
> +                   (substitute* "filters/html-converters/rst2html"
> +                     (("rst2html\\.py") (which "rst2html.py")))))
> +               (delete 'configure) ; no configure script
> +               (add-after 'build 'build-man
> +                 (lambda* (#:key make-flags #:allow-other-keys)
> +                   (apply invoke "make" "doc-man" make-flags)))
> +               (replace 'install
> +                 (lambda* (#:key make-flags outputs #:allow-other-
> keys)
> +                   (let ((out (assoc-ref outputs "out")))
> +                     (apply invoke
> +                            "make" "install" "install-man"
> +                            (string-append "prefix=" out)
> +                            (string-append "CGIT_SCRIPT_PATH=" out
> "/share/cgit")
> +                            make-flags)
> +                     ;; Move the platform-dependent 'cgit.cgi' into
> lib to get it
> +                     ;; stripped.
> +                     (rename-file (string-append out
> "/share/cgit/cgit.cgi")
> +                                  (string-append out
> "/lib/cgit/cgit.cgi")))))
> +               (add-after 'install 'wrap-python-scripts
> +                 (lambda* (#:key outputs #:allow-other-keys)
> +                   (for-each
> +                    (lambda (file)
> +                      (wrap-program (string-append (assoc-ref
> outputs "out")
> +                                                  
> "/lib/cgit/filters/" file)
> +                        `("GUIX_PYTHONPATH" ":" prefix (,(getenv
> "GUIX_PYTHONPATH")))))
> +                    '("syntax-highlighting.py"
> +                      "html-converters/md2html")))))))
>      (native-inputs
>       `(;; Building cgit requires a Git source tree.
>         ("git-source"
Cheers
Liliana Marie Prikler Aug. 18, 2023, 5:06 p.m. UTC | #2
Am Freitag, dem 18.08.2023 um 10:03 +0100 schrieb Arun Isaac:
> +               (add-after 'unpack 'unpack-git
> +                 (lambda* (#:key inputs #:allow-other-keys)
> +                   ;; Unpack the source of git into the 'git'
> directory.
> +                   (invoke "tar" "--strip-components=1" "-C" "git"
> "-xf"
> +                           (assoc-ref inputs "git-source"))))
You can probably use (dirname (search-input-file inputs "git.c")) to
locate the git input :)
Arun Isaac Aug. 21, 2023, 2:26 p.m. UTC | #3
>> +                           (assoc-ref inputs "git-source"))))
> You can probably use (dirname (search-input-file inputs "git.c")) to
> locate the git input :)

Sure, but that sounds very hacky. Unless there is a plan to deprecate
association-list style inputs altogether, I think it's ok to use them
when explicit names are required.
Arun Isaac Aug. 21, 2023, 2:27 p.m. UTC | #4
>> +     (list #:tests? #f ; XXX: fail to build the in-source git.
> You probably want a line break after list, because you're tending to
> the column limit pretty hard.

Ok, will do in the next patchset (or before pushing) once other issues
are resolved.
Liliana Marie Prikler Aug. 21, 2023, 5:07 p.m. UTC | #5
Am Montag, dem 21.08.2023 um 15:26 +0100 schrieb Arun Isaac:
> [Unless] there is a plan to deprecate association-list style inputs
> altogether [...]
While not yet a plan, it is an overall goal and we can avoid this
pattern quite easily.

Cheers
\( Aug. 21, 2023, 5:13 p.m. UTC | #6
Arun Isaac <arunisaac@systemreboot.net> writes:
> Sure, but that sounds very hacky. Unless there is a plan to deprecate
> association-list style inputs altogether, I think it's ok to use them
> when explicit names are required.

You could also replace the ASSOC-REF with an ungexped
THIS-PACKAGE-INPUT.
Arun Isaac Aug. 24, 2023, 10:59 a.m. UTC | #7
> You could also replace the ASSOC-REF with an ungexped
> THIS-PACKAGE-INPUT.

Ah, good one! I didn't know about this-package-input. I'll send an
updated patchset once we agree on other changes.

WDYT? Are there any blocking issues?
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 73c4d8f2df..e2afd92286 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1039,66 +1039,66 @@  (define-public cgit
                 "193d990ym10qlslk0p8mjwp2j6rhqa7fq0y1iff65lvbyv914pss"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f ; XXX: fail to build the in-source git.
-       #:test-target "test"
-       #:make-flags '("CC=gcc" "SHELL_PATH=sh")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'unpack-git
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; Unpack the source of git into the 'git' directory.
-             (invoke "tar" "--strip-components=1" "-C" "git" "-xf"
-                     (assoc-ref inputs "git-source"))))
-         (add-after 'unpack 'patch-absolute-file-names
-           (lambda* (#:key inputs #:allow-other-keys)
-             (define (quoted-file-name input path)
-               (string-append "\"" input path "\""))
-             (substitute* "ui-snapshot.c"
-               (("\"gzip\"")
-                (quoted-file-name (assoc-ref inputs "gzip") "/bin/gzip"))
-               (("\"bzip2\"")
-                (quoted-file-name (assoc-ref inputs "bzip2") "/bin/bzip2"))
-               (("\"xz\"")
-                (quoted-file-name (assoc-ref inputs "xz") "/bin/xz")))
-
-             (substitute* "filters/about-formatting.sh"
-               (("$\\(dirname $0\\)") (string-append (assoc-ref outputs "out")
-                                                     "/lib/cgit/filters"))
-               (("\\| tr") (string-append "| " (which "tr"))))
-
-             (substitute* "filters/html-converters/txt2html"
-               (("sed") (which "sed")))
-
-             (substitute* "filters/html-converters/man2html"
-               (("groff") (which "groff")))
-
-             (substitute* "filters/html-converters/rst2html"
-               (("rst2html\\.py") (which "rst2html.py")))))
-         (delete 'configure) ; no configure script
-         (add-after 'build 'build-man
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (apply invoke "make" "doc-man" make-flags)))
-         (replace 'install
-           (lambda* (#:key make-flags outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (apply invoke
-                      "make" "install" "install-man"
-                      (string-append "prefix=" out)
-                      (string-append "CGIT_SCRIPT_PATH=" out "/share/cgit")
-                      make-flags)
-               ;; Move the platform-dependent 'cgit.cgi' into lib to get it
-               ;; stripped.
-               (rename-file (string-append out "/share/cgit/cgit.cgi")
-                            (string-append out "/lib/cgit/cgit.cgi")))))
-         (add-after 'install 'wrap-python-scripts
-           (lambda* (#:key outputs #:allow-other-keys)
-             (for-each
-              (lambda (file)
-                (wrap-program (string-append (assoc-ref outputs "out")
-                                             "/lib/cgit/filters/" file)
-                  `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH")))))
-              '("syntax-highlighting.py"
-                "html-converters/md2html")))))))
+     (list #:tests? #f ; XXX: fail to build the in-source git.
+           #:test-target "test"
+           #:make-flags #~(list "CC=gcc" "SHELL_PATH=sh")
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'unpack-git
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Unpack the source of git into the 'git' directory.
+                   (invoke "tar" "--strip-components=1" "-C" "git" "-xf"
+                           (assoc-ref inputs "git-source"))))
+               (add-after 'unpack 'patch-absolute-file-names
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (define (quoted-file-name input path)
+                     (string-append "\"" input path "\""))
+                   (substitute* "ui-snapshot.c"
+                     (("\"gzip\"")
+                      (quoted-file-name (assoc-ref inputs "gzip") "/bin/gzip"))
+                     (("\"bzip2\"")
+                      (quoted-file-name (assoc-ref inputs "bzip2") "/bin/bzip2"))
+                     (("\"xz\"")
+                      (quoted-file-name (assoc-ref inputs "xz") "/bin/xz")))
+
+                   (substitute* "filters/about-formatting.sh"
+                     (("$\\(dirname $0\\)") (string-append (assoc-ref outputs "out")
+                                                           "/lib/cgit/filters"))
+                     (("\\| tr") (string-append "| " (which "tr"))))
+
+                   (substitute* "filters/html-converters/txt2html"
+                     (("sed") (which "sed")))
+
+                   (substitute* "filters/html-converters/man2html"
+                     (("groff") (which "groff")))
+
+                   (substitute* "filters/html-converters/rst2html"
+                     (("rst2html\\.py") (which "rst2html.py")))))
+               (delete 'configure) ; no configure script
+               (add-after 'build 'build-man
+                 (lambda* (#:key make-flags #:allow-other-keys)
+                   (apply invoke "make" "doc-man" make-flags)))
+               (replace 'install
+                 (lambda* (#:key make-flags outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     (apply invoke
+                            "make" "install" "install-man"
+                            (string-append "prefix=" out)
+                            (string-append "CGIT_SCRIPT_PATH=" out "/share/cgit")
+                            make-flags)
+                     ;; Move the platform-dependent 'cgit.cgi' into lib to get it
+                     ;; stripped.
+                     (rename-file (string-append out "/share/cgit/cgit.cgi")
+                                  (string-append out "/lib/cgit/cgit.cgi")))))
+               (add-after 'install 'wrap-python-scripts
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (for-each
+                    (lambda (file)
+                      (wrap-program (string-append (assoc-ref outputs "out")
+                                                   "/lib/cgit/filters/" file)
+                        `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH")))))
+                    '("syntax-highlighting.py"
+                      "html-converters/md2html")))))))
     (native-inputs
      `(;; Building cgit requires a Git source tree.
        ("git-source"