[Fusionforge-commits] r8009 - in trunk/gforge: debian packaging/dirs packaging/install plugins plugins/scmcpold/common plugins/scmdarcs plugins/scmdarcs/common plugins/scmdarcs/etc plugins/scmdarcs/etc/plugins plugins/scmdarcs/etc/plugins/scmdarcs

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Aug 27 15:44:10 CEST 2009


Author: lolando
Date: 2009-08-27 15:44:10 +0200 (Thu, 27 Aug 2009)
New Revision: 8009

Added:
   trunk/gforge/debian/gforge-plugin-scmdarcs.postinst
   trunk/gforge/debian/gforge-plugin-scmdarcs.prerm
   trunk/gforge/packaging/dirs/plugin-scmdarcs
   trunk/gforge/packaging/install/plugin-scmdarcs
   trunk/gforge/plugins/scmdarcs/
   trunk/gforge/plugins/scmdarcs/common/
   trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php
   trunk/gforge/plugins/scmdarcs/common/scmdarcs-init.php
   trunk/gforge/plugins/scmdarcs/etc/
   trunk/gforge/plugins/scmdarcs/etc/plugins/
   trunk/gforge/plugins/scmdarcs/etc/plugins/scmdarcs/
   trunk/gforge/plugins/scmdarcs/etc/plugins/scmdarcs/config.php
Modified:
   trunk/gforge/debian/control
   trunk/gforge/packaging/dirs/plugin-scmbzr
   trunk/gforge/packaging/dirs/plugin-scmcpold
   trunk/gforge/packaging/dirs/plugin-scmcvs
   trunk/gforge/plugins/scmcpold/common/scmcpold-init.php
Log:
Started Darcs plugin (doesn't do much yet)

Modified: trunk/gforge/debian/control
===================================================================
--- trunk/gforge/debian/control	2009-08-27 13:43:56 UTC (rev 8008)
+++ trunk/gforge/debian/control	2009-08-27 13:44:10 UTC (rev 8009)
@@ -229,6 +229,21 @@
  over it to the project's administrator.
 Provides: gforge-plugin-scm
 
+Package: gforge-plugin-scmdarcs
+Architecture: all
+Depends: gforge-common, gforge-db-postgresql | gforge-db, gforge-web-apache2 | gforge-web, gforge-shell-postgresql | gforge-shell, darcs, php5-cli, ${misc:Depends}
+Description: collaborative development tool - Darcs plugin
+ FusionForge provides many tools to aid collaboration in a
+ development project, such as bug-tracking, task management,
+ mailing-lists, SCM repository, forums, support request helper,
+ web/FTP hosting, release management, etc. All these services are
+ integrated into one web site and managed through a web interface.
+ .
+ This plugin contains the Darcs subsystem of FusionForge. It allows each
+ FusionForge project to have its own Darcs repository, and gives some control
+ over it to the project's administrator.
+Provides: gforge-plugin-scm
+
 Package: gforge-plugin-scmcpold
 Architecture: all
 Depends: gforge-common, gforge-db-postgresql | gforge-db, gforge-web-apache2 | gforge-web, gforge-shell-postgresql | gforge-shell, php5-cli, ${misc:Depends}

Added: trunk/gforge/debian/gforge-plugin-scmdarcs.postinst
===================================================================
--- trunk/gforge/debian/gforge-plugin-scmdarcs.postinst	                        (rev 0)
+++ trunk/gforge/debian/gforge-plugin-scmdarcs.postinst	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,51 @@
+#! /bin/sh
+# postinst script for gforge-plugin-scmdarcs
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+	gforge-config
+
+	# Prepare database
+	su -s /bin/sh gforge -c '/usr/share/gforge/bin/register-plugin scmdarcs "Darcs"'
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+

Added: trunk/gforge/debian/gforge-plugin-scmdarcs.prerm
===================================================================
--- trunk/gforge/debian/gforge-plugin-scmdarcs.prerm	                        (rev 0)
+++ trunk/gforge/debian/gforge-plugin-scmdarcs.prerm	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,45 @@
+#! /bin/sh
+# prerm script for gforge-plugin-scmdarcs
+#
+# see: dh_installdeb(1)
+set -e
+
+#DEBHELPER#
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|deconfigure)
+	if [ -f /var/run/postgresql/.s.PGSQL.5432 ]
+	then
+		/usr/share/gforge/bin/unregister-plugin scmdarcs
+	else
+		echo "WARNING: database not available to unregister scmdarcs plugin"
+	fi
+        ;;
+    upgrade|failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+

