packages: trac/trac.spec, trac/trac-enableplugin.py (NEW) - add trac-enable...

glen glen at pld-linux.org
Wed Apr 7 11:42:53 CEST 2010


Author: glen                         Date: Wed Apr  7 09:42:53 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add trac-enableplugin script to be able to enable additional plugins automatically; rel 3

---- Files affected:
packages/trac:
   trac.spec (1.72 -> 1.73) , trac-enableplugin.py (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/trac/trac.spec
diff -u packages/trac/trac.spec:1.72 packages/trac/trac.spec:1.73
--- packages/trac/trac.spec:1.72	Tue Apr  6 17:41:41 2010
+++ packages/trac/trac.spec	Wed Apr  7 11:42:47 2010
@@ -16,7 +16,7 @@
 Summary(pl.UTF-8):	Zintegrowane scm, wiki, system śledzenia problemów i środowisko projektowe
 Name:		trac
 Version:	0.11.7
-Release:	2
+Release:	3
 License:	BSD-like
 Group:		Applications/WWW
 Source0:	http://ftp.edgewall.com/pub/trac/Trac-%{version}.tar.gz
@@ -25,6 +25,7 @@
 Source2:	%{name}-lighttpd.conf
 Source3:	%{name}.ico
 Source4:	%{name}.ini
+Source5:	%{name}-enableplugin.py
 Patch0:		%{name}-root2http.patch
 Patch1:		%{name}-defaults.patch
 URL:		http://www.edgewall.com/trac/
@@ -101,9 +102,12 @@
 %{__python} setup.py install \
 	--root=$RPM_BUILD_ROOT
 
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
-install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
+cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
+cp -a %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
+
+# utility script to enable extra plugins
+install -p %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/%{name}-enableplugin
 
 # keep paths from 0.10 install, we want fixed paths so we do not have to update
 # webserver config each time with the upgrade.
@@ -114,8 +118,8 @@
 	mv $a $RPM_BUILD_ROOT%{_appdir}/cgi-bin/${a##*deploy_}
 done
 
-install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/trac.ini
-install %{SOURCE3} $RPM_BUILD_ROOT%{_appdir}/htdocs/%{name}.ico
+cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/trac.ini
+cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_appdir}/htdocs/%{name}.ico
 > $RPM_BUILD_ROOT%{_sysconfdir}/htpasswd
 
 # compile the scripts
@@ -175,6 +179,7 @@
 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/trac.ini
 
 %attr(755,root,root) %{_bindir}/trac-admin
+%attr(755,root,root) %{_bindir}/trac-enableplugin
 %attr(755,root,root) %{_bindir}/tracd
 
 #%{_mandir}/man1/trac*.1*
@@ -202,6 +207,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.73  2010/04/07 09:42:47  glen
+- add trac-enableplugin script to be able to enable additional plugins automatically; rel 3
+
 Revision 1.72  2010/04/06 15:41:41  glen
 - use system jquery; rel 2
 

================================================================
Index: packages/trac/trac-enableplugin.py
diff -u /dev/null packages/trac/trac-enableplugin.py:1.1
--- /dev/null	Wed Apr  7 11:42:53 2010
+++ packages/trac/trac-enableplugin.py	Wed Apr  7 11:42:47 2010
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Enable components specified in commandline in all trac instances unless it is
+# already configured.
+#
+# Author: Elan Ruusamäe <glen at delfi.ee>
+# Date: 2010-04-07
+
+import sys
+from glob import glob
+from trac.env import open_environment
+
+components = sys.argv[1:]
+for file in glob('/var/lib/trac/*/conf/trac.ini'):
+    # strip conf/trac.ini from path
+    project = file[:-14]
+
+    env = open_environment(project)
+
+    # trac/admin/web_ui.py
+    changes = False
+    for component in components:
+        is_present = env.config.has_option('components', component.lower())
+        if not is_present:
+            env.config.set('components', component, 'enabled')
+            print 'Enabling component %s in %s' % (component, project)
+            changes = True
+
+    if changes:
+        env.config.save()
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/trac/trac.spec?r1=1.72&r2=1.73&f=u



More information about the pld-cvs-commit mailing list