head	1.20;
access;
symbols
	TIGRIS_1_1_0RC2:1.18
	TIGRIS_1_1_0RC1:1.18
	TIGRIS_1_1:1.18.0.6
	TIGRIS_1_0_8:1.18
	TIGRIS_1_0_8RC3:1.18
	TIGRIS_1_0_8RC2:1.18
	TIGRIS_1_0_8RC1:1.18
	TIGRIS_1_0_7:1.18
	TIGRIS_1_0_7RC3:1.18
	TIGRIS_1_0_7RC2:1.18
	TIGRIS_1_0_7RC1:1.18
	TIGRIS_1_0_6:1.18
	TIGRIS_1_0_6RC5:1.18
	TIGRIS_1_0_6RC4:1.18
	TIGRIS_1_0_6RC3:1.18
	TIGRIS_1_0_6RC2:1.18
	TIGRIS_1_0_6RC1:1.18
	TIGRIS_1_0_5:1.18
	TIGRIS_1_0_5RC6:1.18
	TIGRIS_1_0_5RC5:1.18
	TIGRIS_1_0_5RC4:1.18
	TIGRIS_1_0_5RC3:1.18
	TIGRIS_1_0_5RC2:1.18
	TIGRIS_1_0_5RC1:1.18
	TIGRIS_1_0_4:1.18
	TIGRIS_1_0_3:1.18
	TIGRIS_1_0_2:1.18
	TIGRIS_1_0_1:1.18
	TIGRIS_1_0:1.18.0.8
	TIGRIS_1_0_0:1.18
	TIGRIS_1_0_0_RC1:1.18.0.4
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.18
	TIGRIS_0_9_2_3:1.18
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.18
	TIGRIS_0_9_2_1:1.18
	TIGRIS_0_9_2:1.18.0.2
	TIGRIS_0_9_0:1.17.0.4
	TIGRIS_0_8_4:1.17.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.11.0.2
	TIGRIS_BASELINE:1.12;
locks; strict;
comment	@# @;


1.20
date	2001.04.18.02.02.58;	author kmaples;	state Exp;
branches;
next	1.19;

1.19
date	2001.04.17.04.44.54;	author kmaples;	state Exp;
branches;
next	1.18;

1.18
date	2001.01.12.02.14.18;	author kmaples;	state Exp;
branches;
next	1.17;

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

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

1.15
date	2000.11.14.02.25.03;	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.09.27.19.23.49;	author kmaples;	state Exp;
branches;
next	1.12;

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

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

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

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

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

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

1.6
date	2000.08.18.17.55.05;	author kmaples;	state dead;
branches;
next	1.5;

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

1.4
date	2000.05.17.00.55.57;	author manoj;	state Exp;
branches;
next	1.3;

1.3
date	2000.04.29.00.04.10;	author jrobbins;	state Exp;
branches;
next	1.2;

1.2
date	2000.03.24.21.45.35;	author jrobbins;	state Exp;
branches;
next	1.1;

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

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

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


desc
@@


1.20
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 -w

# ================================================================
# 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.
#


################################################################
# Name:              ModuleAdd
# Original Author:   jrobbins@@collab.net
# $Id: ModuleAdd,v 1.18 2001/01/12 02:14:18 kmaples Exp $
#
# The goal of this script is to do everything that is needed to add a new
# module to the given project.
#
#---------------------------------------------------------------

my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

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

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
# NOTE:  According to Ed K., servlets are now dealing with functions
# relating to qmail/ezmlm/mhonarc - this leaves CVS and apache as
# the two components to be manipulated here.

# QMAIL:    call defunct
# EZMLM:    call defunct

# CVS:
# add a new cvs directory to the project

# Mhonarc:  call defunct

# Apache:   nothing

# Issuezilla:
# perform insert into issuezilla 'components' table; this is another
# way of saying that in issuezilla, component == module:

my $FAILED = 0; ## Holder for number of the script which failed
my $ct     = 0; ## Current script number

## Iterate through each action:
foreach('cvs-module-add', 'issuezilla-module-add'){
    $ct++;
    print "calling $_:\n";	 
    unless(perform($_)){
        $FAILED ||= $ct; ## Preserve the first failed
    }
}
print "EXIT STATUS: $FAILED\n"; 
## Return the the number of the first script to fail, if any:
exit($FAILED);


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

__END__
@


1.19
log
@Scripts now use IN_PRODUCTION to determine logging level
@
text
@d92 1
a92 1
    print_log(1,"calling $_:\n");
