summaryrefslogtreecommitdiff
blob: f26ef8d29fba1880e7fd76bf4208580bf32dbfaa (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools flag-o-matic readme.gentoo-r1 systemd

COMMIT="6301c30"

DESCRIPTION="RSS downloader for Tranmission"
HOMEPAGE="https://github.com/1100101/Automatic"
SRC_URI="https://github.com/1100101/Automatic/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="test"
PROPERTIES="test_network"

RDEPEND="acct-group/automatic
	acct-user/automatic
	dev-libs/libxml2:2
	dev-libs/libpcre:3
	net-misc/curl"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

S="${WORKDIR}/${P^}"

# wrt #836740
PATCHES=( "${FILESDIR}"/"${P}"-util_test-header.patch )

DOC_CONTENTS="To run automatic you should move /etc/automatic.conf-sample
to /etc/automatic.conf and config it.\\n
If things go wrong, increase verbose level in /etc/conf.d/automatic
and check log file in /var/log/automatic/\\n"

src_prepare() {
	default

	# remove CFLAGS and CXXFLAGS defined by upstream
	sed -i  -e '/CFLAGS=/s/=".*"/+=""/' \
		-e '/CXXFLAGS=/s/=".*"/+=""/' \
		configure.ac || die "sed failed for configure.ac"

	# set version
	sed -i  -e "/SVN_REVISION/s|'\`git rev-parse --short HEAD\`'|${COMMIT}|" \
		-e "/LONG_VERSION_STRING/s|'\`git rev-parse --short HEAD\`'|${COMMIT}|" \
		src/Makefile.am || die "sed failed for src/Makefile.am"

	# provide test api keys for tests
	sed -i '/correct_key/s|""|"05b363d4561aaaa5c4c49bbb15639068b8cb6646"|' \
		src/tests/prowl_test.c || die "sed failed for prowl_test.c"
	# disable pushover tests
	sed -i '/check_PROGRAMS /s/ pushover_test//' src/tests/Makefile.am \
		|| die "sed failed for src/tests/Makefile.am"

	eautoreconf
}

src_configure() {
	filter-lto # wrt #861842

	econf
}

src_install() {
	default

	newinitd "${FILESDIR}"/automatic.initd automatic
	newconfd "${FILESDIR}"/automatic.confd automatic
	systemd_dounit "${FILESDIR}"/automatic.service

	insinto /etc/logrotate.d
	newins "${FILESDIR}"/automatic.logrotate automatic

	readme.gentoo_create_doc

	diropts -o automatic -g automatic -m 0700
	keepdir /var/log/automatic/
}

pkg_postinst() {
	readme.gentoo_print_elog
}