summaryrefslogtreecommitdiff
blob: 3b1e35ab8a2a08fd46cc5d340ddb0ef21b59fb45 (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
# Copyright 2019-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{9..11} )

inherit python-single-r1

DESCRIPTION="Tool for community verification of Gentoo elections"
HOMEPAGE="https://github.com/projg2/votrify/"
SRC_URI="
	https://github.com/projg2/votrify/archive/v${PV}.tar.gz
		-> ${P}.tar.gz
"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="amd64 x86"
REQUIRED_USE=${PYTHON_REQUIRED_USE}

RDEPEND="
	${PYTHON_DEPS}
	app-misc/gentoo-elections
"

src_configure() {
	# update default location for election scripts
	sed -i -e "s^os.path.dirname(__file__)^'${EPREFIX}/usr/lib'^" \
		votrify-make-confirmation || die

	python_fix_shebang votrify-{make,verify}-*
}

make_wrappers() {
	local election=${1}

	newbin - "votrify-${election}-make" \
		< <(sed -e "s^@ELECTION@^${election}^" \
			votrify-wrapper-make.bash.in || die)
	newbin - "votrify-${election}-verify" \
		< <(sed -e "s^@ELECTION@^${election}^" \
			votrify-wrapper-verify.bash.in || die)
}

src_install() {
	dobin votrify-{make,verify}-*
	make_wrappers council-201906
	einstalldocs
}

pkg_postinst() {
	elog "In order to interactively create confirmation for Council 2019 election:"
	elog "  votrify-council-201906-make"
	elog
	elog "In order to verify the results for Council 2019 election:"
	elog "  votrify-council-201906-verify"
}