diff options
author | pgollucci <pgollucci@FreeBSD.org> | 2015-06-28 03:32:38 +0800 |
---|---|---|
committer | pgollucci <pgollucci@FreeBSD.org> | 2015-06-28 03:32:38 +0800 |
commit | 7a423fbc045e1731c79924afd5db781dcf81fa0f (patch) | |
tree | ef4eb1d355d62657b9b86f535b059b938be5282f /ports-mgmt | |
parent | 7c897069524c12ee8b9237f11bdd0504d4800c4b (diff) | |
download | freebsd-ports-gnome-7a423fbc045e1731c79924afd5db781dcf81fa0f.tar.gz freebsd-ports-gnome-7a423fbc045e1731c79924afd5db781dcf81fa0f.tar.zst freebsd-ports-gnome-7a423fbc045e1731c79924afd5db781dcf81fa0f.zip |
ports-mgmt/pkg_tree: support pkg_* and pkg
retrieve data from pkg info
PR: 200730
Submitted by: tatsuki_makino@hotmail.com
Approved by: maintainer timeout (edwin@mavetju.org ; 18 days)
Diffstat (limited to 'ports-mgmt')
-rw-r--r-- | ports-mgmt/pkg_tree/Makefile | 4 | ||||
-rw-r--r-- | ports-mgmt/pkg_tree/files/patch-Makefile | 6 | ||||
-rw-r--r-- | ports-mgmt/pkg_tree/files/patch-pkg__tree | 141 | ||||
-rw-r--r-- | ports-mgmt/pkg_tree/files/patch-pkg__tree.pod | 15 | ||||
-rw-r--r-- | ports-mgmt/pkg_tree/files/patch-pkg_tree | 65 |
5 files changed, 162 insertions, 69 deletions
diff --git a/ports-mgmt/pkg_tree/Makefile b/ports-mgmt/pkg_tree/Makefile index 64e5fe75f17e..fc8148f2cbd8 100644 --- a/ports-mgmt/pkg_tree/Makefile +++ b/ports-mgmt/pkg_tree/Makefile @@ -3,7 +3,7 @@ PORTNAME= pkg_tree PORTVERSION= 1.1 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= ports-mgmt MASTER_SITES= http://www.mavetju.org/download/ @@ -12,6 +12,8 @@ COMMENT= Get a 'graphical' tree-overview of installed packages USES= perl5 +NO_ARCH= yes + PLIST_FILES= bin/pkg_tree man/man7/pkg_tree.7.gz post-patch: diff --git a/ports-mgmt/pkg_tree/files/patch-Makefile b/ports-mgmt/pkg_tree/files/patch-Makefile index 5caa17d2e87d..fc2879dc5c24 100644 --- a/ports-mgmt/pkg_tree/files/patch-Makefile +++ b/ports-mgmt/pkg_tree/files/patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Wed Dec 12 23:06:13 2001 -+++ Makefile Wed Dec 12 23:07:35 2001 -@@ -11,8 +11,8 @@ +--- Makefile.orig 2001-12-12 11:44:40 UTC ++++ Makefile +@@ -11,8 +11,8 @@ pkg_tree.7: pkg_tree.pod --date="December 15, 2001" pkg_tree.pod > pkg_tree.7 install: diff --git a/ports-mgmt/pkg_tree/files/patch-pkg__tree b/ports-mgmt/pkg_tree/files/patch-pkg__tree new file mode 100644 index 000000000000..91635b9567fe --- /dev/null +++ b/ports-mgmt/pkg_tree/files/patch-pkg__tree @@ -0,0 +1,141 @@ +--- pkg_tree.orig 2001-12-12 11:44:40 UTC ++++ pkg_tree +@@ -26,7 +26,7 @@ + # updated by a newer version. In case of tcl-8.3.3_3, this is tcl-8.3.3_4. + # + # PKG-TREE is (c) Edwin Groothuis, edwin@mavetju.org +-# For license issues, see the file LICESE. ++# For license issues, see the file LICENSE. + # For more information, see the website: http://www.mavetju.org + # + +@@ -34,31 +34,95 @@ use strict; + + use Getopt::Std; + +-use vars qw/ $opt_v /; ++use vars qw/ $opt_b $opt_q $opt_t $opt_v /; + + $opt_v=0; +-getopts("v"); ++$opt_t=0; ++$opt_b=0; ++$opt_q=0; ++getopts("bqtv"); ++ ++my @args=@ARGV; ++my $hasargs=$#ARGV>=0; ++ ++my %required; # this key is required by other packages ++my %requires; # this key requires other packages ++my @dirs; ++my $pkg; ++ ++`pkg -N 2>&1`; ++my $child_error_pkg_N = $?; ++ ++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; ++ ++ $line = `pkg info -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 '') { ++ $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) { ++ $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; ++ } ++ } ++ } ++ ++} # 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"; +-my @dirs=readdir DIR; ++@dirs=readdir DIR; + closedir DIR; + + @dirs=grep !/^\./,@dirs; ++@dirs=grep !/^pkgdb.db$/,@dirs; + @dirs=sort @dirs; + +-my @args=@ARGV; +-my $hasargs=$#ARGV>=0; +- +-my %required; # this key is required by other packages +-my %requires; # this key requires other packages +- + # + # Read from every package the +REQUIRED_BY file. This file contains + # info about the packages which require this package. + # +-my $pkg; + foreach $pkg (@dirs) { + $required{$pkg}[0]=0; + if (open FILE,$PKGDIR."/".$pkg."/+REQUIRED_BY") { +@@ -101,6 +165,11 @@ foreach $pkg (@dirs) { + } + } + ++} # end pkg_install ++else { ++ die; ++} ++ + + # + # Print the dependancies (recursive) of the packages +@@ -150,8 +219,10 @@ foreach $pkg (@dirs) { + } + next if (!$found); + } ++ next if ($opt_t && $required{$pkg}[0]!=0); ++ next if ($opt_b && $requires{$pkg}[0]!=0); + print "$pkg\n"; +- if ($requires{$pkg}[0]!=0) { ++ if (!$opt_q && $requires{$pkg}[0]!=0) { + print_deps("|"," ",1,$pkg); + } + } diff --git a/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod b/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod new file mode 100644 index 000000000000..36dfa72c0692 --- /dev/null +++ b/ports-mgmt/pkg_tree/files/patch-pkg__tree.pod @@ -0,0 +1,15 @@ +--- pkg_tree.pod.orig 2001-12-12 11:44:40 UTC ++++ pkg_tree.pod +@@ -53,6 +53,12 @@ E<32>[~] edwin@k7E<gt>B<pkg_tree -v linu + |\__ 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. ++ + =head1 RETURN VALUES + + Always 0. diff --git a/ports-mgmt/pkg_tree/files/patch-pkg_tree b/ports-mgmt/pkg_tree/files/patch-pkg_tree deleted file mode 100644 index b2b81728e81b..000000000000 --- a/ports-mgmt/pkg_tree/files/patch-pkg_tree +++ /dev/null @@ -1,65 +0,0 @@ ---- pkg_tree.orig Wed Dec 12 13:44:40 2001 -+++ pkg_tree Mon Jan 6 23:02:31 2003 -@@ -26,7 +26,7 @@ - # updated by a newer version. In case of tcl-8.3.3_3, this is tcl-8.3.3_4. - # - # PKG-TREE is (c) Edwin Groothuis, edwin@mavetju.org --# For license issues, see the file LICESE. -+# For license issues, see the file LICENSE. - # For more information, see the website: http://www.mavetju.org - # - -@@ -34,10 +34,13 @@ - - use Getopt::Std; - --use vars qw/ $opt_v /; -+use vars qw/ $opt_b $opt_q $opt_t $opt_v /; - - $opt_v=0; --getopts("v"); -+$opt_t=0; -+$opt_b=0; -+$opt_q=0; -+getopts("bqtv"); - - my $PKGDIR="/var/db/pkg"; - -@@ -46,6 +49,7 @@ - closedir DIR; - - @dirs=grep !/^\./,@dirs; -+@dirs=grep !/^pkgdb.db$/,@dirs; - @dirs=sort @dirs; - - my @args=@ARGV; -@@ -150,8 +154,10 @@ - } - next if (!$found); - } -+ next if ($opt_t && $required{$pkg}[0]!=0); -+ next if ($opt_b && $requires{$pkg}[0]!=0); - print "$pkg\n"; -- if ($requires{$pkg}[0]!=0) { -+ if (!$opt_q && $requires{$pkg}[0]!=0) { - print_deps("|"," ",1,$pkg); - } - } ---- patch-aa ends here --- - ---- patch-ab begins here --- ---- pkg_tree.pod.orig Wed Dec 12 13:44:40 2001 -+++ pkg_tree.pod Mon Jan 6 23:20:49 2003 -@@ -53,6 +53,12 @@ - |\__ 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. -+ - =head1 RETURN VALUES - - Always 0. |