[Fusionforge-commits] r15545 - in branches/Branch_5_1: . src/debian src/packaging/install src/plugins/mediawiki src/plugins/mediawiki/debian src/utils

Roland Mas lolando at fusionforge.org
Tue May 22 14:27:17 CEST 2012


Author: lolando
Date: 2012-05-22 14:27:16 +0200 (Tue, 22 May 2012)
New Revision: 15545

Added:
   branches/Branch_5_1/src/plugins/mediawiki/debian/
   branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.postinst
   branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.triggers
   branches/Branch_5_1/src/utils/list-projects-using-plugin.php
Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/debian/changelog
   branches/Branch_5_1/src/debian/rules
   branches/Branch_5_1/src/packaging/install/common
Log:
Set up a dpkg trigger to handle Mediawiki upgrades

Modified: branches/Branch_5_1/src/debian/changelog
===================================================================
--- branches/Branch_5_1/src/debian/changelog	2012-05-21 14:20:45 UTC (rev 15544)
+++ branches/Branch_5_1/src/debian/changelog	2012-05-22 12:27:16 UTC (rev 15545)
@@ -1,3 +1,10 @@
+fusionforge (5.1.1-6+1) unstable; urgency=low
+
+  * Set up a dpkg trigger to handle Mediawiki upgrades and update the
+    database schemas accordingly (closes: #673125).
+
+ -- Roland Mas <lolando at debian.org>  Tue, 22 May 2012 11:24:34 +0200
+
 fusionforge (5.1.1-6) unstable; urgency=low
 
   * Fixes in search.

Modified: branches/Branch_5_1/src/debian/rules
===================================================================
--- branches/Branch_5_1/src/debian/rules	2012-05-21 14:20:45 UTC (rev 15544)
+++ branches/Branch_5_1/src/debian/rules	2012-05-22 12:27:16 UTC (rev 15545)
@@ -45,6 +45,8 @@
 INSTALLFILES=$(patsubst packaging/install/%,debian/$(OLDPACKAGE)-%.install,$(wildcard packaging/install/[a-z]*))
 PINSTALLFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/install/[a-z]*),debian/$(PACKAGE)-plugin-$i.install))
 
+PTRIGGERSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/debian/[a-z]*.triggers),debian/$(PACKAGE)-plugin-$i.triggers))
+
 DOCSFILES=$(patsubst packaging/docs/%,debian/$(OLDPACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*)) \
 		$(patsubst packaging/docs/%,debian/$(PACKAGE)-%.docs,$(wildcard packaging/docs/[a-z]*))
 PDOCSFILES=$(foreach i,$(ENABLED_PLUGINS),$(if $(wildcard plugins/$i/packaging/docs/[a-z]*),debian/$(PACKAGE)-plugin-$i.docs))
@@ -77,13 +79,19 @@
 	sh $(CURDIR)/deb-specific/manage-uufiles.sh clean
 
 .PHONY: conffiles
-conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(READMEFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) debian/control
+conffiles: $(PPOSTINST) $(PPRERM) $(CRONDFILES) $(DIRSFILES) $(LINKSFILES) $(INSTALLFILES) $(DOCSFILES) $(READMEFILES) $(PCRONDFILES) $(PDIRSFILES) $(PLINKSFILES) $(PINSTALLFILES) $(PDOCSFILES) $(PTRIGGERSFILES) debian/control
 
 debian/$(PACKAGE)-plugin-%.postinst:
-	export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
+	export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
+		[ -e $(CURDIR)/plugins/$*/debian/plugin-$*.postinst ] \
+		&& $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/plugins/$*/debian/plugin-$*.postinst > $@ \
+		|| $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.postinst > $@
 
 debian/$(PACKAGE)-plugin-%.prerm:
