From 8f4dfd10d34e103eb43011110282ee6d52d42c40 Mon Sep 17 00:00:00 2001 From: "terry%netscape.com" Date: Wed, 13 Jan 1999 20:31:36 +0000 Subject: [PATCH] despot now also automatically creates mailing lists of people who can check into a repository. git-svn-id: svn://10.0.0.236/trunk@17658 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/despot/maketables.sh | 2 +- mozilla/webtools/despot/syncit.pl | 48 +++++++++++++++++++++------ 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/mozilla/webtools/despot/maketables.sh b/mozilla/webtools/despot/maketables.sh index ad9011dbc38..bfca6a956bf 100755 --- a/mozilla/webtools/despot/maketables.sh +++ b/mozilla/webtools/despot/maketables.sh @@ -44,7 +44,7 @@ create table repositories ( cvsroot varchar(255) not null, ownersrepository smallint, ownerspath varchar(255), - + domailing tinyint not null, unique(name) ); diff --git a/mozilla/webtools/despot/syncit.pl b/mozilla/webtools/despot/syncit.pl index 2aed8437608..4f16bb1f4ef 100755 --- a/mozilla/webtools/despot/syncit.pl +++ b/mozilla/webtools/despot/syncit.pl @@ -94,20 +94,51 @@ close BOILERPLATE; -$repquery = Query("select id,name,cvsroot,ownersrepository,ownerspath from repositories order by name"); +my @grouplist = ('cvs', 'gila'); # Mailing group list. Should really query + # for this list rom the db ... ### + +$repquery = Query("select id,name,cvsroot,ownersrepository,ownerspath,domailing from repositories order by name"); while (@reprow = $repquery->fetchrow()) { - ($repid,$repname,$reproot,$ownersrepository,$ownerspath) = (@reprow); + ($repid,$repname,$reproot,$ownersrepository,$ownerspath,$domailing) = + (@reprow); $query = Query("select email,passwd,${repname}_group,neednewpassword,disabled from users where ${repname}_group != 'None' and passwd != '' order by email"); - $tmpdir = "/tmp/syncit.$$"; + $tmpdir = "/tmp/syncit-$repname.$$"; mkdir $tmpdir, 0777; chdir $tmpdir; $ENV{CVSROOT} = $reproot; - system "$cvs co CVSROOT/passwd CVSROOT/commitcheck.pl" || die "Couldn't checkout files."; - + my @filelist = ('passwd', 'commitcheck.pl'); + if ($domailing) { + foreach my $g (@grouplist) { + push @filelist, "${g}_list"; + } + } + + system "$cvs co " . join(' ', grep(s@^@CVSROOT/@, @filelist)) + || die "Couldn't checkout files."; + + + if ($domailing) { + foreach my $group (@grouplist) { + $outfile = "CVSROOT/${group}_list"; + open(MAILLIST, ">$outfile") || die "Can't open $outfile"; + + print MAILLIST "# DO NOT EDIT THIS FILE! This file is created\n"; + print MAILLIST "# by despot, and is used by /etc/aliases.\n"; + + my $q = Query("select email from users where ${group}_group != 'None' and passwd != '' and disabled != 'Yes' order by email"); + while (@r = $q->fetchrow()) { + print MAILLIST $r[0]. "\n"; + } + close MAILLIST; + } + } + + + $outfile = "CVSROOT/passwd"; open(PASSWD, ">$outfile") || die "Can't open $outfile"; @@ -322,14 +353,11 @@ Documents:"; system "$cvs commit -m 'Pseudo-automatic update of changes made by $usertoblame.'"; } - - - - chdir "/"; - system "rm -rf $tmpdir"; +# system "rm -rf $tmpdir"; + }