[Fusionforge-commits] FusionForge branch Branch_5_2 updated. 77e65871c239e2a5092bed947ae8a928f60c10b2

Roland Mas lolando at fusionforge.org
Wed Nov 7 17:34:00 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_2 has been updated
       via  77e65871c239e2a5092bed947ae8a928f60c10b2 (commit)
      from  7429f6a436953b46755286e18ce5eaf3be9a0239 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 77e65871c239e2a5092bed947ae8a928f60c10b2
Author: Roland Mas <lolando at debian.org>
Date:   Wed Nov 7 17:33:46 2012 +0100

    Backport from trunk: use Loggerhead as WSGI rather than as a daemon, and testsuite for scmbzr

diff --git a/src/debian/dsf-in/plugin-scmbzr.init.d b/src/debian/dsf-in/plugin-scmbzr.init.d
deleted file mode 100644
index 9632a2e..0000000
--- a/src/debian/dsf-in/plugin-scmbzr.init.d
+++ /dev/null
@@ -1,66 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          @OLDPACKAGE at -plugin-scmbzr
-# Required-Start:    $local_fs $remote_fs $network
-# Required-Stop:     $local_fs $remote_fs $network
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-### END INIT INFO
-#
-# Init script for @OLDPACKAGE at -plugin-scmbzr Debian package.
-# Based on the script provided by loggerhead.
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Loggerhead Bazaar Branch Browser for @FORGENAME@"
-NAME=@OLDPACKAGE at -plugin-scmbzr
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-
-# Gracefully exit if the package has been removed.
-[ -x /usr/bin/serve-branches ] || exit 0
-
-# Check if configuration file is present
-[ ! -f /etc/@OLDPACKAGE@/plugins/scmbzr/serve-branches.conf ] && exit 0
-
-. /etc/@OLDPACKAGE@/plugins/scmbzr/serve-branches.conf
-
-#
-#	Function that starts the daemon/service.
-#
-d_start() {
-    start-stop-daemon -p $PIDFILE -S --startas /usr/bin/serve-branches --chuid loggerhead --make-pidfile --background --chdir $served_branches -- --prefix=$prefix --port=$port --log-folder /var/log/loggerhead 2>/dev/null
-}
-
-#
-#	Function that stops the daemon/service.
-#
-d_stop() {
-	start-stop-daemon -p $PIDFILE -K
-}
-
-
-case "$1" in
-  start)
-	echo -n "Starting $DESC: $NAME"
-	d_start
-	echo "."
-	;;
-  stop)
-	echo -n "Stopping $DESC: $NAME"
-	d_stop
-	echo "."
-	;;
-  restart|force-reload)
-	echo -n "Restarting $DESC: $NAME"
-	d_stop
-	sleep 1
-	d_start
-	echo "."
-	;;
-  *)
-	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
-	exit 1
-	;;
-esac
-
-exit 0
diff --git a/src/etc/httpd.conf.d/50-wsgi-scmbzr.conf b/src/etc/httpd.conf.d/50-wsgi-scmbzr.conf
new file mode 100644
index 0000000..74eaaf6
--- /dev/null
+++ b/src/etc/httpd.conf.d/50-wsgi-scmbzr.conf
@@ -0,0 +1,3 @@
+<IfModule wsgi_module>
+  WSGIDaemonProcess fusionforge-plugin-scmbzr user=gforge group=gforge processes=4 maximum-requests=1000 display-name=fusionforge-plugin-scmbzr
+</IfModule>
diff --git a/src/etc/httpd.conf.d/plugin-scmbzr.inc b/src/etc/httpd.conf.d/plugin-scmbzr.inc
index b2bc8b3..55d7433 100644
--- a/src/etc/httpd.conf.d/plugin-scmbzr.inc
+++ b/src/etc/httpd.conf.d/plugin-scmbzr.inc
@@ -1,8 +1,11 @@
-<Proxy http://127.0.0.1:8081/*>
-  Allow from all
-</Proxy>
+Alias {core/url_prefix}scm/loggerhead/static /usr/share/loggerhead/static
+RewriteEngine On
+RewriteRule ^{core/url_prefix}scm/loggerhead$ {core/url_prefix}scm/loggerhead/ [R]
 
