summaryrefslogtreecommitdiff
blob: 6e68001e7270aab8c7c8064996c91446b4d389fd (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/viewcvs/viewcvs-1.0_pre20050929.ebuild,v 1.3 2005/10/09 22:17:08 ramereth Exp $

inherit webapp depend.apache eutils

PDATE=${PV/1.0_pre/}
DESCRIPTION="Viewcvs, a web interface to cvs and subversion"
HOMEPAGE="http://viewcvs.sourceforge.net/"
SRC_URI="mirror://gentoo/${PN}-${PDATE}.tar.bz2"

LICENSE="viewcvs"
KEYWORDS="~amd64 ~sparc ~x86"
IUSE="cvsgraph enscript mod_python mysql standalone"

want_apache

RDEPEND="|| ( >=dev-util/cvs-1.11
			  dev-util/subversion )
		dev-lang/python
		>=app-text/rcs-5.7
		sys-apps/diffutils
		cvsgraph? ( dev-util/cvsgraph )
		enscript? ( app-text/enscript )
		apache2? ( mod_python? ( dev-python/mod_python ) )
		mysql? ( dev-db/mysql
				 dev-python/mysql-python )
		!apache? ( !apache2? ( www-servers/lighttpd ) )"

S=${WORKDIR}/${PN}

pkg_setup() {
	if has_version dev-util/subversion && ! built_with_use dev-util/subversion python ; then
		eerror "Your subversion has been built without python bindings"
		eerror "If you want subversion to work with viewcvs, please"
		eerror "enable the 'python' useflag"
		die "pkg_setup failed"
	fi
	if use mod_python && ! use apache2 ; then
		eerror "mod_python requires at least apache2"
		die "pkg_setup failed"
	fi
	if use standalone && ! built_with_use dev-lang/python tcltk ; then
		eerror "Standalone client requires tkinter, please enable the"
		eerror "tcltk useflag for python and recompile"
		die "pkg_setup failed"
	fi
	webapp_pkg_setup
}

src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/${PN}-commitid-fix.patch
}

src_compile() {
	sed -i -e "s:1.0-dev:${PV}:" lib/viewcvs.py
}

src_install() {
	webapp_src_preinst
	dodir ${MY_CGIBINDIR}/${PN} ${MY_HOSTROOTDIR}/${PN}

	exeinto ${MY_CGIBINDIR}/${PN}
	doexe www/cgi/viewcvs.cgi

	if use mysql ; then
		exeinto ${MY_CGIBINDIR}/${PN}
		doexe www/cgi/query.cgi
	fi

	if use mod_python && use apache2 ; then
		exeinto ${MY_HTDOCSDIR}
		doexe www/mod_python/viewcvs.py www/mod_python/query.py
		if use mysql ; then
			exeinto ${MY_HTDOCSDIR}
			doexe www/mod_python/query.py
		fi
		insinto ${MY_HTDOCSDIR}
		doins www/mod_python/.htaccess
	fi

	cp -r lib/ ${D}/${MY_HOSTROOTDIR}/${PN}/
	cp -r templates/ ${D}/${MY_HOSTROOTDIR}/${PN}/
	cp -r tools/ ${D}/${MY_HOSTROOTDIR}/${PN}/
	cp -r tests/ ${D}/${MY_HOSTROOTDIR}/${PN}/
	insinto ${MY_HOSTROOTDIR}/${PN}
	newins viewcvs.conf.dist viewcvs.conf.example
	newins cvsgraph.conf.dist cvsgraph.conf.example

	dosym /usr/share/doc/${PF}/html ${MY_HTDOCSDIR}/doc
	dodoc INSTALL TODO CHANGES README
	dohtml -r website/*

	if use standalone ; then
		exeinto /usr/sbin
		newexe standalone.py viewcvs-standalone
	fi

	webapp_configfile ${MY_HOSTROOTDIR}/${PN}/viewcvs.conf.example
	webapp_configfile ${MY_HOSTROOTDIR}/${PN}/cvsgraph.conf.example
	webapp_postinst_txt en ${FILESDIR}/postinstall-new-en.txt
	webapp_hook_script ${FILESDIR}/reconfig

	if use mysql && has_version "=dev-db/mysql-4.0*" ; then
		webapp_sqlscript mysql ${FILESDIR}/viewcvs-mysql-4.0.sql
	elif use mysql && has_version "=dev-db/mysql-4.1*" ; then
		webapp_sqlscript mysql ${FILESDIR}/viewcvs-mysql-4.1.sql
	fi

	webapp_src_install
}

pkg_postinst() {
	webapp_pkg_postinst
	if use standalone ; then
		einfo "The standalone script is called viewcvs-standalone"
		einfo "instead of standalone.py for clarity sake"
	fi
}