Modified: trunk/gforge/packaging/dirs/plugin-scmbzr
===================================================================
--- trunk/gforge/packaging/dirs/plugin-scmbzr	2009-08-27 13:43:56 UTC (rev 8008)
+++ trunk/gforge/packaging/dirs/plugin-scmbzr	2009-08-27 13:44:10 UTC (rev 8009)
@@ -1,6 +1,4 @@
 etc/gforge/httpd.d
 etc/gforge/plugins/scmbzr
-usr/share/gforge/plugins/scmbzr/bin
-usr/share/gforge/plugins/scmbzr/cronjobs
 usr/share/gforge/plugins/scmbzr/common
 var/lib/gforge/chroot/scmrepos/bzr

Modified: trunk/gforge/packaging/dirs/plugin-scmcpold
===================================================================
--- trunk/gforge/packaging/dirs/plugin-scmcpold	2009-08-27 13:43:56 UTC (rev 8008)
+++ trunk/gforge/packaging/dirs/plugin-scmcpold	2009-08-27 13:44:10 UTC (rev 8009)
@@ -1,6 +1,4 @@
 etc/gforge/httpd.d
 etc/gforge/plugins/scmcpold
-usr/share/gforge/plugins/scmcpold/bin
-usr/share/gforge/plugins/scmcpold/cronjobs
 usr/share/gforge/plugins/scmcpold/common
 var/lib/gforge/chroot/scmrepos/cpold

Modified: trunk/gforge/packaging/dirs/plugin-scmcvs
===================================================================
--- trunk/gforge/packaging/dirs/plugin-scmcvs	2009-08-27 13:43:56 UTC (rev 8008)
+++ trunk/gforge/packaging/dirs/plugin-scmcvs	2009-08-27 13:44:10 UTC (rev 8009)
@@ -2,7 +2,6 @@
 etc/gforge/plugins/scmcvs
 usr/share/gforge/plugins/scmcvs/bin
 usr/share/gforge/plugins/scmcvs/sbin
-usr/share/gforge/plugins/scmcvs/cronjobs
 usr/share/gforge/plugins/scmcvs/common
 var/lib/gforge/chroot/cvsroot
 var/lib/gforge/chroot/scmrepos/cvs

Added: trunk/gforge/packaging/dirs/plugin-scmdarcs
===================================================================
--- trunk/gforge/packaging/dirs/plugin-scmdarcs	                        (rev 0)
+++ trunk/gforge/packaging/dirs/plugin-scmdarcs	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,4 @@
+etc/gforge/httpd.d
+etc/gforge/plugins/scmdarcs
+usr/share/gforge/plugins/scmdarcs/common
+var/lib/gforge/chroot/scmrepos/darcs

