mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 17:59:20 -04:00
- 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:
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
|
@ -34,7 +34,7 @@
|
||||||
# Id: addport,v 1.5 2000/04/22 22:19:43 mharo Exp (perl conversion)
|
# Id: addport,v 1.5 2000/04/22 22:19:43 mharo Exp (perl conversion)
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
#
|
#
|
||||||
# MAINTAINER= will@FreeBSD.org
|
# MAINTAINER= garga@FreeBSD.org
|
||||||
#
|
#
|
||||||
|
|
||||||
use Cwd "abs_path";
|
use Cwd "abs_path";
|
||||||
|
@ -53,6 +53,7 @@ sub usage();
|
||||||
sub contains($@);
|
sub contains($@);
|
||||||
sub lsports();
|
sub lsports();
|
||||||
sub lastcomment();
|
sub lastcomment();
|
||||||
|
sub addmodule($);
|
||||||
|
|
||||||
my %opts;
|
my %opts;
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ my $sshmod;
|
||||||
if( !defined $ENV{"CVS_RSH"} ) {
|
if( !defined $ENV{"CVS_RSH"} ) {
|
||||||
$ENV{CVS_RSH} = "ssh";
|
$ENV{CVS_RSH} = "ssh";
|
||||||
}
|
}
|
||||||
|
my $portsdir = $ENV{PORTSDIR} ? $ENV{PORTSDIR} : '/usr/ports';
|
||||||
my $make = "make";
|
my $make = "make";
|
||||||
my $portlint = `which portlint`; chomp $portlint;
|
my $portlint = `which portlint`; chomp $portlint;
|
||||||
my $plint_args = "-N -a -c -t";
|
my $plint_args = "-N -a -c -t";
|
||||||
|
@ -105,6 +107,7 @@ my $perl = "perl";
|
||||||
my $cp = "cp";
|
my $cp = "cp";
|
||||||
my $mv = "mv";
|
my $mv = "mv";
|
||||||
my $rm = "rm";
|
my $rm = "rm";
|
||||||
|
my $modulesupdate = ( -f "/usr/local/bin/modulesupdate" ? "/usr/local/bin/modulesupdate" : "$portsdir/Tools/scripts/modulesupdate" );
|
||||||
# vars required for commitfile
|
# vars required for commitfile
|
||||||
my $descr; my $portversion; my $pkgcomment;
|
my $descr; my $portversion; my $pkgcomment;
|
||||||
my $tmp; my $pkgcommentlen; my $comment; my $orig;
|
my $tmp; my $pkgcommentlen; my $comment; my $orig;
|
||||||
|
@ -112,7 +115,7 @@ my $tmp2; my $offset; my $commitfile = "";
|
||||||
$tmp = $tmp2 = $offset = 0;
|
$tmp = $tmp2 = $offset = 0;
|
||||||
|
|
||||||
chomp(my $myhost = lc(hostname()));
|
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 is always required nowadays... pcvs.FreeBSD.org isn't shell accessible.
|
||||||
$ssh = "$ENV{CVS_RSH} $h -l $u";
|
$ssh = "$ENV{CVS_RSH} $h -l $u";
|
||||||
|
@ -358,9 +361,7 @@ foreach my $thisdir (@dirs) {
|
||||||
chdir "$tmpdir/$category" or err(1, "$tmpdir/$category");
|
chdir "$tmpdir/$category" or err(1, "$tmpdir/$category");
|
||||||
system("$cvs $n ci $commitfile Makefile $portname") && errx(1, "cvs commit failed, aborting.");
|
system("$cvs $n ci $commitfile Makefile $portname") && errx(1, "cvs commit failed, aborting.");
|
||||||
if (!$nomodules && ($n ne "-n")) {
|
if (!$nomodules && ($n ne "-n")) {
|
||||||
print "*** If you have problems with the below modulesupdate command, PLEASE\n";
|
addmodule("$sshmod env CVSROOT=$repo $perl $modulesupdate $module ports/$category/$portname") && errx(1, "adding port to modules failed, aborting.");
|
||||||
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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,3 +512,15 @@ sub lastcomment() {
|
||||||
}
|
}
|
||||||
return $num;
|
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 $?;
|
||||||
|
}
|
||||||
|
|
|
@ -39,28 +39,39 @@ sub lsmodules
|
||||||
|
|
||||||
%rv = ();
|
%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>) {
|
while(<CVS>) {
|
||||||
chomp;
|
if (/!!MERGE!!/g) {
|
||||||
chomp;
|
$start_read = 1;
|
||||||
($mname,$mpath) = split;
|
}
|
||||||
next if $mname eq "";
|
|
||||||
$rv{$mname} = $mpath;
|
if ($start_read && /^[^ #]/) {
|
||||||
|
chomp;
|
||||||
|
chomp;
|
||||||
|
($mname,$mpath) = split;
|
||||||
|
next if $mname eq "";
|
||||||
|
$rv{$mname} = $mpath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(CVS);
|
close(CVS);
|
||||||
|
|
||||||
return %rv;
|
return %rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tmpdir=`mktemp -d -t mu`;
|
||||||
|
chomp $tmpdir;
|
||||||
|
chdir $tmpdir or die "$tmpdir: $!";
|
||||||
|
|
||||||
my %cvsmods = &lsmodules;
|
my %cvsmods = &lsmodules;
|
||||||
my $modulename = shift;
|
my $modulename = shift;
|
||||||
my $modulepath = shift;
|
my $modulepath = shift;
|
||||||
my $dont_do_it = "";
|
my $dont_do_it = "";
|
||||||
|
|
||||||
$tmpdir=`mktemp -d -t mu`;
|
|
||||||
chomp $tmpdir;
|
|
||||||
chdir $tmpdir or die "$tmpdir: $!";
|
|
||||||
|
|
||||||
if ($modulepath eq "") {
|
if ($modulepath eq "") {
|
||||||
print "Error: Must specify both modulename and modulepath\n";
|
print "Error: Must specify both modulename and modulepath\n";
|
||||||
&goodbye(1);
|
&goodbye(1);
|
||||||
|
@ -88,9 +99,6 @@ if ($mod eq "") {
|
||||||
$cmd = "/^" . $mod . "[ \t]/\ni\n";
|
$cmd = "/^" . $mod . "[ \t]/\ni\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Checking out the modules database...\n";
|
|
||||||
system("cvs -R co modules") && die "failed.\n";
|
|
||||||
|
|
||||||
my $len = length($modulename);
|
my $len = length($modulename);
|
||||||
print "Inserting new module...\n";
|
print "Inserting new module...\n";
|
||||||
open(ED, "|ed modules/modules") || die "Cannot start ed\n";
|
open(ED, "|ed modules/modules") || die "Cannot start ed\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue