packages: trac/trac.spec, trac/trac-upgrade.py (NEW) - add trac-upgrade scr...

glen glen at pld-linux.org
Tue Sep 28 07:48:16 CEST 2010


Author: glen                         Date: Tue Sep 28 05:48:16 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add trac-upgrade script, sets [inherit] section for now
- rel 8

---- Files affected:
packages/trac:
   trac.spec (1.93 -> 1.94) , trac-upgrade.py (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/trac/trac.spec
diff -u packages/trac/trac.spec:1.93 packages/trac/trac.spec:1.94
--- packages/trac/trac.spec:1.93	Mon Sep 13 22:16:08 2010
+++ packages/trac/trac.spec	Tue Sep 28 07:48:11 2010
@@ -6,7 +6,7 @@
 Summary(pl.UTF-8):	Zintegrowane scm, wiki, system śledzenia problemów i środowisko projektowe
 Name:		trac
 Version:	0.12
-Release:	7
+Release:	8
 License:	BSD-like
 Group:		Applications/WWW
 Source0:	http://ftp.edgewall.com/pub/trac/Trac-%{version}.tar.gz
@@ -16,9 +16,10 @@
 Source3:	%{name}.ico
 Source4:	%{name}.ini
 Source5:	%{name}-enableplugin.py
+Source6:	%{name}-upgrade.py
 Patch0:		%{name}-root2http.patch
 Patch1:		%{name}-defaults.patch
-Patch2:		inherit-global-trac.ini.patch
+Patch2:		inherit-global-%{name}.ini.patch
 URL:		http://trac.edgewall.org/
 BuildRequires:	python >= 1:2.1
 BuildRequires:	python-babel >= 0.9.5
@@ -96,7 +97,7 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},/var/lib/%{name},%{_datadir}/%{name}/{plugins,templates}}
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sbindir},/var/lib/%{name},%{_datadir}/%{name}/{plugins,templates}}
 
 %{__python} setup.py install \
 	--skip-build \
@@ -108,7 +109,9 @@
 cp -a %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
 
 # utility script to enable extra plugins
-install -p %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/%{name}-enableplugin
+install -p %{SOURCE5} $RPM_BUILD_ROOT%{_sbindir}/%{name}-enableplugin
+# handle upgrades
+install -p %{SOURCE6} $RPM_BUILD_ROOT%{_sbindir}/%{name}-upgrade
 
 # keep paths from 0.10 install, we want fixed paths so we do not have to update
 # webserver config each time with the upgrade.
@@ -197,7 +200,8 @@
 %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) %{_sbindir}/trac-enableplugin
+%attr(755,root,root) %{_sbindir}/trac-upgrade
 %attr(755,root,root) %{_bindir}/tracd
 
 #%{_mandir}/man1/trac*.1*
@@ -252,6 +256,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.94  2010/09/28 05:48:11  glen
+- add trac-upgrade script, sets [inherit] section for now
+- rel 8
+
 Revision 1.93  2010/09/13 20:16:08  glen
 - setup to inherit /etc/webapps/trac/trac.ini in new projects
   you still need to alter existing project youself

================================================================
Index: packages/trac/trac-upgrade.py
diff -u /dev/null packages/trac/trac-upgrade.py:1.1
--- /dev/null	Tue Sep 28 07:48:16 2010
+++ packages/trac/trac-upgrade.py	Tue Sep 28 07:48:11 2010
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Upgrade all Trac instances
+#
+# Author: Elan Ruusamäe <glen at delfi.ee>
+# Date: 2010-09-13
+
+import sys
+from glob import glob
+from trac.env import open_environment
+from trac.core import TracError
+
+for file in glob('/var/lib/trac/*/conf/trac.ini'):
+	# strip conf/trac.ini from path
+	project = file[:-14]
+
+	try:
+		env = open_environment(project)
+
+		# Trac 0.11: add [inherit] section
+		changes = False
+		is_present = env.config.has_option('inherit', 'file')
+		if not is_present:
+			env.config.set('inherit', 'file', '/etc/webapps/trac/trac.ini')
+			print 'Set [inherit] file to /etc/webapps/trac/trac.ini in %s' % project
+			changes = True
+
+		if changes:
+			env.config.save()
+	except TracError, e:
+		print e.message
================================================================

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



More information about the pld-cvs-commit mailing list