mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-20 00:21:35 +00:00
Factor out the code that performs the PORTREVISION bump for one port.
Approved by: edwin
This commit is contained in:
parent
d73d8c7759
commit
a351950aad
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=225408
@ -28,6 +28,52 @@ EOF
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub bumpMakefile {
|
||||
|
||||
my ($p) = @_;
|
||||
|
||||
my $makefile = "$p/Makefile";
|
||||
my $fin;
|
||||
unless(open($fin, $makefile)) {
|
||||
print "-- Cannot open Makefile of $p, ignored.\n";
|
||||
next;
|
||||
}
|
||||
my @lines = <$fin>;
|
||||
close($fin) or die "Can't close $makefile b/c $!";
|
||||
chomp(@lines);
|
||||
|
||||
my $revision = 1;
|
||||
|
||||
foreach my $line (@lines) {
|
||||
last if ($line =~ /^MAINTAINER/);
|
||||
$revision += $1 if ($line =~ /PORTREVISION??=[ \t]*(\d+)$/);
|
||||
}
|
||||
|
||||
my $printedrev = 0;
|
||||
open(my $fout, '>', "$makefile");
|
||||
foreach my $line (@lines) {
|
||||
if (!$printedrev) {
|
||||
if ($line =~ /^CATEGORIES??=/ || $line =~ /^PORTEPOCH??=/) {
|
||||
print $fout "PORTREVISION= $revision\n";
|
||||
$printedrev = 1;
|
||||
# Fall through!
|
||||
}
|
||||
if ($line =~ /^PORTREVISION\?=/) {
|
||||
print $fout "PORTREVISION?= $revision\n";
|
||||
$printedrev = 1;
|
||||
next;
|
||||
}
|
||||
if ($line =~ /^PORTREVISION=/) {
|
||||
print $fout "PORTREVISION= $revision\n";
|
||||
$printedrev = 1;
|
||||
next;
|
||||
}
|
||||
}
|
||||
print $fout "$line\n";
|
||||
}
|
||||
close($fout) or die "Can't close $makefile b/c $!";
|
||||
}
|
||||
|
||||
my $INDEX = "/usr/ports/INDEX";
|
||||
my $USER = $ENV{USER};
|
||||
{
|
||||
@ -143,50 +189,9 @@ unless ($opt_n) {
|
||||
{
|
||||
print "Updating Makefiles\n";
|
||||
foreach my $p (keys(%DEPPORTS)) {
|
||||
my $makefile = "ports/$p/Makefile";
|
||||
|
||||
print "- Updating Makefile of $p\n";
|
||||
next if $opt_c;
|
||||
|
||||
my $fin;
|
||||
unless(open($fin, $makefile)) {
|
||||
print "-- Cannot open Makefile of $p, ignored.\n";
|
||||
next;
|
||||
}
|
||||
my @lines = <$fin>;
|
||||
close($fin) or die "Can't close $makefile b/c $!";
|
||||
chomp(@lines);
|
||||
|
||||
my $revision = 1;
|
||||
|
||||
foreach my $line (@lines) {
|
||||
last if ($line =~ /^MAINTAINER/);
|
||||
$revision += $1 if ($line =~ /PORTREVISION??=[ \t]*(\d+)$/);
|
||||
}
|
||||
|
||||
my $printedrev = 0;
|
||||
open(my $fout, '>', "$makefile");
|
||||
foreach my $line (@lines) {
|
||||
if (!$printedrev) {
|
||||
if ($line =~ /^CATEGORIES??=/ || $line =~ /^PORTEPOCH??=/) {
|
||||
print $fout "PORTREVISION= $revision\n";
|
||||
$printedrev = 1;
|
||||
# Fall through!
|
||||
}
|
||||
if ($line =~ /^PORTREVISION\?=/) {
|
||||
print $fout "PORTREVISION?= $revision\n";
|
||||
$printedrev = 1;
|
||||
next;
|
||||
}
|
||||
if ($line =~ /^PORTREVISION=/) {
|
||||
print $fout "PORTREVISION= $revision\n";
|
||||
$printedrev = 1;
|
||||
next;
|
||||
}
|
||||
}
|
||||
print $fout "$line\n";
|
||||
}
|
||||
close($fout) or die "Can't close $makefile b/c $!";
|
||||
bumpMakefile "ports/$p";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user