Gentoo Archives: gentoo-dev

From: Max Kalika <max+lists.gentoo-dev@×××××××××.edu>
To: gentoo-dev@g.o
Subject: [gentoo-dev] proposal: webapp.eclass (long)
Date: Wed, 02 Jul 2003 17:35:31
Message-Id: 59270000.1057167330@valkyrie.lsit.ucsb.edu
1 There was a discussion a while back about where and how to install
2 web-related applications. As it is now, most webapps try to do some grep
3 magic to see where the apache/apache2 doc root is. Why not consolidate all
4 this into an eclass with the following (very rough) design spec:
5
6
7 --BEGIN---------------------------------------------------------
8 inherit webapp
9
10 # The directory to install. Defaults to "${S}"
11 WEBAPP_SOURCE="/path/to/source/dir"
12
13 # Override which files to install relative to ${WEBAPP_SOURCE}.
14 # Allows files, and directories. Defaults to all (unset).
15 WEBAPP_FILES="file1.php file2.cgi dir1 dir2/file3.html"
16
17 # Files to move to /etc/webapps/${PN} and link back so they
18 # can be taken into account via CONFIG_PROTECT.
19 # Defaults to none (unset).
20 WEBAPP_CONFIGS="file1.php dir/config.php"
21
22 # Whether or not this webapp contains CGIs. See below.
23 # I can see a few packages benefiting from this: e.g. xmltv, mailman
24 # nut, apcupsd. Defaults to no (unset).
25 WEBAPP_CGI="yes"
26
27 # Path to a file contain other directives for the generated apache
28 # configuration file. Defaults to none (unset)
29 WEBAPP_EXTRA="${FILESDIR}/somefile.conf"
30
31 src_unpack() nothing changes -- unpack as normal;
32 src_compile() nothing changes -- should have nothing to compile;
33 src_install() by default runs webapp_src_install()
34 pkg_postinst() by default runs webapp_pkg_postinst()
35 pkg_config() by default runs webapp_pkg_config()
36
37
38 webapp_src_install() is the workhorse
39 - copies ${WEBAPP_SOURCE} all together or the items specified under
40 ${WEBAPP_FILES} to /usr/share/webapps/${PN}. (I believe /usr/share/web
41 was mentioned as a target candidate as well)
42 - copies anything in ${WEBAPP_CONFIG} to /etc/webapps/${PN} and links
43 back
44 to /usr/share/webapps/${PN}. (Maybe /etc/web?)
45 - generates a ${PN}.conf and places it into /etc/apache2/conf/modules.d
46 or
47 /etc/apache/conf/addon-modules (or both, depending on what exists).
48 - the conf file may look something like:
49
50 Alias /${PN}/ /usr/share/webapps/${PN}/
51 <Directory /usr/share/webapps/${PN}>
52 AllowOverride Limit
53 Options Indexes FollowSymLinks # ExecCGI if ${WEBAPP_CGI}
54 # contents of ${WEBAPP_EXTRA} if it exists
55 </Directory>
56
57 webapp_pkg_postinst()
58 - prints an einfo about running /var/db/pkg/${PF}/${PF}.ebuild config
59
60 webapp_pkg_config()
61 - activates the $PN.conf file created by webapp_src_install()
62 ----END---------------------------------------------------------
63
64
65 Again, this is all very rough and is probably missing important features.
66 Here's a sample ebuild that can take advantage of this eclass (there's
67 absolutely zero testing done because the said eclass is not yet
68 implemented).
69
70
71 --BEGIN-[net-www/myweb-0.10.ebuild]-----------------------------
72 inherit webapp
73
74 IUSE=""
75 DESCRIPTION="PHP scripts intended to manage MythTV from a web browser."
76 HOMEPAGE="http://www.mythtv.org/"
77 SRC_URI="http://www.mythtv.org/mc/${P}.tar.bz2"
78
79 LICENSE="GPL-2"
80 SLOT="0"
81 KEYWORDS="~x86"
82
83 RDEPEND="dev-db/mysql
84 dev-php/mod_php"
85
86 src_install() {
87
88 WEBAPP_CONFIGS="settings.php"
89 webapp_src_install()
90
91 dodoc README
92
93 }
94 ----END---------------------------------------------------------
95
96 ---max kalika
97 --max@×××××××××.edu
98 -lsit systems administrator
99
100 --
101 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] proposal: webapp.eclass (long) Alex Veber <coronalvr@g.o>
Re: [gentoo-dev] proposal: webapp.eclass (long) Dylan Carlson <absinthe@g.o>