aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2022-01-17 22:19:04 +0000
committerMatthias Andree <mandree@FreeBSD.org>2022-01-17 22:19:14 +0000
commit171f76521e4ec422dfd44548519f311d153f2bf6 (patch)
treee3250c3cf0631a09b2854e9f145dd4b08e454bc6
parent29b349b2dba2a188140cb73fe451a9b9793178d4 (diff)
downloadports-171f76521e4ec422dfd44548519f311d153f2bf6.tar.gz
ports-171f76521e4ec422dfd44548519f311d153f2bf6.zip
Tools/scripts/bump_revision.pl: Minimal update
to deal with ports that have flavors renaming the main port, for instance e2fsprogs-nobootfsck.
-rwxr-xr-xTools/scripts/bump_revision.pl36
1 files changed, 24 insertions, 12 deletions
diff --git a/Tools/scripts/bump_revision.pl b/Tools/scripts/bump_revision.pl
index ff7eb5d07e09..33a79c0ce2d7 100755
--- a/Tools/scripts/bump_revision.pl
+++ b/Tools/scripts/bump_revision.pl
@@ -20,10 +20,13 @@ use strict;
use Getopt::Std;
use Carp 'verbose';
use Cwd;
-use Data::Dumper;
use File::Basename;
+use Data::Dumper;
+$Data::Dumper::Indent = 1; # simple indent
+$Data::Dumper::Purity = 1; # Perl syntax
+my $debug = 0;
-use vars qw/$opt_n $opt_f $opt_i $opt_u $opt_l $opt_g $opt_p/;
+use vars qw/$opt_n $opt_f $opt_i $opt_u $opt_l $opt_g $opt_p $opt_h/;
# launder environment
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
@@ -107,7 +110,9 @@ my ($portsdir, $INDEX);
{
$opt_i = "";
$opt_u = "";
- getopts("fgi:lnu:p:") or die "Aborting";
+ getopts("fghi:lnu:p:") or die "Aborting";
+ usage() if $opt_h;
+ if ($ENV{'DEBUG'}) { $debug = $ENV{'DEBUG'}; }
$shallow = $opt_l if $opt_l;
if ($opt_l and $opt_g) {
die "Options -g and -l given, which are mutually exclusive. Pick either.";
@@ -132,8 +137,8 @@ my $TMPDIR = File::Basename::dirname($INDEX);
#
# Sanity checking
#
-if (-d "$TMPDIR/.svn" and not $opt_f and not $opt_n) {
- die "$TMPDIR/.svn exists, cowardly refusing to proceed.\n";
+if (-d "$TMPDIR/.git" and not $opt_f and not $opt_n) {
+ die "$TMPDIR/.git exists, cowardly refusing to proceed.\n";
}
@@ -160,23 +165,28 @@ my %index = ();
my @a;
my @b;
- my $port;
+ my $origin;
+ my $cat_port;
map {
@a = split(/\|/, $_);
@b = split(/\//, $a[1]);
- $port = $b[-2]."/".$b[-1];
+ $cat_port = $b[-2]."/".$a[0];
+ $cat_port =~ s/-[^-]+$//;
+ $origin = $b[-2]."/".$b[-1];
- @{ $index{$port} }{'portname', 'portnameversion', 'origin', 'comment', 'deps'}
- = ($b[-1], $a[0], $port, $a[3], ());
+ @{ $index{$cat_port} }{'portname', 'portnameversion', 'origin', 'comment', 'deps'}
+ = ($b[-1], $a[0], $origin, $a[3], ());
if ($a[8]) {
@b = split(" ", $a[8]);
- @{ $index{$port}{deps} }{@b} = (1) x @b;
+ @{ $index{$cat_port}{deps} }{@b} = (1) x @b;
}
-
} @lines;
print "- Processed ", scalar keys(%index), " entries.\n";
+ if ($debug and $debug > 1) {
+ print STDERR Dumper(\%index);
+ }
}
my %DEPPORTS = ();
@@ -225,6 +235,7 @@ foreach my $PORT (@ARGV) {
# In shallow mode, strip all those who don't have a direct dependency
#
sub direct_dependency($@) {
+ if ($debug) { print STDERR Dumper \@_; }
my ($port, @requisites) = @_;
open F, '-|', '/usr/bin/make', '-C', $port, qw/-V _RUN_DEPENDS -V _LIB_DEPENDS/ or die "cannot launch make: $!";
my @lines = <F>;
@@ -243,7 +254,7 @@ if ($shallow) {
foreach my $p (keys %DEPPORTS) {
print "- Checking requisites of port $idx/$n...\r";
++$idx;
- unless (direct_dependency($p, @ARGV)) {
+ unless (direct_dependency($p, map { $index{$_}{origin} } @ARGV)) {
delete $DEPPORTS{$p};
}
}
@@ -258,6 +269,7 @@ my $ports = join(" ", keys %DEPPORTS);
#
unless ($opt_f or $opt_n) {
$TMPDIR = ".bump_revision_pl_tmpdir.$$";
+ die "This code fragment has not been updated for Git yet.";
print "svn checkout into $TMPDIR...\n";
mkdir($TMPDIR, 0755);
chdir($TMPDIR);