[vhffs-dev] [2047] Reworked Svn robots the same way we did for Cvs

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2047
Author:   gradator
Date:     2012-02-25 01:14:43 +0100 (Sat, 25 Feb 2012)
Log Message:
-----------
Reworked Svn robots the same way we did for Cvs

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
    trunk/vhffs-robots/Makefile.am

Added Paths:
-----------
    trunk/vhffs-robots/src/svn.pl

Removed Paths:
-------------
    trunk/vhffs-robots/src/svn_create.pl
    trunk/vhffs-robots/src/svn_delete.pl
    trunk/vhffs-robots/src/svn_public.pl
    trunk/vhffs-robots/src/svn_viewvcconf.pl
    trunk/vhffs-robots/src/svn_websvn.pl

Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm	2012-02-25 00:14:43 UTC (rev 2047)
@@ -29,166 +29,276 @@
 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-package Vhffs::Robots::Svn;
-
 use strict;
 use utf8;
+use Cwd;
 use File::Path;
 use File::Basename;
 
-use Vhffs::Services::Svn;
 use Vhffs::Constants;
 use Vhffs::Functions;
+use Vhffs::Robots;
+use Vhffs::Services::Svn;
 
-sub change_conf
-{
-	my $svn	= shift;
-	return -1 unless defined $svn;
+package Vhffs::Robots::Svn;
 
-	my $file = $svn->get_dir.'/conf/svnserve.conf';
-	return -1 unless -f $file;
+sub create {
+	my $svn = shift;
+	return undef unless defined $svn and $svn->get_status == Vhffs::Constants::WAITING_FOR_CREATION;
 
+	my $vhffs = $svn->get_main;
+	my $dir = $svn->get_dir;
+
+	if( -e $dir ) {
+		$svn->set_status( Vhffs::Constants::CREATION_ERROR );
+		$svn->commit();
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating svn repository '.$svn->get_reponame.' to the filesystem' );
+		return undef;
+	}
+
+	File::Path::make_path( $dir, { error => \my $errors });
+	if(@$errors) {
+		$svn->set_status( Vhffs::Constants::CREATION_ERROR );
+		$svn->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating svn repository '.$svn->get_reponame.' to the filesystem' );
+		return undef;
+	}
+
+	my $childpid = open( my $output, '-|', 'svnadmin', 'create', '--fs-type', 'fsfs', $dir );
+	if($childpid) {
+		# read process output then discard
+		while(<$output>) {}
+
+		# wait for the child to finish
+		waitpid( $childpid, 0 );
+
+		# we don't care whether svn succedded, we are going to check that ourself
+	}
+
+	unless( -f $dir.'/format' ) {
+		$svn->set_status( Vhffs::Constants::CREATION_ERROR );
+		$svn->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating svn repository '.$svn->get_reponame.' to the filesystem' );
+		return undef;
+	}
+
+	Vhffs::Robots::chmod_recur( $dir, 0664, 02775 );
+	Vhffs::Robots::chown_recur( $dir, $svn->get_owner_uid, $svn->get_owner_gid );
+
+	# './hooks' directory must be owned by root to prevent abuse of servers
+	Vhffs::Robots::chmod_recur( $dir.'/hooks', 0644, 0755 );
+	Vhffs::Robots::chown_recur( $dir.'/hooks', 0, 0 );
+
+	Vhffs::Robots::vhffs_log( $vhffs, 'Created svn repository '.$svn->get_reponame );
+	return modify( $svn );
+}
+
+sub delete {
+	my $svn = shift;
+	return undef unless defined $svn and $svn->get_status == Vhffs::Constants::WAITING_FOR_DELETION;
+
+	my $vhffs = $svn->get_main;
+	my $dir = $svn->get_dir;
+
+	Vhffs::Robots::archive_targz( $svn, $dir );
+
+	File::Path::remove_tree( $dir, { error => \my $errors });
+	my $groupdir = File::Basename::dirname($dir);
+	rmdir($groupdir);
+
+	if(@$errors) {
+		$svn->set_status( Vhffs::Constants::DELETION_ERROR );
+		$svn->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing svn repository '.$svn->get_reponame.' from the filesystem' );
+		return undef;
+	}
+
+	if( $svn->delete ) {
+		Vhffs::Robots::vhffs_log( $vhffs, 'Deleted svn repository '.$svn->get_reponame );
+	} else {
+		$svn->set_status( Vhffs::Constants::DELETION_ERROR );
+		$svn->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while deleting svn repository '.$svn->get_reponame.' object' );
+		return undef;
+	}
+
+	viewvc_conf( $vhffs );
+	websvn_conf( $vhffs );
+	return 1;
+}
+
+sub modify {
+	my $svn = shift;
+	return undef unless defined $svn and ( $svn->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION or $svn->get_status == Vhffs::Constants::WAITING_FOR_CREATION );
+
+	my $vhffs = $svn->get_main;
+	my $dir = $svn->get_dir;
+
+	if( $svn->is_public ) {
+		chmod 02775, $dir;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' is now public' );
+		$svn->add_history( 'Is now public');
+	}
+	else {
+		chmod 02770, $dir;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' is now private' );
+		$svn->add_history( 'Is now private');
+	}
+
+	my $confpath = $dir.'/conf/svnserve.conf';
+
+	# Read configuration file
+	open( my $conffile, '<', $confpath ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying svn repository, cannot open '.$confpath );
+	unless( defined $conffile ) {
+		$svn->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+		$svn->commit;
+		return undef;
+	}
+
 	my @lines;
-	open( FILE , $file );
-	while( <FILE> )
-	{
-		push( @lines , $_ );
+	while( <$conffile> ) {
+		push( @lines, $_ );
 	}
-	close( FILE );
+	close( $conffile );
 
+	# Write configuration file
+	open( $conffile, '>', $confpath ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying svn repository, cannot open '.$confpath );
+	unless( defined $conffile ) {
+		$svn->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+		$svn->commit;
+		return undef;
+	}
 
-	open( FILE , '>'.$file );
-	foreach my $line ( @lines )
-	{
-		if( $line =~ /.*anon\-access.*/ )
-		{
-			if( $svn->is_public == 1 )
-			{
-				$line = 'anon-access = read'."\n";
+	foreach( @lines ) {
+		if( $_ =~ /.*anon\-access.*/ ) {
+			if( $svn->is_public == 1 ) {
+				$_ = 'anon-access = read'."\n";
+			} else{
+				$_ = 'anon-access = none'."\n";
 			}
-			else
-			{
-				$line = 'anon-access = none'."\n";
-			}
 		}
-		if( $line =~ /.*\[general\].*/ )
-		{
-			$line = '[general]'."\n";
+		if( $_ =~ /.*\[general\].*/ ) {
+			$_ = '[general]'."\n";
 		}
-		print FILE $line;
+		print $conffile $_;
 	}
-	close( FILE );
+	close( $conffile );
 
-
-	# -- commit mail
+	# Commit mail
 	my $svnconf = $svn->{'main'}->get_config->get_service('svn');
 	my $mailfrom = $svnconf->{'notify_from'};
 	my $mailto = $svn->{ml_name};
-	if( defined $mailfrom && defined $mailto )  {
+	if( defined $mailfrom and defined $mailto )  {
 
-		my @lines;
-
 		# read template file
-		open( POSTCOMMIT , '%VHFFS_BOTS_DIR%/misc/svn_post-commit.pl' );
-		while( <POSTCOMMIT> )   {
-			push( @lines , $_ );
+		open( my $postcommit, '<', '%VHFFS_BOTS_DIR%/misc/svn_post-commit.pl' ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying svn repository, cannot open %VHFFS_BOTS_DIR%/misc/svn_post-commit.pl' );
+		unless( defined $postcommit ) {
+			$svn->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+			$svn->commit;
+			return undef;
 		}
-		close( POSTCOMMIT );
 
+		my @lines;
+		while( <$postcommit> ) {
+			push( @lines, $_ );
+		}
+		close( $postcommit );
+
 		# write hook
-		unlink ( $svn->get_dir().'/hooks/post-commit' );
-		open ( POSTCOMMIT , '>'.$svn->get_dir().'/hooks/post-commit' );
-		foreach my $line ( @lines )  {
+		my $postcommitpath = $dir.'/hooks/post-commit';
 
-			# remplace some parameters
-			$line =~ s/%MAILNOTIFYFROM%/$mailfrom/g;
-			$line =~ s/%MAILNOTIFYTO%/$mailto/g;
+		unlink $postcommitpath;
 
-			print POSTCOMMIT $line;
+		open( $postcommit, '>', $postcommitpath ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying svn repository, cannot open '.$postcommitpath );
+		unless( defined $postcommit ) {
+			$svn->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+			$svn->commit;
+			return undef;
 		}
-		close ( POSTCOMMIT );
-		chmod 0755 , $svn->get_dir().'/hooks/post-commit';
+
+		foreach( @lines )  {
+			# replace some parameters
+			$_ =~ s/%MAILNOTIFYFROM%/$mailfrom/g;
+			$_ =~ s/%MAILNOTIFYTO%/$mailto/g;
+
+			print $postcommit $_;
+		}
+		close( $postcommit );
+		chmod 0755, $postcommitpath;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Svn repository '.$svn->get_reponame.' commit mail set to '.$mailto );
+		$svn->add_history( 'Commit mail set to '.$mailto );
 	}
 
-	$svn->add_history( 'Changed configuration of SVN repository' );
+	$svn->set_status( Vhffs::Constants::ACTIVATED );
+	$svn->commit;
 
-	return 0;
+	viewvc_conf( $vhffs );
+	websvn_conf( $vhffs );
+	return 1;
 }
 
+sub viewvc_conf {
+	require Template;
+	require File::Copy;
 
-sub create_repo
-{
-	my $svn = shift;
-	return -1 unless defined $svn;
-	return -1 if $svn->get_status != Vhffs::Constants::WAITING_FOR_CREATION;
+	my $vhffs = shift;
 
-	my $dir = $svn->get_dir;
-
-	if( -e $dir ) {
-		$svn->set_status( Vhffs::Constants::CREATION_ERROR );
-		$svn->commit();
-		$svn->add_history('Error, directory of this svn repository already exists! Administrators must fix the problem.');
-		return -1;
+	my $confdir = $vhffs->get_config->get_datadir.'/svn/conf';
+	unless( -d $confdir ) {
+		mkdir( $confdir ) or Vhffs::Robots::vhffs_log( $vhffs, 'Unable to create svn confdir '.$confdir.': '.$! );
 	}
 
-	# TODO: check make_path
-	File::Path::make_path( $dir );
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $svn->get_owner_uid , $svn->get_owner_gid );
-	$svn->add_history('Ok, robots find the empty directory and will create svn repository');
-
-	my $childpid = open( my $output, '-|', 'svnadmin', 'create', '--fs-type', 'fsfs', $dir );
-	if($childpid) {
-		# read process output then discard
-		while(<$output>) {}
-
-		# wait for the child to finish
-		waitpid( $childpid, 0 );
-
-		# we don't care whether svn succedded, we are going to check that ourself
+	my $svnroots = [];
+	my $svns = Vhffs::Services::Svn::getall( $vhffs, Vhffs::Constants::ACTIVATED );
+	foreach ( @{$svns} ) {
+		next unless $_->is_public;
+		my $svnpath = $_->get_reponame;
+		$svnpath =~ s/\//_/;
+		push @$svnroots, $svnpath.': '.$_->get_dir;
 	}
 
-	unless( -f $dir.'/format' ) {
-		$svn->set_status( Vhffs::Constants::CREATION_ERROR );
-		$svn->commit();
-		$svn->add_history('Error, nothing was created after calling the svnadmin binary, something is wrong.');
-		return -1;
-	}	
+	return undef unless $svnroots;
 
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $svn->get_owner_uid , $svn->get_owner_gid );
+	my ( $tmpfile, $tmppath ) = Vhffs::Robots::tmpfile( $vhffs );
+	return undef unless defined $tmpfile;
+	close( $tmpfile );
 
-	# './hooks' directory must be owned by root to prevent abuse of servers
-	Vhffs::Robots::chmod_recur( $dir.'/hooks' , 0644 , 0755 );
-	Vhffs::Robots::chown_recur( $dir.'/hooks' , 0 , 0 );
+	# TODO: remove hardcoded path
+	my $template = new Template( { INCLUDE_PATH => '/usr/lib/vhffs/bots/misc/' } );
+	$template->process( 'svn_viewvc.conf.tt', { svnroots => $svnroots }, $tmppath );
 
-	change_conf( $svn );
+	File::Copy::move( $tmppath, $confdir.'/viewvc.conf' );
 
-	$svn->add_history('The Robots created the subversion repository');
-	$svn->set_status( Vhffs::Constants::ACTIVATED );
-	$svn->commit();
-
-	return 0;
+	return 1;
 }
 
+sub websvn_conf {
+	require File::Copy;
 
+	my $vhffs = shift;
 
+	my $confdir = $vhffs->get_config->get_datadir.'/svn/conf';
+	unless( -d $confdir ) {
+		mkdir( $confdir ) or Vhffs::Robots::vhffs_log( $vhffs, 'Unable to create svn confdir '.$confdir.': '.$! );
+	}
 
-sub delete_repo
-{
-	my $svn = shift;
-	return -1 unless defined $svn;
+	my ( $tmpfile, $tmppath ) = Vhffs::Robots::tmpfile( $vhffs );
+	return undef unless defined $tmpfile;
+	print $tmpfile '<?php'."\n";
 
-	my $dir = $svn->get_dir;
-	Vhffs::Robots::archive_targz( $svn, $dir );
+	my $svns = Vhffs::Services::Svn::getall( $vhffs, Vhffs::Constants::ACTIVATED );
+	foreach ( @{$svns} )  {
+		print $tmpfile '  $config->addRepository("'.$_->get_reponame.'","file://'.$_->get_dir.'");'."\n" if $_->is_public;
+	}
 
-	# TODO: check remove_tree
-	File::Path::remove_tree($dir);
-	my $group_dir = File::Basename::dirname($dir);
-	rmdir $group_dir;
+	print $tmpfile '?>'."\n";
+	close( $tmpfile );
 
-	return 0;
+	File::Copy::move( $tmppath, $confdir.'/websvn.inc' );
+	return 1;
 }
 
-
 1;

Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-robots/Makefile.am	2012-02-25 00:14:43 UTC (rev 2047)
@@ -48,11 +48,7 @@
 	src/repository_delete.pl \
 	src/repository_quota.pl \
 	src/repository_stats.pl \
-	src/svn_create.pl \
-	src/svn_delete.pl \
-	src/svn_public.pl \
-	src/svn_viewvcconf.pl \
-	src/svn_websvn.pl \
+	src/svn.pl \
 	src/git_create.pl \
 	src/git_delete.pl \
 	src/git_public.pl \

Copied: trunk/vhffs-robots/src/svn.pl (from rev 2043, trunk/vhffs-robots/src/svn_create.pl)
===================================================================
--- trunk/vhffs-robots/src/svn.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/svn.pl	2012-02-25 00:14:43 UTC (rev 2047)
@@ -0,0 +1,59 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+use utf8;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Robots::Svn;
+
+my $vhffs = init Vhffs::Main;
+exit 1 unless defined $vhffs;
+
+Vhffs::Robots::lock( $vhffs, 'svn' );
+
+my $repos = Vhffs::Services::Svn::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Svn::create( $_ );
+}
+
+$repos = Vhffs::Services::Svn::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Svn::delete( $_ );
+}
+
+$repos = Vhffs::Services::Svn::getall( $vhffs, Vhffs::Constants::WAITING_FOR_MODIFICATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Svn::modify( $_ );
+}
+
+Vhffs::Robots::unlock( $vhffs, 'svn' );
+exit 0;

Deleted: trunk/vhffs-robots/src/svn_create.pl
===================================================================
--- trunk/vhffs-robots/src/svn_create.pl	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-robots/src/svn_create.pl	2012-02-25 00:14:43 UTC (rev 2047)
@@ -1,59 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Robots::Svn;
-use Vhffs::Services::Svn;
-use Vhffs::Constants;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'svn' );
-
-my $repos = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::WAITING_FOR_CREATION );
-foreach my $svn ( @{$repos} )
-{
-	if( Vhffs::Robots::Svn::create_repo( $svn ) != 0 ) {
-    		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot create SVN %s' , $svn->get_reponame ), $vhffs );
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Created SVN %s' , $svn->get_reponame ), $vhffs );
-	}
-}
-
-
-Vhffs::Robots::unlock( $vhffs , 'svn' );
-exit 0;

Deleted: trunk/vhffs-robots/src/svn_delete.pl
===================================================================
--- trunk/vhffs-robots/src/svn_delete.pl	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-robots/src/svn_delete.pl	2012-02-25 00:14:43 UTC (rev 2047)
@@ -1,64 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Robots::Svn;
-use Vhffs::Services::Svn;
-use Vhffs::Constants;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'svn' );
-
-my $repos = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::WAITING_FOR_DELETION);
-foreach my $svn ( @{$repos} )
-{
-	if( Vhffs::Robots::Svn::delete_repo( $svn ) != 0 )	{
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot delete files from SVN repository %s' , $svn->get_reponame ), $vhffs );
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Delete files from SVN repository %s' , $svn->get_reponame ), $vhffs );
-	}
-
-	if( $svn->delete < 0 ) {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot delete SVN repository object %s' , $svn->get_reponame ), $vhffs );
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Delete SVN repository object %s' , $svn->get_reponame ), $vhffs );
-	}
-}
-
-Vhffs::Robots::unlock( $vhffs , 'svn' );
-exit 0;

Deleted: trunk/vhffs-robots/src/svn_public.pl
===================================================================
--- trunk/vhffs-robots/src/svn_public.pl	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-robots/src/svn_public.pl	2012-02-25 00:14:43 UTC (rev 2047)
@@ -1,71 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Robots::Svn;
-use Vhffs::Services::Svn;
-use Vhffs::Constants;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'svn' );
-
-my $repos = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::WAITING_FOR_MODIFICATION );
-foreach my $svn ( @{$repos} )
-{
-	if( $svn->is_public == 1 ) {
-		chmod 02775 , $svn->get_dir;
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'SVN status %s is now public' , $svn->get_dir ) );
-	} else {
-		chmod 02770 , $svn->get_dir;
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'SVN status %s is now private' , $svn->get_dir ) );
-	}
-
-	Vhffs::Robots::Svn::change_conf( $svn );
-	$svn->set_status( Vhffs::Constants::ACTIVATED );
-	
-	if( $svn->commit < 0 ) {
-		$svn->add_history( 'Error while updating repository configuration' );
-	} else {
-		$svn->add_history( 'Successfully modify repository configuration' );
-	}
-}
-
-
-Vhffs::Robots::unlock( $vhffs , 'svn' );
-
-exit 0;

Deleted: trunk/vhffs-robots/src/svn_viewvcconf.pl
===================================================================
--- trunk/vhffs-robots/src/svn_viewvcconf.pl	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-robots/src/svn_viewvcconf.pl	2012-02-25 00:14:43 UTC (rev 2047)
@@ -1,75 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Constants;
-use Vhffs::Services::Svn;
-use Vhffs::Robots;
-use Template;
-
-my $vhffs = init Vhffs::Main;
-
-my $confdir = $vhffs->get_config->get_datadir.'/svn/conf';
-mkdir( $confdir ) or die("Unable to create svn confdir $confdir: $!") unless -d $confdir;
-
-Vhffs::Robots::lock( $vhffs , 'svn_viewvc' );
-
-my $svnroots = [];
-
-if( $vhffs->get_config->get_service_availability('svn') == 1 )
-{
-	my $svns = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-	my $svn;
-
-	foreach $svn ( @{$svns} )
-	{
-		if( $svn->is_public == 1 )
-		{
-			my $svnpath = $svn->get_reponame;
-			$svnpath =~ s/\//_/;
-            push @$svnroots, $svnpath.': '.$svn->get_dir;
-		}
-	}
-}
-
-if ( $svnroots )  {
-     my $template = new Template({
-         INCLUDE_PATH => '/usr/lib/vhffs/bots/misc/',
-    });
-
-    $template->process( 'svn_viewvc.conf.tt', { svnroots => $svnroots }, "$confdir/viewvc.conf" );
-}
-
-Vhffs::Robots::unlock( $vhffs , 'svn_viewvc' );

Deleted: trunk/vhffs-robots/src/svn_websvn.pl
===================================================================
--- trunk/vhffs-robots/src/svn_websvn.pl	2012-02-24 22:55:04 UTC (rev 2046)
+++ trunk/vhffs-robots/src/svn_websvn.pl	2012-02-25 00:14:43 UTC (rev 2047)
@@ -1,58 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Constants;
-use Vhffs::Services::Svn;
-use Vhffs::Robots;
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'websvn' );
-
-my $svnss = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-my $svn;
-my $svnconfdir = $vhffs->get_config->get_datadir . '/svn/conf/';
-mkdir $svnconfdir unless -d $svnconfdir;
-
-open( FILE , '>'.$svnconfdir.'/websvn.inc' );
-print FILE  '<?php'."\n";
-foreach $svn ( @{$svnss} )  {
-	print FILE  '  $config->addRepository("'.$svn->get_reponame.'","file://'.$svn->get_dir.'");'."\n"   if $svn->is_public;
-}
-print FILE  '?>'."\n";
-close( FILE );
-
-Vhffs::Robots::unlock( $vhffs , 'websvn' );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/