From b6b097ac8114510c380a9293bf50f797c57ff3ed Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 9 Jun 2014 18:54:52 +0200 Subject: guix build: Only 'guix build' sets #:print-build-trace. This makes 'guix package' et al. slightly less verbose, by not emitting "@ substituter-started" lines and similar. * guix/scripts/build.scm (set-build-options-from-command-line): Pass #:print-build-trace. (%default-options): Add 'print-build-trace?'. --- guix/scripts/build.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guix') diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 35b10a0ec2..6d864bfe3b 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -151,6 +151,7 @@ options handled by 'set-build-options-from-command-line', and listed in #:use-build-hook? (assoc-ref opts 'build-hook?) #:max-silent-time (assoc-ref opts 'max-silent-time) #:timeout (assoc-ref opts 'timeout) + #:print-build-trace (assoc-ref opts 'print-build-trace?) #:verbosity (assoc-ref opts 'verbosity))) (define %standard-build-options @@ -213,6 +214,7 @@ options handled by 'set-build-options-from-command-line', and listed in `((system . ,(%current-system)) (substitutes? . #t) (build-hook? . #t) + (print-build-trace? . #t) (max-silent-time . 3600) (verbosity . 0))) -- cgit v1.2.3 From 9d0b8fbd78552e44dcd0a7ee9933ea1e3709b07a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 13 Jun 2014 11:42:33 +0200 Subject: pull: Copy and compile gnu.scm. * guix/build/pull.scm (build-guix): Copy gnu.scm to OUT. --- guix/build/pull.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/build/pull.scm b/guix/build/pull.scm index 4bad88fe42..e5b8797503 100644 --- a/guix/build/pull.scm +++ b/guix/build/pull.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013 Ludovic Courtès +;;; Copyright © 2013, 2014 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -94,10 +94,11 @@ exit with non-zero." (format #t "copying and compiling Guix to `~a'...~%" out) - ;; Copy everything under guix/ and gnu/ plus guix.scm. + ;; Copy everything under guix/ and gnu/ plus {guix,gnu}.scm. (copy-recursively "guix" (string-append out "/guix")) (copy-recursively "gnu" (string-append out "/gnu")) (copy-file "guix.scm" (string-append out "/guix.scm")) + (copy-file "gnu.scm" (string-append out "/gnu.scm")) ;; Add a fake (guix config) module to allow the other modules to be ;; compiled. The user's (guix config) is the one that will be used. -- cgit v1.2.3 From ee76417972b3a749a28a627c2858c09311d9c0c5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 13 Jun 2014 17:30:40 +0200 Subject: Separate package description translations from string translations. * po/packages/LINGUAS, po/packages/Makevars, po/packages/POTFILES.in: New files. * po/guix/Makevars (DOMAIN): Change to "guix". (XGETTEXT_OPTIONS): Remove "--keyword=synopsis --keyword=description". * po/guix/POTFILES.in: Remove gnu/packages/*.scm. * configure.ac: Change to gettext 0.18.3. Produce po/packages/Makefile.in. * Makefile.am (SUBDIRS): Add po/packages. * guix/ui.scm (%package-text-domain): New variable. (P_): New procedure. (package->recutils): Use 'P_' instead of '_'. * guix/scripts/package.scm (find-packages-by-description): Use 'P_' instead of 'gettext'. --- .gitignore | 17 +++++++++++++++++ Makefile.am | 2 +- configure.ac | 3 ++- guix/scripts/package.scm | 6 +++--- guix/ui.scm | 11 +++++++++-- po/guix/Makevars | 6 ++---- po/guix/POTFILES.in | 5 +---- po/packages/LINGUAS | 4 ++++ po/packages/Makevars | 19 +++++++++++++++++++ po/packages/POTFILES.in | 6 ++++++ 10 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 po/packages/LINGUAS create mode 100644 po/packages/Makevars create mode 100644 po/packages/POTFILES.in (limited to 'guix') diff --git a/.gitignore b/.gitignore index 755773567c..dacd234c9b 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,23 @@ config.cache /po/guix/guix.pot /po/guix/*.mo /po/guix/*.gmo +/po/packages/ChangeLog +/po/packages/Makefile.in.in +/po/packages/Makevars.template +/po/packages/POTFILES +/po/packages/Rules-quot +/po/packages/boldquot.sed +/po/packages/en@boldquot.* +/po/packages/en@quot.* +/po/packages/insert-header.sin +/po/packages/*.insert-header +/po/packages/quot.sed +/po/packages/remove-potcdate.sed +/po/packages/remove-potcdate.sin +/po/packages/stamp-po +/po/packages/guix-packages.pot +/po/packages/*.mo +/po/packages/*.gmo /tests/*.trs /INSTALL /m4/* diff --git a/Makefile.am b/Makefile.am index 6c63c96345..c2345409a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -246,7 +246,7 @@ SUFFIXES = .go guix_install_go_files = install-nobase_nodist_guilemoduleDATA $(guix_install_go_files): install-nobase_dist_guilemoduleDATA -SUBDIRS = po/guix +SUBDIRS = po/guix po/packages include doc.am diff --git a/configure.ac b/configure.ac index 398d8fc705..eb038db253 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ dnl For the C++ code. This must be used early. AC_USE_SYSTEM_EXTENSIONS AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION([0.18.1]) +AM_GNU_GETTEXT_VERSION([0.18.3]) guilemoduledir="${datarootdir}/guile/site/2.0" AC_SUBST([guilemoduledir]) @@ -167,6 +167,7 @@ AM_MISSING_PROG([DOT], [dot]) AC_CONFIG_FILES([Makefile po/guix/Makefile.in + po/packages/Makefile.in guix/config.scm]) AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix]) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 3947159c2e..f930b00804 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -228,11 +228,11 @@ RX." (define matches? (cut regexp-exec rx <>)) - (if (or (matches? (gettext (package-name package))) + (if (or (matches? (package-name package)) (and=> (package-synopsis package) - (compose matches? gettext)) + (compose matches? P_)) (and=> (package-description package) - (compose matches? gettext))) + (compose matches? P_))) (cons package result) result)) '()) diff --git a/guix/ui.scm b/guix/ui.scm index 48b5c745c6..6fef9b36e4 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -39,6 +39,7 @@ #:use-module (ice-9 regex) #:export (_ N_ + P_ leave show-version-and-exit show-bug-report-information @@ -72,10 +73,16 @@ ;;; Code: (define %gettext-domain + ;; Text domain for strings used in the tools. "guix") +(define %package-text-domain + ;; Text domain for package synopses and descriptions. + "guix-packages") + (define _ (cut gettext <> %gettext-domain)) (define N_ (cut ngettext <> <> <> %gettext-domain)) +(define P_ (cut gettext <> %package-text-domain)) (define-syntax-rule (define-diagnostic name prefix) "Create a diagnostic macro (i.e., NAME), which will prepend PREFIX to all @@ -431,7 +438,7 @@ followed by \"+ \", which makes for a valid multi-line field value in the "Write to PORT a `recutils' record of package P, arranging to fit within WIDTH columns." (define (description->recutils str) - (let ((str (_ str))) + (let ((str (P_ str))) (string->recutils (fill-paragraph str width (string-length "description: "))))) @@ -460,7 +467,7 @@ WIDTH columns." (string-map (match-lambda (#\newline #\space) (chr chr)) - (or (and=> (package-synopsis p) _) + (or (and=> (package-synopsis p) P_) ""))) (format port "description: ~a~%" (and=> (package-description p) description->recutils)) diff --git a/po/guix/Makevars b/po/guix/Makevars index 3f85141efb..87bb438418 100644 --- a/po/guix/Makevars +++ b/po/guix/Makevars @@ -1,17 +1,15 @@ # Makefile variables for PO directory in any package using GNU gettext. -DOMAIN = $(PACKAGE) +DOMAIN = guix subdir = po/guix top_builddir = ../.. # These options get passed to xgettext. We want to catch standard -# gettext uses, package synopses and descriptions, and SRFI-35 error -# condition messages. +# gettext uses, and SRFI-35 error condition messages. XGETTEXT_OPTIONS = \ --language=Scheme --from-code=UTF-8 \ --keyword=_ --keyword=N_ \ - --keyword=synopsis --keyword=description \ --keyword=message COPYRIGHT_HOLDER = Ludovic Courtès diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index ef864fe817..bf2d31306a 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -1,9 +1,6 @@ # List of source files which contain translatable strings. +# This should be source files of the various tools, and not package modules. gnu/packages.scm -gnu/packages/base.scm -gnu/packages/guile.scm -gnu/packages/lout.scm -gnu/packages/recutils.scm guix/scripts/build.scm guix/scripts/download.scm guix/scripts/package.scm diff --git a/po/packages/LINGUAS b/po/packages/LINGUAS new file mode 100644 index 0000000000..dcb16dfaa7 --- /dev/null +++ b/po/packages/LINGUAS @@ -0,0 +1,4 @@ +# Set of available languages. + +en@boldquot +en@quot diff --git a/po/packages/Makevars b/po/packages/Makevars new file mode 100644 index 0000000000..1b4689b7c3 --- /dev/null +++ b/po/packages/Makevars @@ -0,0 +1,19 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# This domain contains only translations of package synopses and descriptions. +DOMAIN = guix-packages + +subdir = po/packages +top_builddir = ../.. + +# These options get passed to xgettext. We want to catch exclusively package +# synopses and descriptions. +XGETTEXT_OPTIONS = \ + --language=Scheme --from-code=UTF-8 \ + --keyword=synopsis --keyword=description + +COPYRIGHT_HOLDER = Ludovic Courtès + +MSGID_BUGS_ADDRESS = ludo@gnu.org + +EXTRA_LOCALE_CATEGORIES = diff --git a/po/packages/POTFILES.in b/po/packages/POTFILES.in new file mode 100644 index 0000000000..43db1b2719 --- /dev/null +++ b/po/packages/POTFILES.in @@ -0,0 +1,6 @@ +# List of source files which contain translatable strings. These should be +# only package modules. Strings of the tools are in 'po/guix'. +gnu/packages/base.scm +gnu/packages/guile.scm +gnu/packages/lout.scm +gnu/packages/recutils.scm -- cgit v1.2.3 From 56b821069722c6341e9079299d90ae1cdfe9a916 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 14 Jun 2014 22:37:24 +0200 Subject: guix build: Allow gexps to be passed to '-e'. * guix/ui.scm (%guix-user-module): New variable. (read/eval): Pass it as the second argument to 'eval'. * guix/scripts/build.scm (options/resolve-packages): Add case for 'gexp?'. * tests/guix-build.sh: Add tests. * doc/guix.texi (Invoking guix build): Document '-e gexp'. guxi build: Allow gexps to be passed to '-e'. * guix/ui.scm (%guix-user-module): New variable. (read/eval): Pass it as the second argument to 'eval'. * guix/scripts/build.scm (options/resolve-packages): Add case for 'gexp?'. * tests/guix-build.sh: Add tests. * doc/guix.texi (Invoking guix build): Document '-e gexp'. --- doc/guix.texi | 6 +++++- guix/scripts/build.scm | 6 ++++++ guix/ui.scm | 10 +++++++++- tests/guix-build.sh | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/doc/guix.texi b/doc/guix.texi index c1e51eac94..c14272ed9a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2244,7 +2244,11 @@ For example, @var{expr} may be @code{(@@ (gnu packages guile) guile-1.8)}, which unambiguously designates this specific variant of version 1.8 of Guile. -Alternately, @var{expr} may refer to a zero-argument monadic procedure +Alternately, @var{expr} may be a G-expression, in which case it is used +as a build program passed to @code{gexp->derivation} +(@pxref{G-Expressions}). + +Lastly, @var{expr} may refer to a zero-argument monadic procedure (@pxref{The Store Monad}). The procedure must return a derivation as a monadic value, which is then passed through @code{run-with-store}. diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 6d864bfe3b..5e4647de79 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -24,6 +24,7 @@ #:use-module (guix packages) #:use-module (guix utils) #:use-module (guix monads) + #:use-module (guix gexp) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (ice-9 vlist) @@ -338,6 +339,11 @@ packages." `(argument . ,p)) ((? procedure? proc) (let ((drv (run-with-store store (proc) #:system system))) + `(argument . ,drv))) + ((? gexp? gexp) + (let ((drv (run-with-store store + (gexp->derivation "gexp" gexp + #:system system)))) `(argument . ,drv))))) (opt opt)) opts)) diff --git a/guix/ui.scm b/guix/ui.scm index 6fef9b36e4..beb41e925a 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -238,6 +238,14 @@ interpreted." (leave (_ "~a: ~a~%") proc (apply format #f format-string format-args)))))) +(define %guix-user-module + ;; Module in which user expressions are evaluated. + (let ((module (make-module))) + (beautify-user-module! module) + ;; Use (guix gexp) so that one can use #~ & co. + (module-use! module (resolve-interface '(guix gexp))) + module)) + (define (read/eval str) "Read and evaluate STR, raising an error if something goes wrong." (let ((exp (catch #t @@ -248,7 +256,7 @@ interpreted." str args))))) (catch #t (lambda () - (eval exp the-root-module)) + (eval exp %guix-user-module)) (lambda args (leave (_ "failed to evaluate expression `~a': ~s~%") exp args))))) diff --git a/tests/guix-build.sh b/tests/guix-build.sh index e0c774d055..7c6594775a 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -80,3 +80,7 @@ guix build -e "(begin (gexp->derivation \"test\" (gexp (mkdir (ungexp output))))))" \ --dry-run + +# Running a gexp. +guix build -e '#~(mkdir #$output)' -d +guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv' -- cgit v1.2.3 From 07254feb24d755a01c63b64c1df1bfb68ac469bf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 14 Jun 2014 23:23:56 +0200 Subject: ui: Avoid circularity with (guix gexp). Fixes a regression introduced in 56b8210 ("guix build: Allow gexps to be passed to '-e'.") * guix/ui.scm (%guix-user-module): Wrap in 'delay'. (read/eval): Adjust accordingly. --- guix/ui.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'guix') diff --git a/guix/ui.scm b/guix/ui.scm index beb41e925a..7338b82401 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -240,11 +240,13 @@ interpreted." (define %guix-user-module ;; Module in which user expressions are evaluated. - (let ((module (make-module))) - (beautify-user-module! module) - ;; Use (guix gexp) so that one can use #~ & co. - (module-use! module (resolve-interface '(guix gexp))) - module)) + ;; Compute lazily to avoid circularity with (guix gexp). + (delay + (let ((module (make-module))) + (beautify-user-module! module) + ;; Use (guix gexp) so that one can use #~ & co. + (module-use! module (resolve-interface '(guix gexp))) + module))) (define (read/eval str) "Read and evaluate STR, raising an error if something goes wrong." @@ -256,7 +258,7 @@ interpreted." str args))))) (catch #t (lambda () - (eval exp %guix-user-module)) + (eval exp (force %guix-user-module))) (lambda args (leave (_ "failed to evaluate expression `~a': ~s~%") exp args))))) -- cgit v1.2.3