- Change addport script to do the job locally instead connect to freefall every

time to add a new module. If you want to still use old way, just use
  "-M freefall.FreeBSD.org" option
- Take addport maintainership
- When modulesupdate fail, ask user to retry
- Change modulesupdate to work fine with addport

Approved by:	will (maintainer)
This commit is contained in:
Renato Botelho 2006-05-16 15:44:29 +00:00
parent c332272201
commit 3cf8cfc8cd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=162578
2 changed files with 39 additions and 18 deletions

View file

@ -34,7 +34,7 @@
# Id: addport,v 1.5 2000/04/22 22:19:43 mharo Exp (perl conversion)
# $FreeBSD$
#
# MAINTAINER= will@FreeBSD.org
# MAINTAINER= garga@FreeBSD.org
#
use Cwd "abs_path";
@ -53,6 +53,7 @@ sub usage();
sub contains($@);
sub lsports();
sub lastcomment();
sub addmodule($);
my %opts;
@ -98,6 +99,7 @@ my $sshmod;
if( !defined $ENV{"CVS_RSH"} ) {
$ENV{CVS_RSH} = "ssh";
}
my $portsdir = $ENV{PORTSDIR} ? $ENV{PORTSDIR} : '/usr/ports';
my $make = "make";
my $portlint = `which portlint`; chomp $portlint;
my $plint_args = "-N -a -c -t";
@ -105,6 +107,7 @@ my $perl = "perl";
my $cp = "cp";
my $mv = "mv";
my $rm = "rm";
my $modulesupdate = ( -f "/usr/local/bin/modulesupdate" ? "/usr/local/bin/modulesupdate" : "$portsdir/Tools/scripts/modulesupdate" );
# vars required for commitfile
my $descr; my $portversion; my $pkgcomment;
my $tmp; my $pkgcommentlen; my $comment; my $orig;
@ -112,7 +115,7 @@ my $tmp2; my $offset; my $commitfile = "";
$tmp = $tmp2 = $offset = 0;
chomp(my $myhost = lc(hostname()));
$moduleshost = "freefall.freebsd.org" if ($moduleshost eq "");
$moduleshost = $myhost if ($moduleshost eq "");
# SSH is always required nowadays... pcvs.FreeBSD.org isn't shell accessible.
$ssh = "$ENV{CVS_RSH} $h -l $u";
@ -358,9 +361,7 @@ foreach my $thisdir (@dirs) {
chdir "$tmpdir/$category" or err(1, "$tmpdir/$category");
system("$cvs $n ci $commitfile Makefile $portname") && errx(1, "cvs commit failed, aborting.");
if (!$nomodules && ($n ne "-n")) {
print "*** If you have problems with the below modulesupdate command, PLEASE\n";
print "*** ensure that you can login to $h from $moduleshost!\n";
system("$sshmod env CVSROOT=$repo $perl /usr/local/bin/modulesupdate $module ports/$category/$portname") && errx(1, "adding port to modules failed, aborting.");
addmodule("$sshmod env CVSROOT=$repo $perl $modulesupdate $module ports/$category/$portname") && errx(1, "adding port to modules failed, aborting.");
}
}
@ -511,3 +512,15 @@ sub lastcomment() {
}
return $num;
}
# this adds the module
sub addmodule($) {
my ($command) = @_;
print "*** If you have problems with the below modulesupdate command, PLEASE\n";
print "*** ensure that you can login to $h from $moduleshost!\n";
do {
system($command);
} while ( ($? != 0) && !prompt("Add module failed, retry? ") );
return $?;
}

View file

@ -39,28 +39,39 @@ sub lsmodules
%rv = ();
open(CVS, "cvs -R co -c|") || die "cvs: $!";
print "Checking out the modules database...\n";
system("cvs -R co modules") && die "failed.\n";
my $start_read = 0;
open(CVS, "<modules/modules") || die "$!";
while(<CVS>) {
if (/!!MERGE!!/g) {
$start_read = 1;
}
if ($start_read && /^[^ #]/) {
chomp;
chomp;
($mname,$mpath) = split;
next if $mname eq "";
$rv{$mname} = $mpath;
}
}
close(CVS);
return %rv;
}
$tmpdir=`mktemp -d -t mu`;
chomp $tmpdir;
chdir $tmpdir or die "$tmpdir: $!";
my %cvsmods = &lsmodules;
my $modulename = shift;
my $modulepath = shift;
my $dont_do_it = "";
$tmpdir=`mktemp -d -t mu`;
chomp $tmpdir;
chdir $tmpdir or die "$tmpdir: $!";
if ($modulepath eq "") {
print "Error: Must specify both modulename and modulepath\n";
&goodbye(1);
@ -88,9 +99,6 @@ if ($mod eq "") {
$cmd = "/^" . $mod . "[ \t]/\ni\n";
}
print "Checking out the modules database...\n";
system("cvs -R co modules") && die "failed.\n";
my $len = length($modulename);
print "Inserting new module...\n";
open(ED, "|ed modules/modules") || die "Cannot start ed\n";