[vhffs-dev] [2046] merged vhffs-robots/src/bazaar_* to vhffs-robots/src/bazaar.pl, merged vhffs-robots/src/cvs_* to vhffs-robots/src/cvs.pl, moved all code to Vhffs::Robots, improved CVS viewvc configuration generation efficiency

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


Revision: 2046
Author:   gradator
Date:     2012-02-24 23:55:04 +0100 (Fri, 24 Feb 2012)
Log Message:
-----------
merged vhffs-robots/src/bazaar_* to vhffs-robots/src/bazaar.pl, merged vhffs-robots/src/cvs_* to vhffs-robots/src/cvs.pl, moved all code to Vhffs::Robots, improved CVS viewvc configuration generation efficiency

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

Added Paths:
-----------
    trunk/vhffs-robots/src/bazaar.pl
    trunk/vhffs-robots/src/cvs.pl

Removed Paths:
-------------
    trunk/vhffs-robots/src/bazaar_create.pl
    trunk/vhffs-robots/src/bazaar_delete.pl
    trunk/vhffs-robots/src/bazaar_modify.pl
    trunk/vhffs-robots/src/cvs_create.pl
    trunk/vhffs-robots/src/cvs_delete.pl
    trunk/vhffs-robots/src/cvs_public.pl
    trunk/vhffs-robots/src/cvs_viewvcconf.pl

Modified: trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm	2012-02-24 22:55:04 UTC (rev 2046)
@@ -35,12 +35,13 @@
 use File::Path;
 use File::Basename;
 
-package Vhffs::Robots::Bazaar;
 use Vhffs::Constants;
 use Vhffs::Functions;
 use Vhffs::Robots;
 use Vhffs::Services::Bazaar;
 
+package Vhffs::Robots::Bazaar;
+
 sub create {
 	my $bazaar = shift;
 	return undef unless defined $bazaar and $bazaar->get_status == Vhffs::Constants::WAITING_FOR_CREATION;
@@ -63,9 +64,6 @@
 		return undef;
 	}
 
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $bazaar->get_owner_uid , $bazaar->get_owner_gid );
-
 	my $oldcwd = Cwd::getcwd();
 	if( chdir($dir) ) {
 		my $childpid = open( my $output, '-|', 'bzr', 'init' );
@@ -91,11 +89,8 @@
 	Vhffs::Robots::chmod_recur( $dir, 0664, 02775 );
 	Vhffs::Robots::chown_recur( $dir, $bazaar->get_owner_uid, $bazaar->get_owner_gid );
 
-	$bazaar->set_status( Vhffs::Constants::ACTIVATED );
-	$bazaar->commit;
 	Vhffs::Robots::vhffs_log( $vhffs, 'Created bazaar repository '.$bazaar->get_reponame );
-
-	return 1;
+	return modify( $bazaar );
 }
 
 sub delete {
@@ -143,11 +138,11 @@
 	}
 
 	if( $bazaar->is_public ) {
-		chmod 02775 , $bazaar->get_dir;
+		chmod 02775, $bazaar->get_dir;
 		Vhffs::Robots::vhffs_log( $vhffs, 'Bazaar repository '.$bazaar->get_reponame.' is now public' );
 		$bazaar->add_history( 'Is now public');
 	} else {
-		chmod 02770 , $bazaar->get_dir;
+		chmod 02770, $bazaar->get_dir;
 		Vhffs::Robots::vhffs_log( $vhffs, 'Bazaar repository '.$bazaar->get_reponame.' is now private' );
 		$bazaar->add_history( 'Is now private');
 	}

Modified: trunk/vhffs-api/src/Vhffs/Robots/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Cron.pm	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-api/src/Vhffs/Robots/Cron.pm	2012-02-24 22:55:04 UTC (rev 2046)
@@ -32,12 +32,13 @@
 use strict;
 use utf8;
 
-package Vhffs::Robots::Cron;
 use Vhffs::Constants;
 use Vhffs::Functions;
 use Vhffs::Robots;
 use Vhffs::Services::Cron;
 
