summaryrefslogtreecommitdiff
blob: fd69a70403c1bd34682aeb00386d2a078d06cf56 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

PYTHON_COMPAT=( python2_7 python3_{4,5} )
DISTUTILS_OPTIONAL=true

inherit distutils-r1

DESCRIPTION="Provides information about the Debian distributions' releases"
HOMEPAGE="https://debian.org"
SRC_URI="mirror://debian/pool/main/d/${PN}/${PN}_${PV}.tar.xz"

LICENSE="ISC"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="python test"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

CDEPEND="dev-lang/perl:=
	python? ( ${PYTHON_DEPS} )"
DEPEND="${CDEPEND}
	python? ( dev-python/setuptools[${PYTHON_USEDEP}] )
	test? (
		dev-util/shunit2
		dev-python/pylint[${PYTHON_USEDEP}]
	)"
RDEPEND="${CDEPEND}
	dev-util/distro-info-data"

src_prepare() {
	default

	# 1. Gentoo do not provides dpkg vendor information
	# 2. Strip *FLAGS
	# 3. Strip predefined CFLAGS
	# 4. Point to correct perl's vendorlib
	# 5. Remove python tests - python eclass will be used instead
	sed -e "/cd python && python/d" \
		-e "/VENDOR/d" \
		-e "/dpkg-buildflags/d" \
		-e "s/-g -O2//g" \
		-e "s:\$(PREFIX)/share/perl5/Debian:\$(PERL_VENDORLIB)/Debian:g" \
		-e "/pyversions/d" \
		-i "${S}"/Makefile || die
}

src_configure() {
	default

	if use python; then
		pushd ./python > /dev/null || die
		distutils-r1_src_configure
		popd > /dev/null || die
	fi
}

src_compile() {
	default

	if use python; then
		pushd ./python > /dev/null || die
		distutils-r1_src_compile
		popd > /dev/null || die
	fi
}

src_install() {
	emake PERL_VENDORLIB=$(perl -e 'require Config; print "$Config::Config{'vendorlib'}\n";') \
		DESTDIR="${D}" install

	if use python; then
		pushd ./python > /dev/null || die
		distutils-r1_src_install
		popd > /dev/null || die
	fi
}

src_test() {
	TZ=UTC default

	if use python; then
		python_test() {
			esetup.py test
		}

		pushd ./python > /dev/null || die
		distutils-r1_src_test
		popd > /dev/null || die
	fi
}