aboutsummaryrefslogtreecommitdiff
blob: 428497b9145c7fc3ad0d6ac27c06ef05974453e8 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit distutils

MY_PV="1278111487"
INFO_REV="1"
#PATCHES_REV="1"

DESCRIPTION="A tool that generates and installs ebuilds for Octave-Forge"
HOMEPAGE="http://g-octave.rafaelmartins.eng.br/"

SRC_URI="http://g-octave.rafaelmartins.eng.br/distfiles/releases/${P}.tar.gz
	http://g-octave.rafaelmartins.eng.br/distfiles/db/octave-forge-${MY_PV}.db.tar.gz
	http://g-octave.rafaelmartins.eng.br/distfiles/db/info-${MY_PV}-${INFO_REV}.json"
	#http://g-octave.rafaelmartins.eng.br/distfiles/db/patches-${MY_PV}-${PATCHES_REV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="svn test"

DEPEND="( >=dev-lang/python-2.6 <dev-lang/python-3 )"
RDEPEND="${DEPEND}
	svn? ( dev-python/pysvn )
	|| ( >=sys-apps/portage-2.1.7[-python3] <sys-apps/portage-2.1.7 )"

PYTHON_MODNAME="g_octave"

src_unpack() {
	unpack ${P}.tar.gz
}

src_prepare() {
	distutils_src_prepare
	sed -i -e 's/^has_fetch.*$/has_fetch = False/' scripts/g-octave \
		|| die 'failed to patch the g-octave main script'
	if ! use svn; then
		rm -rf g_octave/svn/ || die 'failed to remove the Subversion stuff.'
		sed -i -e '/g_octave.svn/d' -e '/pysvn/d' setup.py \
			|| die 'failed to remove the SVN stuff from setup.py'
	fi
}

src_install() {
	distutils_src_install
	dohtml ${PN}.html
	doman ${PN}.1
}

src_test() {
	PYTHONPATH=. scripts/run_tests.py || die "test failed."
}

pkg_postinst() {
	distutils_pkg_postinst
	elog
	elog 'To be able to use g-octave with the shipped package database, please'
	elog 'edit your configuration file, clean your db directory and run:'
	elog "    emerge --config =${PF}"
	elog
}

pkg_config() {
	local db="$(g-octave --config db)"
	mkdir -p "${db}"
	elog "Copying g-octave database files to: ${db}"
	cp "${DISTDIR}/octave-forge-${MY_PV}.db.tar.gz" "${db}/" \
		|| die "failed to copy octave-forge-${MY_PV}.db.tar.gz"
	cp "${DISTDIR}/info-${MY_PV}-${INFO_REV}.json" "${db}/" \
		|| die "failed to copy info-${MY_PV}-${INFO_REV}.json"
	#cp "${DISTDIR}/patches-${MY_P}-${PATCHES_REV}.tar.gz" "${db}/" \
	#	|| die "failed to copy patches-${MY_P}-${PATCHES_REV}.tar.gz"
}