-<Location {core/url_prefix}scm/loggerhead/>
-  ProxyPass http://127.0.0.1:8081/
-  ProxyPassReverse http://127.0.0.1:8081/
+WSGIScriptAlias {core/url_prefix}scm/loggerhead /usr/bin/loggerhead.wsgi
+
+<Location {core/url_prefix}scm/loggerhead>
+    WSGIProcessGroup fusionforge-plugin-scmbzr
+    Order deny,allow
+    Allow from all
 </Location>
diff --git a/src/plugins/scmbzr/bin/install.sh b/src/plugins/scmbzr/bin/install.sh
new file mode 100644
index 0000000..5aef04e
--- /dev/null
+++ b/src/plugins/scmbzr/bin/install.sh
@@ -0,0 +1,50 @@
+#! /bin/sh
+# 
+# Configure Loggerhead for FusionForge
+# Roland Mas
+
+set -e
+
+if [ `id -u` != 0 ] ; then
+    echo "You must be root to run this, please enter passwd"
+    exec su -c "$0 $1"
+fi
+
+configfile=~gforge/.bazaar/bazaar.conf
+cachedir=/var/cache/gforge/loggerhead
+
+case "$1" in
+    configure)
+	PATH=/usr/share/gforge/bin:/usr/share/fusionforge/bin:$PATH
+	repos_path=$(forge_get_config repos_path scmbzr)
+	web_host=$(forge_get_config web_host)
+	url_prefix=$(forge_get_config url_prefix)
+
+	a2enmod wsgi
+	if [ ! -e $configfile ] ; then
+	    mkdir -p $(dirname $configfile)
+	    cat > $configfile <<EOF
+# Directory to serve bzr branches from
+# Non-bzr directories under this path will also be visible in loggerhead
+http_root_dir = '${repos_path}'
+
+# The url prefix for the bzr branches.
+http_user_prefix = 'http://${web_host}${url_prefix}scm/loggerhead'
+
+# Directory to put cache files in
+http_sql_dir = '/var/cache/gforge/loggerhead'
+EOF
+	    mkdir -p $cachedir
+	    chown gforge $cachedir
+	fi
+        ;;
+
+    purge)
+	rm -rf $configfile $cachedir
+	rmdir $(dirname $configfile) || true
+        ;;
+
+    *)
+        echo "Usage: $0 {configure|purge}"
+        exit 1
+esac
diff --git a/src/plugins/scmbzr/packaging/control/132plugin-scmbzr b/src/plugins/scmbzr/packaging/control/132plugin-scmbzr
index a27d085..ada2cb8 100644
--- a/src/plugins/scmbzr/packaging/control/132plugin-scmbzr
+++ b/src/plugins/scmbzr/packaging/control/132plugin-scmbzr
@@ -1,6 +1,6 @@
 Package: @PACKAGE at -plugin-scmbzr
 Architecture: all
-Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, @OLDPACKAGE at -web-apache2 | @OLDPACKAGE at -web, @OLDPACKAGE at -shell-postgresql | @OLDPACKAGE at -shell, bzr, php5-cli, ${misc:Depends}
+Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, @OLDPACKAGE at -web-apache2 | @OLDPACKAGE at -web, @OLDPACKAGE at -shell-postgresql | @OLDPACKAGE at -shell, bzr, php5-cli, ${misc:Depends}, libapache2-mod-wsgi, loggerhead (>= 1.19~bzr477~), python-pastedeploy
 Provides: @PACKAGE at -plugin-scm, @OLDPACKAGE at -plugin-scmbzr
 Conflicts: @OLDPACKAGE at -plugin-scmbzr
 Replaces: @OLDPACKAGE at -plugin-scmbzr