d97 1
a97 1
print_log(0,"EXIT STATUS: $FAILED\n");
@


1.18
log
@Less is more.  Refactored logging into shared lib., log stuff performed
from the command line as well as automatically.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.17 2000/11/16 00:38:49 kmaples Exp $
d92 1
a92 1
    print "calling $_:\n";	 
d97 1
a97 1
print "EXIT STATUS: $FAILED\n"; 
@


1.17
log
@Changed presumptive mailing addresses to be <user>@@<project>.<domain>
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.16 2000/11/14 19:59:56 kmaples Exp $
d60 1
a60 2
# Minimum number of args this script requires for successful execution:
#my $minimum_arg_index = 8;
d62 2
a63 88
#---------------------------------------------------------------
# Approach to logging - each 'ControlScript' (like this one) should 
# maintain it's own log file that includes the actions it's children.

my $script_name;

# Alpha and Omega:
BEGIN {
	$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
	my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

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

	# Open the logfile for logging at the beginning of execution.
	# The primary reason for this is to 'die' before doing anything
	# that we won't be able to log, and opening the log filehandle
	# in the beginning ensures this.
	
	# Grab just the filename portion of this script to use as a 
	# log identifier:
	$script_name = $0;
	$script_name =~ s/^.*\/([\w]+)$/$1/;

	# Autoflush buffer:
	$| = 1;

	# If this program is called by another program, we'll send STDOUT
	# and SDTERR to the logfile - this way the children's messages will
	# stick with the parent's logs.  Conversely, if this is called 
	# interactively (on the command line), we'll just let the output
	# go to the terminal instead of clogging up the logfiles with stuff
	# resulting from debugging attempts.
	
	unless(-t STDIN && -t STDOUT){
			
		# This needs to be established dynamically; I don't know the
		# preferred method for arriving at this value:
		my $logdir   = get_sandbox() . '/log/';
		my $logfile  = 'HelmPerlScripts' . '.log';
		
		# Point STDOUT and STDERR to the logfile, or bail out:
		unless(open(STDOUT,">> $logdir" . "$logfile") && open(STDERR,">&STDOUT")){
			die "Can't open handle for logging: $!\n";
		}
		
		# This shouldn't really be necessary, but it couldn't hurt:
		select(STDERR); $| = 1;	
		select(STDOUT); $| = 1;	

		# This might appear odd, but since STDOUT is now a filehandle
		# for the logfile, try to get a lock on it, or bail out:
		unless(flock(STDOUT, 2|4)){ # Ask nice first.
			sleep 1;
			unless(flock(STDOUT, 2)){
				die "Unable to lock logfile: $!\n";
			}
		}
	}
	# This is all in order to print a nice header for the log
	# entry:

	my $time   = time();
	my $date   = localtime($time);
        my $header = "[$date]\n[$$] START: $script_name " . join(' ',@@ARGV) . "\n";
	
	print $header;
}
END {
	# Note that because END blocks are executed from bottom to top,
	# this block should appear BEFORE any other END blocks trying 
	# to print to the same filehandle.  This might seem unnecessary,
	# but since we did point these at a file, we really ought to 
	# clean up after ourselves:

	my $footer = "[$$] END: $script_name\n\n";
	
	print $footer;

	close(STDOUT) or die "Couldn't close logging handle STDOUT: $!\n";
	close(STDERR) or die "Couldn't close logging handle STDERR: $!\n";
}
#---------------------------------------------------------------
# An early-warning system: nip this in the bud if it's not going 
# to be able to execute anyway:
#unless($#ARGV >= $minimum_arg_index){
#	die "Execution failed due to insufficient arguments.\n";
#}
@


1.16
log
@Added line to print exit status for debugging.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.15 2000/11/14 02:25:03 kmaples Exp $
d127 1
a127 1
	my $header = "[$date]\n[$$] START: $script_name\n";
@


1.15
log
@Changed the way that child scripts are called in order to return the number
or the (child) script which failed (if any).  Currently returns 0 or the
number of the first script in the sequence to fail.  Removed leftovers from
merge.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.14 2000/11/12 22:57:33 dlr Exp $
d184 1
a184 1

@


1.14
log
@Resolved merge conflicts.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.1.1.1 2000/11/12 21:17:14 dlr Exp $
a158 2
my $ret = ''; # placeholder for current return value.  Unused.

a163 2
print "calling cvs-module-add:\n";
$ret = perform('cvs-module-add');
d172 15
a186 2
print "calling issuezilla-module-add:\n";
$ret = perform('issuezilla-module-add');
@


