summaryrefslogtreecommitdiff
blob: ed043ff9a673542fef60e2b39ce5c7e9b8c9f85d (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-portage/pfl/pfl-1.8.1.ebuild,v 1.1 2009/06/28 17:59:41 billie Exp $

inherit python multilib

DESCRIPTION="PFL is an online searchable file/package database for Gentoo"
HOMEPAGE="http://www.portagefilelist.de/index.php/Special:PFLQuery2"
SRC_URI="http://files.portagefilelist.de/${P}
	http://files.portagefilelist.de/e-file"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="network-cron"

DEPEND="virtual/python"
RDEPEND="${DEPEND}
	net-misc/curl
	sys-apps/portage"

RESTRICT="mirror"

src_unpack() {
	cp "${DISTDIR}/${P}" "${WORKDIR}/${PN}.py"
	cp "${DISTDIR}/e-file" "${WORKDIR}/e-file"
}

src_install() {
	python_version

	if use network-cron ; then
		cat >> "${T}/${PN}" <<- EOF
		#!/bin/sh
		exec nice ${python} -O $(python_get_sitedir)/${PN}/${PN}.py >/dev/null
		EOF

		exeinto /etc/cron.weekly
		doexe "${T}/${PN}" || die "install ${PN} cron file failed"
	fi

	exeinto $(python_get_sitedir)/${PN}
	doexe ${PN}.py || die "install ${PN}.py failed"

	dobin e-file || die "install e-file failed"

	dodir /var/lib/${PN} || die "directory creation failed"
	fowners 0:portage /var/lib/${PN}
	fperms 0775 /var/lib/${PN}
}

pkg_postinst() {
	python_version
	python_mod_optimize $(python_get_sitedir)/${PN}

	if [[ ! -e "${ROOT%/}/var/lib/${PN}/lastrun" ]]; then
		echo -n 0 > "${ROOT%/}/var/lib/${PN}/lastrun"
		chown -R 0:portage "${ROOT%/}/var/lib/${PN}"
		chmod -R 775 "${ROOT%/}/var/lib/${PN}"
	fi
}

pkg_postrm() {
	python_mod_cleanup
}