summaryrefslogtreecommitdiff
blob: 6f6efd90021bed5eee9e373d0b33aabe2dc50fa4 (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-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit eutils multilib

DESCRIPTION="helps finding orphaned files on a gentoo system"
HOMEPAGE="http://www.genoetigt.de/site/projects/gcruft"
SRC_URI="http://files.keksbude.net/gentoo/distfiles/${P}.tar.bz2"
KEYWORDS="~x86 ~amd64"
LICENSE="GPL-2"
RESTRICT="mirror"
SLOT="0"
IUSE=""
DEPEND=""
RDEPEND=""

src_prepare() {
	if has_multilib_profile; then
		local multilib="yes";
	else
		local multilib="no";
	fi
	echo -e "
our \$DISTDIR = '${PORTAGE_ACTUAL_DISTDIR}';
our \$CHOST = '${CHOST}';
our \$PKGDIR = '${PKGDIR}';
our \$PORTAGE_TMPDIR = '${PORTAGE_TMPDIR}';
our \$PORTDIR = '${PORTDIR}';
our @PORTDIR_OVERLAY = ('$(env -i portageq portdir_overlay 2>/dev/null|sed -e "s/ /', '/g")');
our \$installedbase = '$(portageq vdb_path)';
our \$multilib = '$multilib';
our \$libmap = '$(get_libdir)';
our \$man_ext = '$(ecompress --suffix)';
" > config.pm.new
	sed -e '1,/^# == PORTAGE VARIABLES BEGIN ==/ w config.pm.start' "${S}"/config.pm >/dev/null
	sed -e '/^# == PORTAGE VARIABLES END ==/,$ w config.pm.end' "${S}"/config.pm >/dev/null
	cat config.pm.{start,new,end} > "${S}"/config.pm
	sed -e 's/^\(use warnings;use diagnostics;\)/#\1/' -i "${S}"/gcruft.pl
}

src_install() {
	local cfdir='/etc/gcruft'
	dodir /usr/share/gcruft
	mv "${S}"/share/{exceptions,functions.pl} "${D}"/usr/share/gcruft || die "couldn't move directories"
	dobin "${S}"/gcruft.pl
	dodoc "${S}"/README
	dodoc "${S}"/README.html
	dodoc "${S}"/exception.example.pl
	insinto $cfdir
	doins "${S}"/config.pm
	dodir $cfdir/exceptions
}

pkg_postinst() {
	einfo "Please check the files gcruft reports carefully"
	einfo "before deleting them! There are most probably false positives!"
	einfo "For further information take a look at the provided"
	einfo "README/README.html in /usr/share/doc/${PF}"
	einfo "Examples for custom exceptions can be found in the"
	einfo "exception.example.pl, which can also be found in"
	einfo "/usr/share/doc/${PF}"
}