summaryrefslogtreecommitdiff
blob: 9f1d9f83a45005026be73c97ecaebb6d1a1c6fe2 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils

MY_PV=${PV%.*}
MY_DPV=${PV#*.*.*.}

DESCRIPTION="Yet another implementation of a HTTP proxy for Debian/Ubuntu software packages written in C++"
HOMEPAGE="http://www.unix-ag.uni-kl.de/~bloch/acng/"
SRC_URI="mirror://debian/pool/main/a/${PN}/${PN}_${MY_PV}.orig.tar.gz
	mirror://debian/pool/main/a/${PN}/${PN}_${MY_PV}-${MY_DPV}.diff.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~x86"
IUSE="doc fuse"

DEPEND="app-arch/bzip2
	sys-libs/zlib"
RDEPEND="${DEPEND}
	dev-lang/perl
	fuse? ( sys-fs/fuse )"

S=${WORKDIR}/${PN}-${MY_PV}

pkg_setup() {
	# add new user & group for daemon
	enewgroup ${PN}
	enewuser ${PN} -1 -1 -1 ${PN}
}

src_unpack() {
	unpack ${A}
	epatch "${WORKDIR}/${PN}_${MY_PV}-${MY_DPV}.diff" # Debian patchset number 1.2.3.x
	cd "${S}" && epatch "${FILESDIR}/${PN}-0.3.8-respect-portage-qa-build-unstripped.patch" # Respect portage
}

src_compile() {
	local build="acng"
	use fuse && build="${build} acngfs"
	# -j1 fix race noted in bug #265840 comment #5
	emake -j1 CURDIR="${S}" ${build} || die "make '${build}' failed!"
}

src_install() {
	# There is no any install target :(
	# So we do all stuff here

	dosbin apt-cacher-ng || die "Can't install apt-cacher-ng"
	if use fuse; then dobin acngfs || die "Can't install acngfs"; fi

	newinitd "${FILESDIR}"/initd ${PN} || die "Can't add new init.d ${PN}"
	newconfd "${FILESDIR}"/confd ${PN} || die "Can't add new conf.d ${PN}"

	# for logrotate
	insinto /etc/logrotate.d
	newins "${FILESDIR}"/logrotate ${PN} || die "Can't install new file ${PN} into '/etc/logrotate.d'"

	doman doc/man/${PN}* || die "Can't install mans"
	if use fuse; then doman doc/man/acngfs* || die "Can't install man pages for fusefs"; fi

	# Documentation
	dodoc README TODO VERSION INSTALL ChangeLog || die "Can't install common docs"
	if use doc; then
		dodoc doc/*.pdf || die "Can't install docs"
		dohtml doc/html/* || die "Can't install html docs"
		docinto examples/conf
		dodoc conf/* || die "Can't install config examples"
	fi

	# perl daily cron script
	dosbin expire-caller.pl || die "Can't install cache cleaner perl script"
	exeinto /etc/cron.daily
	newexe "${FILESDIR}"/cron.daily ${PN} || die "Can't install new daily cron script"

	# default configuration
	insinto /etc/${PN}
	newins conf/acng.conf ${PN}.conf || die "Can't install ${PN} configuration file"
	newins conf/report.html acng-report.html || die "Can't install ${PN} report page"

	# Some directories must exists
	keepdir /var/log/${PN}
	keepdir /var/run/${PN}
	fowners ${PN}:${PN} \
		/etc/${PN} \
		/etc/${PN}/${PN}.conf \
		/etc/${PN}/acng-report.html \
		/var/log/${PN} \
		/var/run/${PN} || die "Can't change owners"
}

pkg_postinst() {
	elog "Do not forget about edit configuration file and read manuals!"
	elog "   Default file : /etc/${PN}/${PN}.conf"
	elog "   Manual page  : man 8 apt-cache-ng"
	elog "   Documentation: /usr/share/doc/${PF}"
	if use fuse; then
		elog "You have choose to build fuse httpfs named 'acngfs'."
		elog "It's can be used to mount apt cache on server to client"
		elog "filesystem."
		elog "   Manual page  : man 8 acngfs"
	fi
	elog "Please note: this ebuild installs /etc/cron.daily/${PN} cron job."
}