1.13
log
@Changed all these parent scripts to point at single logfile ('HelmPerlScripts.log')
instead of the individually-named per-parent scripts each had been writing to.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.12 2000/09/21 19:29:10 kmaples Exp $
d173 5
a177 5
# Bugzilla:
# perform insert into bugzilla 'components' table; this is another
# way of saying that in bugzilla, component == module:
print "calling bugzilla-module-add:\n";
$ret = perform('bugzilla-module-add');
a184 2


@


1.12
log
@Added print statements for log files
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.11 2000/09/12 16:28:06 kmaples Exp $
d102 1
a102 1
		my $logfile  = $script_name . '.log';
@


1.11
log
@Stubs for bugzilla-related functions
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.10 2000/09/11 19:35:40 kmaples Exp $
d176 1
@


1.10
log
@Changed scripts to set PATH; HTDOC_ROOT and SANDBOX are being taken from ENV
again - this was in order to overcome a problem with the calling servlet not
knowing what it's CWD was, thus causing 'require' statments to fail.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.9 2000/09/08 20:21:37 kmaples Exp $
d172 6
@


1.9
log
@Changed SANDBOX to come from function in ParentChildArgumentBridge.pl so
that logging would function properly
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.8 2000/09/05 21:16:45 kmaples Exp $
d71 5
a75 1
        require 'ParentChildArgumentBridge.pl' or die "Require failed: $!\n";
@


1.8
log
@Added 'require' for library (scripts weren't much good without this).
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.7 2000/09/05 20:06:38 kmaples Exp $
a59 2
require 'ParentChildArgumentBridge.pl' or die "Require failed: $!\n";

d71 2
d97 1
a97 1
		my $logdir   = '__SANDBOX__/log/';		
@


1.7
log
@Refactored common hash definitions, subroutine definition into new library
@
text
@d53 1
a53 1
# $Id: ModuleAdd.in,v 1.6 2000/09/05 02:26:12 kmaples Exp $
d59 2
@


1.6
log
@Deprecated by .in file.
@
text
@d5 1
a5 1
# 
d9 1
a9 1
# 
d12 1
a12 1
# 
d16 1
a16 1
# 
d22 1
a22 1
# 
d26 1
a26 1
# 
d30 1
a30 1
# 
d44 1
a44 1
# 
a49 1

d51 3
a53 2
# $Id: ModuleAdd,v 1.5 2000/08/01 22:38:13 kmaples Exp $
# Original Author: jrobbins@@collab.net
d58 94
a151 31
# Arguments:
# $ARGV[1] = project_name
# $ARGV[2] = domain_name (including TLD)
# $ARGV[3] = brand_name
# $ARGV[4] = module name (may include slashes)
# $ARGV[5] = module description 
# $ARGV[6] = check out to web server? (1 or 0)
# $ARGV[7] = is this module private? (1 or 0)
 
# Process arguments
my $sandbox             = $ARGV[0];
my $project_name        = $ARGV[1];
my $domain_name         = $ARGV[2];
my $brand_name          = $ARGV[3];
my $module_name         = $ARGV[4];
my $module_description  = $ARGV[5];
my $is_web              = $ARGV[6];
my $is_private          = $ARGV[7];

my $cmd = "unix command line";


# Main code body

# QMAIL
# do nothing


# EZMLM
# do nothing
# future: module specific mailing lists?
d153 1
d155 4
a158 1
# CVS
d160 6
a165 3
$cmd = "./cvs-module-add $sandbox $project_name $domain_name $brand_name $module_name $module_description $is_web $is_private";
print "ModuleAdd: $cmd\n";
system($cmd) == 0 or die "Command failed: $!\n";
d167 3
a169 3
# why do we need modules at all?
# maybe we should just have components: bugzilla components,
# and lists of directories
d171 1
a171 2
# Monarc
# do nothing
a173 3
  
# Apache
# do nothing
@


1.5
log
@Removed dangling left-bracket.
@
text
@d52 1
a52 1
# $Id: ModuleAdd,v 1.4 2000/05/17 00:55:57 manoj Exp $
@


1.4
log
@Eliminate DNS and bugzilla administration code from the perl scripts.
@
text
@d52 1
a52 1
# $Id: ModuleAdd,v 1.3 2000/04/29 00:04:10 jrobbins Exp $
d104 1
a104 1
}
@


1.3
log
@initial checkin
@
text
@d52 1
a52 1
# $Id: ModuleAdd,v 1.2 2000/03/24 21:45:35 jrobbins Exp $
a81 3
# DNS
# do nothing

