summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorGerald Pfeifer <gerald@FreeBSD.org>2009-01-07 21:33:17 +0000
committerGerald Pfeifer <gerald@FreeBSD.org>2009-01-07 21:33:17 +0000
commita351950aad09236cba24f04f6815942e1c7bdb56 (patch)
tree18c594e1c8ab23908c600e63313a70dc730443f1 /Tools
parentThis module collects common email validation routines to (diff)
Factor out the code that performs the PORTREVISION bump for one port.
Approved by: edwin
Notes
Notes: svn path=/head/; revision=225408
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/bump_revision.pl89
1 files changed, 47 insertions, 42 deletions
diff --git a/Tools/scripts/bump_revision.pl b/Tools/scripts/bump_revision.pl
index 7fe997c20aa8..239fe070dd10 100755
--- a/Tools/scripts/bump_revision.pl
+++ b/Tools/scripts/bump_revision.pl
@@ -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";
}
}