summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2006-05-16 15:44:29 +0000
committerRenato Botelho <garga@FreeBSD.org>2006-05-16 15:44:29 +0000
commit3cf8cfc8cd44efecd519c30e8e1e67e02ca422ef (patch)
tree104c31e40815ebb6544035da877fddc9930c0b7a
parent- Update to 1.1 (diff)
- 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)
Notes
Notes: svn path=/head/; revision=162578
-rwxr-xr-xTools/scripts/addport23
-rwxr-xr-xTools/scripts/modulesupdate34
2 files changed, 39 insertions, 18 deletions
diff --git a/Tools/scripts/addport b/Tools/scripts/addport
index 351d9479f564..fc133d1ee3ec 100755
--- a/Tools/scripts/addport
+++ b/Tools/scripts/addport
@@ -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 $?;
+}
diff --git a/Tools/scripts/modulesupdate b/Tools/scripts/modulesupdate
index bc01ae37720e..c5a0bbce1f37 100755
--- a/Tools/scripts/modulesupdate
+++ b/Tools/scripts/modulesupdate
@@ -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>) {
- chomp;
- chomp;
- ($mname,$mpath) = split;
- next if $mname eq "";
- $rv{$mname} = $mpath;
+ 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";