+package Vhffs::Robots::Cron;
+
 sub get_runnable_jobs {
 	my $main = shift;
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm	2012-02-24 22:55:04 UTC (rev 2046)
@@ -29,37 +29,40 @@
 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-package Vhffs::Robots::Cvs;
-
 use strict;
 use utf8;
+use Cwd;
 use File::Path;
 use File::Basename;
 
-use Vhffs::Services::Cvs;
 use Vhffs::Constants;
 use Vhffs::Functions;
+use Vhffs::Robots;
+use Vhffs::Services::Cvs;
 
-sub create_cvs
-{
+package Vhffs::Robots::Cvs;
+
+sub create {
 	my $cvs = shift;
-	return -1 unless defined $cvs;
-	return -1 if $cvs->get_status != Vhffs::Constants::WAITING_FOR_CREATION;
+	return undef unless defined $cvs and $cvs->get_status == Vhffs::Constants::WAITING_FOR_CREATION;
 
+	my $vhffs = $cvs->get_main;
 	my $dir = $cvs->get_dir;
 
 	if( -e $dir ) {
 		$cvs->set_status( Vhffs::Constants::CREATION_ERROR );
 		$cvs->commit();
-		$cvs->add_history('Error, directory of this cvs repository already exists! Administrators must fix the problem.');
-		return -1;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating cvs repository '.$cvs->get_reponame.' to the filesystem' );
+		return undef;
 	}
 
-	# TODO: check make_path
-	File::Path::make_path( $dir );
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $cvs->get_owner_uid , $cvs->get_owner_gid );
-	$cvs->add_history('Ok, robots find the empty directory and will create cvs repository');
+	File::Path::make_path( $dir, { error => \my $errors });
+	if(@$errors) {
+		$cvs->set_status( Vhffs::Constants::CREATION_ERROR );
+		$cvs->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating cvs repository '.$cvs->get_reponame.' to the filesystem' );
+		return undef;
+	}
 
 	my $childpid = open( my $output, '-|', 'cvs', '-d', $dir, 'init' );
 	if($childpid) {
@@ -74,38 +77,132 @@
 
 	unless( -d $dir.'/CVSROOT' ) {
 		$cvs->set_status( Vhffs::Constants::CREATION_ERROR );
-		$cvs->commit();
-		$cvs->add_history('Error, nothing was created after calling the cvs binary, something is wrong.');
-		return -1;
+		$cvs->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating cvs repository '.$cvs->get_reponame.' to the filesystem' );
+		return undef;
 	}
 
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $cvs->get_owner_uid , $cvs->get_owner_gid );
+	Vhffs::Robots::chmod_recur( $dir, 0664, 02775 );
+	Vhffs::Robots::chown_recur( $dir, $cvs->get_owner_uid, $cvs->get_owner_gid );
 
-	$cvs->add_history('The Robots created the cvs repository');
-	$cvs->set_status( Vhffs::Constants::ACTIVATED );
-	$cvs->commit;
-
-	return 0;
+	Vhffs::Robots::vhffs_log( $vhffs, 'Created cvs repository '.$cvs->get_reponame );
+	return modify( $cvs );
 }
 
-
-sub delete_cvs
-{
+sub delete {
 	my $cvs = shift;
-	return -1 unless defined $cvs;
+	return undef unless defined $cvs and $cvs->get_status == Vhffs::Constants::WAITING_FOR_DELETION;
 
+	my $vhffs = $cvs->get_main;
 	my $dir = $cvs->get_dir;
+
 	Vhffs::Robots::archive_targz( $cvs, $dir );
 
-	# TODO: check remove_tree
-	File::Path::remove_tree($dir) if(-d $dir);
-	# Remove parent dir if empty (i.e. this group has no move CVSes).
+	File::Path::remove_tree( $dir, { error => \my $errors });
 	my $groupdir = File::Basename::dirname($dir);
-	rmdir $groupdir;
+	rmdir($groupdir);
 
-	return 0;
+	if(@$errors) {
+		$cvs->set_status( Vhffs::Constants::DELETION_ERROR );
+		$cvs->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing cvs repository '.$cvs->get_reponame.' from the filesystem' );
+		return undef;
+	}
+
+	if( $cvs->delete ) {
+		Vhffs::Robots::vhffs_log( $vhffs, 'Deleted cvs repository '.$cvs->get_reponame );
+	} else {
+		$cvs->set_status( Vhffs::Constants::DELETION_ERROR );
+		$cvs->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while deleting cvs repository '.$cvs->get_reponame.' object' );
+		return undef;
+	}
+
+	viewvc_conf( $vhffs );
+	return 1;
 }
 
+sub modify {
+	my $cvs = shift;
+	return undef unless defined $cvs and ( $cvs->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION or $cvs->get_status == Vhffs::Constants::WAITING_FOR_CREATION );
 
+	my $vhffs = $cvs->get_main;
+	my $dir = $cvs->get_dir;
+	my $readers_file = $dir.'/CVSROOT/readers';
+	my $passwd_file = $dir.'/CVSROOT/passwd';
+
+	if( $cvs->is_public ) {
+		chmod 02775, $dir;
+
+		open( my $readers, '>', $readers_file ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying cvs repository, cannot open '.$readers_file );
+		open( my $passwd, '>', $passwd_file ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying cvs repository, cannot open '.$passwd_file );
+		unless( defined $readers and defined $passwd ) {
+			$cvs->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+			$cvs->commit;
+			return undef;
+		}
+
+		# Write readers file
+		print $readers 'anonymous'."\n";
+		close( $readers );
+		chown $cvs->get_owner_uid, $cvs->get_owner_gid, $readers_file;
+
+		# Write passwd file
+		print $passwd 'anonymous::'.$cvs->get_owner->get_username."\n";
+		close( $passwd );
+		chown $cvs->get_owner_uid, $cvs->get_owner_gid, $passwd_file;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Cvs repository '.$cvs->get_reponame.' is now public' );
+		$cvs->add_history( 'Is now public');
+	}
+	else {
+		chmod 02770, $dir;
+		unlink $readers_file;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Cvs repository '.$cvs->get_reponame.' is now private' );
+		$cvs->add_history( 'Is now private');
+	}
+
+	$cvs->set_status( Vhffs::Constants::ACTIVATED );
+	$cvs->commit;
+
+	viewvc_conf( $vhffs );
+	return 1;
+}
+
+sub viewvc_conf {
+	require Template;
+	require File::Copy;
+
+	my $vhffs = shift;
+
+	my $confdir = $vhffs->get_config->get_datadir.'/cvs/conf';
+	unless( -d $confdir ) {
+		mkdir( $confdir ) or Vhffs::Robots::vhffs_log( $vhffs, 'Unable to create cvs confdir '.$confdir.': '.$! );
+	}
+
+	my $cvsroots = [];
+	my $cvss = Vhffs::Services::Cvs::getall( $vhffs, Vhffs::Constants::ACTIVATED );
+	foreach ( @{$cvss} ) {
+		next unless $_->is_public;
+		my $cvspath = $_->get_reponame;
+		$cvspath =~ s/\//_/;
+		push @$cvsroots, $cvspath.': '.$_->get_dir;
+	}
+
+	return undef unless $cvsroots;
+
+	my ( $tmpfile, $tmppath ) = Vhffs::Robots::tmpfile( $vhffs );
+	return undef unless defined $tmpfile;
+	close( $tmpfile );
+
+	# TODO: remove hardcoded path
+	my $template = new Template( { INCLUDE_PATH => '/usr/lib/vhffs/bots/misc/' } );
+	$template->process( 'cvs_viewvc.conf.tt', { cvsroots => $cvsroots }, $tmppath );
+
+	File::Copy::move( $tmppath, $confdir.'/viewvc.conf' );
+
+	return 1;
+}
+
 1;

Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/Makefile.am	2012-02-24 22:55:04 UTC (rev 2046)
@@ -21,10 +21,7 @@
 	misc/git_post-receive
 
 dist_bots_SCRIPTS = \
-	src/cvs_create.pl \
-	src/cvs_delete.pl \
-	src/cvs_public.pl \
-	src/cvs_viewvcconf.pl \
+	src/cvs.pl \
 	src/dns_create.pl \
 	src/dns_delete.pl \
 	src/group_create.pl \
@@ -62,9 +59,7 @@
 	src/mercurial_create.pl \
 	src/mercurial_delete.pl \
 	src/mercurial_public.pl \
-	src/bazaar_create.pl \
-	src/bazaar_delete.pl \
-	src/bazaar_modify.pl \
+	src/bazaar.pl \
 	src/user_create.pl \
 	src/user_delete.pl \
 	src/user_group.pl \

Copied: trunk/vhffs-robots/src/bazaar.pl (from rev 2043, trunk/vhffs-robots/src/bazaar_create.pl)
===================================================================
--- trunk/vhffs-robots/src/bazaar.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/bazaar.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -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::Bazaar;
+
+my $vhffs = init Vhffs::Main;
+exit 1 unless defined $vhffs;
+
+Vhffs::Robots::lock( $vhffs, 'bazaar' );
+
+my $repos = Vhffs::Services::Bazaar::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Bazaar::create( $_ );
+}
+
+$repos = Vhffs::Services::Bazaar::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Bazaar::delete( $_ );
+}
+
+$repos = Vhffs::Services::Bazaar::getall( $vhffs, Vhffs::Constants::WAITING_FOR_MODIFICATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Bazaar::modify( $_ );
+}
+
+Vhffs::Robots::unlock( $vhffs, 'bazaar' );
+exit 0;

Deleted: trunk/vhffs-robots/src/bazaar_create.pl
===================================================================
--- trunk/vhffs-robots/src/bazaar_create.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/bazaar_create.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,49 +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::Robots::Bazaar;
-
-my $vhffs = init Vhffs::Main;
-exit 1 unless defined $vhffs;
-
-Vhffs::Robots::lock( $vhffs, 'bazaar' );
-
-my $repos = Vhffs::Services::Bazaar::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
-foreach ( @{$repos} ) {
-	Vhffs::Robots::Bazaar::create( $_ );
-}
-
-Vhffs::Robots::unlock( $vhffs, 'bazaar' );
-exit 0;

Deleted: trunk/vhffs-robots/src/bazaar_delete.pl
===================================================================
--- trunk/vhffs-robots/src/bazaar_delete.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/bazaar_delete.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,49 +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::Robots::Bazaar;
-
-my $vhffs = init Vhffs::Main;
-exit 1 unless defined $vhffs;
-
-Vhffs::Robots::lock( $vhffs, 'bazaar' );
-
-my $repos = Vhffs::Services::Bazaar::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
-foreach ( @{$repos} ) {
-	Vhffs::Robots::Bazaar::delete( $_ );
-}
-
-Vhffs::Robots::unlock( $vhffs, 'bazaar' );
-exit 0;

Deleted: trunk/vhffs-robots/src/bazaar_modify.pl
===================================================================
--- trunk/vhffs-robots/src/bazaar_modify.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/bazaar_modify.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,49 +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::Robots::Bazaar;
-
-my $vhffs = init Vhffs::Main;
-exit 1 unless defined $vhffs;
-
-Vhffs::Robots::lock( $vhffs, 'bazaar' );
-
-my $repos = Vhffs::Services::Bazaar::getall( $vhffs, Vhffs::Constants::WAITING_FOR_MODIFICATION );
-foreach ( @{$repos} ) {
-	Vhffs::Robots::Bazaar::modify( $_ );
-}
-
-Vhffs::Robots::unlock( $vhffs, 'bazaar' );
-exit 0;

Copied: trunk/vhffs-robots/src/cvs.pl (from rev 2043, trunk/vhffs-robots/src/cvs_create.pl)
===================================================================
--- trunk/vhffs-robots/src/cvs.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/cvs.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -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::Cvs;
+
+my $vhffs = init Vhffs::Main;
+exit 1 unless defined $vhffs;
+
+Vhffs::Robots::lock( $vhffs, 'cvs' );
+
+my $repos = Vhffs::Services::Cvs::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Cvs::create( $_ );
+}
+
+$repos = Vhffs::Services::Cvs::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Cvs::delete( $_ );
+}
+
+$repos = Vhffs::Services::Cvs::getall( $vhffs, Vhffs::Constants::WAITING_FOR_MODIFICATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Cvs::modify( $_ );
+}
+
+Vhffs::Robots::unlock( $vhffs, 'cvs' );
+exit 0;

