diff options
author | Henrik Riomar <henrik.riomar@gmail.com> | 2017-08-06 11:26:38 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2017-08-28 07:15:08 +0000 |
commit | bcf6059ec23ab4ff2d600c8669a5a81c24ee74b4 (patch) | |
tree | 3f92548d945de504cf49e5d6c3543721305c1a33 /community/etckeeper | |
parent | 93364931ad25e79c2137579cfe61730460695beb (diff) | |
download | aports-bcf6059ec23ab4ff2d600c8669a5a81c24ee74b4.tar.bz2 aports-bcf6059ec23ab4ff2d600c8669a5a81c24ee74b4.tar.xz |
community/etckeeper: move from testing
Diffstat (limited to 'community/etckeeper')
-rw-r--r-- | community/etckeeper/0001-Work-around-git-commit-s-lack-of-robustness-by-provi.patch | 102 | ||||
-rw-r--r-- | community/etckeeper/APKBUILD | 52 | ||||
-rw-r--r-- | community/etckeeper/apk-commit_hook | 17 | ||||
-rw-r--r-- | community/etckeeper/etckeeper.post-install | 10 | ||||
-rw-r--r-- | community/etckeeper/etckeeper.pre-deinstall | 6 |
5 files changed, 187 insertions, 0 deletions
diff --git a/community/etckeeper/0001-Work-around-git-commit-s-lack-of-robustness-by-provi.patch b/community/etckeeper/0001-Work-around-git-commit-s-lack-of-robustness-by-provi.patch new file mode 100644 index 0000000000..0726f43362 --- /dev/null +++ b/community/etckeeper/0001-Work-around-git-commit-s-lack-of-robustness-by-provi.patch @@ -0,0 +1,102 @@ +From e19e9c51f63fdf6c836310bacf4a7d5caebdd55f Mon Sep 17 00:00:00 2001 +From: Joey Hess <joeyh@joeyh.name> +Date: Thu, 8 Jun 2017 13:26:34 -0400 +Subject: [PATCH] Work around git commit's lack of robustness, by providing + reasonable default values for GIT_COMMITTER_EMAIL etc. + +This was already done as part of the su/sudo handling, and is now always +done. + +This commit was sponsored by Trenton Cronholm on Patreon. +--- + commit.d/50vcs-commit | 9 +++++++- + debian/changelog | 9 ++++++++ + ...___be_set_under_undocumented_circumstances.mdwn | 2 ++ + ...ent_1_f8399058ebbf3059000e6528296cc1e9._comment | 26 ++++++++++++++++++++++ + 4 files changed, 45 insertions(+), 1 deletion(-) + create mode 100644 doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances/comment_1_f8399058ebbf3059000e6528296cc1e9._comment + +diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit +index 55f0db2..f970d3d 100755 +--- a/commit.d/50vcs-commit ++++ b/commit.d/50vcs-commit +@@ -41,9 +41,16 @@ else + fi + + if [ "$VCS" = git ] && [ -d .git ]; then ++ # When not su'd to root, still set environment variables, ++ # since git's own code to determine the author and committer ++ # has several edge cases where it fails and would prevent the ++ # commit. ++ if [ -z "$USER" ]; then ++ USER="$(whoami)" ++ fi + if [ -n "$USER" ]; then + # Use user.name and user.email from the gitconfig belonging +- # to the user who became root. ++ # to USER. + USER_HOME="$(getent passwd "$USER" | cut -d: -f6)" + if [ -n "$USER_HOME" ] && [ -e "$USER_HOME/.gitconfig" ]; then + if [ -z "$GIT_AUTHOR_NAME" ]; then +diff --git a/debian/changelog b/debian/changelog +index 23783bd..46df223 100644 +--- a/debian/changelog ++++ b/debian/changelog +@@ -1,3 +1,12 @@ ++etckeeper (1.18.8) UNRELEASED; urgency=medium ++ ++ * Work around git commit's lack of robustness, by providing ++ reasonable default values for GIT_COMMITTER_EMAIL etc. ++ This was already done as part of the su/sudo handling, ++ and is now always done. ++ ++ -- Joey Hess <id@joeyh.name> Thu, 08 Jun 2017 13:22:01 -0400 ++ + etckeeper (1.18.7) unstable; urgency=medium + + * Added some unit tests. +diff --git a/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances.mdwn b/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances.mdwn +index 93177d8..5ddd8ad 100644 +--- a/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances.mdwn ++++ b/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances.mdwn +@@ -34,3 +34,5 @@ This is not Ansible-specific: the last two conditions will also arise in the dai + + + IMO, considering how to document this behaviour shows it to be user-unfriendly. Therefore, it would be simplest if etckeeper could fall back to using `$(id -un)`, once `$(tty)` fails. ++ ++> Set `USER=$(whoami)`, for git only. [[done]] --[[Joey]] +diff --git a/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances/comment_1_f8399058ebbf3059000e6528296cc1e9._comment b/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances/comment_1_f8399058ebbf3059000e6528296cc1e9._comment +new file mode 100644 +index 0000000..16e907f +--- /dev/null ++++ b/doc/todo/requires___96__user.email__96___be_set_under_undocumented_circumstances/comment_1_f8399058ebbf3059000e6528296cc1e9._comment +@@ -0,0 +1,26 @@ ++[[!comment format=mdwn ++ username="joey" ++ subject="""comment 1""" ++ date="2017-06-08T17:00:19Z" ++ content=""" ++What actually requires user.email be set under ++undocumented circumstances? git does. Personally, I feel this is a total ++misfeature on git's part; git commit should succeed under all ++configuraations. Every single program that automates `git commit` ++is potentially buggy otherwise. ++ ++Anyway, yes, setting `USER=$(id -un)` (or whoami) would make ++the code that currently is used to handle sudo users be always ++run, and so git and any other VCSs that break in unusual circumstances ++would always work (at least as far as username and email goes, who knows ++what other requirements VCSs may have). ++ ++The downside is that this could change etckeeper's behavior, since ++it would now be guessing at the user name and email, and may make ++different choices than git does. ++ ++Setting USER would also impact the code for other VCSs than git. For ++example, the code for hg always sets HGUSER when USER is set. I don't know ++if the others VCSs are as picky as git; if this kind of breakage is not a ++problem for them it might be best to only set USER when using git. ++"""]] +-- +2.11.0 + diff --git a/community/etckeeper/APKBUILD b/community/etckeeper/APKBUILD new file mode 100644 index 0000000000..39d2efb368 --- /dev/null +++ b/community/etckeeper/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Henrik Riomar <henrik.riomar@gmail.com> +# Maintainer: Henrik Riomar <henrik.riomar@gmail.com> + +pkgname=etckeeper +pkgver=1.18.7 +pkgrel=1 +pkgdesc="Store /etc in git." +url="http://etckeeper.branchable.com" +arch="noarch" +license="GPL2" +checkdepends="bats fakeroot" +depends="findutils git" +subpackages="$pkgname-doc" +options="!checkroot" +install="$pkgname.post-install $pkgname.pre-deinstall" +source="$pkgname-$pkgver.tar.gz::https://git.joeyh.name/index.cgi/$pkgname.git/snapshot/$pkgname-$pkgver.tar.gz + apk-commit_hook + 0001-Work-around-git-commit-s-lack-of-robustness-by-provi.patch + " +builddir="$srcdir/$pkgname-$pkgver" + +prepare() { + default_prepare + + cd "$builddir" + sed -i 's|^PYTHON=python$|PYTHON=/bin/false|' Makefile + sed -i 's/_PACKAGE_MANAGER=.*/_PACKAGE_MANAGER=apk/' etckeeper.conf +} + +check() { + cd "$builddir" + make test +} + +package() { + cd "$builddir" + + make install DESTDIR="$pkgdir" + rm -rf "$pkgdir"/lib/systemd + rmdir "$pkgdir"/lib/ + rm -rf "$pkgdir"/etc/apt + + install -m755 -D "$builddir"/debian/cron.daily \ + "$pkgdir"/etc/periodic/daily/"$pkgname" + + install -m755 -D "$srcdir"/apk-commit_hook \ + "$pkgdir"/etc/apk/commit_hooks.d/"$pkgname" +} + +sha512sums="44b8f66b95663da1370943128bb5673e57bd7b9df7e727c93baea5dfc79852ebba9d0834827fed19722668849d3ed18b045db5cb42135e198576a2b839523d1a etckeeper-1.18.7.tar.gz +2b1a29d31b6e7cf4ddb05de9b5e088b5747c2abfb2d63f9bddd25f4b7dc8503d457df7fd644afe5bd6fea6a5285a111a47c0489d24378b483c1e026cc11c6bf7 apk-commit_hook +d4aa516f7b35c2eddd5c534391fd6363429633aea3b4b2e8e46b1fe192986c79f91bf9e3e808992ce524ffc3ac96cc3952d1a1e7c3b355b7f97ffa9badc8b8d0 0001-Work-around-git-commit-s-lack-of-robustness-by-provi.patch" diff --git a/community/etckeeper/apk-commit_hook b/community/etckeeper/apk-commit_hook new file mode 100644 index 0000000000..6f0a4c043c --- /dev/null +++ b/community/etckeeper/apk-commit_hook @@ -0,0 +1,17 @@ +#!/bin/sh + + +[ -x /usr/bin/etckeeper ] || exit + +case "$1" in + pre-commit) + etckeeper pre-install + ;; + post-commit) + etckeeper post-install + ;; + + *) + echo "$0: Un-handled action: $1" + ;; +esac diff --git a/community/etckeeper/etckeeper.post-install b/community/etckeeper/etckeeper.post-install new file mode 100644 index 0000000000..5bb094cb22 --- /dev/null +++ b/community/etckeeper/etckeeper.post-install @@ -0,0 +1,10 @@ +#!/bin/sh + +[ -e /etc/.git ] && exit 0 + +if etckeeper init; then + etckeeper commit "initial commit" + # we are in trigger context so the apk database + # contains info before the change takes effect + /etc/etckeeper/pre-install.d/10packagelist +fi diff --git a/community/etckeeper/etckeeper.pre-deinstall b/community/etckeeper/etckeeper.pre-deinstall new file mode 100644 index 0000000000..9170848b38 --- /dev/null +++ b/community/etckeeper/etckeeper.pre-deinstall @@ -0,0 +1,6 @@ +#!/bin/sh + +etckeeper uninit + +rm -f /var/cache/etckeeper/packagelist.fmt +rm -f /var/cache/etckeeper/packagelist.pre-install |