diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68b5aa7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +viewmtn-0.10.tgz diff --git a/dead.package b/dead.package deleted file mode 100644 index 5204a84..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -Orphaned for 6+ weeks diff --git a/sources b/sources new file mode 100644 index 0000000..badfb30 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +1758f8b6340cca7d191b21fc25daf283 viewmtn-0.10.tgz diff --git a/viewmtn.conf.httpd b/viewmtn.conf.httpd new file mode 100644 index 0000000..4de913f --- /dev/null +++ b/viewmtn.conf.httpd @@ -0,0 +1,9 @@ +Alias /viewmtn __python_sitelib__/viewmtn/__init__.py +Alias /viewmtn-static/ __datadir__/viewmtn/ + + + + SetHandler wsgi-script + Options +ExecCGI + + diff --git a/viewmtn.conf.py b/viewmtn.conf.py new file mode 100644 index 0000000..4d1055d --- /dev/null +++ b/viewmtn.conf.py @@ -0,0 +1,28 @@ +# +# See __python_sitelib__/viewmtn/config.py, +# which imports this file. +# You can override any of the settings in that file here to customize. +# +# For viewmtn to work at all, it must have a definition for dbfile or dbfiles. +# These can be a simple constants configured here, or Python code here +# can set them dynamically. +# + +import os.path +import glob + +def _flatten_tuples(l): + return reduce(tuple.__add__, l, ()) + +def _dbfile_tuple(file): + dir = os.path.dirname(file) + name = os.path.basename(dir) + description = None + try: + description = open(os.path.join(dir, 'description')).read() + except IOError: + pass + return (name, file, description) + +def dbfiles(): + return _flatten_tuples(map(_dbfile_tuple, glob.glob('/srv/mtn/*/db.mtn'))) diff --git a/viewmtn.spec b/viewmtn.spec new file mode 100644 index 0000000..ba18cad --- /dev/null +++ b/viewmtn.spec @@ -0,0 +1,118 @@ +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + +Name: viewmtn +Version: 0.10 +Release: 1%{?dist} + +Summary: Web interface for Monotone version control system +Group: Development/Tools +License: GPLv2+ + +URL: http://grahame.angrygoats.net/moinmoin/ViewMTN +Source0: http://grahame.angrygoats.net/source/%{name}/%{name}-%{version}.tgz + +Source1: viewmtn.conf.httpd +Source2: viewmtn.conf.py + +BuildArch: noarch +BuildRequires: python-devel +Requires: python-cheetah +Requires(pre): httpd +Requires: monotone >= 0.35 +Requires: mod_wsgi +Requires: gnome-icon-theme +Requires: shared-mime-info +Requires: highlight +Requires: graphviz + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%define mydata %{_datadir}/viewmtn +%define mypy %{python_sitelib}/viewmtn +%define mygraph %{_localstatedir}/cache/viewmtn-graph + +%description +ViewMTN is a web interface to the Monotone distributed version +control system. It aims to provide a convenient and useful web +interface to Monotone. If you've used interfaces to other version +control systems, ViewMTN will be immediately familiar. + +%prep +%setup -q + +cat > __init__.py <<\EOF +from viewmtn import assemble_urls, web +urls, fvars = assemble_urls() +application = web.wsgifunc(web.webpyfunc(urls, fvars)) +EOF + +%build +%{__sed} -e s,__datadir__,%{_datadir}, \ + -e s,__python_sitelib__,%{python_sitelib}, %{SOURCE1} > viewmtn.conf +%{__sed} -e s,__datadir__,%{_datadir}, \ + -e s,__python_sitelib__,%{python_sitelib}, %{SOURCE2} > viewmtn.conf.py +%{__sed} -e s,/usr/bin,%{_bindir},g \ + -e '/^dbfile/s,= .*$,'"= '%{mydb}',"\ + -e '/^dynamic_uri_path/s,= .*$,'"= '/viewmtn/'," \ + -e '/^static_uri_path/s,= .*$,'"= '/viewmtn-static/'," \ + -e '/^templates_directory/s,= .*$,'"= '%{mydata}/templates/'," \ + -e '/viewmtn-graph/s|: .*$|'": '%{mygraph}/',|" \ + -e '/^running_under_apache2/s/$/ # not relevant to mod_wsgi setup/' \ + config.py.example > config.py + +cat >> config.py <<\EOF + +# Get the local configuration linked from %{_sysconfdir}/. +from user_config import * +EOF + + +%install +rm -rf $RPM_BUILD_ROOT +%{__install} -d -m 755 $RPM_BUILD_ROOT%{mypy}/fdo +%{__install} -d -m 755 $RPM_BUILD_ROOT%{mypy}/web +%{__install} -d -m 755 $RPM_BUILD_ROOT%{mydata}/templates +%{__install} -d -m 755 $RPM_BUILD_ROOT%{mydata}/MochiKit +%{__install} -d -m 755 $RPM_BUILD_ROOT%{mygraph} +%{__install} -Dp -m 0644 viewmtn.conf \ + $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/viewmtn.conf +%{__install} -Dp -m 644 -t $RPM_BUILD_ROOT%{mypy} *.py +%{__install} -Dp -m 644 -t $RPM_BUILD_ROOT%{mypy}/fdo fdo/*.py +%{__install} -Dp -m 644 -t $RPM_BUILD_ROOT%{mypy}/web web/*.py +%{__install} -Dp -m 644 -t $RPM_BUILD_ROOT%{mydata}/templates templates/*.html +%{__install} -Dp -m 644 -t $RPM_BUILD_ROOT%{mydata} \ + static/*.gif static/*.css static/*.js +%{__install} -Dp -m 644 -t $RPM_BUILD_ROOT%{mydata}/MochiKit \ + static/MochiKit/*.js + +%{__install} -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name} +%{__install} -Dp -m 0644 viewmtn.conf.py \ + $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.py + +mypy_rel=`echo %{mypy} | sed 's,/[^/]*,../,g;s,/$,,'` +%{__ln_s} -nf $mypy_rel%{_sysconfdir}/%{name}/conf.py \ + $RPM_BUILD_ROOT%{mypy}/user_config.py + +# Pacify overeager rpmlint #! checks. +find $RPM_BUILD_ROOT%{mypy} -type f -name '*.py' -print0 | +xargs -0 sed -i '1{/^#!/d;}' + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc README AUTHORS LICENSE ChangeLog TODO INSTALL +%{mypy} +%{mydata} +%dir %attr(0755,apache,apache) %{mygraph} +%config(noreplace) %{_sysconfdir}/httpd/conf.d/viewmtn.conf +%dir %{_sysconfdir}/%{name} +%config(noreplace) %{_sysconfdir}/%{name}/conf.py* + + +%changelog +* Sun Mar 23 2008 Roland McGrath - 0.10-1 +- New package. Thanks to Thomas Moschny for packaging assistance.