Deleted: trunk/vhffs-robots/src/cvs_create.pl
===================================================================
--- trunk/vhffs-robots/src/cvs_create.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/cvs_create.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,61 +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::Robots::Cvs;
-use Vhffs::Robots;
-use Vhffs::Main;
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'cvs' );
-
-my $cvs = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::WAITING_FOR_CREATION , undef , undef  );
-foreach my $c ( @{$cvs} )
-{
-	if( Vhffs::Robots::Cvs::create_cvs( $c ) != 0 )
-	{
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'CVS: repository %s is created' , $c->get_reponame ) );
-	}
-	else
-	{
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'CVS: cannot create %s CVS repository' , $c->get_reponame ) );
-	}
-}
-
-Vhffs::Robots::unlock( $vhffs , 'cvs' );
-
-exit 0;

Deleted: trunk/vhffs-robots/src/cvs_delete.pl
===================================================================
--- trunk/vhffs-robots/src/cvs_delete.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/cvs_delete.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,66 +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::Robots::Cvs;
-use Vhffs::Services::Cvs;
-use Vhffs::Constants;
-use Vhffs::Robots;
-use Vhffs::Main;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'cvs' );
-
-my $repos = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::WAITING_FOR_DELETION );
-foreach my $cvs ( @{$repos} )
-{
-	if( Vhffs::Robots::Cvs::delete_cvs( $cvs ) != 0 ) {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot delete files from %s', $cvs->get_reponame ));
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Delete files from %s', $cvs->get_reponame ));
-	}
-
-	if( $cvs->delete < 0 ) {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot delete CVS object %s', $cvs->get_reponame ));
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Delete CVS object %s', $cvs->get_reponame ));
-	}
-}
-
-
-Vhffs::Robots::unlock( $vhffs , 'cvs' );
-
-exit 0;

