head	1.15;
access;
symbols
	TIGRIS_1_1_0RC2:1.13
	TIGRIS_1_1_0RC1:1.13
	TIGRIS_1_1:1.13.0.6
	TIGRIS_1_0_8:1.13
	TIGRIS_1_0_8RC3:1.13
	TIGRIS_1_0_8RC2:1.13
	TIGRIS_1_0_8RC1:1.13
	TIGRIS_1_0_7:1.13
	TIGRIS_1_0_7RC3:1.13
	TIGRIS_1_0_7RC2:1.13
	TIGRIS_1_0_7RC1:1.13
	TIGRIS_1_0_6:1.13
	TIGRIS_1_0_6RC5:1.13
	TIGRIS_1_0_6RC4:1.13
	TIGRIS_1_0_6RC3:1.13
	TIGRIS_1_0_6RC2:1.13
	TIGRIS_1_0_6RC1:1.13
	TIGRIS_1_0_5:1.13
	TIGRIS_1_0_5RC6:1.13
	TIGRIS_1_0_5RC5:1.13
	TIGRIS_1_0_5RC4:1.13
	TIGRIS_1_0_5RC3:1.13
	TIGRIS_1_0_5RC2:1.13
	TIGRIS_1_0_5RC1:1.13
	TIGRIS_1_0_4:1.13
	TIGRIS_1_0_3:1.13
	TIGRIS_1_0_2:1.13
	TIGRIS_1_0_1:1.13
	TIGRIS_1_0:1.13.0.8
	TIGRIS_1_0_0:1.13
	TIGRIS_1_0_0_RC1:1.13.0.4
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.13
	TIGRIS_0_9_2_3:1.13
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.13
	TIGRIS_0_9_2_1:1.13
	TIGRIS_0_9_2:1.13.0.2
	TIGRIS_0_9_0:1.12.0.4
	TIGRIS_0_8_4:1.12.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1
	OLDHELM:1.11.0.2
	TIGRIS_NOV_11_2000:1.11
	TIGRIS_SEP_13_2000:1.6.0.2
	TIGRIS_BASELINE:1.11;
locks; strict;
comment	@# @;


1.15
date	2001.04.18.02.02.58;	author kmaples;	state Exp;
branches;
next	1.14;

1.14
date	2001.04.17.04.44.54;	author kmaples;	state Exp;
branches;
next	1.13;

1.13
date	2001.01.04.18.25.33;	author kmaples;	state Exp;
branches;
next	1.12;

1.12
date	2000.11.12.22.57.33;	author dlr;	state Exp;
branches;
next	1.11;

1.11
date	2000.09.22.23.42.20;	author kmaples;	state Exp;
branches;
next	1.10;

1.10
date	2000.09.15.03.51.10;	author kmaples;	state Exp;
branches;
next	1.9;

1.9
date	2000.09.14.19.02.22;	author kmaples;	state Exp;
branches;
next	1.8;

1.8
date	2000.09.13.22.33.46;	author kmaples;	state Exp;
branches;
next	1.7;

1.7
date	2000.09.13.21.55.36;	author kmaples;	state Exp;
branches;
next	1.6;

1.6
date	2000.09.08.22.08.26;	author kmaples;	state Exp;
branches;
next	1.5;

1.5
date	2000.09.05.22.57.48;	author kmaples;	state Exp;
branches;
next	1.4;

1.4
date	2000.08.16.23.58.25;	author kmaples;	state Exp;
branches;
next	1.3;

1.3
date	2000.05.19.20.06.32;	author manoj;	state Exp;
branches;
next	1.2;

1.2
date	2000.05.01.09.11.11;	author manoj;	state Exp;
branches;
next	1.1;

1.1
date	2000.04.29.00.04.10;	author jrobbins;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.17.32;	author dlr;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.02.21.00.35.58;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.15
log
@Undoing yesterday's commit - my hastiness to implement some sort of logging
level notion into these scripts caused me great pain.
@
text
@#!/usr/bin/perl -wU

