gnu: a2ps: Improve package style.

* gnu/packages/pretty-print.scm (a2ps)[origin]<snippet>: Use G-expressions.
[arguments]<#:phases>: Use G-expression and SEARCH-INPUT-FILE.
This commit is contained in:
Nicolas Goaziou 2023-04-03 12:35:33 +02:00 committed by Maxim Cournoyer
parent 4239b6ac85
commit c072084fed
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -27,6 +27,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages pretty-print) (define-module (gnu packages pretty-print)
#:use-module (guix gexp)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix licenses) #:use-module (guix licenses)
#:use-module (guix git-download) #:use-module (guix git-download)
@ -65,46 +66,46 @@ (define-public a2ps
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
;; Remove timestamp from the installed 'README' file. ;; Remove timestamp from the installed 'README' file.
'(begin #~(begin
(substitute* "etc/README.in" (substitute* "etc/README.in"
(("@date@") (("@date@")
"1st of some month, sometime after 1970")))))) "1st of some month, sometime after 1970"))))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
'(#:phases (list
(modify-phases %standard-phases #:phases
(add-after 'unpack 'skip-failing-tests #~(modify-phases %standard-phases
(lambda _ (add-after 'unpack 'skip-failing-tests
(substitute* (list "tests/Makefile.am" "tests/Makefile.in") (lambda _
(("(encoding|prolog-2)\\.tst") "")))) (substitute* (list "tests/Makefile.am" "tests/Makefile.in")
(add-before 'build 'patch-scripts (("(encoding|prolog-2)\\.tst") ""))))
(lambda _ (add-before 'build 'patch-scripts
(substitute* (lambda _
'("afm/make_fonts_map.sh" (substitute*
"tests/defs" '("afm/make_fonts_map.sh"
"tests/backup.tst" "tests/defs"
"tests/styles.tst") "tests/backup.tst"
(("/bin/rm") (which "rm"))))) "tests/styles.tst")
(add-before 'check 'patch-test-files (("/bin/rm") (which "rm")))))
;; Alternatively, we could unpatch the shebangs in tstfiles (add-before 'check 'patch-test-files
(lambda* (#:key inputs #:allow-other-keys) ;; Alternatively, we could unpatch the shebangs in tst files.
(let ((perl (assoc-ref inputs "perl"))) (lambda* (#:key inputs #:allow-other-keys)
(substitute* '("tests/ps-ref/includeres.ps" (substitute* '("tests/ps-ref/includeres.ps"
"tests/gps-ref/includeres.ps") "tests/gps-ref/includeres.ps")
(("/usr/local/bin/perl") (("/usr/local/bin/perl")
(string-append perl "/bin/perl")))) (search-input-file inputs "/bin/perl")))
;; Some of the reference postscript contain a 'version 3' ;; Some of the reference postscript contain a 'version 3'
;; string that in inconsistent with the source text in the ;; string that in inconsistent with the source text in the
;; tstfiles directory. Erroneous search-and-replace? ;; tstfiles directory. Erroneous search-and-replace?
(substitute* '("tests/ps-ref/InsertBlock.ps" (substitute* '("tests/ps-ref/InsertBlock.ps"
"tests/gps-ref/InsertBlock.ps" "tests/gps-ref/InsertBlock.ps"
"tests/ps-ref/bookie.ps" "tests/ps-ref/bookie.ps"
"tests/gps-ref/bookie.ps") "tests/gps-ref/bookie.ps")
(("version 3") "version 2")) (("version 3") "version 2"))
(substitute* '("tests/ps-ref/psmandup.ps" (substitute* '("tests/ps-ref/psmandup.ps"
"tests/gps-ref/psmandup.ps") "tests/gps-ref/psmandup.ps")
(("#! */bin/sh") (string-append (("#! */bin/sh")
"#!" (which "sh"))))))))) (string-append "#!" (which "sh")))))))))
(native-inputs (native-inputs
(list gperf groff perl pkg-config)) (list gperf groff perl pkg-config))
(inputs (inputs
@ -116,7 +117,7 @@ (define-public a2ps
printing. It accomplishes this by being able to delegate files to external printing. It accomplishes this by being able to delegate files to external
handlers, such as Groff and Gzip. It handles as many steps as is necessary to handlers, such as Groff and Gzip. It handles as many steps as is necessary to
produce a pretty-printed file. It also includes some extra abilities for produce a pretty-printed file. It also includes some extra abilities for
special cases, such as pretty-printing \"--help\" output.") special cases, such as pretty-printing @samp{-help} output.")
(license gpl3+))) (license gpl3+)))
(define-public trueprint (define-public trueprint