diff --git a/src/plugins/scmbzr/packaging/install/plugin-scmbzr b/src/plugins/scmbzr/packaging/install/plugin-scmbzr
index c455154..5b11c98 100644
--- a/src/plugins/scmbzr/packaging/install/plugin-scmbzr
+++ b/src/plugins/scmbzr/packaging/install/plugin-scmbzr
@@ -1,3 +1,4 @@
+plugins/scmbzr/bin/*                 usr/share/gforge/scmbzr/bin/
 plugins/scmbzr/common/*              usr/share/gforge/plugins/scmbzr/common/
 plugins/scmbzr/etc/plugins/scmbzr/*  etc/gforge/plugins/scmbzr/
 plugins/scmbzr/etc/*.ini 	     etc/@PACKAGE@/config.ini.d/
diff --git a/tests/DEBDebian60Tests.php b/tests/DEBDebian60Tests.php
index 943e57c..a24adec 100644
--- a/tests/DEBDebian60Tests.php
+++ b/tests/DEBDebian60Tests.php
@@ -30,6 +30,7 @@ class DEBDebian60Tests
 		$suite->addTestFiles(glob("func/Forums/*Test.php"));
 		$suite->addTestFiles(glob("func/News/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsBlocks/*Test.php"));
+		$suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
 		$suite->addTestFiles(glob("func/RBAC/*Test.php"));
 		$suite->addTestFiles(glob("func/Surveys/*Test.php"));
diff --git a/tests/DEBDebian70Tests.php b/tests/DEBDebian70Tests.php
index 8219e10..1a52109 100644
--- a/tests/DEBDebian70Tests.php
+++ b/tests/DEBDebian70Tests.php
@@ -33,6 +33,7 @@ class DEBDebian60Tests
 		$suite->addTestFiles(glob("func/PluginsMediawiki/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsMoinMoin/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsOnlineHelp/*Test.php"));
+		$suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsSvnTracker/*Test.php"));
 		$suite->addTestFiles(glob("func/RBAC/*Test.php"));
diff --git a/tests/RPMCentosTests.php b/tests/RPMCentosTests.php
index 8e9e400..102d033 100644
--- a/tests/RPMCentosTests.php
+++ b/tests/RPMCentosTests.php
@@ -29,6 +29,7 @@ class RPMCentosTests
 //		$suite->addTestFiles(glob("func/PluginsMediawiki/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsMoinMoin/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsOnlineHelp/*Test.php"));
+//		$suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsSvnTracker/*Test.php"));
 		$suite->addTestFiles(glob("func/RBAC/*Test.php"));
diff --git a/tests/TarCentosTests.php b/tests/TarCentosTests.php
index 24f5918..c6622b4 100755
--- a/tests/TarCentosTests.php
+++ b/tests/TarCentosTests.php
@@ -29,6 +29,7 @@ class TarCentosTests
 //		$suite->addTestFiles(glob("func/PluginsMediawiki/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsMoinMoin/*Test.php"));
 		$suite->addTestFiles(glob("func/PluginsOnlineHelp/*Test.php"));
+//		$suite->addTestFiles(glob("func/PluginsScmBzr/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsScmGit/*Test.php"));
 //		$suite->addTestFiles(glob("func/PluginsSvnTracker/*Test.php"));
 		$suite->addTestFiles(glob("func/RBAC/*Test.php"));
diff --git a/tests/func/PluginsScmBzr/bzrTest.php b/tests/func/PluginsScmBzr/bzrTest.php
new file mode 100644
index 0000000..ebf89f5
--- /dev/null
+++ b/tests/func/PluginsScmBzr/bzrTest.php
@@ -0,0 +1,89 @@
+<?php
+/*
+ * Copyright (C) 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.
+ */             
+
+require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
+
+class ScmBzrTest extends FForge_SeleniumTestCase
+{
+	function testScmBzr()
+	{
+		$this->activatePlugin('scmbzr');
+		$this->populateStandardTemplate('empty');
+		$this->init();
+
+		$this->open(ROOT);
+		$this->clickAndWait("link=ProjectA");
+		$this->clickAndWait("link=Admin");
+		$this->clickAndWait("link=Tools");
+		$this->clickAndWait("link=Source Code Admin");
+		$this->click("//input[@name='scmradio' and @value='scmbzr']");
+		$this->clickAndWait("submit");
+	    
+		// Run the cronjob to create repositories
+		$this->cron("create_scm_repos.php");
+
+		// Check that the repo is present and Loggerhead shows it (even if empty)
+		$this->open(ROOT);
+		$this->clickAndWait("link=ProjectA");
+		$this->clickAndWait("link=SCM");
+
+		$this->open(ROOT.'/scm/loggerhead/');
+		$this->assertTextPresent("Browsing (root)");
+		$this->clickAndWait("link=projecta");
+		$this->assertTextPresent("Browsing (root)/projecta");
+
+		// Get the address of the repo
+		$this->open(ROOT);
+		$this->clickAndWait("link=ProjectA");
+		$this->clickAndWait("link=SCM");
+		$p = $this->getText("//tt[contains(.,'bzr checkout bzr+ssh')]");
+		$p = preg_replace(",^bzr checkout ,", "", $p);
+		$p = preg_replace(",://.*@,", "://root@", $p);
+		$p = preg_replace(",/branchname$,", "", $p);
+
+		// Create a local branch, push it to the repo
+		$t = exec("mktemp -d /tmp/bzrTest.XXXXXX");
+		system("cd $t && bzr init --quiet trunk >/dev/null", $ret);
+		$this->assertEquals($ret, 0);
+
+		system("echo 'this is a simple text' > $t/trunk/mytext.txt");
+		system("cd $t/trunk && bzr add --quiet && bzr commit -m'Adding file' --quiet", $ret);
+		system("echo 'another simple text' >> $t/trunk/mytext.txt");
+		system("cd $t/trunk && bzr add --quiet && bzr commit -m'Modifying file' --quiet", $ret);
+		$this->assertEquals($ret, 0);
+
+		system("cd $t/trunk && bzr push --quiet $p/trunk", $ret);
+		$this->assertEquals($ret, 0);
+
+		$this->open(ROOT.'/scm/loggerhead/projecta');
+		$this->assertTextPresent("Browsing (root)/projecta");
+		$this->assertTextPresent("trunk");
+		$this->clickAndWait("link=trunk");
+		$this->assertTextPresent("Modifying file");
+		$this->assertTextNotPresent("Adding file");
+		$this->clickAndWait("link=Changes");
+		$this->assertTextPresent("Modifying file");
+		$this->assertTextPresent("Adding file");
+
+		system("rm -fr $t");
+	}
+}
+?>

