aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/completion/bash/guix24
-rwxr-xr-xetc/git/pre-push22
-rwxr-xr-xetc/indent-code.el.in114
-rwxr-xr-xetc/indent-package.el.in53
4 files changed, 151 insertions, 62 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index c92f8915c9..6a5f281c4f 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -26,7 +26,7 @@ _guix_complete_subcommand ()
local subcommands="$(${COMP_WORDS[0]} $command --help 2> /dev/null \
| grep '^ [a-z]' \
| sed -e's/^ \+\([a-z-]\+\).*$/\1/g')"
- COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[${#COMP_WORDS[*]} - 1]}"))
+ COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[$COMP_CWORD]}"))
}
_guix_complete_available_package ()
@@ -113,6 +113,12 @@ _guix_complete_file ()
COMPREPLY=()
}
+_guix_complete_pid ()
+{
+ local pids="$(cd /proc; echo [0-9]*)"
+ COMPREPLY=($(compgen -W "$pids" -- "$1"))
+}
+
declare _guix_subcommands
_guix_complete ()
@@ -154,11 +160,21 @@ _guix_complete ()
fi
elif _guix_is_command "system"
then
- _guix_complete_subcommand
+ case $COMP_CWORD in
+ 2) _guix_complete_subcommand;;
+ *) _guix_complete_file;; # TODO: restrict to *.scm
+ esac
+ elif _guix_is_command "container"
+ then
+ case $COMP_CWORD in
+ 2) _guix_complete_subcommand;;
+ 3) _guix_complete_pid "$word_at_point";;
+ *) _guix_complete_file;;
+ esac
elif _guix_is_command "import"
then
_guix_complete_subcommand
- elif _guix_is_command "hash"
+ elif _guix_is_command "hash" || _guix_is_command "gc"
then
_guix_complete_file
else
diff --git a/etc/git/pre-push b/etc/git/pre-push
index c894c5a9ec..9206a2dfe5 100755
--- a/etc/git/pre-push
+++ b/etc/git/pre-push
@@ -40,17 +40,29 @@ do
else
if [ "$remote_sha" = $z40 ]
then
- # New branch, examine all commits
- range="$local_sha"
+ # We are pushing a new branch. To prevent wasting too
+ # much time for this relatively rare case, we examine
+ # all commits since the first signed commit, rather than
+ # the full history. This check *will* fail, and the user
+ # will need to temporarily disable the hook to push the
+ # new branch.
+ range="e3d0fcbf7e55e8cbe8d0a1c5a24d73f341d7243b..$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi
# Verify the signatures of all commits being pushed.
- git verify-commit $(git rev-list $range) >/dev/null 2>&1
-
- exit $?
+ ret=0
+ for commit in $(git rev-list $range)
+ do
+ if ! git verify-commit $commit >/dev/null 2>&1
+ then
+ printf "%s failed signature check\n" $commit
+ ret=1
+ fi
+ done
+ exit $ret
fi
done
diff --git a/etc/indent-code.el.in b/etc/indent-code.el.in
new file mode 100755
index 0000000000..68ad72c562
--- /dev/null
+++ b/etc/indent-code.el.in
@@ -0,0 +1,114 @@
+#!@EMACS@ --script
+;;; indent-code.el --- Run Emacs to indent a package definition.
+
+;; Copyright © 2017 Alex Kost <alezost@gmail.com>
+;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+
+;; 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 <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This scripts indents the given file or package definition in the specified
+;; file using Emacs.
+
+;;; Code:
+
+;; Load Scheme indentation rules from the current directory.
+(with-temp-buffer
+ (scheme-mode)
+ (let ((default-directory (file-name-as-directory "."))
+ (enable-local-variables :all))
+ (hack-dir-local-variables)
+ (hack-local-variables-apply)))
+
+;; Add indentation info for Scheme constructs that are not Guix-specific.
+;; This is normally provided by Geiser but this file is for people who may not
+;; be running Geiser, so we just copy it here (from 'geiser-syntax.el').
+(defmacro guix-syntax--scheme-indent (&rest pairs)
+ `(progn ,@(mapcar (lambda (p)
+ `(put ',(car p) 'scheme-indent-function ',(cadr p)))
+ pairs)))
+
+(guix-syntax--scheme-indent
+ (and-let* 1)
+ (case-lambda 0)
+ (catch defun)
+ (class defun)
+ (dynamic-wind 0)
+ (guard 1)
+ (let*-values 1)
+ (let-values 1)
+ (let/ec 1)
+ (letrec* 1)
+ (match 1)
+ (match-lambda 0)
+ (match-lambda* 0)
+ (match-let scheme-let-indent)
+ (match-let* 1)
+ (match-letrec 1)
+ (opt-lambda 1)
+ (parameterize 1)
+ (parameterize* 1)
+ (receive 2)
+ (require-extension 0)
+ (syntax-case 2)
+ (test-approximate 1)
+ (test-assert 1)
+ (test-eq 1)
+ (test-equal 1)
+ (test-eqv 1)
+ (test-group-with-cleanup 1)
+ (test-runner-on-bad-count! 1)
+ (test-runner-on-bad-end-name! 1)
+ (test-runner-on-final! 1)
+ (test-runner-on-group-begin! 1)
+ (test-runner-on-group-end! 1)
+ (test-runner-on-test-begin! 1)
+ (test-runner-on-test-end! 1)
+ (test-with-runner 1)
+ (unless 1)
+ (when 1)
+ (while 1)
+ (with-exception-handler 1)
+ (with-syntax 1))
+
+
+(pcase command-line-args-left
+ (`(,file-name ,package-name)
+ ;; Indent the definition of PACKAGE-NAME in FILE-NAME.
+ (find-file file-name)
+ (goto-char (point-min))
+ (if (re-search-forward (concat "^(define\\(-public\\) +"
+ package-name)
+ nil t)
+ (let ((indent-tabs-mode nil))
+ (beginning-of-defun)
+ (indent-sexp)
+ (save-buffer)
+ (message "Done!"))
+ (error "Package '%s' not found in '%s'"
+ package-name file-name)))
+ (`(,file-name)
+ ;; Indent all of FILE-NAME.
+ (find-file file-name)
+ (let ((indent-tabs-mode nil))
+ (indent-region (point-min) (point-max))
+ (save-buffer)
+ (message "Done!")))
+ (x
+ (error "Usage: indent-code.el FILE [PACKAGE]")))
+
+;;; indent-code.el ends here
diff --git a/etc/indent-package.el.in b/etc/indent-package.el.in
deleted file mode 100755
index 3188809f0b..0000000000
--- a/etc/indent-package.el.in
+++ /dev/null
@@ -1,53 +0,0 @@
-#!@EMACS@ --script
-;;; indent-package.el --- Run Emacs to indent a package definition.
-
-;; Copyright © 2017 Alex Kost <alezost@gmail.com>
-
-;; 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 <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This scripts indents the given package definition in the specified file
-;; using Emacs.
-
-;;; Code:
-
-;; Load Scheme indentation rules from the current directory.
-(with-temp-buffer
- (scheme-mode)
- (let ((default-directory (file-name-as-directory "."))
- (enable-local-variables :all))
- (hack-dir-local-variables)
- (hack-local-variables-apply)))
-
-(pcase command-line-args-left
- (`(,file-name ,package-name)
- (find-file file-name)
- (goto-char (point-min))
- (if (re-search-forward (concat "^(define\\(-public\\) +"
- package-name)
- nil t)
- (let ((indent-tabs-mode nil))
- (beginning-of-defun)
- (indent-sexp)
- (save-buffer)
- (message "Done!"))
- (error "Package '%s' not found in '%s'"
- package-name file-name)))
- (x
- (error "Usage: indent-package.el FILE PACKAGE")))
-
-;;; indent-package.el ends here