# ================================================================
# Copyright (c) 2000 Collab.Net.  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. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement: "This product includes
# software developed by Collab.Net (http://www.Collab.Net/)."
# Alternately, this acknowlegement may appear in the software itself, if
# and wherever such third-party acknowlegements normally appear.
# 
# 4. The hosted project names must not be used to endorse or promote
# products derived from this software without prior written
# permission. For written permission, please contact info@@collab.net.
# 
# 5. Products derived from this software may not use the "Tigris" name
# nor may "Tigris" appear in their names without prior written
# permission of Collab.Net.
# 
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 COLLAB.NET OR ITS 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 software consists of voluntary contributions made by many
# individuals on behalf of Collab.Net.
#


# cvs-project-delete
# $Id: cvs-project-delete,v 1.13 2001/01/04 18:25:33 kmaples Exp $
# --------------------
# Provide operations for CVS as past of Tigris

# Flush buffer, just in case:
$| = 1;

# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);


use strict;

# Process arguments
my $sandbox            = $ARGV[0];
my $project_name       = $ARGV[1];

# Grab just the filename portion of this script to use as a 
# log identifier:
my $script_name = $0;
$script_name =~ s/^.*\/([^\/]+)$/  $1/;

# Paths and files derived from @@ARGV:
my $tigris_rep    = 'data/helm/cvs/repository';
my $tigris_del    = 'data/helm/cvs/deletedprojects';

my $cvsroot       = "$sandbox/$tigris_rep";
my $cvs_del_root  = "$sandbox/$tigris_del";

my $old_dir       = "$cvsroot/$project_name";
my $new_dir       = "$cvs_del_root/$project_name";


#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
print "$script_name: beginning for $project_name\n";

# If the directory doesn't exist, assume that the project has
# already been deleted:
unless(-e $old_dir){
    print "$script_name: directory $old_dir not found\n";
    print "$script_name: exiting successful\n";
    exit 0;
}

# Check for the directory which should hold defunct projects:
unless (-d $cvs_del_root) {
    mkdir($cvs_del_root, 0770) or die "$script_name: mkdir $cvs_del_root failed: $!\n";
}

# If by some perversity of nature there's already a deleted 
# project dir, for god's sake, move it out of the way!
if(-d $new_dir){
    print "$script_name: there's already a deleted project dir for $project_name.  Trying to move or delete.\n";
    system('mv',$new_dir,$new_dir . $$) == 0 
        or system('rm','-rf',$new_dir) == 0
        or die "$script_name: unable to move or delete $new_dir: $!\n";
}

print "$script_name: moving $old_dir to $new_dir\n";
system('mv', $old_dir, $new_dir) == 0 
    or die "$script_name: rename $old_dir -> $new_dir failed: $!\n";


#---------------------------------------------------------------
# END MAIN
#---------------------------------------------------------------


# crude attempt to overcome data tainting in perl:
#-------------------
sub detaint_array {
#-------------------
    my @@unclean = @@_;
    my @@clean = ();

    foreach(@@unclean){
        # We don't really have rules for this, so at the moment
        # this acts as a passthrough:
        $_ =~ m/^(.*)$/;
        push(@@clean,$1);
    }

    return(@@clean);
}

@


1.14
log
@Scripts now use IN_PRODUCTION to determine logging level
@
text
@a54 5
my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

require "$scripts_dir/ParentChildArgumentBridge.pl"
    or die "Require failed: $!\n";

d89 1
a89 1
print_log(1, "$script_name: beginning for $project_name\n");
d94 2
a95 2
    print_log(1, "$script_name: directory $old_dir not found\n");
    print_log(1, "$script_name: exiting successful\n");
d107 1
a107 1
    print_log(1, "$script_name: there's already a deleted project dir for $project_name.  Trying to move or delete.\n");
d113 1
a113 1
print_log(1, "$script_name: moving $old_dir to $new_dir\n");
@


