aboutsummaryrefslogtreecommitdiff
path: root/etc/git/pre-push
blob: 9206a2dfe53e292881247aefc5d408ab21d94212 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh

# This hook script prevents the user from pushing to Savannah if any of the new
# commits' OpenPGP signatures cannot be verified.

# Called by "git push" after it has checked the remote status, but before
# anything has been pushed.  If this script exits with a non-zero status nothing
# will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
#   <local ref> <local sha1> <remote ref> <remote sha1>

z40=0000000000000000000000000000000000000000

# Only use the hook when pushing to Savannah.
case "$2" in
*git.sv.gnu.org*)
	break
	;;
*)
	exit 0
	;;
esac

while read local_ref local_sha remote_ref remote_sha
do
	if [ "$local_sha" = $z40 ]
	then
		# Handle delete
		:
	else
		if [ "$remote_sha" = $z40 ]
		then
			# 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.
		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

exit 0
f75c3c4964 texlive-source Change-Id: I198a361fd6df3c5dd2b4fa376e1ad623937f08cc 2024-08-31guix: import texlive: Handle versions.Nicolas Goaziou * guix/import/texlive.scm (texlive-repository): (texlive-repository-location): (svn-command): (version->revision): (current-day): (latest-texlive-tag): (texlive->svn-multi-reference): New variables. (tlpdb-file) Remove function. (tlpdb): Add VERSION argument. * guix/import/texlive.scm (list-upstream-inputs): Add VERSION and DATABASE arguments. (tlpdb->package): Do not use fixed version. Instead, make use of the version provided as an argument. Add DATABASE argument for testing. (texlive->guix-package): Do not memoize. Allow providing any TeX Live release tag as version. Default to latest tag. Add DATABASE argument for testing. Improve docstring. * tests/texlive.scm ("texlive->guix-package, no docfiles"): ("texlive->guix-package"): ("texlive->guix-package, with METAFONT files"): ("texlive->guix-package, with catalogue entry, no inputs"): ("texlive->guix-package, multiple licenses"): ("texlive->guix-package, meta-package"): ("texlive->guix-package, with TeX format"): ("texlive->guix-package, execute but no TeX format"): ("texlive->guix-package, translate dependencies"): ("texlive->guix-package, lonely `hyphen-base' dependency and ARCH"): ("texlive->guix-package, single script, no extension"): ("texlive->guix-package, multiple scripts, with extensions"): ("texlive->guix-package, script with associated input"): ("texlive->guix-package, propagated binaries, no script"): ("texlive->guix-package, propagated binaries and scripts"): ("texlive->guix-package, with skipped propagated binaries"): Update tests. Change-Id: I7576b6e31e9ec3ff84258b71d0c4dd180d2b5c38 2024-08-31guix: import texlive: Propagate binaries when necessary.Nicolas Goaziou * guix/import/texlive.scm (no-bin-propagation-packages): New variable. (list-binfiles): New function. (linked-scripts): Renamed to... (list-linked-scripts): ... this. Now always return a list. (tlpdb->package): Handle binary propagation. * tests/texlive.scm (%fake-tlpdb): Add data for new tests. ("texlive->guix-package, propagated binaries, no script"): ("texlive->guix-package, propagated binaries and scripts"): ("texlive->guix-package, with skipped propagated binaries"): New tests. Change-Id: I707ba33a10aa98ad27151724d3ecc4158db6b7cc 2024-08-31import: go: Emit new-style package inputs.Sarah Morgensen Since PACKAGE-NAMES->PACKAGE-INPUTS is used by both the go and crate importers, give the crate importer a copy of the original so it continues to use old-style inputs until it is updated. * guix/import/utils.scm (package-names->package-inputs)[make-input]: Return new-style package inputs. (maybe-inputs): Wrap PACKAGE-INPUTS in 'list' instead of 'quasiquote'. * guix/import/crate.scm (package-names->package-inputs): New variable. * tests/go.scm ("go-module->guix-package"): Adjust to new-style package inputs. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> 2024-08-31import: crate: Emit new-style package inputs.Sarah Morgensen * guix/import/crate.scm (maybe-cargo-development-inputs) (maybe-cargo-inputs): Wrap PACKAGE-INPUTS in unquoted 'list'. * tests/crate.scm ("crate->guix-package") ("cargo-recursive-import") ("cargo-recursive-import-honors-existing-packages"): Adjust accordingly. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Change-Id: I4dfb745272ecbc893926446872514fb815c07236 2024-08-31profiles: Use C.UTF-8 instead of ‘glibc-utf8-locales’ where possible.Ludovic Courtès This is a followup to 1cebc334a77030c0c94955981652f4df7608c9e3. * guix/profiles.scm (ca-certificate-bundle)[libc-utf8-locales-for-target]: Remove. [build]: Use “C.UTF-8” instead of “en_US.utf8”. (profile-derivation)[libc-utf8-locales-for-target]: Remove. [set-utf8-locale]: Rewrite to a gexp that calls ‘setlocale’ for “C.UTF-8”. * tests/profiles.scm ("profile-derivation, cross-compilation"): Remove ‘locales’ variable and related check. Change-Id: I7cb148b9149fe5fbe5b9b1b25fdce1002ad1f37e 2024-08-31build-systems: gnu: Export %default-gnu-imported-modules and ↵Maxim Cournoyer %default-gnu-modules. Until now users would have to cargo cult or inspect the private %default-modules variable of (guix build-systems gnu) to discover which modules to include when extending the used modules via the #:modules argument. The renaming was automated via the command: $ git grep -l %gnu-build-system-modules | xargs sed 's/%gnu-build-system-modules/%default-gnu-imported-modules/' -i * guix/build-system/gnu.scm (%gnu-build-system-modules): Rename to... (%default-gnu-imported-modules): ... this. (%default-modules): Rename to... (%default-gnu-modules): ... this. Export. (dist-package, gnu-build, gnu-cross-build): Adjust accordingly. Change-Id: Idef307fff13cb76f3182d782b26e1cd3a5c757ee 2024-08-31build: utils: Raise error in modify-phases upon missing key.Carlo Zancanaro * guix/build/utils.scm (alist-cons-before) (alist-cons-after): Error with a match failure if the reference is not found, instead of appending to the alist. * tests/build-utils.scm: Update tests to match the new behavior. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Change-Id: I3044b101bd06231d5cd55a544ac1009e6ce6f9a0 2024-08-21cache: Avoid cache cleanup storms from concurrent processes.Ludovic Courtès Reported by Christopher Baines <guix@cbaines.net>. * guix/cache.scm (maybe-remove-expired-cache-entries): Define ‘expiry-port’; create it with ‘lock-file’. Change ‘last-expiry-date’ accordingly. Write timestamp straight to ‘expiry-port’. * tests/cache.scm ("maybe-remove-expired-cache-entries, cleanup needed but lock taken"): New test. Change-Id: I22441d9d2c4a339d3d3878de131864db5a0ae826 2024-08-21syscalls: Add ‘mode’ parameter to ‘lock-file’.Ludovic Courtès * guix/build/syscalls.scm (lock-file): Add ‘mode’ parameter and honor it. * tests/syscalls.scm ("lock-file + unlock-file"): New test. Change-Id: I113fb4a8b35dd8782b9c0991574e39a4b4393333 2024-08-01tests: gexp: Handle incorrect guile-bootstrap version for riscv.Christopher Baines The tests currently fail when run on riscv-linux (affecting the guix package) because Guile 3 is used as the bootstrap guile. Correcting the package version seems hard, so I'm just tweaking the tests to use the right effective version for riscv64-linux. * tests/gexp.scm (bootstrap-guile-effective-version): New procedure. ("gexp->derivation & with-extensions", "lower-gexp", "lower-gexp, raw-derivation-file"): Use bootstrap-guile-effective-version. Change-Id: I3995e1f6b58ada1baf38a8ec55b0173059dd0079 2024-07-18modules: ‘file-name->module-name’ strips leading “./”.Ludovic Courtès Fixes <https://issues.guix.gnu.org/71979>. * guix/modules.scm (file-name->module-name): Strip leading “.” component from FILE. * tests/modules.scm ("file-name->module-name") ("file-name->module-name, leading dot"): New tests. Reported-by: Tomas Volf <~@wolfsden.cz> Change-Id: I3d1b9f3f21448050cac4f3b1aed5f8f03758d4c9 2024-07-18git: Remove untracked files from cached checkouts.Ludovic Courtès Cached checkouts could end up with stale untracked files, for example because the checkout was interrupted. As a result, when this happens for the Guix checkout, users would not get substitutes for ‘guix pull’. * guix/git.scm (delete-untracked-files): New procedure. (switch-to-ref): Use it. * tests/git.scm ("update-cached-checkout, untracked files removed"): New test. Co-authored-by: Ricardo Wurmus <rekado@elephly.net> Change-Id: Iccbe644ade396ad27a037db7e0ef1c2a68ef91ce 2024-07-18guix build: Take ‘--system’ into account together with ‘-S’.Ludovic Courtès * guix/scripts/build.scm (options->derivations)[compute-derivation]: Pass ‘system’ to ‘package-source-derivation’. * tests/guix-build.sh: Test ‘-S’ together with ‘-s’. Change-Id: If35f116285dd9caaf939221163ad0ba831eea993 2024-07-10pack: Create /tmp in Apptainer images.Lars Bilke Related to <https://bugs.gnu.org/37161> and <https://git.savannah.gnu.org/cgit/guix.git/commit/?id=7979a287f8eb84cbbfa44629951572408939a756>. * guix/scripts/pack.scm (squashfs-image)[build]: Add /tmp to the set of directories created. * tests/pack.scm ("squashfs-image + localstatedir"): Check for /tmp. Change-Id: I576aaa6ba8cb8478acf4c3144d492ae5caf411ca Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2024-06-13tests: Adjust ‘guix system’ test for EFI bootloader.Ludovic Courtès This is a followup to e5078ff3210f4a9863b641a60430b2cb3c9c15ee, which broke this test: $ guix system disk-image -n gnu/system/examples/desktop.tmpl guix system: warning: 'disk-image' is deprecated: use 'image' instead guix system: error: EFI bootloader required with GPT partitioning * tests/guix-system.sh: Use ‘guix system image’ instead of ‘guix system disk-image’. Pass ‘-t efi-raw’ for ‘desktop.tmpl’. Change-Id: I6877085ab33d9e8b471315b806fed22a7d1241a3 2024-06-13tests: Fix ‘beautify-description’ test.Ludovic Courtès This is a followup to 510ad5d93c0ba6208aa42815863853ec522352e6. * tests/import-utils.scm ("beautify-description: transform fragment into sentence"): Fix. Change-Id: I331cb38a3460a024a789846772a074ba0b6c857c 2024-06-03import: utils: End package descriptions with period.Herman Rimm * guix/import/utils.scm (beautify-description): Append period to last words which do not end with one. * tests/crate.scm: Append period to descriptions. * tests/elm.scm: Append period to descriptions. * tests/gem.scm: Append period to descriptions. * tests/hexpm.scm: Append period to descriptions. * tests/minetest.scm: Append period to descriptions. * tests/pypi.scm: Append period to descriptions. * tests/import-utils.scm ("beautify-description: transform fragment into sentence"): Likewise. Change-Id: I0b12c4d94cb26cf62fab5b7cbf7885e66ff6c10f Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2024-06-03import: crate: Include a main verb in crate importer descriptions.Herman Rimm * guix/import/crate.scm (make-crate-sexp): Start description with 'This package provides '. * tests/crate.scm: Set descriptions to "This package provides summary". Signed-off-by: Ludovic Courtès <ludo@gnu.org> Change-Id: If0f47a68f986b9e878fd5caa3e365c5ad863089a 2024-06-03style: Fix conversion of ‘unquote-splicing’ by ‘-S arguments’.Ludovic Courtès * guix/scripts/style.scm (unquote->ungexp): Add missing comma for ‘ungexp-splicing’. * tests/style.scm ("gexpify arguments, substitute-keyword-arguments + unquote-splicing"): New test. Change-Id: I17dcdd9b4812d54ddba1137e369360706b137bb4 2024-05-25deduplication: Detect holes and create sparse files.Ludovic Courtès This reduces disk usage of sparse files that are substituted such as Guile object files (ELF files). As of Guile 3.0.9, .go files are sparse due to ELF sections being aligned on 64 KiB boundaries. This reduces disk usage reported by “du -sh” by 9% for the ‘guix’ package, by 23% for ‘guile’, and by 35% for ‘guile-git’. * guix/store/deduplication.scm (hole-size, find-holes): New procedures. (tee)[seekable?]: New variable. [read!]: Add case when SEEKABLE? is true. * tests/store-deduplication.scm (cartesian-product): New procedure. ("copy-file/deduplicate, sparse files (holes: ~a/~a/~a)"): New test set. Change-Id: Iad2ab7830dcb1220e2026f4a127a6c718afa8964 2024-05-19import: Add binary npm importer.Jelle Licht * guix/scripts/import.scm: (importers): Add "npm-binary". * doc/guix.texi (Invoking guix import): Document npm-binary importer. * guix/import/npm-binary.scm: New file. * guix/scripts/import/npm-binary.scm: New file. * tests/npm-binary.scm: New file. * Makefile.am: Add them. Co-authored-by: Timothy Sample <samplet@ngyro.com> Co-authored-by: Lars-Dominik Braun <lars@6xq.net> Change-Id: I98a45068cf5b9c42790664cc743feaa7ac76f807 2024-05-13tests: Skip ‘terminal-string-width’ test on encodings other than UTF-8.Ludovic Courtès * tests/syscalls.scm ("terminal-string-width Japanese"): Skip when the encoding of (current-output-port) is not UTF-8. Reported-by: Ashvith Shetty <ashvithshetty10@gmail.com> Change-Id: Ic284dd088d6b148d6fcb457290a28fdb0838b83d 2024-05-13tests: Remove interference from the user’s Git config.Ludovic Courtès * tests/guix-download.sh: Set ‘GIT_CONFIG_GLOBAL’ and ‘GIT_CONFIG_SYSTEM’. Reported-by: Ashvith Shetty <ashvithshetty10@gmail.com> Change-Id: Ibe14d23db2e8af58b85c78248997c6dde78e11e0