-----------------------------------------------------------------------

Summary of changes:
 src/debian/dsf-in/plugin-scmbzr.init.d             |   66 ---------------
 src/etc/httpd.conf.d/50-wsgi-scmbzr.conf           |    3 +
 src/etc/httpd.conf.d/plugin-scmbzr.inc             |   15 ++--
 src/plugins/scmbzr/bin/install.sh                  |   50 +++++++++++
 .../scmbzr/packaging/control/132plugin-scmbzr      |    2 +-
 src/plugins/scmbzr/packaging/install/plugin-scmbzr |    1 +
 tests/DEBDebian60Tests.php                         |    1 +
 tests/DEBDebian70Tests.php                         |    1 +
 tests/RPMCentosTests.php                           |    1 +
 tests/TarCentosTests.php                           |    1 +
 tests/func/PluginsScmBzr/bzrTest.php               |   89 ++++++++++++++++++++
 11 files changed, 157 insertions(+), 73 deletions(-)
 delete mode 100644 src/debian/dsf-in/plugin-scmbzr.init.d
 create mode 100644 src/etc/httpd.conf.d/50-wsgi-scmbzr.conf
 create mode 100644 src/plugins/scmbzr/bin/install.sh
 create mode 100644 tests/func/PluginsScmBzr/bzrTest.php


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list