1.13
log
@Out with the unnecessary, in with the preparatory.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.12 2000/11/12 22:57:33 dlr Exp $
d55 5
d94 1
a94 1
print "$script_name: beginning for $project_name\n";
d99 2
a100 2
    print "$script_name: directory $old_dir not found\n";
    print "$script_name: exiting successful\n";
d112 1
a112 1
    print "$script_name: there's already a deleted project dir for $project_name.  Trying to move or delete.\n";
d118 1
a118 1
print "$script_name: moving $old_dir to $new_dir\n";
@


1.12
log
@Resolved merge conflicts.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.1.1.1 2000/11/12 21:17:32 dlr Exp $
d68 1
a68 4
my $htdoc_root         = $ARGV[1]; # unreferenced.
my $project_name       = $ARGV[2];
my $domain_name        = $ARGV[3]; # unreferenced.
my $brand_name         = $ARGV[4]; # unreferenced.
@


1.11
log
@Many changes and fixes; specified arguments to pass to bugzilla-*-delete
scripts; fixed some omissions preventing project dirs from being properly
deleted, etc.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.10 2000/09/15 03:51:10 kmaples Exp $
@


1.10
log
@Fixed regex to display script name in logfiles.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.9 2000/09/14 19:02:22 kmaples Exp $
d105 9
@


1.9
log
@Miscellaneous changes to resolve tainting problems with setuid scripts.
CVS child scripts are now, unfortunately, permitted to perform unsafe ops.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.8 2000/09/13 22:33:46 kmaples Exp $
d76 1
a76 1
$script_name =~ s/^.*\/([\w]+)$/$1/;
@


1.8
log
@Added crude subroutine to all child scripts to detaint @@ARGV.  At the moment,
this isn't doing any real detainting - just spitting the args back out to get
around warnings setuid generates.  Complications with the scripts' knowledge
of it's own working dir when it's called prevent the effective use of 'require'
in the child scripts, thus the redundancy of code in the children (for the time
being)
@
text
@d1 1
a1 1
#!/usr/bin/perl -w
d51 1
a51 1
# $Id: cvs-project-delete,v 1.7 2000/09/13 21:55:36 kmaples Exp $
@


1.7
log
@Set PATH in child scripts to suppress -T warnings.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.6 2000/09/08 22:08:26 kmaples Exp $
d60 3
d117 16
@


