From owner-dev-commits-ports-all@freebsd.org Tue Jun 1 07:20:09 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0133A64EF22; Tue, 1 Jun 2021 07:20:09 +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 4FvNpc6bwCz3llG; Tue, 1 Jun 2021 07:20:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CA94C1F700; Tue, 1 Jun 2021 07:20:08 +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 1517K8ec094400; Tue, 1 Jun 2021 07:20:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1517K8SV094398; Tue, 1 Jun 2021 07:20:08 GMT (envelope-from git) Date: Tue, 1 Jun 2021 07:20:08 GMT Message-Id: <202106010720.1517K8SV094398@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 4c6e492cd331 - main - ports-mgmt/pkg_tree: Retrieve data from pkg info at one time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c6e492cd331cfb1dadf2914988ab28ed4b9bdf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 07:20:09 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/ports/commit/?id=4c6e492cd331cfb1dadf2914988ab28ed4b9bdf8 commit 4c6e492cd331cfb1dadf2914988ab28ed4b9bdf8 Author: Tatsuki Makino AuthorDate: 2021-06-01 07:02:20 +0000 Commit: Li-Wen Hsu CommitDate: 2021-06-01 07:19:46 +0000 ports-mgmt/pkg_tree: Retrieve data from pkg info at one time The way it works is that it calls pkg info 3 times, so there is a possibility of losing consistency. The -r option added for displaying the "Required by" graph instead of the "Depends on" graph. Pass maintainership to submitter PR: 256214 --- ports-mgmt/pkg_tree/Makefile | 2 +- ports-mgmt/pkg_tree/distinfo | 1 + ports-mgmt/pkg_tree/files/patch-pkg__tree | 85 ++++++++++++--------------- ports-mgmt/pkg_tree/files/patch-pkg__tree.pod | 17 +++++- 4 files changed, 55 insertions(+), 50 deletions(-) diff --git a/ports-mgmt/pkg_tree/Makefile b/ports-mgmt/pkg_tree/Makefile index 735bc2bbe1cd..364572d8e20a 100644 --- a/ports-mgmt/pkg_tree/Makefile +++ b/ports-mgmt/pkg_tree/Makefile @@ -6,7 +6,7 @@ PORTREVISION= 4 CATEGORIES= ports-mgmt MASTER_SITES= http://www.mavetju.org/download/ -MAINTAINER= ports@FreeBSD.org +MAINTAINER= tatsuki_makino@hotmail.com COMMENT= Get a 'graphical' tree-overview of installed packages LICENSE= BSD2CLAUSE diff --git a/ports-mgmt/pkg_tree/distinfo b/ports-mgmt/pkg_tree/distinfo index ad21b36f3b6a..6dc6ec5f933e 100644 --- a/ports-mgmt/pkg_tree/distinfo +++ b/ports-mgmt/pkg_tree/distinfo @@ -1,2 +1,3 @@ +TIMESTAMP = 1622170800 SHA256 (pkg_tree-1.1.tar.gz) = f82a68ab0fda053654cc35a0864b55a9529287f58017b4a1b500e91076a458be SIZE (pkg_tree-1.1.tar.gz) = 5006 diff --git a/ports-mgmt/pkg_tree/files/patch-pkg__tree b/ports-mgmt/pkg_tree/files/patch-pkg__tree index 91635b9567fe..2d4c511aaf17 100644 --- a/ports-mgmt/pkg_tree/files/patch-pkg__tree +++ b/ports-mgmt/pkg_tree/files/patch-pkg__tree @@ -9,20 +9,21 @@ # For more information, see the website: http://www.mavetju.org # -@@ -34,31 +34,95 @@ use strict; +@@ -34,31 +34,77 @@ use strict; use Getopt::Std; -use vars qw/ $opt_v /; -+use vars qw/ $opt_b $opt_q $opt_t $opt_v /; ++use vars qw/ $opt_b $opt_q $opt_r $opt_t $opt_v /; $opt_v=0; -getopts("v"); +$opt_t=0; +$opt_b=0; +$opt_q=0; -+getopts("bqtv"); -+ ++$opt_r=0; ++getopts("bqrtv"); + +my @args=@ARGV; +my $hasargs=$#ARGV>=0; + @@ -37,59 +38,40 @@ +if ($child_error_pkg_N == 0) { # begin pkgng + + my $re_trim = qr/^\s+|\s+$/o; -+ my $re_rtrim = qr/:\s*$/o; + my $re_pkg = qr/^\s+/o; -+ my $line; ++ my $re_dep = qr/^Depends on :$/o; ++ my $re_req = qr/^Required by :$/o; ++ my($line, $r); + -+ $line = `pkg info -r -a`; ++ $line = `pkg info -d -r -a`; + if ($? == 0) { + my @lines = split(/^/, $line); + $pkg = ''; + foreach $line (@lines) { -+ if ($line !~ $re_pkg) { -+ $pkg = $line; -+ $pkg =~ s/$re_rtrim//; -+ $required{$pkg}[0] = 0; -+ } elsif ($pkg ne '') { ++ if ($line =~ $re_dep) { ++ $r = \%requires; ++ } elsif ($line =~ $re_req) { ++ $r = \%required; ++ } elsif ($line =~ $re_pkg) { + $line =~ s/$re_trim//g; -+ $required{$pkg}[++$required{$pkg}[0]] = $line; -+ } -+ } -+ } -+ -+ $line = `pkg info -d -a`; -+ if ($? == 0) { -+ my @lines = split(/^/, $line); -+ $pkg = ''; -+ foreach $line (@lines) { -+ if ($line !~ $re_pkg) { ++ ${$r}{$pkg}[++${$r}{$pkg}[0]] = $line; ++ } else { + $pkg = $line; -+ $pkg =~ s/$re_rtrim//; -+ $requires{$pkg}[0] = 0; -+ } elsif ($pkg ne '') { -+ $line =~ s/$re_trim//g; -+ $requires{$pkg}[++$requires{$pkg}[0]] = $line; -+ } -+ } -+ } -+ -+ $line = `pkg info -q`; -+ if ($? == 0) { -+ @dirs = split(/^/, $line); -+ foreach $pkg (@dirs) { -+ $pkg =~ s/$re_trim//g; -+ unless (exists $required{$pkg}) { -+ $required{$pkg}[0] = 0; -+ } -+ unless (exists $requires{$pkg}) { -+ $requires{$pkg}[0] = 0; ++ $pkg =~ s/$re_trim//g; ++ push(@dirs, $pkg); ++ unless (exists $required{$pkg}) { ++ $required{$pkg}[0] = 0; ++ } ++ unless (exists $requires{$pkg}) { ++ $requires{$pkg}[0] = 0; ++ } + } + } + } + +} # end pkgng +elsif (-e '/usr/sbin/pkg_info') { # begin pkg_install - ++ my $PKGDIR="/var/db/pkg"; opendir DIR,$PKGDIR or die "Couldn't open $PKGDIR"; @@ -115,7 +97,7 @@ foreach $pkg (@dirs) { $required{$pkg}[0]=0; if (open FILE,$PKGDIR."/".$pkg."/+REQUIRED_BY") { -@@ -101,6 +165,11 @@ foreach $pkg (@dirs) { +@@ -101,6 +147,10 @@ foreach $pkg (@dirs) { } } @@ -123,11 +105,22 @@ +else { + die; +} -+ # # Print the dependancies (recursive) of the packages -@@ -150,8 +219,10 @@ foreach $pkg (@dirs) { +@@ -141,6 +191,11 @@ sub print_deps { + # Print all packages or, if there is a command line argument, the ones which + # matches one of the arguments. + # ++if ($opt_r) { ++ my %t = %required; ++ %required = %requires; ++ %requires = %t; ++} + foreach $pkg (@dirs) { + if ($hasargs) { + my $found=0; +@@ -150,8 +205,10 @@ foreach $pkg (@dirs) { } next if (!$found); } diff --git a/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod b/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod index 36dfa72c0692..941f65b42224 100644 --- a/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod +++ b/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod @@ -1,15 +1,26 @@ --- pkg_tree.pod.orig 2001-12-12 11:44:40 UTC +++ pkg_tree.pod -@@ -53,6 +53,12 @@ E<32>[~] edwin@k7EB - Generate a graphical tree of packages an + + =head1 SYNOPSIS + +-B [B<-v>] [I] ++B [B<-bqrtv>] [I] + + =head1 DESCRIPTION + +@@ -52,6 +52,14 @@ E<32>[~] edwin@k7EB + |\__ imake-4.1.0 (unknown) |\__ freetype2-2.0.5 \__ XFree86-libraries-4.1.0 (unknown) - ++ +Use the B<-t> parameter to show only top level packages, +and B<-b> to show only bottom level packages. And B<-t> B<-q> +together will give the list of top level packages without their +dependencies, installing only these packages should install all +currently installed packages. + ++Use the B<-r> parameter to show requirements relation. + =head1 RETURN VALUES - Always 0.