head	1.17;
access;
symbols
	TIGRIS_1_1_0RC2:1.15
	TIGRIS_1_1_0RC1:1.15
	TIGRIS_1_1:1.15.0.6
	TIGRIS_1_0_8:1.15
	TIGRIS_1_0_8RC3:1.15
	TIGRIS_1_0_8RC2:1.15
	TIGRIS_1_0_8RC1:1.15
	TIGRIS_1_0_7:1.15
	TIGRIS_1_0_7RC3:1.15
	TIGRIS_1_0_7RC2:1.15
	TIGRIS_1_0_7RC1:1.15
	TIGRIS_1_0_6:1.15
	TIGRIS_1_0_6RC5:1.15
	TIGRIS_1_0_6RC4:1.15
	TIGRIS_1_0_6RC3:1.15
	TIGRIS_1_0_6RC2:1.15
	TIGRIS_1_0_6RC1:1.15
	TIGRIS_1_0_5:1.15
	TIGRIS_1_0_5RC6:1.15
	TIGRIS_1_0_5RC5:1.15
	TIGRIS_1_0_5RC4:1.15
	TIGRIS_1_0_5RC3:1.15
	TIGRIS_1_0_5RC2:1.15
	TIGRIS_1_0_5RC1:1.15
	TIGRIS_1_0_4:1.15
	TIGRIS_1_0_3:1.15
	TIGRIS_1_0_2:1.15
	TIGRIS_1_0_1:1.15
	TIGRIS_1_0:1.15.0.8
	TIGRIS_1_0_0:1.15
	TIGRIS_1_0_0_RC1:1.15.0.4
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.15
	TIGRIS_0_9_2_3:1.15
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.15
	TIGRIS_0_9_2_1:1.15
	TIGRIS_0_9_2:1.15.0.2
	TIGRIS_0_9_0:1.14.0.4
	TIGRIS_0_8_4:1.14.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1
	OLDHELM:1.13.0.2
	TIGRIS_NOV_11_2000:1.13
	TIGRIS_SEP_13_2000:1.8.0.2
	TIGRIS_BASELINE:1.12;
locks; strict;
comment	@# @;


1.17
date	2001.04.18.02.02.58;	author kmaples;	state Exp;
branches;
next	1.16;

1.16
date	2001.04.17.04.44.54;	author kmaples;	state Exp;
branches;
next	1.15;

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

1.14
date	2000.11.12.22.57.33;	author dlr;	state Exp;
branches;
next	1.13;

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

1.12
date	2000.09.15.03.51.10;	author kmaples;	state Exp;
branches;
next	1.11;

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

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

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

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

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

1.6
date	2000.09.07.16.43.00;	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.57;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.17
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-add
# $Id: cvs-project-add,v 1.15 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';      # static portion off sbx
my $cvsroot       = "$sandbox/$tigris_rep";
my $project_dir   = "$cvsroot/$project_name";

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------

print "$script_name: beginning for project $project_name\n";

if (-d $project_dir) {
    print "$script_name: directory '$project_dir' exists\n";
    print "$script_name: checking for writability\n";
    # This appears to be making a major assumption here - that
    # is, that the same uid which is running this script to check
    # or set permissions will be the same one used to access this
    # dir later on:
    if(-r $project_dir && -w $project_dir && -x $project_dir){
	print "$script_name: $project_name presumed added\n";
    } else {
	print "$script_name: setting permissions on $project_dir\n";
	chmod(0775, $project_dir) or die "$script_name: chmod $project_dir 0775 failed: $!\n";
    }
} else {
	# Bail out if there's no parent directory:
	die "$script_name: cvsroot $cvsroot does not exist; failed\n" unless -d $cvsroot;
	
	# Otherwise, create the directory for the project:
	print "$script_name: creating $project_dir\n";
	mkdir($project_dir, 0775) or die "$script_name:mkdir $project_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);
}
__END__
@


1.16
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";

d84 1
a84 1
print_log(1, "$script_name: beginning for project $project_name\n");
d87 2
a88 2
    print_log(1, "$script_name: directory '$project_dir' exists\n");
    print_log(1, "$script_name: checking for writability\n");
d94 1
a94 1
	print_log(1, "$script_name: $project_name presumed added\n");
d96 1
a96 1
	print_log(1, "$script_name: setting permissions on $project_dir\n");
d104 1
a104 1
	print_log(1, "$script_name: creating $project_dir\n");
@


1.15
log
@Out with the unnecessary, in with the preparatory.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.14 2000/11/12 22:57:33 dlr Exp $
d55 5
d89 1
a89 1
print "$script_name: beginning for project $project_name\n";
d92 2
a93 2
    print "$script_name: directory '$project_dir' exists\n";
    print "$script_name: checking for writability\n";
d99 1
a99 1
	print "$script_name: $project_name presumed added\n";
d101 1
a101 1
	print "$script_name: setting permissions on $project_dir\n";
d109 1
a109 1
	print "$script_name: creating $project_dir\n";
@


1.14
log
@Resolved merge conflicts.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,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.
a78 8

# This is perhaps a bit overboard, but if we can get the system
# to tell us where CVS is, it's one less thing to have to hardcode:
my $default_cvs_bin = '/usr/bin/cvs';
my $cvs_bin = `which cvs` || $default_cvs_bin;
chomp $cvs_bin;
# There's no reason to go on if CVS isn't there:
die "$script_name: CVS executable could not be found: $!\n" unless -x $cvs_bin;
@