1.6
log
@Changed 'rename' calls to system calls (dirs wouldn't be empty at time of
rename, and perl doesn't like that)
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.5 2000/09/05 22:57:48 kmaples Exp $
d57 3
@


1.5
log
@Corrected paths for the current position of the cvsroot in installations:
	[sandbox]/data/helm/cvs/repository
as opposed to the former
	[sandbox]/tigrisc/repository
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.4 2000/08/16 23:58:25 kmaples Exp $
d102 2
a103 1
rename($old_dir, $new_dir) or die "$script_name: rename $old_dir -> $new_dir failed: $!\n";
@


1.4
log
@Extensive rewrites and modifications to standarize interface with caller
@
text
@d51 1
a51 1
# $Id: $
d73 2
a74 2
my $tigris_rep    = 'tigrisc/repository';
my $tigris_del    = 'tigrisc/deletedprojects';
@


1.3
log
@Fix some syntax errors.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.2 2000/05/01 09:11:11 manoj Exp $
d55 3
d61 32
a92 16
my $sandbox      = $ARGV[0];
my $project_name       = $ARGV[1];
my $domain_name        = $ARGV[2];
my $brand_name         = $ARGV[3];

my $cvsroot = "$sandbox/tigrisc/repository";
my $cvs_del_root = "$sandbox/tigrisc/deletedprojects";

# my $cvs_bin = $db-config('cvs_cvsbin') . "/cvs";
my $cvs_bin = "/usr/bin/cvs";

my $old_dir = "$cvsroot/$project_name";
my $new_dir = "$cvs_del_root/$project_name";

if (! -e $old_dir) {
    print "Project named \"$project_name\" already deleted\n";
d96 1
a96 1
print "cvs: mv to safe place the top level module for project $project_name\n";
d98 1
a98 1
    mkdir($cvs_del_root, 770) or die "mkdir $cvs_del_root failed: $!";
d100 11
a110 1
rename($old_dir, $new_dir) or die "rename $old_dir -> $new_dir failed: $!";
@


1.2
log
@Untested code for CVS project management.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.1 2000/04/29 00:04:10 jrobbins Exp $
d69 2
a70 2
my $old_dir = $cvsroot/$project_name";
my $new_dir = $cvs_del_root/$project_name";
d73 1
a73 1
    print "Module named \"$module_name\" already deleted\n";
d78 3
a80 2
unless (-d $cvs_del_root)
    mkdir($cvs_del_root) or die "mkdir $cvs_del_root failed: $!";
@


1.1
log
@initial checkin
@
text
@d51 1
a51 1
# $Id: cvs.pm,v 1.1 2000/03/24 20:33:58 jrobbins Exp $
d63 14
d78 3
a80 1

@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@d1 1
a1 1
#!/usr/bin/perl -wU
d51 1
a51 1
# $Id: cvs-project-delete,v 1.1 2000/10/05 20:05:49 jrobbins Exp $
a54 9
# Flush buffer, just in case:
$| = 1;

# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);


d58 4
a61 72
my $sandbox            = $ARGV[0];
my $htdoc_root         = $ARGV[1]; # unreferenced.
my $project_name       = $ARGV[2];
my $domain_name        = $ARGV[3]; # unreferenced.
my $brand_name         = $ARGV[4]; # unreferenced.

# Grab just the filename portion of this script to use as a 
# log identifier:
my $script_name = $0;
$script_name =~ s/^.*\/([^\/]+)$/  $1/;

# Paths and files derived from @@ARGV:
my $tigris_rep    = 'data/helm/cvs/repository';
my $tigris_del    = 'data/helm/cvs/deletedprojects';

my $cvsroot       = "$sandbox/$tigris_rep";
my $cvs_del_root  = "$sandbox/$tigris_del";

my $old_dir       = "$cvsroot/$project_name";
my $new_dir       = "$cvs_del_root/$project_name";


#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
print "$script_name: beginning for $project_name\n";

# If the directory doesn't exist, assume that the project has
# already been deleted:
unless(-e $old_dir){
    print "$script_name: directory $old_dir not found\n";
    print "$script_name: exiting successful\n";
    exit 0;
}

# Check for the directory which should hold defunct projects:
unless (-d $cvs_del_root) {
    mkdir($cvs_del_root, 0770) or die "$script_name: mkdir $cvs_del_root failed: $!\n";
}

# If by some perversity of nature there's already a deleted 
# project dir, for god's sake, move it out of the way!
if(-d $new_dir){
    print "$script_name: there's already a deleted project dir for $project_name.  Trying to move or delete.\n";
    system('mv',$new_dir,$new_dir . $$) == 0 
        or system('rm','-rf',$new_dir) == 0
        or die "$script_name: unable to move or delete $new_dir: $!\n";
}

print "$script_name: moving $old_dir to $new_dir\n";
system('mv', $old_dir, $new_dir) == 0 
    or die "$script_name: rename $old_dir -> $new_dir failed: $!\n";


#---------------------------------------------------------------
# END MAIN
#---------------------------------------------------------------


# crude attempt to overcome data tainting in perl:
#-------------------
sub detaint_array {
#-------------------
    my @@unclean = @@_;
    my @@clean = ();

    foreach(@@unclean){
        # We don't really have rules for this, so at the moment
        # this acts as a passthrough:
        $_ =~ m/^(.*)$/;
        push(@@clean,$1);
    }
d63 1
a63 2
    return(@@clean);
}
@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d51 1
a51 1
# $Id: cvs-project-delete,v 1.13 2001/01/04 18:25:33 kmaples Exp $
d68 4
a71 1
my $project_name       = $ARGV[1];
@


