[Fusionforge-commits] FusionForge branch Branch_5_3 updated. d81e9349b8a91f2baccc3d3d8a578a29cdb9d23a

Sylvain Beucler beuc-inria at fusionforge.org
Tue Mar 18 17:29:54 CET 2014


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_3 has been updated
       via  d81e9349b8a91f2baccc3d3d8a578a29cdb9d23a (commit)
       via  83d0ef3a7b92c2548cddd243663c2d120c6a571a (commit)
       via  484fea262520c904ce3f92b929c378fb8f43364c (commit)
       via  d8856a3aafd5eb3e07bc1aa2d16bb5ca23e0c6f7 (commit)
       via  b7959d9af9f8e0287121603ad4066c8c89c884e5 (commit)
       via  8dfb7bc46d7508315c6de7b3ccae2915a39daff4 (commit)
      from  3621086a3358b685f7df04ee20da2e88a6d43794 (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 d81e9349b8a91f2baccc3d3d8a578a29cdb9d23a
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Tue Mar 4 12:50:45 2014 +0100

    svn/commitemail: Make svnlook support accents

diff --git a/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php b/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php
index 5042439..ae8b97a 100644
--- a/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php
+++ b/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php
@@ -31,6 +31,9 @@ $commit_email_pl = dirname(__FILE__).'/commit-email.pl';
 # Set sendmail path to next script from our configuration.
 putenv("SENDMAIL=".forge_get_config('sendmail_path'));
 
+# Make svnlook support accents
+putenv("LANG=en_US.UTF-8");
+
 if(!file_exists($svnlook) || !file_exists($commit_email_pl)) { die("Missing required executables."); }
 
 # Find who made the changes

commit 83d0ef3a7b92c2548cddd243663c2d120c6a571a
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Mon Mar 3 11:17:25 2014 +0100

    Improve indentation/readability

diff --git a/src/plugins/scmhook/library/scmsvn/commitEmail.class.php b/src/plugins/scmhook/library/scmsvn/commitEmail.class.php
index 7dba266..288d475 100644
--- a/src/plugins/scmhook/library/scmsvn/commitEmail.class.php
+++ b/src/plugins/scmhook/library/scmsvn/commitEmail.class.php
@@ -37,8 +37,8 @@ class commitEmail extends scmhook {
 		$this->label = "scmsvn";
 		$this->unixname = "commitemail";
 		$this->needcopy = 0;
-		$this->command = '/usr/bin/php -d include_path='.ini_get('include_path').' '.forge_get_config('plugins_path').'/scmhook/library/'.
-		$this->label.'/hooks/'.$this->unixname.'/commit-email.php "$1" "$2" '.$this->group->getUnixName().'-commits@'.forge_get_config('lists_host');
+		$this->command = '/usr/bin/php -d include_path='.ini_get('include_path').' '.forge_get_config('plugins_path').'/scmhook/library/'
+			.$this->label.'/hooks/'.$this->unixname.'/commit-email.php "$1" "$2" '.$this->group->getUnixName().'-commits@'.forge_get_config('lists_host');
 	}
 
 	function isAvailable() {

commit 484fea262520c904ce3f92b929c378fb8f43364c
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Wed Mar 12 15:31:05 2014 +0100

    scmhook: let commit-email.pl set the sender from the SVN username; forward return code to SVN so it displays errors if any

diff --git a/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php b/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php
index 16dab1e..5042439 100644
--- a/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php
+++ b/src/plugins/scmhook/library/scmsvn/hooks/commitemail/commit-email.php
@@ -36,15 +36,8 @@ if(!file_exists($svnlook) || !file_exists($commit_email_pl)) { die("Missing requ
 # Find who made the changes
 if($argc < 4) { die("Invalid arguments."); }
 
-$author = exec("$svnlook author \"$argv[1]\" -r $argv[2]");
-$res_db= db_query_params('SELECT email FROM users where user_name = lower($1) LIMIT 1',
-			array($author));
-if($res_db) {
-	$e = db_fetch_array($res_db);
-	if($e) {
-		passthru("$commit_email_pl --from $e[email] \"$argv[1]\" $argv[2] $argv[3]");
-		exit;
-	}
-}
-passthru("$commit_email_pl \"$argv[1]\" $argv[2] $argv[3]");
-?>
+$users_host = forge_get_config('users_host');
+if (!empty($users_host))
+  $hostname = "-h $users_host";
+passthru("$commit_email_pl \"$argv[1]\" $argv[2] $hostname $argv[3]", $ret);
+exit($ret);  // warn SVN if something went wrong

commit d8856a3aafd5eb3e07bc1aa2d16bb5ca23e0c6f7
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Wed Mar 12 14:36:23 2014 +0100

    scmhook: cronjob packaging

diff --git a/src/plugins/scmhook/cronjobs/updateScmRepo.php b/src/plugins/scmhook/cronjobs/updateScmRepo.php
index 524c785..4163e47 100644
--- a/src/plugins/scmhook/cronjobs/updateScmRepo.php
+++ b/src/plugins/scmhook/cronjobs/updateScmRepo.php
@@ -1,3 +1,4 @@
+#!/usr/bin/php
 <?php
 /**
  * Copyright 2011, Franck Villaume - Capgemini
diff --git a/src/plugins/scmhook/packaging/cron.d/plugin-scmhook b/src/plugins/scmhook/packaging/cron.d/plugin-scmhook
new file mode 100644
index 0000000..0792b16
--- /dev/null
+++ b/src/plugins/scmhook/packaging/cron.d/plugin-scmhook
@@ -0,0 +1,2 @@
+# Apply hooks every hour
+0 * * * * root forge_run_plugin_job scmhook updateScmRepo.php
diff --git a/src/plugins/scmhook/packaging/install/plugin-scmhook b/src/plugins/scmhook/packaging/install/plugin-scmhook
index fa0778f..cc7283f 100644
--- a/src/plugins/scmhook/packaging/install/plugin-scmhook
+++ b/src/plugins/scmhook/packaging/install/plugin-scmhook
@@ -4,4 +4,4 @@ plugins/scmhook/db/*		@PLUGIN_PATH@/scmhook/db/
 plugins/scmhook/bin/*		@PLUGIN_PATH@/scmhook/bin/
 plugins/scmhook/library/*	@PLUGIN_PATH@/scmhook/library/
 plugins/scmhook/etc/*.ini	etc/@PACKAGE@/config.ini.d/
-plugins/scmhook/cronjobs/*	usr/share/gforge/cronjobs
+plugins/scmhook/cronjobs/*	@PLUGIN_PATH@/scmhook/cronjobs/

commit b7959d9af9f8e0287121603ad4066c8c89c884e5
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Wed Mar 12 12:01:52 2014 +0100

    scmhook: db packaging
    
    Conflicts:
    	.gitignore

diff --git a/src/plugins/scmhook/bin/db-delete.pl b/src/plugins/scmhook/bin/db-delete.pl
new file mode 100755
index 0000000..f4f0c1e
--- /dev/null
+++ b/src/plugins/scmhook/bin/db-delete.pl
@@ -0,0 +1,187 @@
+#!/usr/bin/perl -w
+#
+# Debian-specific script to delete plugin-specific tables
+# Roland Mas <lolando at debian.org>
+
+use strict ;
+use diagnostics ;
+
+use DBI ;
+use MIME::Base64 ;
+use HTML::Entities ;
+
+use vars qw/$dbh @reqlist $query/ ;
+use vars qw/$sys_default_domain $sys_cvs_host
+    $sys_shell_host $sys_users_host $sys_docs_host $sys_lists_host
+    $sys_dns1_host $sys_dns2_host $FTPINCOMING_DIR $FTPFILES_DIR
+    $sys_urlroot $sf_cache_dir $sys_name $sys_themeroot
+    $sys_news_group $sys_dbhost $sys_dbname $sys_dbuser $sys_dbpasswd
+    $sys_ldap_base_dn $sys_ldap_host $admin_login $admin_password
+    $domain_name
+    $skill_list/ ;
+use vars qw/$pluginname/ ;
+
+sub is_lesser ( $$ ) ;
+sub is_greater ( $$ ) ;
+sub debug ( $ ) ;
+sub parse_sql_file ( $ ) ;
+
+require ("/usr/share/gforge/lib/include.pl") ; # Include a few predefined functions 
+require ("/usr/share/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
+
+debug "You'll see some debugging info during this installation." ;
+debug "Do not worry unless told otherwise." ;
+
+&db_connect ;
+
+# debug "Connected to the database OK." ;
+
+$pluginname = "scmhook" ;
+
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+eval {
+    my ($sth, @array, $version, $action, $path, $target, $rname) ;
+
+    my $pattern = "plugin_" . $pluginname . '_%' ;
+
+    $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='v'" ;
+    $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    while (@array = $sth->fetchrow_array ()) {
+	$rname = $array [0] ;
+	&drop_view_if_exists ($rname) ;
+    }
+    $sth->finish () ;
+
+    $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='r'" ;
+    $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    while (@array = $sth->fetchrow_array ()) {
+	$rname = $array [0] ;
+	&drop_table_if_exists ($rname) ;
+    }
+    $sth->finish () ;
+
+    $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='i'" ;
+    $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    while (@array = $sth->fetchrow_array ()) {
+	$rname = $array [0] ;
+	&drop_index_if_exists ($rname) ;
+    }
+    $sth->finish () ;
+
+    $query = "SELECT relname FROM pg_class WHERE relname LIKE '$pattern' AND relkind='s'" ;
+    $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    while (@array = $sth->fetchrow_array ()) {
+	$rname = $array [0] ;
+	&drop_sequence_if_exists ($rname) ;
+    }
+    $sth->finish () ;
+
+    $dbh->commit ();
+
+
+    debug "It seems your database deletion went well and smoothly.  That's cool." ;
+    debug "Please enjoy using Debian FusionForge." ;
+
+    # There should be a commit at the end of every block above.
+    # If there is not, then it might be symptomatic of a problem.
+    # For safety, we roll back.
+    $dbh->rollback ();
+};
+
+if ($@) {
+    warn "Transaction aborted because $@" ;
+    debug "Transaction aborted because $@" ;
+    debug "Last SQL query was:\n$query\n(end of query)" ;
+    $dbh->rollback ;
+    debug "Please report this bug on the Debian bug-tracking system." ;
+    debug "Please include the previous messages as well to help debugging." ;
+    debug "You should not worry too much about this," ;
+    debug "your DB is still in a consistent state and should be usable." ;
+    exit 1 ;
+}
+
+$dbh->rollback ;
+$dbh->disconnect ;
+
+sub debug ( $ ) {
+    my $v = shift ;
+    chomp $v ;
+    print STDERR "$v\n" ;
+}
+
+sub drop_table_if_exists ( $ ) {
+    my $tname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$tname' AND relkind='r'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping table $tname" ;
+	$query = "DROP TABLE $tname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub drop_sequence_if_exists ( $ ) {
+    my $sname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$sname' AND relkind='S'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping sequence $sname" ;
+	$query = "DROP SEQUENCE $sname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub drop_index_if_exists ( $ ) {
+    my $iname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='i'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping index $iname" ;
+	$query = "DROP INDEX $iname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub drop_view_if_exists ( $ ) {
+    my $iname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='v'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping view $iname" ;
+	$query = "DROP VIEW $iname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
diff --git a/src/plugins/scmhook/bin/db-upgrade.pl b/src/plugins/scmhook/bin/db-upgrade.pl
new file mode 100755
index 0000000..28ef00c
--- /dev/null
+++ b/src/plugins/scmhook/bin/db-upgrade.pl
@@ -0,0 +1,300 @@
+#!/usr/bin/perl -w
+#
+# Debian-specific script to upgrade the database between releases
+# Roland Mas <lolando at debian.org>
+
+use strict ;
+use diagnostics ;
+
+use DBI ;
+use MIME::Base64 ;
+use HTML::Entities ;
+
+use vars qw/$dbh @reqlist $query/ ;
+use vars qw/$sys_default_domain $sys_cvs_host
+    $sys_shell_host $sys_users_host $sys_docs_host $sys_lists_host
+    $sys_dns1_host $sys_dns2_host $FTPINCOMING_DIR $FTPFILES_DIR
+    $sys_urlroot $sf_cache_dir $sys_name $sys_themeroot
+    $sys_news_group $sys_dbhost $sys_dbname $sys_dbuser $sys_dbpasswd
+    $sys_ldap_base_dn $sys_ldap_host $admin_login $admin_password
+    $domain_name
+    $skill_list/ ;
+use vars qw/$pluginname/ ;
+
+sub is_lesser ( $$ ) ;
+sub is_greater ( $$ ) ;
+sub debug ( $ ) ;
+sub parse_sql_file ( $ ) ;
+
+require ("/usr/share/gforge/lib/include.pl") ; # Include a few predefined functions 
+require ("/usr/share/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
+
+debug "You'll see some debugging info during this installation." ;
+debug "Do not worry unless told otherwise." ;
+
+&db_connect ;
+
+# debug "Connected to the database OK." ;
+
+$pluginname = "scmhook" ;
+
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+eval {
+    my ($sth, @array, $version, $path, $target) ;
+
+    &create_metadata_table ("0") ;
+    
+    $version = &get_db_version ;
+    $target = "0.1" ;
+    if (is_lesser $version, $target) {
+	my @filelist = ( "/usr/share/gforge/plugins/$pluginname/db/$pluginname-init.sql" ) ;
+	
+	foreach my $file (@filelist) {
+	    debug "Processing $file" ;
+	    @reqlist = @{ &parse_sql_file ($file) } ;
+	    
+	    foreach my $s (@reqlist) {
+		$query = $s ;
+		# debug $query ;
+		$sth = $dbh->prepare ($query) ;
+		$sth->execute () ;
+		$sth->finish () ;
+	    }
+	}
+	@reqlist = () ;
+	
+	&update_db_version ($target) ;
+	debug "Committing." ;
+	$dbh->commit () ;
+    }
+
+    &update_with_sql("/usr/share/gforge/plugins/$pluginname/db/20130702-create_scmhook_git_committracker.sql","0.2");
+    
+    debug "It seems your database install/upgrade went well and smoothly.  That's cool." ;
+    debug "Please enjoy using Debian FusionForge." ;
+
+    # There should be a commit at the end of every block above.
+    # If there is not, then it might be symptomatic of a problem.
+    # For safety, we roll back.
+    $dbh->rollback ();
+};
+
+if ($@) {
+    warn "Transaction aborted because $@" ;
+    debug "Transaction aborted because $@" ;
+    debug "Last SQL query was:\n$query\n(end of query)" ;
+    $dbh->rollback ;
+    debug "Please report this bug on the Debian bug-tracking system." ;
+    debug "Please include the previous messages as well to help debugging." ;
+    debug "You should not worry too much about this," ;
+    debug "your DB is still in a consistent state and should be usable." ;
+    exit 1 ;
+}
+
+$dbh->rollback ;
+$dbh->disconnect ;
+
+sub is_lesser ( $$ ) {
+    my $v1 = shift || 0 ;
+    my $v2 = shift || 0 ;
+
+    my $rc = system "dpkg --compare-versions $v1 lt $v2" ;
+
+    return (! $rc) ;
+}
+
+sub is_greater ( $$ ) {
+    my $v1 = shift || 0 ;
+    my $v2 = shift || 0 ;
+
+    my $rc = system "dpkg --compare-versions $v1 gt $v2" ;
+
+    return (! $rc) ;
+}
+
+sub debug ( $ ) {
+    my $v = shift ;
+    chomp $v ;
+    print STDERR "$v\n" ;
+}
+
+sub create_metadata_table ( $ ) {
+    my $v = shift || "0" ;
+    my $tablename = "plugin_" .$pluginname . "_meta_data" ;
+    # Do we have the metadata table?
+
+    $query = "SELECT count(*) FROM pg_class WHERE relname = '$tablename' and relkind = 'r'";
+    # debug $query ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    # Let's create this table if we have it not
+
+    if ($array [0] == 0) {
+	debug "Creating $tablename table." ;
+	$query = "CREATE TABLE $tablename (key varchar primary key, value text not null)" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+
+    $query = "SELECT count(*) FROM $tablename WHERE key = 'db-version'";
+    # debug $query ;
+    $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    # Empty table?  We'll have to fill it up a bit
+
+    if ($array [0] == 0) {
+	debug "Inserting first data into $tablename table." ;
+	$query = "INSERT INTO $tablename (key, value) VALUES ('db-version', '$v')" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub update_db_version ( $ ) {
+    my $v = shift or die "Not enough arguments" ;
+    my $tablename = "plugin_" .$pluginname . "_meta_data" ;
+
+    debug "Updating $tablename table." ;
+    $query = "UPDATE $tablename SET value = '$v' WHERE key = 'db-version'" ;
+    # debug $query ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    $sth->finish () ;
+}
+
+sub get_db_version () {
+    my $tablename = "plugin_" .$pluginname . "_meta_data" ;
+
+    $query = "SELECT value FROM $tablename WHERE key = 'db-version'" ;
+    # debug $query ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    my $version = $array [0] ;
+
+    return $version ;
+}
+
+sub drop_table_if_exists ( $ ) {
+    my $tname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$tname' AND relkind='r'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping table $tname" ;
+	$query = "DROP TABLE $tname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub drop_sequence_if_exists ( $ ) {
+    my $sname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$sname' AND relkind='S'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping sequence $sname" ;
+	$query = "DROP SEQUENCE $sname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub drop_index_if_exists ( $ ) {
+    my $iname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='i'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping index $iname" ;
+	$query = "DROP INDEX $iname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub drop_view_if_exists ( $ ) {
+    my $iname = shift or die  "Not enough arguments" ;
+    $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='v'" ;
+    my $sth = $dbh->prepare ($query) ;
+    $sth->execute () ;
+    my @array = $sth->fetchrow_array () ;
+    $sth->finish () ;
+
+    if ($array [0] != 0) {
+	# debug "Dropping view $iname" ;
+	$query = "DROP VIEW $iname" ;
+	# debug $query ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	$sth->finish () ;
+    }
+}
+
+sub bump_sequence_to ( $$ ) {
+    my ($sth, @array, $seqname, $targetvalue) ;
+
+    $seqname = shift ;
+    $targetvalue = shift ;
+
+    do {
+	$query = "select nextval ('$seqname')" ;
+	$sth = $dbh->prepare ($query) ;
+	$sth->execute () ;
+	@array = $sth->fetchrow_array () ;
+	$sth->finish () ;
+    } until $array[0] >= $targetvalue ;
+}
+
+sub update_with_sql ( $$ ) {
+    my $sqlfile = shift or die "Not enough arguments" ;
+    my $target = shift or die "Not enough arguments" ;
+    $sqlfile =~ s/\.sql$//;
+    my $version = &get_db_version ;
+    if (&is_lesser ($version, $target)) {
+        &debug ("Upgrading database with $sqlfile.sql") ;
+
+        @reqlist = @{ &parse_sql_file ("$sqlfile.sql") } ;
+        foreach my $s (@reqlist) {
+            my $query = $s ;
+            # debug $query ;
+            my $sth = $dbh->prepare ($query) ;
+            $sth->execute () ;
+            $sth->finish () ;
+        }
+        @reqlist = () ;
+
+        &update_db_version ($target) ;
+        &debug ("...OK.") ;
+        $dbh->commit () ;
+    }
+}
diff --git a/src/plugins/scmhook/packaging/install/plugin-scmhook b/src/plugins/scmhook/packaging/install/plugin-scmhook
index 341c7cb..fa0778f 100644
--- a/src/plugins/scmhook/packaging/install/plugin-scmhook
+++ b/src/plugins/scmhook/packaging/install/plugin-scmhook
@@ -1,6 +1,7 @@
 plugins/scmhook/common/*	@PLUGIN_PATH@/scmhook/common/
 plugins/scmhook/www/*		@PLUGIN_PATH@/scmhook/www/
 plugins/scmhook/db/*		@PLUGIN_PATH@/scmhook/db/
+plugins/scmhook/bin/*		@PLUGIN_PATH@/scmhook/bin/
 plugins/scmhook/library/*	@PLUGIN_PATH@/scmhook/library/
 plugins/scmhook/etc/*.ini	etc/@PACKAGE@/config.ini.d/
 plugins/scmhook/cronjobs/*	usr/share/gforge/cronjobs

commit 8dfb7bc46d7508315c6de7b3ccae2915a39daff4
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Tue Mar 11 18:35:02 2014 +0100

    scmhook: packaging

diff --git a/src/plugins/scmhook/NAME b/src/plugins/scmhook/NAME
new file mode 100644
index 0000000..09eaf63
--- /dev/null
+++ b/src/plugins/scmhook/NAME
@@ -0,0 +1 @@
+SCM Hook
\ No newline at end of file
diff --git a/src/plugins/scmhook/etc/scmhook.ini b/src/plugins/scmhook/etc/scmhook.ini
index c52c1fd..8308e94 100644
--- a/src/plugins/scmhook/etc/scmhook.ini
+++ b/src/plugins/scmhook/etc/scmhook.ini
@@ -4,4 +4,4 @@
 ; valid means : production ready.
 ; Any other strings means it's under work or broken and plugin
 ; is available in installation_environment = development only.
-plugin_status = "valid"
+plugin_status = valid
diff --git a/src/plugins/scmhook/packaging/control/133plugin-scmhook b/src/plugins/scmhook/packaging/control/133plugin-scmhook
new file mode 100644
index 0000000..b0cba54
--- /dev/null
+++ b/src/plugins/scmhook/packaging/control/133plugin-scmhook
@@ -0,0 +1,4 @@
+Package: @PACKAGE at -plugin-scmhook
+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, php5-cli, ${misc:Depends}
+Description: collaborative development tool - SCM Hook plugin
diff --git a/src/plugins/scmhook/packaging/control/133plugin-scmhook.shortdesc b/src/plugins/scmhook/packaging/control/133plugin-scmhook.shortdesc
new file mode 100644
index 0000000..fba6b4f
--- /dev/null
+++ b/src/plugins/scmhook/packaging/control/133plugin-scmhook.shortdesc
@@ -0,0 +1,3 @@
+ This plugin contains a set of commit hooks (e-mail notifications,
+ tracker integration, conformity...) that can be enabled for each
+ project independently.
diff --git a/src/plugins/scmhook/packaging/dirs/plugin-scmhook b/src/plugins/scmhook/packaging/dirs/plugin-scmhook
new file mode 100644
index 0000000..8ec74c6
--- /dev/null
+++ b/src/plugins/scmhook/packaging/dirs/plugin-scmhook
@@ -0,0 +1,4 @@
+etc/gforge/httpd.d
+etc/gforge/plugins/scmhook
+ at PLUGIN_PATH@/scmhook/common
+ at PLUGIN_PATH@/scmhook/www
diff --git a/src/plugins/scmhook/packaging/install/plugin-scmhook b/src/plugins/scmhook/packaging/install/plugin-scmhook
new file mode 100644
index 0000000..341c7cb
--- /dev/null
+++ b/src/plugins/scmhook/packaging/install/plugin-scmhook
@@ -0,0 +1,6 @@
+plugins/scmhook/common/*	@PLUGIN_PATH@/scmhook/common/
+plugins/scmhook/www/*		@PLUGIN_PATH@/scmhook/www/
+plugins/scmhook/db/*		@PLUGIN_PATH@/scmhook/db/
+plugins/scmhook/library/*	@PLUGIN_PATH@/scmhook/library/
+plugins/scmhook/etc/*.ini	etc/@PACKAGE@/config.ini.d/
+plugins/scmhook/cronjobs/*	usr/share/gforge/cronjobs

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

Summary of changes:
 src/plugins/scmhook/NAME                           |    1 +
 src/plugins/{hudson => scmhook}/bin/db-delete.pl   |    2 +-
 src/plugins/{scmgit => scmhook}/bin/db-upgrade.pl  |   14 +++++---------
 src/plugins/scmhook/cronjobs/updateScmRepo.php     |    1 +
 src/plugins/scmhook/etc/scmhook.ini                |    2 +-
 .../scmhook/library/scmsvn/commitEmail.class.php   |    4 ++--
 .../scmsvn/hooks/commitemail/commit-email.php      |   20 ++++++++------------
 .../packaging/control/133plugin-scmhook}           |    4 ++--
 .../packaging/control/133plugin-scmhook.shortdesc  |    3 +++
 .../scmhook/packaging/cron.d/plugin-scmhook        |    2 ++
 src/plugins/scmhook/packaging/dirs/plugin-scmhook  |    4 ++++
 .../scmhook/packaging/install/plugin-scmhook       |    7 +++++++
 12 files changed, 37 insertions(+), 27 deletions(-)
 create mode 100644 src/plugins/scmhook/NAME
 copy src/plugins/{hudson => scmhook}/bin/db-delete.pl (99%)
 copy src/plugins/{scmgit => scmhook}/bin/db-upgrade.pl (93%)
 copy src/plugins/{blocks/packaging/control/222plugin-blocks => scmhook/packaging/control/133plugin-scmhook} (69%)
 create mode 100644 src/plugins/scmhook/packaging/control/133plugin-scmhook.shortdesc
 create mode 100644 src/plugins/scmhook/packaging/cron.d/plugin-scmhook
 create mode 100644 src/plugins/scmhook/packaging/dirs/plugin-scmhook
 create mode 100644 src/plugins/scmhook/packaging/install/plugin-scmhook


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list