Deleted: trunk/vhffs-robots/src/cvs_public.pl
===================================================================
--- trunk/vhffs-robots/src/cvs_public.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/cvs_public.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,95 +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.
-
-
-# This is a part of VHFFS platform
-# Please consider the entire platform
-# See http://vhffs.org
-
-# by sod
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Functions;
-use Vhffs::Constants;
-use Vhffs::Services::Cvs;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'cvs' );
-
-my $cvss = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::WAITING_FOR_MODIFICATION );
-foreach my $cvs ( @{$cvss} )
-{
-	my $readers_file = $cvs->get_dir.'/CVSROOT/readers';
-	my $passwd_file = $cvs->get_dir.'/CVSROOT/passwd';
-
-	if( $cvs->is_public == 1 )
-	{
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'CVS fixperm (public) for %s', $cvs->get_reponame ));
-		$cvs->add_history('CVS is now public');
-		chmod 02775 , $cvs->get_dir;
-
-		# fix readers file
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf('CVS, put repository %s public' , $cvs->get_reponame));
-		open( FILE , '>'.$readers_file ) or die( 'cannot open '.$readers_file );
-		print FILE 'anonymous'."\n";
-		close( FILE );
-		chown $cvs->get_owner_uid , $cvs->get_owner_gid , $readers_file;
-
-		# fix passwd file
-		open( FILE , '>'.$passwd_file ) or die( 'cannot open '.$passwd_file );
-		print FILE 'anonymous::'.$cvs->get_owner->get_username."\n";
-		close( FILE );
-		chown $cvs->get_owner_uid , $cvs->get_owner_gid , $passwd_file;
-	}
-	else
-	{
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'CVS fixperm (private) for %s', $cvs->get_reponame ));
-		$cvs->add_history('CVS is now private');
-		chmod 02770 , $cvs->get_dir;
-
-		# delete reader_file if it exists
-		unlink $readers_file if -f $readers_file;
-	}
-
-	$cvs->set_status( Vhffs::Constants::ACTIVATED );
-	$cvs->commit;
-}
-
-Vhffs::Robots::unlock( $vhffs , 'cvs' );
-
-exit 0;

