From 5dc876231bc990650a558aeaa1823b0da3b84ab8 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 7 Sep 2015 22:58:05 -0400 Subject: build: ruby: Add support for tarball and directory sources. Previously, the Ruby build system only knew how to work with gem archives, which made it difficult to build unreleased gems from a Git repository or released gems in tarball form. * gnu/build/ruby-build-system.scm (gnu:unpack, gem-archive?): New procedures. (unpack): Use GNU build system unpack phase for non-gem sources. (build): Rebuild the gemspec iff the source is a gem archive. * guix.texi ("ruby-build-system"): Mention that tarballs and directories are acceptable. --- doc/guix.texi | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 9ae91a8d1e..ff3a9c47b7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2506,12 +2506,13 @@ This variable is exported by @code{(guix build-system ruby)}. It implements the RubyGems build procedure used by Ruby packages, which involves running @code{gem build} followed by @code{gem install}. -The @code{source} field of a package that uses this build system is -expected to reference a gem archive instead of a traditional tarball, -since this is the format that all Ruby developers use when releasing -their software. The build system unpacks the gem archive, potentially -patches the source, runs the test suite, repackages the gem, and -installs it. +The @code{source} field of a package that uses this build system +typically references a gem archive, since this is the format that Ruby +developers use when releasing their software. The build system unpacks +the gem archive, potentially patches the source, runs the test suite, +repackages the gem, and installs it. Additionally, directories and +tarballs may be referenced to allow building unreleased gems from Git or +a traditional source release tarball. Which Ruby package is used can be specified with the @code{#:ruby} parameter. A list of additional flags to be passed to the @command{gem} -- cgit v1.2.3 From 17d8e33f316b7e88aa06452f873b59770989f1b6 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sun, 13 Sep 2015 22:26:37 +0200 Subject: doc: Use the recommended Scheme format. Apply the recommended formatting rules from '.dir-locals.el' to the examples in the manual in order to fulfill it's purpose of being a reference. * doc/package-hello.scm: Indent it. * doc/guix.texi (Defining Packages, Version Numbers): Likewise. * gnu/packages/base.scm (hello): Be consistent with the manual. --- doc/guix.texi | 31 ++++++++++++++++--------------- doc/package-hello.scm | 5 +++-- gnu/packages/base.scm | 29 +++++++++++++++-------------- 3 files changed, 34 insertions(+), 31 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index ff3a9c47b7..51f7cb24b9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1963,13 +1963,14 @@ package looks like this: (define-public hello (package (name "hello") - (version "2.8") + (version "2.10") (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/hello/hello-" version - ".tar.gz")) - (sha256 - (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6")))) + (method url-fetch) + (uri (string-append "mirror://gnu/hello/hello-" version + ".tar.gz")) + (sha256 + (base32 + "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) (arguments `(#:configure-flags '("--enable-silent-rules"))) (inputs `(("gawk" ,gawk))) @@ -7232,22 +7233,22 @@ For instance, the versions 2.24.20 and 3.9.12 of GTK+ may be packaged as follows @example (define-public gtk+ (package - (name "gtk+") - (version "3.9.12") - ...)) + (name "gtk+") + (version "3.9.12") + ...)) (define-public gtk+-2 (package - (name "gtk+") - (version "2.24.20") - ...)) + (name "gtk+") + (version "2.24.20") + ...)) @end example If we also wanted GTK+ 3.8.2, this would be packaged as @example (define-public gtk+-3.8 (package - (name "gtk+") - (version "3.8.2") - ...)) + (name "gtk+") + (version "3.8.2") + ...)) @end example diff --git a/doc/package-hello.scm b/doc/package-hello.scm index b3fcd4ff73..c57eb89108 100644 --- a/doc/package-hello.scm +++ b/doc/package-hello.scm @@ -4,13 +4,14 @@ (package (name "hello") - (version "2.8") + (version "2.10") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/hello/hello-" version ".tar.gz")) (sha256 - (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6")))) + (base32 + "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) (synopsis "Hello, GNU world: An example GNU package") (description "Guess what GNU Hello prints!") diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index f35f619201..c5f447736a 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -49,22 +49,23 @@ (define-public hello (package - (name "hello") - (version "2.10") - (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/hello/hello-" version - ".tar.gz")) - (sha256 - (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) - (build-system gnu-build-system) - (synopsis "Hello, GNU world: An example GNU package") - (description - "GNU Hello prints the message \"Hello, world!\" and then exits. It + (name "hello") + (version "2.10") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/hello/hello-" version + ".tar.gz")) + (sha256 + (base32 + "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) + (build-system gnu-build-system) + (synopsis "Hello, GNU world: An example GNU package") + (description + "GNU Hello prints the message \"Hello, world!\" and then exits. It serves as an example of standard GNU coding practices. As such, it supports command-line arguments, multiple languages, and so on.") - (home-page "http://www.gnu.org/software/hello/") - (license gpl3+))) + (home-page "http://www.gnu.org/software/hello/") + (license gpl3+))) (define-public grep (package -- cgit v1.2.3 From 50f5c46d0674eb68201c56bef17b2a41c7744404 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Thu, 10 Sep 2015 15:34:58 -0500 Subject: guix: lint: Check for meaningful origin file names. * guix/scripts/lint.scm (check-source-file-name): New procedure. (%checkers): Add 'source-file-name' checker. * tests/lint.scm ("source-file-name", "source-file-name: v prefix") ("source-file-name: valid", "source-file-name: bad checkout") ("source-file-name: good checkout"): New tests. * doc/guix.texi (Invoking guix lint): Mention file name check. --- doc/guix.texi | 5 +++- guix/scripts/lint.scm | 27 ++++++++++++++++- tests/lint.scm | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 109 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 51f7cb24b9..b70be01faa 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4219,8 +4219,11 @@ Identify inputs that should most likely be native inputs. @item source @itemx home-page +@itemx source-file-name Probe @code{home-page} and @code{source} URLs and report those that are -invalid. +invalid. Check that the source file name is meaningful, e.g. is not +just a version number or ``git-checkout'', and should not have a +@code{file-name} declared (@pxref{origin Reference}). @item formatting Warn about obvious source code formatting issues: trailing white space, diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 2a618c9451..ab7d7c67dc 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Cyril Roelandt -;;; Copyright © 2014 Eric Bavier +;;; Copyright © 2014, 2015 Eric Bavier ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. @@ -57,6 +57,7 @@ check-derivation check-home-page check-source + check-source-file-name check-license check-formatting @@ -501,6 +502,26 @@ descriptions maintained upstream." (display warning (guix-warning-port))) (reverse warnings))))))))) +(define (check-source-file-name package) + "Emit a warning if PACKAGE's origin has no meaningful file name." + (define (origin-file-name-valid? origin) + ;; Return #t if the source file name contains only a version or is #f; + ;; indicates that the origin needs a 'file-name' field. + (let ((file-name (origin-actual-file-name origin)) + (version (package-version package))) + (and file-name + (not (or (string-prefix? version file-name) + ;; Common in many projects is for the filename to start + ;; with a "v" followed by the version, + ;; e.g. "v3.2.0.tar.gz". + (string-prefix? (string-append "v" version) file-name)))))) + + (let ((origin (package-source package))) + (unless (or (not origin) (origin-file-name-valid? origin)) + (emit-warning package + (_ "the source file name should contain the package name") + 'source)))) + (define (check-derivation package) "Emit a warning if we fail to compile PACKAGE to a derivation." (catch #t @@ -642,6 +663,10 @@ or a list thereof") (name 'source) (description "Validate source URLs") (check check-source)) + (lint-checker + (name 'source-file-name) + (description "Validate file names of sources") + (check check-source-file-name)) (lint-checker (name 'derivation) (description "Report failure to compile a package to a derivation") diff --git a/tests/lint.scm b/tests/lint.scm index ac47dbb768..76040c1f3e 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013 Cyril Roelandt -;;; Copyright © 2014 Eric Bavier +;;; Copyright © 2014, 2015 Eric Bavier ;;; Copyright © 2014, 2015 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. @@ -21,6 +21,7 @@ (define-module (test-lint) #:use-module (guix tests) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (guix packages) #:use-module (guix scripts lint) @@ -398,6 +399,83 @@ requests." (check-home-page pkg)))) "not reachable: 404"))) +(test-assert "source-file-name" + (->bool + (string-contains + (with-warnings + (let ((pkg (dummy-package "x" + (version "3.2.1") + (source + (origin + (method url-fetch) + (uri "http://www.example.com/3.2.1.tar.gz") + (sha256 %null-sha256)))))) + (check-source-file-name pkg))) + "file name should contain the package name"))) + +(test-assert "source-file-name: v prefix" + (->bool + (string-contains + (with-warnings + (let ((pkg (dummy-package "x" + (version "3.2.1") + (source + (origin + (method url-fetch) + (uri "http://www.example.com/v3.2.1.tar.gz") + (sha256 %null-sha256)))))) + (check-source-file-name pkg))) + "file name should contain the package name"))) + +(test-assert "source-file-name: bad checkout" + (->bool + (string-contains + (with-warnings + (let ((pkg (dummy-package "x" + (version "3.2.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "http://www.example.com/x.git") + (commit "0"))) + (sha256 %null-sha256)))))) + (check-source-file-name pkg))) + "file name should contain the package name"))) + +(test-assert "source-file-name: good checkout" + (not + (->bool + (string-contains + (with-warnings + (let ((pkg (dummy-package "x" + (version "3.2.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "http://git.example.com/x.git") + (commit "0"))) + (file-name (string-append "x-" version)) + (sha256 %null-sha256)))))) + (check-source-file-name pkg))) + "file name should contain the package name")))) + +(test-assert "source-file-name: valid" + (not + (->bool + (string-contains + (with-warnings + (let ((pkg (dummy-package "x" + (version "3.2.1") + (source + (origin + (method url-fetch) + (uri "http://www.example.com/x-3.2.1.tar.gz") + (sha256 %null-sha256)))))) + (check-source-file-name pkg))) + "file name should contain the package name")))) + (test-skip (if %http-server-socket 0 1)) (test-equal "source: 200" "" -- cgit v1.2.3 From 34850cd59d00d060c1821503ca8fb2c3b0c46162 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 12 Sep 2015 22:16:42 +0300 Subject: emacs: Add modes for viewing build logs. * emacs/guix-build-log.el: New file. * emacs.am (ELFILES): Add it. * doc/emacs.texi (Emacs Build Log): Document it. New node. (Emacs Interface): Add it. * doc/guix.texi (Top): Likewise. --- doc/emacs.texi | 31 ++++++ doc/guix.texi | 1 + emacs.am | 1 + emacs/guix-build-log.el | 252 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 285 insertions(+) create mode 100644 emacs/guix-build-log.el (limited to 'doc') diff --git a/doc/emacs.texi b/doc/emacs.texi index db2e657d27..33bdbd23d9 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -11,6 +11,7 @@ Guix convenient and fun. * Package Management: Emacs Package Management. Managing packages and generations. * Popup Interface: Emacs Popup Interface. Magit-like interface for guix commands. * Prettify Mode: Emacs Prettify. Abbreviating @file{/gnu/store/@dots{}} file names. +* Build Log Mode: Emacs Build Log. Highlighting Guix build logs. * Completions: Emacs Completions. Completing @command{guix} shell command. @end menu @@ -571,6 +572,36 @@ mode hooks (@pxref{Hooks,,, emacs, The GNU Emacs Manual}), for example: @end example +@node Emacs Build Log +@section Build Log Mode + +GNU@tie{}Guix provides major and minor modes for highlighting build +logs. So when you have a file with a package build output---for +example, a file returned by @command{guix build --log-file @dots{}} +command (@pxref{Invoking guix build}), you may call @kbd{M-x +guix-build-log-mode} command in the buffer with this file. This major +mode highlights some lines specific to build output and provides the +following key bindings: + +@table @kbd + +@item M-n +Move to the next build phase. + +@item M-p +Move to the previous build phase. + +@end table + +There is also @kbd{M-x guix-build-log-minor-mode} which also provides +the same highlighting (but not key bindings). And as it is a minor +mode, it can be enabled in any buffer. For example, if you are building +some package in a shell buffer (@pxref{Interactive Shell,,, emacs, The +GNU Emacs Manual}), you may enable @command{guix-build-log-minor-mode} +to make it more colorful. Guix build output is rather specific, so this +new highlighting shouldn't conflict with the existing one. + + @node Emacs Completions @section Shell Completions diff --git a/doc/guix.texi b/doc/guix.texi index b70be01faa..d082d63aa6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -114,6 +114,7 @@ Emacs Interface * Package Management: Emacs Package Management. Managing packages and generations. * Popup Interface: Emacs Popup Interface. Magit-like interface for guix commands. * Prettify Mode: Emacs Prettify. Abbreviating @file{/gnu/store/@dots{}} file names. +* Build Log Mode: Emacs Build Log. Highlighting Guix build logs. * Completions: Emacs Completions. Completing @command{guix} shell command. Programming Interface diff --git a/emacs.am b/emacs.am index 5d3cb81257..a9147ed21c 100644 --- a/emacs.am +++ b/emacs.am @@ -21,6 +21,7 @@ AUTOLOADS = emacs/guix-autoloads.el ELFILES = \ emacs/guix-backend.el \ emacs/guix-base.el \ + emacs/guix-build-log.el \ emacs/guix-command.el \ emacs/guix-emacs.el \ emacs/guix-external.el \ diff --git a/emacs/guix-build-log.el b/emacs/guix-build-log.el new file mode 100644 index 0000000000..6d71521a86 --- /dev/null +++ b/emacs/guix-build-log.el @@ -0,0 +1,252 @@ +;;; guix-build-log.el --- Major and minor modes for build logs -*- lexical-binding: t -*- + +;; Copyright © 2015 Alex Kost + +;; 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 this program. If not, see . + +;;; Commentary: + +;; This file provides a major mode (`guix-build-log-mode') and a minor mode +;; (`guix-build-log-minor-mode') for highlighting Guix build logs. + +;;; Code: + +(defgroup guix-build-log nil + "Settings for `guix-build-log-mode'." + :group 'guix) + +(defgroup guix-build-log-faces nil + "Faces for `guix-build-log-mode'." + :group 'guix-build-log + :group 'guix-faces) + +(defface guix-build-log-title-head + '((t :inherit font-lock-keyword-face)) + "Face for '@' symbol of a log title." + :group 'guix-build-log-faces) + +(defface guix-build-log-title-start + '((t :inherit guix-build-log-title-head)) + "Face for a log title denoting a start of a process." + :group 'guix-build-log-faces) + +(defface guix-build-log-title-success + '((t :inherit guix-build-log-title-head)) + "Face for a log title denoting a successful end of a process." + :group 'guix-build-log-faces) + +(defface guix-build-log-title-fail + '((t :inherit error)) + "Face for a log title denoting a failed end of a process." + :group 'guix-build-log-faces) + +(defface guix-build-log-title-end + '((t :inherit guix-build-log-title-head)) + "Face for a log title denoting an undefined end of a process." + :group 'guix-build-log-faces) + +(defface guix-build-log-phase-name + '((t :inherit font-lock-function-name-face)) + "Face for a phase name." + :group 'guix-build-log-faces) + +(defface guix-build-log-phase-start + '((default :weight bold) + (((class grayscale) (background light)) :foreground "Gray90") + (((class grayscale) (background dark)) :foreground "DimGray") + (((class color) (min-colors 16) (background light)) + :foreground "DarkGreen") + (((class color) (min-colors 16) (background dark)) + :foreground "LimeGreen") + (((class color) (min-colors 8)) :foreground "green")) + "Face for the start line of a phase." + :group 'guix-build-log-faces) + +(defface guix-build-log-phase-end + '((((class grayscale) (background light)) :foreground "Gray90") + (((class grayscale) (background dark)) :foreground "DimGray") + (((class color) (min-colors 16) (background light)) + :foreground "ForestGreen") + (((class color) (min-colors 16) (background dark)) + :foreground "LightGreen") + (((class color) (min-colors 8)) :foreground "green") + (t :weight bold)) + "Face for the end line of a phase." + :group 'guix-build-log-faces) + +(defface guix-build-log-phase-success + '((t)) + "Face for the 'succeeded' word of a phase line." + :group 'guix-build-log-faces) + +(defface guix-build-log-phase-fail + '((t :inherit error)) + "Face for the 'failed' word of a phase line." + :group 'guix-build-log-faces) + +(defface guix-build-log-phase-seconds + '((t :inherit font-lock-constant-face)) + "Face for the number of seconds for a phase." + :group 'guix-build-log-faces) + +(defcustom guix-build-log-mode-hook + ;; Not using `compilation-minor-mode' because it rebinds some standard + ;; keys, including M-n/M-p. + '(compilation-shell-minor-mode view-mode) + "Hook run after `guix-build-log-mode' is entered." + :type 'hook + :group 'guix-build-log) + +(defvar guix-build-log-phase-name-regexp "`\\([^']+\\)'" + "Regexp for a phase name.") + +(defvar guix-build-log-phase-start-regexp + (concat "^starting phase " guix-build-log-phase-name-regexp) + "Regexp for the start line of a 'build' phase.") + +(defun guix-build-log-title-regexp (&optional state) + "Return regexp for the log title. +STATE is a symbol denoting a state of the title. It should be +`start', `fail', `success' or `nil' (for a regexp matching any +state)." + (let* ((word-rx (rx (1+ (any word "-")))) + (state-rx (cond ((eq state 'start) (concat word-rx "started")) + ((eq state 'success) (concat word-rx "succeeded")) + ((eq state 'fail) (concat word-rx "failed")) + (t word-rx)))) + (rx-to-string + `(and bol (group "@") " " (group (regexp ,state-rx))) + t))) + +(defun guix-build-log-phase-end-regexp (&optional state) + "Return regexp for the end line of a 'build' phase. +STATE is a symbol denoting how a build phase was ended. It should be +`fail', `success' or `nil' (for a regexp matching any state)." + (let ((state-rx (cond ((eq state 'success) "succeeded") + ((eq state 'fail) "failed") + (t (regexp-opt '("succeeded" "failed")))))) + (rx-to-string + `(and bol "phase " (regexp ,guix-build-log-phase-name-regexp) + " " (group (regexp ,state-rx)) " after " + (group (1+ digit)) " seconds") + t))) + +(defvar guix-build-log-font-lock-keywords + `((,(guix-build-log-title-regexp 'start) + (1 'guix-build-log-title-head) + (2 'guix-build-log-title-start)) + (,(guix-build-log-title-regexp 'success) + (1 'guix-build-log-title-head) + (2 'guix-build-log-title-success)) + (,(guix-build-log-title-regexp 'fail) + (1 'guix-build-log-title-head) + (2 'guix-build-log-title-fail)) + (,(guix-build-log-title-regexp) + (1 'guix-build-log-title-head) + (2 'guix-build-log-title-end)) + (,guix-build-log-phase-start-regexp + (0 'guix-build-log-phase-start) + (1 'guix-build-log-phase-name prepend)) + (,(guix-build-log-phase-end-regexp 'success) + (0 'guix-build-log-phase-end) + (1 'guix-build-log-phase-name prepend) + (2 'guix-build-log-phase-success prepend) + (3 'guix-build-log-phase-seconds prepend)) + (,(guix-build-log-phase-end-regexp 'fail) + (0 'guix-build-log-phase-end) + (1 'guix-build-log-phase-name prepend) + (2 'guix-build-log-phase-fail prepend) + (3 'guix-build-log-phase-seconds prepend))) + "A list of `font-lock-keywords' for `guix-build-log-mode'.") + +(defvar guix-build-log-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map special-mode-map) + (define-key map (kbd "M-n") 'guix-build-log-next-phase) + (define-key map (kbd "M-p") 'guix-build-log-previous-phase) + map) + "Keymap for `guix-build-log-mode' buffers.") + +(defun guix-build-log-next-phase (&optional arg) + "Move to the next build phase. +With ARG, do it that many times. Negative ARG means move +backward." + (interactive "^p") + (if arg + (when (zerop arg) (user-error "Try again")) + (setq arg 1)) + (let ((search-fun (if (> arg 0) + #'re-search-forward + #'re-search-backward)) + (n (abs arg)) + found last-found) + (save-excursion + (end-of-line (if (> arg 0) 1 0)) ; skip the current line + (while (and (not (zerop n)) + (setq found + (funcall search-fun + guix-build-log-phase-start-regexp + nil t))) + (setq n (1- n) + last-found found))) + (when last-found + (goto-char last-found) + (forward-line 0)) + (or found + (user-error (if (> arg 0) + "No next build phase" + "No previous build phase"))))) + +(defun guix-build-log-previous-phase (&optional arg) + "Move to the previous build phase. +With ARG, do it that many times. Negative ARG means move +forward." + (interactive "^p") + (guix-build-log-next-phase (- (or arg 1)))) + +;;;###autoload +(define-derived-mode guix-build-log-mode special-mode + "Guix-Build-Log" + "Major mode for viewing Guix build logs. + +\\{guix-build-log-mode-map}" + (setq font-lock-defaults '(guix-build-log-font-lock-keywords t))) + +;;;###autoload +(define-minor-mode guix-build-log-minor-mode + "Toggle Guix Build Log minor mode. + +With a prefix argument ARG, enable Guix Build Log minor mode if +ARG is positive, and disable it otherwise. If called from Lisp, +enable the mode if ARG is omitted or nil. + +When Guix Build Log minor mode is enabled, it highlights build +log in the current buffer. This mode can be enabled +programmatically using hooks: + + (add-hook 'shell-mode-hook 'guix-build-log-minor-mode)" + :init-value nil + :lighter " Guix-Build-Log" + :group 'guix-build-log + (if guix-build-log-minor-mode + (font-lock-add-keywords nil guix-build-log-font-lock-keywords) + (font-lock-remove-keywords nil guix-build-log-font-lock-keywords)) + (when font-lock-mode + (font-lock-fontify-buffer))) + +(provide 'guix-build-log) + +;;; guix-build-log.el ends here -- cgit v1.2.3 From 2cbed07eef96648948cfec2e225b9dfe6f08d72c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 15 Sep 2015 21:41:03 +0200 Subject: doc: Change authorship to "The GNU Guix Developers". * doc/guix.texi: Replace outdated @author list with just "The GNU Guix Developers". --- doc/guix.texi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index d082d63aa6..e3c7660b72 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -45,9 +45,7 @@ Documentation License''. @titlepage @title GNU Guix Reference Manual @subtitle Using the GNU Guix Functional Package Manager -@author Ludovic Courtès -@author Andreas Enge -@author Nikita Karetnikov +@author The GNU Guix Developers @page @vskip 0pt plus 1filll -- cgit v1.2.3 From cbd02397b523e167c7db9775eee1be71f110482c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 15 Sep 2015 22:37:12 +0200 Subject: doc: Add guidelines for synopses and descriptions. * doc/guix.texi (Synopses and Descriptions): New node. * doc/contributing.texi (Submitting Patches): Add item that cross-references it. --- doc/contributing.texi | 4 ++++ doc/guix.texi | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'doc') diff --git a/doc/contributing.texi b/doc/contributing.texi index 7b16ea3539..ded54348bc 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -206,6 +206,10 @@ Before submitting a patch that adds or modifies a package definition, please run through this check list: @enumerate +@item +Take some time to provide an adequate synopsis and description for the +package. @xref{Synopses and Descriptions}, for some guidelines. + @item Run @code{guix lint @var{package}}, where @var{package} is the name of the new or modified package, and fix any errors it reports diff --git a/doc/guix.texi b/doc/guix.texi index e3c7660b72..cfe83909da 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -178,6 +178,7 @@ Services * X Window:: Graphical display. * Desktop Services:: D-Bus and desktop services. * Database Services:: SQL databases. +* Web Services:: Web servers. * Various Services:: Other services. Packaging Guidelines @@ -185,6 +186,7 @@ Packaging Guidelines * Software Freedom:: What may go into the distribution. * Package Naming:: What's in a name? * Version Numbers:: When the name is not enough. +* Synopses and Descriptions:: Helping users find the right package. * Python Modules:: Taming the snake. * Perl Modules:: Little pearls. * Fonts:: Fond of fonts. @@ -7158,6 +7160,7 @@ needed is to review and apply the patch. * Software Freedom:: What may go into the distribution. * Package Naming:: What's in a name? * Version Numbers:: When the name is not enough. +* Synopses and Descriptions:: Helping users find the right package. * Python Modules:: Taming the snake. * Perl Modules:: Little pearls. * Fonts:: Fond of fonts. @@ -7253,6 +7256,53 @@ If we also wanted GTK+ 3.8.2, this would be packaged as ...)) @end example +@node Synopses and Descriptions +@subsection Synopses and Descriptions + +As we have seen before, each package in GNU@tie{}Guix includes a +synopsis and a description (@pxref{Defining Packages}). Synopses and +descriptions are important: They are what @command{guix package +--search} searches, and a crucial piece of information to help users +determine whether a given package suits their needs. Consequently, +packagers should pay attention to what goes into them. + +Synopses must start with a capital letter and must not end with a +period. They must not start with ``a'' or ``the'', which usually does +not bring anything; for instance, prefer ``File-frobbing tool'' over ``A +tool that frobs files''. The synopsis should say what the package +is---e.g., ``Core GNU utilities (file, text, shell)''---or what it is +used for---e.g., the synopsis for GNU@tie{}grep is ``Print lines +matching a pattern''. + +Keep in mind that the synopsis must be meaningful for a very wide +audience. For example, ``Manipulate alignments in the SAM format'' +might make sense for a seasoned bioinformatics researcher, but might be +fairly unhelpful or even misleading to a non-specialized audience. It +is a good idea to come up with a synopsis that gives an idea of the +application domain of the package. In this example, this might give +something like ``Manipulate nucleotide sequence alignments'', which +hopefully gives the user a better idea of whether this is what they are +looking for. + +@cindex Texinfo markup, in package descriptions +Descriptions should take between five and ten lines. Use full +sentences, and avoid using acronyms without first introducing them. +Descriptions can include Texinfo markup, which is useful to introduce +ornaments such as @code{@@code} or @code{@@dfn}, bullet lists, or +hyperlinks (@pxref{Overview, overview of Texinfo,, texinfo, GNU +Texinfo}). User interfaces such as @command{guix package --show} take +care of rendering it appropriately. + +Synopses and descriptions are translated by volunteers +@uref{http://translationproject.org/domain/guix-packages.html, at the +Translation Project} so that as many users as possible can read them in +their native language. User interfaces search them and display them in +the language specified by the current locale. + +Translation is a lot of work so, as a packager, please pay even more +attention to your synopses and descriptions as every change may entail +additional work for translators. + @node Python Modules @subsection Python Modules -- cgit v1.2.3 From eda1cc8b5d68189166e1d61142aa84e5af4187c7 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Tue, 15 Sep 2015 21:27:44 +0300 Subject: emacs: Add commands to show/hide build log phases. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suggested by Ludovic Courtès . * emacs/guix-build-log.el (guix-build-log-phase-end-regexp): New variable. (guix-build-log-phase-start, guix-build-log-phase-end, guix-build-log-phase-hide, guix-build-log-phase-show, guix-build-log-phase-hidden-p, guix-build-log-phase-toggle-function, guix-build-log-phase-toggle, guix-build-log-phase-toggle-all): New functions. (guix-build-log-mode-map): Add 'TAB'/'S-TAB' key bindings. * doc/emacs.texi (Emacs Build Log): Document them. --- doc/emacs.texi | 6 ++++ emacs/guix-build-log.el | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) (limited to 'doc') diff --git a/doc/emacs.texi b/doc/emacs.texi index 33bdbd23d9..67773466a4 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -591,6 +591,12 @@ Move to the next build phase. @item M-p Move to the previous build phase. +@item @key{TAB} +Toggle (show/hide) the body of the current build phase. + +@item S-@key{TAB} +Toggle (show/hide) the bodies of all build phases. + @end table There is also @kbd{M-x guix-build-log-minor-mode} which also provides diff --git a/emacs/guix-build-log.el b/emacs/guix-build-log.el index 6d71521a86..6faa37c311 100644 --- a/emacs/guix-build-log.el +++ b/emacs/guix-build-log.el @@ -144,6 +144,12 @@ STATE is a symbol denoting how a build phase was ended. It should be (group (1+ digit)) " seconds") t))) +(defvar guix-build-log-phase-end-regexp + ;; For efficiency, it is better to have a regexp for the general line + ;; of the phase end, then to call the function all the time. + (guix-build-log-phase-end-regexp) + "Regexp for the end line of a 'build' phase.") + (defvar guix-build-log-font-lock-keywords `((,(guix-build-log-title-regexp 'start) (1 'guix-build-log-title-head) @@ -177,9 +183,84 @@ STATE is a symbol denoting how a build phase was ended. It should be (set-keymap-parent map special-mode-map) (define-key map (kbd "M-n") 'guix-build-log-next-phase) (define-key map (kbd "M-p") 'guix-build-log-previous-phase) + (define-key map (kbd "TAB") 'guix-build-log-phase-toggle) + (define-key map (kbd "") 'guix-build-log-phase-toggle) + (define-key map (kbd "") 'guix-build-log-phase-toggle-all) + (define-key map [(shift tab)] 'guix-build-log-phase-toggle-all) map) "Keymap for `guix-build-log-mode' buffers.") +(defun guix-build-log-phase-start (&optional with-header?) + "Return the start point of the current build phase. +If WITH-HEADER? is non-nil, do not skip 'starting phase ...' header. +Return nil, if there is no phase start before the current point." + (save-excursion + (end-of-line) + (when (re-search-backward guix-build-log-phase-start-regexp nil t) + (unless with-header? (end-of-line)) + (point)))) + +(defun guix-build-log-phase-end () + "Return the end point of the current build phase." + (save-excursion + (beginning-of-line) + (when (re-search-forward guix-build-log-phase-end-regexp nil t) + (point)))) + +(defun guix-build-log-phase-hide () + "Hide the body of the current build phase." + (interactive) + (let ((beg (guix-build-log-phase-start)) + (end (guix-build-log-phase-end))) + (when (and beg end) + ;; If not on the header line, move to it. + (when (and (> (point) beg) + (< (point) end)) + (goto-char (guix-build-log-phase-start t))) + (remove-overlays beg end 'invisible t) + (let ((o (make-overlay beg end))) + (overlay-put o 'evaporate t) + (overlay-put o 'invisible t))))) + +(defun guix-build-log-phase-show () + "Show the body of the current build phase." + (interactive) + (let ((beg (guix-build-log-phase-start)) + (end (guix-build-log-phase-end))) + (when (and beg end) + (remove-overlays beg end 'invisible t)))) + +(defun guix-build-log-phase-hidden-p () + "Return non-nil, if the body of the current build phase is hidden." + (let ((beg (guix-build-log-phase-start))) + (and beg + (cl-some (lambda (o) + (overlay-get o 'invisible)) + (overlays-at beg))))) + +(defun guix-build-log-phase-toggle-function () + "Return a function to toggle the body of the current build phase." + (if (guix-build-log-phase-hidden-p) + #'guix-build-log-phase-show + #'guix-build-log-phase-hide)) + +(defun guix-build-log-phase-toggle () + "Show/hide the body of the current build phase." + (interactive) + (funcall (guix-build-log-phase-toggle-function))) + +(defun guix-build-log-phase-toggle-all () + "Show/hide the bodies of all build phases." + (interactive) + (save-excursion + ;; Some phases may be hidden, and some shown. Whether to hide or to + ;; show them, it is determined by the state of the first phase here. + (goto-char (point-min)) + (guix-build-log-next-phase) + (let ((fun (guix-build-log-phase-toggle-function))) + (while (re-search-forward guix-build-log-phase-start-regexp nil t) + (funcall fun))))) + (defun guix-build-log-next-phase (&optional arg) "Move to the next build phase. With ARG, do it that many times. Negative ARG means move -- cgit v1.2.3 From cc0e575a94a4e22a0bf2bf1b0c7b0514f1c1fbb5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 20 Sep 2015 21:44:39 +0200 Subject: linux-boot: Mount /dev as a devtmpfs from the start. Suggested by Petter and Mark H Weaver . Reported by Duncan Keall . Partly fixes by populating /dev/mapper early enough. * gnu/build/linux-boot.scm (mount-essential-file-systems): Mount /dev as a devtmpfs. (move-essential-file-systems): Add /dev. (mount-root-file-system): Mount /rw-root/dev as a devtmpfs instead of calling 'make-essential-device-nodes'. (boot-system): Remove call to 'make-essential-device-nodes'. * gnu/system/file-systems.scm (%devtmpfs-file-system): Remove. * doc/guix.texi (File Systems): Adjust accordingly. --- doc/guix.texi | 7 +------ gnu/build/linux-boot.scm | 20 +++++++++----------- gnu/system/file-systems.scm | 15 +-------------- 3 files changed, 11 insertions(+), 31 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index cfe83909da..3ca4cefa63 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5295,16 +5295,11 @@ variables. @defvr {Scheme Variable} %base-file-systems These are essential file systems that are required on normal systems, -such as @var{%devtmpfs-file-system} and @var{%immutable-store} (see +such as @var{%pseudo-terminal-file-system} and @var{%immutable-store} (see below.) Operating system declarations should always contain at least these. @end defvr -@defvr {Scheme Variable} %devtmpfs-file-system -The @code{devtmpfs} file system to be mounted on @file{/dev}. This is a -requirement for udev (@pxref{Base Services, @code{udev-service}}). -@end defvr - @defvr {Scheme Variable} %pseudo-terminal-file-system This is the file system to be mounted as @file{/dev/pts}. It supports @dfn{pseudo-terminals} created @i{via} @code{openpty} and similar diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 3081a93a97..30d6570b04 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -48,7 +48,7 @@ ;;; Code: (define* (mount-essential-file-systems #:key (root "/")) - "Mount /proc and /sys under ROOT." + "Mount /dev, /proc, and /sys under ROOT." (define (scope dir) (string-append root (if (string-suffix? "/" root) @@ -60,6 +60,10 @@ (mkdir (scope "proc"))) (mount "none" (scope "proc") "proc") + (unless (file-exists? (scope "dev")) + (mkdir (scope "dev"))) + (mount "none" (scope "dev") "devtmpfs") + (unless (file-exists? (scope "sys")) (mkdir (scope "sys"))) (mount "none" (scope "sys") "sysfs")) @@ -71,7 +75,7 @@ (unless (file-exists? target) (mkdir target)) (mount dir target "" MS_MOVE))) - '("/proc" "/sys"))) + '("/dev" "/proc" "/sys"))) (define (linux-command-line) "Return the Linux kernel command line as a list of strings." @@ -100,7 +104,7 @@ with the given MAJOR number, starting with MINOR." (define* (make-essential-device-nodes #:key (root "/")) "Make essential device nodes under ROOT/dev." - ;; The hand-made udev! + ;; The hand-made devtmpfs/udev! (define (scope dir) (string-append root @@ -255,7 +259,8 @@ UNIONFS." (mount "none" "/rw-root" "tmpfs") ;; We want read-write /dev nodes. - (make-essential-device-nodes #:root "/rw-root") + (mkdir-p "/rw-root/dev") + (mount "none" "/rw-root/dev" "devtmpfs") ;; Make /root a union of the tmpfs and the actual root. Use ;; 'max_files' to set a high RLIMIT_NOFILE for the unionfs process @@ -385,9 +390,6 @@ to it are lost." (unless (configure-qemu-networking) (display "network interface is DOWN\n"))) - ;; Make /dev nodes. - (make-essential-device-nodes) - ;; Prepare the real root file system under /root. (unless (file-exists? "/root") (mkdir "/root")) @@ -405,10 +407,6 @@ to it are lost." #:volatile-root? volatile-root?) (mount "none" "/root" "tmpfs")) - (unless (file-exists? "/root/dev") - (mkdir "/root/dev") - (make-essential-device-nodes #:root "/root")) - ;; Mount the specified file systems. (for-each mount-file-system (remove root-mount-point? mounts)) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index b177f93398..8155b273e3 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -47,7 +47,6 @@ %binary-format-file-system %shared-memory-file-system %pseudo-terminal-file-system - %devtmpfs-file-system %immutable-store %control-groups %elogind-file-systems @@ -186,17 +185,6 @@ UUID representation." (type "binfmt_misc") (check? #f))) -(define %devtmpfs-file-system - ;; /dev as a 'devtmpfs' file system, needed for udev. - (file-system - (device "none") - (mount-point "/dev") - (type "devtmpfs") - (check? #f) - - ;; Mount it from the initrd so /dev/pts & co. can then be mounted over it. - (needed-for-boot? #t))) - (define %tty-gid ;; ID of the 'tty' group. Allocate it statically to make it easy to refer ;; to it from here and from the 'tty' group definitions. @@ -282,8 +270,7 @@ UUID representation." (define %base-file-systems ;; List of basic file systems to be mounted. Note that /proc and /sys are ;; currently mounted by the initrd. - (append (list %devtmpfs-file-system - %pseudo-terminal-file-system + (append (list %pseudo-terminal-file-system %shared-memory-file-system %immutable-store) %elogind-file-systems -- cgit v1.2.3