[evolvis-commits] r11858: cleaning up scmccase
mirabilos at evolvis.org
mirabilos at evolvis.org
Thu Feb 24 18:27:26 CET 2011
Author: mirabilos
Date: 2011-02-24 18:27:26 +0100 (Thu, 24 Feb 2011)
New Revision: 11858
Added:
trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/
trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/ccase_dump_update.pl
trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-delete.pl
trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-upgrade.pl
trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/install-ccase.sh
Removed:
trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/bin/
Log:
cleaning up scmccase
Added: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/ccase_dump_update.pl
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/ccase_dump_update.pl (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/ccase_dump_update.pl 2011-02-24 17:27:26 UTC (rev 11858)
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+#
+# $Id$
+#
+# ccase_dump_update.pl - script to dump data from the database
+# and update Clear Case consequently
+# inspired from sourceforge scripts
+# Christian Bayle <bayle at debian.org>
+# Roland Mas <lolando at debian.org>
+#
+use DBI;
+use Sys::Hostname;
+
+require("/usr/lib/gforge/lib/include.pl"); # Include all the predefined functions
+require($db_include); # Include global configuration variables
+require("/etc/gforge/plugins/scmccase/config.pl"); # Include plugin config vars
+
+my $verbose = 0;
+
+if($verbose) {print ("\nConnecting to database");}
+&db_connect;
+
+$query = "SELECT plugin_id FROM plugins WHERE plugin_name = 'scmccase'" ;
+$c = $dbh->prepare ($query) ;
+$c->execute () ;
+my ($plugin_id) = $c->fetchrow () ;
+$c->finish () ;
+
+if($verbose) {print ("\nGetting group list");}
+$query = "SELECT groups.group_id, unix_group_name, status
+ FROM groups, group_plugin, plugin_scmccase_group_usage
+ WHERE groups.group_id = group_plugin.group_id
+ AND group_plugin.plugin_id = $plugin_id
+ AND plugin_scmccase_group_usage.group_id = groups.group_id
+ AND plugin_scmccase_group_usage.ccase_host = '$this_server'" ;
+
+$c = $dbh->prepare($query);
+$c->execute();
+
+open LSVOB, "$cleartool lsvob $group_name |" ;
+while ($ls = <LSVOB>) {
+ chomp $ls ;
+ push @vobs, $ls ;
+}
+close LSVOB ;
+
+while(my ($group_id, $group_name, $status) = $c->fetchrow()) {
+
+ $ccase_uid = $group_id + $anoncvs_uid_add;
+ $ccase_gid = $group_id + $gid_add;
+
+ $group_exists = (-d $grpdir_prefix . $group_name);
+
+ $vob_tag = $tag_pattern ;
+ $vob_tag =~ s/GROUPNAME/$group_name/g ;
+
+ $ccase_exists = 0 ;
+ foreach $ls (@vobs) {
+ if ($ls =~ /\s$vob_tag\s/) {
+ $ccase_exists = 1 ;
+ }
+ }
+
+ # CCASE repository creation
+ if ($group_exists && !$ccase_exists && $status eq 'A') {
+ if($verbose){print("Creating a Clear Case VOB for $group_name with VOB-tag $vob_tag\n");}
+
+ # Firce create the VOB
+ system("$cleartool mkvob --tag $vob_tag --comment 'Clear Case VOB for project $group_name'");
+
+ # Set group ownership, anonymous group user
+ system("$cleartool protectvob --force --chgrp $group_name $vob_tag");
+ }
+}
Property changes on: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/ccase_dump_update.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-delete.pl
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-delete.pl (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-delete.pl 2011-02-24 17:27:26 UTC (rev 11858)
@@ -0,0 +1,112 @@
+#!/usr/bin/perl -w
+#
+# $Id$
+#
+# 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_download_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
+ $server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
+ $skill_list/ ;
+use vars qw/$pluginname $pluginid/ ;
+
+require ("/usr/lib/gforge/lib/include.pl") ; # Include a few predefined functions
+require ("/usr/lib/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
+require ("/usr/lib/gforge/lib/sqlhelper.pm") ; # Our SQL functions
+
+&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 = "scmccase" ;
+$pluginid = -1 ;
+
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+eval {
+ my ($sth, @array, $version, $action, $path, $target, $rname) ;
+
+ $pluginid = &get_plugin_id ($dbh, $pluginname) ;
+ &remove_plugin_from_groups ($dbh, $pluginid) ;
+ &remove_plugin_from_users ($dbh, $pluginid) ;
+
+ 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 ($dbh, $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 ($dbh, $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 ($dbh, $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 ($dbh, $rname) ;
+ }
+ $sth->finish () ;
+
+ $dbh->commit ();
+
+
+ &debug ("It seems your database deletion went well and smoothly. That's cool.") ;
+ &debug ("Please enjoy using Debian GForge.") ;
+
+ # 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 ;
Property changes on: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-delete.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-upgrade.pl
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-upgrade.pl (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-upgrade.pl 2011-02-24 17:27:26 UTC (rev 11858)
@@ -0,0 +1,92 @@
+#!/usr/bin/perl -w
+#
+# $Id$
+#
+# 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_download_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
+ $server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
+ $skill_list/ ;
+use vars qw/$pluginname/ ;
+
+require ("/usr/lib/gforge/lib/include.pl") ; # Include a few predefined functions
+require ("/usr/lib/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
+require ("/usr/lib/gforge/lib/sqlhelper.pm") ; # Our SQL functions
+
+&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 = "scmccase" ;
+
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+eval {
+ my ($sth, @array, $version, $path, $target) ;
+
+ &create_plugin_metadata_table ($dbh, $pluginname, "0") ;
+
+ $version = &get_plugin_db_version ($dbh, $pluginname) ;
+ $target = "0.1" ;
+ if (&is_lesser ($version, $target)) {
+ my @filelist = ( "/usr/lib/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_plugin_db_version ($dbh, $pluginname, $target) ;
+ &debug ("Committing.") ;
+ $dbh->commit () ;
+ }
+
+ &debug ("It seems your database install/upgrade went well and smoothly. That's cool.") ;
+ &debug ("Please enjoy using Debian GForge.") ;
+
+ # 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 ;
Property changes on: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/db-upgrade.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/install-ccase.sh
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/install-ccase.sh (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/install-ccase.sh 2011-02-24 17:27:26 UTC (rev 11858)
@@ -0,0 +1,25 @@
+#! /bin/sh
+#
+# $Id$
+#
+# Configure CVS for Sourceforge
+# Christian Bayle, Roland Mas, debian-sf (Sourceforge for Debian)
+
+set -e
+
+if [ $(id -u) != 0 ] ; then
+ echo "You must be root to run this, please enter passwd"
+ exec su -c "$0 $1"
+fi
+
+case "$1" in
+ configure)
+ ;;
+
+ purge)
+ ;;
+
+ *)
+ echo "Usage: $0 {configure|purge}"
+ exit 1
+esac
Property changes on: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmccase/debian/bin/install-ccase.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the evolvis-commits
mailing list