-	export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
+	export PLUGLONGNAME="`cat $(CURDIR)/plugins/$*/NAME`"; \
+		[ -e $(CURDIR)/plugins/$*/debian/plugin-$*.prerm ] \
+		&& $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/plugins/$*/debian/plugin-$*.prerm > $@ \
+		|| $(SED_REPLACE) -e 's/@PLUGSHORTNAME@/$*/g' -e "s/@PLUGLONGNAME@/$$PLUGLONGNAME/g" $(CURDIR)/debian/dsf-in/plugin.prerm > $@
 
 debian/$(PACKAGE)-plugin-%.cron.d:
 	$(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/plugins/$*/packaging/cron.d/plugin-$* > $@
@@ -91,6 +99,7 @@
 debian/$(OLDPACKAGE)-%.cron.d:
 	(cat $(CURDIR)/packaging/cron.d/00phpcron ; $(SED_REPLACE) -e 's/\$$FFUSER/$(OLDPACKAGE)/g' $(CURDIR)/packaging/cron.d/$*) | $(SED_REPLACE) > $@
 
+# Perform subsitutions on 'dirs', 'links', 'install', 'docs', 'triggers' files
 debian/$(PACKAGE)-plugin-%.dirs:
 	$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/dirs/plugin-$* > $@
 
@@ -106,6 +115,9 @@
 debian/$(PACKAGE)-plugin-%.install:
 	$(SED_REPLACE) $(CURDIR)/plugins/$*/packaging/install/plugin-$* > $@
 
+debian/$(PACKAGE)-plugin-%.triggers:
+	$(SED_REPLACE) $(CURDIR)/plugins/$*/debian/plugin-$*.triggers > $@
+
 debian/$(OLDPACKAGE)-%.install:
 	$(SED_REPLACE) $(CURDIR)/packaging/install/$* > $@ 
 

Modified: branches/Branch_5_1/src/packaging/install/common
===================================================================
--- branches/Branch_5_1/src/packaging/install/common	2012-05-21 14:20:45 UTC (rev 15544)
+++ branches/Branch_5_1/src/packaging/install/common	2012-05-22 12:27:16 UTC (rev 15545)
@@ -29,3 +29,4 @@
 cronjobs/generate_scm_snapshots.php    usr/share/@OLDPACKAGE@/cronjobs/
 locales/*                              usr/share/locale/
 utils/list-admins.php                  usr/share/@OLDPACKAGE@/bin/
+utils/list-projects-using-plugin.php   usr/share/@OLDPACKAGE@/bin/

Added: branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.postinst
===================================================================
--- branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.postinst	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.postinst	2012-05-22 12:27:16 UTC (rev 15545)
@@ -0,0 +1,28 @@
+#! /bin/sh
+# postinst script for @PACKAGE at -plugin-mediawiki
+
+set -e
+
+case "$1" in
+    triggered)
+	if [ "$2" = /usr/share/mediawiki/maintenance/postgres ] ; then
+	    # Upgrade Mediawiki database schemas
+	    /usr/share/gforge/bin/list-projects-using-plugin.php mediawiki | while read i ; do
+		/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php $i update.php
+	    done
+
+	fi
+	;;
+    
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+	;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+	;;
+esac
+
+#DEBHELPER#
+
+exit 0

Added: branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.triggers
===================================================================
--- branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.triggers	                        (rev 0)
+++ branches/Branch_5_1/src/plugins/mediawiki/debian/plugin-mediawiki.triggers	2012-05-22 12:27:16 UTC (rev 15545)
@@ -0,0 +1,2 @@
+# Triggers for @PACKAGE at -plugin-mediawiki
+interest /usr/share/mediawiki/maintenance/postgres

Added: branches/Branch_5_1/src/utils/list-projects-using-plugin.php
===================================================================
--- branches/Branch_5_1/src/utils/list-projects-using-plugin.php	                        (rev 0)
+++ branches/Branch_5_1/src/utils/list-projects-using-plugin.php	2012-05-22 12:27:16 UTC (rev 15545)
@@ -0,0 +1,53 @@
+#! /usr/bin/php -f
+<?php
+/**
+ * FusionForge
+ *
+ * Copyright 2012, Roland Mas
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+if (count ($argv) < 2) {
+        echo "Usage: .../list-projects-using-plugin.php <plugin>
+For instance: .../list-projects-using-plugin.php mediawiki
+" ;
+        exit (1) ;
+}
+
+$pname = $argv[1] ;
+
+require (dirname(__FILE__).'/../common/include/env.inc.php');
+require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'include/cron_utils.php';
+
+// Plugins subsystem
+require_once($gfcommon.'include/Plugin.class.php');
+require_once($gfcommon.'include/PluginManager.class.php');
+
+setup_plugin_manager () ;
+
+$plugin = plugin_get_object($pname);
+
+if (!$plugin) {
+	die ("Wrong plugin name\n") ;
+}
+
+foreach ($plugin->getGroups() as $p) {
+	print $p->getUnixName()."\n";
+}
+?>




More information about the Fusionforge-commits mailing list