Deleted: trunk/vhffs-robots/src/cvs_viewvcconf.pl
===================================================================
--- trunk/vhffs-robots/src/cvs_viewvcconf.pl	2012-02-24 21:51:52 UTC (rev 2045)
+++ trunk/vhffs-robots/src/cvs_viewvcconf.pl	2012-02-24 22:55:04 UTC (rev 2046)
@@ -1,73 +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 lib '%VHFFS_LIB_DIR%';
-use utf8;
-use Vhffs::Main;
-use Vhffs::Constants;
-use Vhffs::Services::Cvs;
-use Vhffs::Robots;
-use Template;
-
-my $vhffs = init Vhffs::Main;
-
-my $confdir = $vhffs->get_config->get_datadir.'/cvs/conf';
-mkdir( $confdir ) or die("Unable to create cvs confdir $confdir: $!") unless(-d $confdir);
-
-Vhffs::Robots::lock( $vhffs , 'cvs_viewvc' );
-
-my $cvsroots = [];
-
-if( $vhffs->get_config->get_service_availability('cvs') == 1 )
-{
-	my $cvss = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::ACTIVATED );
-	foreach my $cvs ( @{$cvss} )
-	{
-		if( $cvs->is_public == 1 )
-		{
-			my $cvspath = $cvs->get_reponame;
-			$cvspath =~ s/\//_/;
-			push @$cvsroots, $cvspath.': '.$cvs->get_dir;
-		}
-	}
-}
-
-if( $cvsroots )  {
-     my $template = new Template({
-         INCLUDE_PATH => '/usr/lib/vhffs/bots/misc/',
-    });
-
-    $template->process( 'cvs_viewvc.conf.tt', { cvsroots => $cvsroots }, "$confdir/viewvc.conf" );
-}
-
-Vhffs::Robots::unlock( $vhffs , 'cvs_viewvc' );


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