summaryrefslogtreecommitdiff
blob: fc1a5ed511d517c831316d5449ef9dd2c5fad5bd (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/yum/yum-2.6.1.ebuild,v 1.4 2008/05/29 18:04:58 hawking Exp $

inherit python distutils eutils

DESCRIPTION="Automatic updater and package installer/remover for rpm systems"
HOMEPAGE="http://linux.duke.edu/projects/yum/"
SRC_URI="${HOMEPAGE}/download/${PV%.[0-9]}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="doc"

RDEPEND="dev-python/celementtree
	>=dev-python/urlgrabber-2.9.6
	dev-libs/libxml2
	>=app-arch/rpm-4.4.1"

DEPEND=""

PYTHON_MODNAME="yum repomd rpmUtils"

pkg_setup() {
	if ! built_with_use dev-libs/libxml2 python
	then
		eerror "dev-libs/libxml2 wasn't built with the python use flag set!"
		eerror "Add python to USE in /etc/make.conf and run"
		eerror "'emerge --oneshot dev-libs/libxml2'"
		die "need dev-libs/libxml2 built with python support."
	fi
	if !  built_with_use app-arch/rpm python
	then
		eerror "app-arch/rpm wasn't built with the python use flag set!"
		eerror "Add python to USE in /etc/make.conf and run"
		eerror "'emerge --oneshot app-arch/rpm'"
		die "need app-arch/rpm built with python support."
	fi
}

src_compile() {
	emake || die "emake failed"
}

src_install() {
	make DESTDIR="${D}" install || die "make install failed"

	dodoc README AUTHORS ChangeLog TODO
	useq doc && dodoc PLUGINS

	# Makefile explicitly compiles python files
	find "${D}"/usr/ -name *.py[co] -exec rm {} \;

	# yum's auto-update functionality doesn't make
	# sense for a system managed by portage
	rm -rf "${D}"/etc/cron.{daily,weekly}
	rm -rf "${D}"/etc/{rc.d,yum}
}

pkg_postinst() {
	python_mod_optimize /usr/share/${PN}-cli
	distutils_pkg_postinst
}

pkg_postrm() {
	python_mod_cleanup /usr/share/${PN}-cli
	distutils_pkg_postrm
}