From nobody Sat Mar 04 10:41:29 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PTLx56NvHz3vs9Y; Sat, 4 Mar 2023 10:41:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PTLx55nf4z49Yq; Sat, 4 Mar 2023 10:41:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677926489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l8p0APNka+kENDDBxEgySBXirIogHSpM26kUega8tWk=; b=kof3SpvAdkr7N1hvUoI52rqFE3vpQg803H1ayM5L4Po9Ebl9u+7XJQ7p7NvgyMjT3r0fJ0 HNDWPAsaFfaySoC3kyNty/8caPxCdPoACkdOsUdBLSfevTWFiPbVpual2TBvmRnYmGLziX +1+DF5qq9SJYM4bgPFu8fusKXOS3K6qmhPbPiF9U5kEIE6QDZBl6fjO7AhgMkknvndxiGp kuHiMw2NWY7/5qgnfQSVy20D6DwXrgWGoDXAnq4xyLDjpV8JAq2xaUvGyWd90g4jvvlSzo SxGlmJ+GsXC7TQtZhekqZ/vfQLBhDFNeVA3G5RBV1YZ4uBLIRjIT8s9CStJj7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677926489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l8p0APNka+kENDDBxEgySBXirIogHSpM26kUega8tWk=; b=RWLqhruQw+h9gnEzGjMxHFwwcQRODEyZ3SluIoa14RvRj8S2EQJnrqzQoXm62u7IWTfhhy oa+rRYkuQyiBcGibf2AjHZysBkgSecvmcXpBQ0pE6vBpm2Bl85vUQE92fn0K2ci+HOPa6e 7jti0PBW/237q2G+e+EMnXv+h1KmrFjfjfF38wSEYVctc+2eu7h7Zx4weSuoffp/M+Go7v ZL+pkrV3gHitLV/+1ItgrdphcEiKaEjEY+C0YXex4VrY7pnfLKHy843T3umQqaHTvfyjRA HxW7BtczohnlzdS2Gaf4TZAh8y7vrZ5aV2NjwIrzFxFVR3x9TrPwwIrxw42/0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677926489; a=rsa-sha256; cv=none; b=iKVFE3XTN48Rmo0DRCW49ni/LqxTu1kGCygxz1GKRS9QIghrgtVRfsBdO67L1IVezEVT8A sxU58X+OnIu3M4yPlHUhNmBqWP8w+LYBDckij0hkNLIdOhP0sX80NbI6CrC70aMXsJNf+n eJkuGpFZMRuLRgW4xP/4C5pT/ND0L+LbW4ydSoQYEdClquhwMs/SKKKXfvdGcTUy842orb 0dSgcxMUEiypuJI9jWoN03ELH5DdG11+btvBhWVhqHCwHE6fxE6fZfRc/He0yL48Ivyv1o vk2RjJUqDuM4V24+BzGtijEaTuFLE7v5JvEqNaiGk5uUrb2mWxSFPSUKChq+kQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PTLx54rN6zcYp; Sat, 4 Mar 2023 10:41:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 324AfTN9024300; Sat, 4 Mar 2023 10:41:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 324AfTPA024299; Sat, 4 Mar 2023 10:41:29 GMT (envelope-from git) Date: Sat, 4 Mar 2023 10:41:29 GMT Message-Id: <202303041041.324AfTPA024299@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Matthias Andree Subject: git: 0b21baa8620d - main - Tools/scripts/bump_revision.pl: update List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mandree X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b21baa8620d083464d2b8b93b95ba359f886648 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mandree: URL: https://cgit.FreeBSD.org/ports/commit/?id=0b21baa8620d083464d2b8b93b95ba359f886648 commit 0b21baa8620d083464d2b8b93b95ba359f886648 Author: Matthias Andree AuthorDate: 2023-03-02 21:44:35 +0000 Commit: Matthias Andree CommitDate: 2023-03-04 10:41:16 +0000 Tools/scripts/bump_revision.pl: update --- Tools/scripts/bump_revision.pl | 144 ++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 67 deletions(-) diff --git a/Tools/scripts/bump_revision.pl b/Tools/scripts/bump_revision.pl index 33a79c0ce2d7..b2196bb3b1ee 100755 --- a/Tools/scripts/bump_revision.pl +++ b/Tools/scripts/bump_revision.pl @@ -1,4 +1,4 @@ -#!/usr/bin/env -S perl -wT +#!/usr/bin/env -S perl -wt # # This script helps with bumping the PORTREVISION of all ports that depend on a @@ -54,51 +54,58 @@ EOF $| = 1; sub bumpMakefile { + my ($taintedorigin) = @_; + my $origin; - my ($p) = @_; + if ($taintedorigin =~ /^([-\@\w.\/]+)$/) { + $origin = $1; + } else { + Carp::carp "cannot untaint $taintedorigin - invalid characters"; + return; + } - my $makefile = "$p/Makefile"; + my $makefile = "$origin/Makefile"; my $fin; - unless(open($fin, $makefile)) { - print "-- Cannot open Makefile of $p, ignored.\n"; - next; - } - my @lines = <$fin>; - if ($!) { die "Error while reading $makefile: $!. Aborting"; } - close($fin) or die "Can't close $makefile b/c $!"; - chomp(@lines); + unless(open($fin, $makefile)) { + print "-- Cannot open Makefile of $origin, ignored.\n"; + return; + } + my @lines = <$fin>; + if ($!) { die "Error while reading $makefile: $!. Aborting"; } + close($fin) or die "Can't close $makefile b/c $!"; + chomp(@lines); - my $revision = 1; + my $revision = 1; - foreach my $line (@lines) { - last if ($line =~ /^MAINTAINER/); - $revision += $1 if ($line =~ /PORTREVISION\??=[ \t]*(\d+)$/); - } + foreach my $line (@lines) { + last if ($line =~ /^MAINTAINER/); + $revision += $1 if ($line =~ /PORTREVISION\??=[ \t]*(\d+)$/); + } - my $printedrev = 0; - open(my $fout, '>', "$makefile.bumped"); - 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; - } + my $printedrev = 0; + open(my $fout, '>', "$makefile.bumped"); + 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 $!"; - rename "$makefile.bumped", $makefile or die "Can't rename $makefile.bumped to $makefile: $!"; + print $fout "$line\n"; + } + close($fout) or die "Can't close $makefile b/c $!"; + rename "$makefile.bumped", $makefile or die "Can't rename $makefile.bumped to $makefile: $!"; } my $osversion = `uname -r`; @@ -167,22 +174,28 @@ my %index = (); my @b; my $origin; my $cat_port; + my $pkgname; map { - @a = split(/\|/, $_); + @a = split(/\|/, $_); # columns per PORTINDEX(5) aka INDEX(5) @b = split(/\//, $a[1]); $cat_port = $b[-2]."/".$a[0]; $cat_port =~ s/-[^-]+$//; $origin = $b[-2]."/".$b[-1]; - @{ $index{$cat_port} }{'portname', 'portnameversion', 'origin', 'comment', 'deps'} - = ($b[-1], $a[0], $origin, $a[3], ()); + unless ($b[-1]) { die "undefined portname"; } + unless ($origin) { die "undefined origin"; } + + @{ $index{$a[0]} }{'portname', 'origin', 'comment', 'deps'} + = ($b[-1], $origin, $a[3], ()); - if ($a[8]) { + if ($a[8]) { # run dependencies @b = split(" ", $a[8]); - @{ $index{$cat_port}{deps} }{@b} = (1) x @b; + @{ $index{$a[0]}{deps} }{@b} = (1) x @b; } + undef; } @lines; + print "- Processed ", scalar keys(%index), " entries.\n"; if ($debug and $debug > 1) { print STDERR Dumper(\%index); @@ -191,28 +204,20 @@ my %index = (); my %DEPPORTS = (); +my %byorigin = map { ($index{$_}{'origin'} => $_) } keys %index; +my %byportname = map { ($index{$_}{'portname'} => $_) } keys %index; + foreach my $PORT (@ARGV) { # # See if the port really exists. # If specified as category/portname, that should be enough. # If specified as portname, check all categories for existence or duplicates. # - unless (defined $index{$PORT}) { - my @found = grep /\/$PORT$/, keys(%index); - my $count = @found; - - if ($count == 0) { - die "Cannot find ${PORT} in ${INDEX}."; - } elsif ($count == 1) { - $PORT = $found[0]; - } else { - my $n = join(" ", @found); - die "Found ${PORT} more than once in ${INDEX}: $n. Try category/$PORT.\nAborting"; - } - } - - my $PORTNAMEVERSION = $index{$PORT}{portnameversion}; - print "Found $PORT as $PORTNAMEVERSION\n"; + my $r = $index{$PORT}; + if (!defined $r) { $r = $byportname{$PORT}; } + if (!defined $r) { $r = $byorigin{$PORT}; } + if (defined $r) { print "Found $PORT as $r.\n"; $PORT = $r; } + else { die "Cannot find $PORT in $INDEX! Aborting"; } # # Figure out all the ports depending on this one. @@ -222,7 +227,8 @@ foreach my $PORT (@ARGV) { my $count = 0; foreach my $p (keys(%index)) { - if (defined $index{$p}{'deps'}{$PORTNAMEVERSION}) { + my $q = $index{$p}{'deps'}{$PORT}; + if ($q) { $DEPPORTS{$p} = 1; ++$count; } @@ -243,7 +249,7 @@ sub direct_dependency($@) { my $deps = join(" ", @lines); my %deps = map { $_ =~ s[/usr/ports/][]; $_ =~ s[$portsdir/][]; ($_ => 1) } split " ", $deps; if ($!) { die "cannot read depends from make: $!"; } - close F or die "cannot read depends from make: $!"; + close F or Carp::carp "cannot read depends from make: $!"; my $required = grep { $_ } map { defined $deps{$_} } @requisites; return $required; } @@ -252,9 +258,11 @@ if ($shallow) { my $n = keys %DEPPORTS; my $idx = 1; foreach my $p (keys %DEPPORTS) { - print "- Checking requisites of port $idx/$n...\r"; + print "- Checking requisites of port $idx/$n... \r"; + print "\n" if $debug; ++$idx; - unless (direct_dependency($p, map { $index{$_}{origin} } @ARGV)) { + my $pp = $index{$p}->{'origin'}; + unless (direct_dependency($pp, map { $index{$_}{origin} } @ARGV)) { delete $DEPPORTS{$p}; } } @@ -284,9 +292,11 @@ unless ($opt_f or $opt_n) { { print "Updating Makefiles\n"; foreach my $p (sort keys(%DEPPORTS)) { - print "- Updating Makefile of $p\n"; - next if $opt_n; - bumpMakefile "$p"; + my $origin = $index{$p}->{'origin'}; + print "- Updating Makefile of $origin\n"; + unless($opt_n) { + bumpMakefile "$origin"; + } } } @@ -300,7 +310,7 @@ thing remains: Committing to the ports tree. This program is not going to do that for you, you have to do it manually. \$ cd $TMPDIR -\$ svn commit +\$ git commit Then, remove the temp directory ($TMPDIR). EOF