1.13
log
@Removed references to 'is_private' flag.  Not only is this unnecessary, but
according Leonard, it 'kills puppies and causes dutch elm disease'.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.12 2000/09/15 03:51:10 kmaples Exp $
d108 1
a108 1
	chmod(0770, $project_dir) or die "$script_name: chmod $project_dir 0770 failed: $!\n";
d116 1
a116 1
	mkdir($project_dir, 0770) or die "$script_name:mkdir $project_dir failed: $!\n";
a140 1

@


1.12
log
@Fixed regex to display script name in logfiles.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.11 2000/09/14 19:02:22 kmaples Exp $
a71 1
my $is_private         = $ARGV[5] || ''; # unreferenced.
@


1.11
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-add,v 1.10 2000/09/13 22:33:46 kmaples Exp $
d77 1
a77 1
$script_name =~ s/^.*\/([\w]+)$/$1/;
@


1.10
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-add,v 1.9 2000/09/13 21:55:36 kmaples Exp $
@


1.9
log
@Set PATH in child scripts to suppress -T warnings.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.8 2000/09/12 16:28:06 kmaples Exp $
d60 3
d125 17
@


1.8
log
@Stubs for bugzilla-related functions
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.7 2000/09/08 19:31:17 kmaples Exp $
d57 3
@


1.7
log
@Changing script interactions with cvs
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.6 2000/09/07 16:43:00 kmaples Exp $
a111 3
        chdir("$project_dir/..") or die "$script_name:chdir $project_dir/.. failed: $!\n";
	system($cvs_bin,'add',$project_name) == 0 
            or die "$script_name: unable to perform 'cvs add $project_dir: $!\n";
@


1.6
log
@Minor changes to flow.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.5 2000/09/05 22:57:48 kmaples Exp $
d78 8
d112 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-add,v 1.4 2000/08/16 23:58:25 kmaples Exp $
d92 4
a95 3
	    print "$script_name: $project_name presumed added\n";
    	print "$script_name: exiting successful\n";
    	exit 0;
a96 2
    print "$script_name: setting permissions on $project_dir\n";
    chmod(0770, $project_dir) or die "$script_name: chmod $project_dir 0770 failed: $!\n";
@


1.4
log
@Extensive rewrites and modifications to standarize interface with caller
@
text
@d51 1
a51 1
# $Id: $
d74 1
a74 1
my $tigris_rep    = 'tigrisc/repository';      # static portion off sbx
@


1.3
log
@Fix some syntax errors.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.2 2000/05/01 09:11:11 manoj Exp $
d55 3
d61 20
a80 5
my $sandbox      = $ARGV[0];
my $project_name       = $ARGV[1];
my $domain_name        = $ARGV[2];
my $brand_name         = $ARGV[3];
my $is_private         = $ARGV[4];
d82 1
a82 1
print "cvs: make a top level module for project $project_name\n";
d84 22
a105 1
my $cmd = "unix command line";
d107 3
a109 2
my $cvsroot = "$sandbox/tigrisc/repository";
my $project_dir = "$cvsroot/$project_name";
a110 6
if (-d $project_dir) {
    print "Project named \"$project_name\" already added\n";
    exit 0;
}
print "cvs: add a directory: " . $project_name .
    " in cvs root for domain " . $domain_name . "\n";
a111 6
if (-d $project_dir) {
    chmod($project_dir, 770) or die "chmod $project_dir 700 failed: $!";
}
else {
    mkdir($project_dir,770) or die "mkdir $project_dir failed: $!";
}
@


1.2
log
@Untested code for CVS project management.
@
text
@d51 1
a51 1
# $Id: cvs-project-add,v 1.1 2000/04/29 00:04:10 jrobbins Exp $
d77 7
a83 1
mkdir($project_dir) or die "mkdir $project_dir 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 $
d68 1
a68 1
my $cvsroot = "/home/tigrisc";
d71 7
a77 3
$cmd = "/bin/mkdir $project_dir";
print "Running: $cmd\n";

@


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-add,v 1.2 2000/11/03 00:57:58 edk Exp $
d55 8
a62 2
# Flush buffer, just in case:
$| = 1;
d64 1
a64 4
# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);
d66 1
d68 5
a72 1
use strict;
a73 75
# Process arguments
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';      # static portion off sbx
my $cvsroot       = "$sandbox/$tigris_rep";
my $project_dir   = "$cvsroot/$project_name";

# This is perhaps a bit overboard, but if we can get the system
# to tell us where CVS is, it's one less thing to have to hardcode:
my $default_cvs_bin = '/usr/bin/cvs';
my $cvs_bin = `which cvs` || $default_cvs_bin;
chomp $cvs_bin;
# There's no reason to go on if CVS isn't there:
die "$script_name: CVS executable could not be found: $!\n" unless -x $cvs_bin;

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------

print "$script_name: beginning for project $project_name\n";

if (-d $project_dir) {
    print "$script_name: directory '$project_dir' exists\n";
    print "$script_name: checking for writability\n";
    # This appears to be making a major assumption here - that
    # is, that the same uid which is running this script to check
    # or set permissions will be the same one used to access this
    # dir later on:
    if(-r $project_dir && -w $project_dir && -x $project_dir){
	print "$script_name: $project_name presumed added\n";
    } else {
	print "$script_name: setting permissions on $project_dir\n";
	chmod(0775, $project_dir) or die "$script_name: chmod $project_dir 0775 failed: $!\n";
    }
} else {
	# Bail out if there's no parent directory:
	die "$script_name: cvsroot $cvsroot does not exist; failed\n" unless -d $cvsroot;
	
	# Otherwise, create the directory for the project:
	print "$script_name: creating $project_dir\n";
	mkdir($project_dir, 0775) or die "$script_name:mkdir $project_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);
}
__END__
@


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