a102 8


# Bugzilla
# add a bugzilla component
if ($is_private == 0) {
$cmd = "./bugzilla-module-add $sandbox $project_name $domain_name $brand_name $module_name $module_description $is_web";
print "ModuleAdd: $cmd\n";
system($cmd) == 0 or die "Command failed: $!\n";
@


1.2
log
@removed control-Ms and started using /home/jrobbins
@
text
@d52 1
a52 1
# $Id: ModuleAdd,v 1.1 2000/03/24 20:31:59 jrobbins Exp $
a66 14


# CONFIG - set to /path/to/helm/perl
use lib "$ENV{'SANDBOX'}/helm/perl";

# include needed libraries
use Helm::dns;
use Helm::qmail;
use Helm::ezmlm;
use Helm::cvs;
use Helm::mhonarc;
use Helm::bugzilla;
use Helm::apache;

d68 8
a75 16
my $project_name        = $ARGV[0];
my $domain_name         = $ARGV[1];
my $brand_name          = $ARGV[2];
my $module_name         = $ARGV[3];
my $module_description  = $ARGV[4];
my $is_web              = $ARGV[5];
my $is_private          = $ARGV[6];


print "project_name       = $project_name\n";
print "domain_name        = $domain_name\n";
print "brand_name         = $brand_name\n";
print "module_name        = $module_name\n";
print "module_description = $module_description\n";
print "is_web             = $is_web\n";
print "is_private         = $is_private\n";
d77 1
d96 3
a98 3
Helm::cvs->moduleAdd($project_name, $domain_name, $brand_name,
                     $module_name, $module_description,
		     $is_web, $is_private);
d111 3
a113 3
  Helm::bugzilla->moduleAdd($project_name, $domain_name,
			    $brand_name, $module_name,
			    $module_description, $is_web);
@


1.1
log
@initial checkin of new event-driven scripts for tigris
@
text
@d1 139
a139 139
#!/usr/bin/perl -w

# ================================================================
# 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.
#



################################################################
# $Id$
# Original Author: jrobbins@@collab.net
#
# The goal of this script is to do everything that is needed to add a new
# module to the given project.
#
# Arguments:
# $ARGV[1] = project_name
# $ARGV[2] = domain_name (including TLD)
# $ARGV[3] = brand_name
# $ARGV[4] = module name (may include slashes)
# $ARGV[5] = module description 
# $ARGV[6] = check out to web server? (1 or 0)
# $ARGV[7] = is this module private? (1 or 0)
 


# CONFIG - set to /path/to/helm/perl
use lib "/home/httpd/helm/perl";

# include needed libraries
use Helm::dns;
use Helm::qmail;
use Helm::ezmlm;
use Helm::cvs;
use Helm::mhonarc;
use Helm::bugzilla;
use Helm::apache;

# Process arguments
my $project_name        = $ARGV[0];
my $domain_name         = $ARGV[1];
my $brand_name          = $ARGV[2];
my $module_name         = $ARGV[3];
my $module_description  = $ARGV[4];
my $is_web              = $ARGV[5];
my $is_private          = $ARGV[6];


print "project_name       = $project_name\n";
print "domain_name        = $domain_name\n";
print "brand_name         = $brand_name\n";
print "module_name        = $module_name\n";
print "module_description = $module_description\n";
print "is_web             = $is_web\n";
print "is_private         = $is_private\n";



# Main code body

# DNS
# do nothing

# QMAIL
# do nothing


# EZMLM
# do nothing
# future: module specific mailing lists?


# CVS
# add a new cvs directory to the project
Helm::cvs->moduleAdd($project_name, $domain_name, $brand_name,
                     $module_name, $module_description,
		     $is_web, $is_private);

# why do we need modules at all?
# maybe we should just have components: bugzilla components,
# and lists of directories

# Monarc
# do nothing


# Bugzilla
# add a bugzilla component
if ($is_private == 0) {
  Helm::bugzilla->moduleAdd($project_name, $domain_name,
			    $brand_name, $module_name,
			    $module_description, $is_web);

}
  
# Apache
# do nothing
@


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 139
a139 186
#!/usr/bin/perl -w

# ================================================================
# 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.
#


################################################################
# Name:              ModuleAdd
# Original Author:   jrobbins@@collab.net
# $Id: ModuleAdd,v 1.3 2000/10/27 18:07:50 kmaples Exp $
#
# The goal of this script is to do everything that is needed to add a new
# module to the given project.
#
#---------------------------------------------------------------

# Minimum number of args this script requires for successful execution:
#my $minimum_arg_index = 8;

#---------------------------------------------------------------
# Approach to logging - each 'ControlScript' (like this one) should 
# maintain it's own log file that includes the actions it's children.

my $script_name;

# Alpha and Omega:
BEGIN {
	$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
	my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

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

	# Open the logfile for logging at the beginning of execution.
	# The primary reason for this is to 'die' before doing anything
	# that we won't be able to log, and opening the log filehandle
	# in the beginning ensures this.
	
	# Grab just the filename portion of this script to use as a 
	# log identifier:
	$script_name = $0;
	$script_name =~ s/^.*\/([\w]+)$/$1/;

	# Autoflush buffer:
	$| = 1;

	# If this program is called by another program, we'll send STDOUT
	# and SDTERR to the logfile - this way the children's messages will
	# stick with the parent's logs.  Conversely, if this is called 
	# interactively (on the command line), we'll just let the output
	# go to the terminal instead of clogging up the logfiles with stuff
	# resulting from debugging attempts.
	
	unless(-t STDIN && -t STDOUT){
			
		# This needs to be established dynamically; I don't know the
		# preferred method for arriving at this value:
		my $logdir   = get_sandbox() . '/log/';
		my $logfile  = 'HelmPerlScripts' . '.log';
		
		# Point STDOUT and STDERR to the logfile, or bail out:
		unless(open(STDOUT,">> $logdir" . "$logfile") && open(STDERR,">&STDOUT")){
			die "Can't open handle for logging: $!\n";
		}
		
		# This shouldn't really be necessary, but it couldn't hurt:
		select(STDERR); $| = 1;	
		select(STDOUT); $| = 1;	

		# This might appear odd, but since STDOUT is now a filehandle
		# for the logfile, try to get a lock on it, or bail out:
		unless(flock(STDOUT, 2|4)){ # Ask nice first.
			sleep 1;
			unless(flock(STDOUT, 2)){
				die "Unable to lock logfile: $!\n";
			}
		}
	}
	# This is all in order to print a nice header for the log
	# entry:

	my $time   = time();
	my $date   = localtime($time);
	my $header = "[$date]\n[$$] START: $script_name\n";
	
	print $header;
}
END {
	# Note that because END blocks are executed from bottom to top,
	# this block should appear BEFORE any other END blocks trying 
	# to print to the same filehandle.  This might seem unnecessary,
	# but since we did point these at a file, we really ought to 
	# clean up after ourselves:

	my $footer = "[$$] END: $script_name\n\n";
	
	print $footer;

	close(STDOUT) or die "Couldn't close logging handle STDOUT: $!\n";
	close(STDERR) or die "Couldn't close logging handle STDERR: $!\n";
}
#---------------------------------------------------------------
# An early-warning system: nip this in the bud if it's not going 
# to be able to execute anyway:
#unless($#ARGV >= $minimum_arg_index){
#	die "Execution failed due to insufficient arguments.\n";
#}

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
# NOTE:  According to Ed K., servlets are now dealing with functions
# relating to qmail/ezmlm/mhonarc - this leaves CVS and apache as
# the two components to be manipulated here.

my $ret = ''; # placeholder for current return value.  Unused.

# QMAIL:    call defunct
# EZMLM:    call defunct

# CVS:
# add a new cvs directory to the project
print "calling cvs-module-add:\n";
$ret = perform('cvs-module-add');

# Mhonarc:  call defunct

# Apache:   nothing

# Issuezilla:
# perform insert into issuezilla 'components' table; this is another
# way of saying that in issuezilla, component == module:
print "calling issuezilla-module-add:\n";
$ret = perform('issuezilla-module-add');


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

__END__


@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d53 1
a53 1
# $Id: ModuleAdd,v 1.18 2001/01/12 02:14:18 kmaples Exp $
d60 2
a61 1
my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';
d63 88
a150 2
require "$scripts_dir/ParentChildArgumentBridge.pl"
    or die "Require failed: $!\n";
d159 2
d166 2
d176 2
a177 15

my $FAILED = 0; ## Holder for number of the script which failed
my $ct     = 0; ## Current script number

## Iterate through each action:
foreach('cvs-module-add', 'issuezilla-module-add'){
    $ct++;
    print "calling $_:\n";	 
    unless(perform($_)){
        $FAILED ||= $ct; ## Preserve the first failed
    }
}
print "EXIT STATUS: $FAILED\n"; 
## Return the the number of the first script to fail, if any:
exit($FAILED);
d185 2
@