Added: trunk/gforge/packaging/install/plugin-scmdarcs
===================================================================
--- trunk/gforge/packaging/install/plugin-scmdarcs	                        (rev 0)
+++ trunk/gforge/packaging/install/plugin-scmdarcs	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,2 @@
+plugins/scmdarcs/common/*               usr/share/gforge/plugins/scmdarcs/common/
+plugins/scmdarcs/etc/plugins/scmdarcs/* etc/gforge/plugins/scmdarcs/

Modified: trunk/gforge/plugins/scmcpold/common/scmcpold-init.php
===================================================================
--- trunk/gforge/plugins/scmcpold/common/scmcpold-init.php	2009-08-27 13:43:56 UTC (rev 8008)
+++ trunk/gforge/plugins/scmcpold/common/scmcpold-init.php	2009-08-27 13:44:10 UTC (rev 8009)
@@ -1,5 +1,5 @@
 <?php
-/** FusionForge Bazaar plugin
+/** FusionForge CPOLD plugin
  *
  * Copyright 2009, Roland Mas
  *

Added: trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php	                        (rev 0)
+++ trunk/gforge/plugins/scmdarcs/common/DarcsPlugin.class.php	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,138 @@
+<?php
+/** FusionForge Darcs plugin
+ *
+ * Copyright 2009, 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 FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+class DarcsPlugin extends SCMPlugin {
+	function DarcsPlugin () {
+		global $gfconfig;
+		$this->SCMPlugin () ;
+		$this->name = 'scmdarcs';
+		$this->text = 'Darcs';
+		$this->hooks[] = 'scm_generate_snapshots' ;
+		$this->hooks[] = 'scm_darcs_do_nothing' ;
+		
+		require_once $gfconfig.'plugins/scmdarcs/config.php' ;
+		
+		$this->default_darcs_server = $default_darcs_server ;
+		$this->enabled_by_default = $enabled_by_default ;
+		$this->darcs_root = $darcs_root;
+		
+		$this->register () ;
+	}
+	
+	function getDefaultServer() {
+		return $this->default_darcs_server ;
+	}
+
+	function getBlurb () {
+		return _('<p>This Darcs plugin is not fully implemented yet.</p>') ;
+	}
+
+	function getInstructionsForAnon ($project) {
+		$b =  _('<p><b>Anonymous Darcs Access</b></p><p>This project\'s Darcs repository cannot be anonymously checked out yet.</p>');
+		return $b ;
+	}
+
+	function getInstructionsForRW ($project) {
+		$b = _('<p><b>Developer Darcs Access via SSH</b></p><p>Only project developers can access the Darcs tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.</p>');
+		$b .= '<p><tt>scp -r <i>'._('developername').'</i>@' . $project->getSCMBox() . ':'. $this->darcs_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
+		return $b ;
+	}
+
+	function getSnapshotPara ($project) {
+		return ;
+	}
+
+	function getBrowserLinkBlock ($project) {
+		return ;
+	}
+
+	function getStatsBlock ($project) {
+		return ;
+	}
+
+	function createOrUpdateRepo ($params) {
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
+		}
+				
+		if (! $project->usesPlugin ($this->name)) {
+			return false;
+		}
+
+		$repo = $this->darcs_root . '/' . $project->getUnixName() ;
+		$unix_group = 'scm_' . $project->getUnixName() ;
+
+		system ("mkdir -p $repo") ;
+		system ("chgrp -R $unix_group $repo") ;
+		if ($project->enableAnonSCM()) {
+			system ("chmod -R g+wXs,o+rX-w $repo") ;
+		} else {
+			system ("chmod -R g+wXs,o-rwx $repo") ;
+		}
+	}
+
+	function generateSnapshots ($params) {
+		global $sys_scm_tarballs_path ;
+
+		$project = $this->checkParams ($params) ;
+		if (!$project) {
+			return false ;
+		}
+		
+		$group_name = $project->getUnixName() ;
+
+		$tarball = $sys_scm_tarballs_path.'/'.$group_name.'-scmroot.tar.gz';
+
+		if (! $project->usesPlugin ($this->name)
+		    || ! $project->enableAnonSCM()) {
+			unlink ($tarball) ;
+			return false;
+		}
+
+		$toprepo = $this->darcs_root ;
+		$repo = $toprepo . '/' . $project->getUnixName() ;
+
+		if (!is_dir ($repo)) {
+			unlink ($tarball) ;
+			return false ;
+		}
+
+		$tmp = trim (`mktemp -d`) ;
+		if ($tmp == '') {
+			return false ;
+		}
+		system ("tar czCf $toprepo $tmp/tarball.tar.gz " . $project->getUnixName()) ;
+		chmod ("$tmp/tarball.tar.gz", 0644) ;
+		copy ("$tmp/tarball.tar.gz", $tarball) ;
+		unlink ("$tmp/tarball.tar.gz") ;
+		system ("rm -rf $tmp") ;
+	}
+  }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Added: trunk/gforge/plugins/scmdarcs/common/scmdarcs-init.php
===================================================================
--- trunk/gforge/plugins/scmdarcs/common/scmdarcs-init.php	                        (rev 0)
+++ trunk/gforge/plugins/scmdarcs/common/scmdarcs-init.php	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,36 @@
+<?php
+/** FusionForge Darcs plugin
+ *
+ * Copyright 2009, 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 FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+global $gfplugins;
+require_once $gfplugins.'scmdarcs/common/DarcsPlugin.class.php' ;
+
+$DarcsPluginObject = new DarcsPlugin ;
+
+register_plugin ($DarcsPluginObject) ;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Added: trunk/gforge/plugins/scmdarcs/etc/plugins/scmdarcs/config.php
===================================================================
--- trunk/gforge/plugins/scmdarcs/etc/plugins/scmdarcs/config.php	                        (rev 0)
+++ trunk/gforge/plugins/scmdarcs/etc/plugins/scmdarcs/config.php	2009-08-27 13:44:10 UTC (rev 8009)
@@ -0,0 +1,12 @@
+<?php
+ 
+$default_darcs_server = $GLOBALS['sys_scm_host'];
+$darcs_root = '/var/lib/gforge/chroot/scmrepos/darcs';
+$enabled_by_default = false;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+ 
+?>




More information about the Fusionforge-commits mailing list