View | Details | Raw Unified | Return to bug 256214 | Differences between
and this patch

Collapse All | Expand All

(-)ports-mgmt/pkg_tree/distinfo (+1 lines)
Lines 1-2 Link Here
1
TIMESTAMP = 1622170800
1
SHA256 (pkg_tree-1.1.tar.gz) = f82a68ab0fda053654cc35a0864b55a9529287f58017b4a1b500e91076a458be
2
SHA256 (pkg_tree-1.1.tar.gz) = f82a68ab0fda053654cc35a0864b55a9529287f58017b4a1b500e91076a458be
2
SIZE (pkg_tree-1.1.tar.gz) = 5006
3
SIZE (pkg_tree-1.1.tar.gz) = 5006
(-)ports-mgmt/pkg_tree/files/patch-pkg__tree (-46 / +39 lines)
Lines 9-28 Link Here
9
 # For more information, see the website: http://www.mavetju.org
9
 # For more information, see the website: http://www.mavetju.org
10
 #
10
 #
11
 
11
 
12
@@ -34,31 +34,95 @@ use strict;
12
@@ -34,31 +34,77 @@ use strict;
13
 
13
 
14
 use Getopt::Std;
14
 use Getopt::Std;
15
 
15
 
16
-use vars qw/ $opt_v /;
16
-use vars qw/ $opt_v /;
17
+use vars qw/ $opt_b $opt_q $opt_t $opt_v /;
17
+use vars qw/ $opt_b $opt_q $opt_r $opt_t $opt_v /;
18
 
18
 
19
 $opt_v=0;
19
 $opt_v=0;
20
-getopts("v");
20
-getopts("v");
21
+$opt_t=0;
21
+$opt_t=0;
22
+$opt_b=0;
22
+$opt_b=0;
23
+$opt_q=0;
23
+$opt_q=0;
24
+getopts("bqtv");
24
+$opt_r=0;
25
+
25
+getopts("bqrtv");
26
 
26
+my @args=@ARGV;
27
+my @args=@ARGV;
27
+my $hasargs=$#ARGV>=0;
28
+my $hasargs=$#ARGV>=0;
28
+
29
+
Lines 37-95 Link Here
37
+if ($child_error_pkg_N == 0) {	# begin pkgng
38
+if ($child_error_pkg_N == 0) {	# begin pkgng
38
+
39
+
39
+    my $re_trim = qr/^\s+|\s+$/o;
40
+    my $re_trim = qr/^\s+|\s+$/o;
40
+    my $re_rtrim = qr/:\s*$/o;
41
+    my $re_pkg = qr/^\s+/o;
41
+    my $re_pkg = qr/^\s+/o;
42
+    my $line;
42
+    my $re_dep = qr/^Depends on     :$/o;
43
+    my $re_req = qr/^Required by    :$/o;
44
+    my($line, $r);
43
+
45
+
44
+    $line = `pkg info -r -a`;
46
+    $line = `pkg info -d -r -a`;
45
+    if ($? == 0) {
47
+    if ($? == 0) {
46
+	my @lines = split(/^/, $line);
48
+	my @lines = split(/^/, $line);
47
+	$pkg = '';
49
+	$pkg = '';
48
+	foreach $line (@lines) {
50
+	foreach $line (@lines) {
49
+	    if ($line !~ $re_pkg) {
51
+	    if ($line =~ $re_dep) {
50
+		$pkg = $line;
52
+		$r = \%requires;
51
+		$pkg =~ s/$re_rtrim//;
53
+	    } elsif ($line =~ $re_req) {
52
+		$required{$pkg}[0] = 0;
54
+		$r = \%required;
53
+	    } elsif ($pkg ne '') {
55
+	    } elsif ($line =~ $re_pkg) {
54
+		$line =~ s/$re_trim//g;
56
+		$line =~ s/$re_trim//g;
55
+		$required{$pkg}[++$required{$pkg}[0]] = $line;
57
+		${$r}{$pkg}[++${$r}{$pkg}[0]] = $line;
56
+	    }
58
+	    } else {
57
+	}
58
+    }
59
+
60
+    $line = `pkg info -d -a`;
61
+    if ($? == 0) {
62
+	my @lines = split(/^/, $line);
63
+	$pkg = '';
64
+	foreach $line (@lines) {
65
+	    if ($line !~ $re_pkg) {
66
+		$pkg = $line;
59
+		$pkg = $line;
67
+		$pkg =~ s/$re_rtrim//;
60
+		$pkg =~ s/$re_trim//g;
68
+		$requires{$pkg}[0] = 0;
61
+		push(@dirs, $pkg);
69
+	    } elsif ($pkg ne '') {
62
+		unless (exists $required{$pkg}) {
70
+		$line =~ s/$re_trim//g;
63
+		    $required{$pkg}[0] = 0;
71
+		$requires{$pkg}[++$requires{$pkg}[0]] = $line;
64
+		}
72
+	    }
65
+		unless (exists $requires{$pkg}) {
73
+	}
66
+		    $requires{$pkg}[0] = 0;
74
+    }
67
+		}
75
+
76
+    $line = `pkg info -q`;
77
+    if ($? == 0) {
78
+	@dirs = split(/^/, $line);
79
+	foreach $pkg (@dirs) {
80
+	    $pkg =~ s/$re_trim//g;
81
+	    unless (exists $required{$pkg}) {
82
+		$required{$pkg}[0] = 0;
83
+	    }
84
+	    unless (exists $requires{$pkg}) {
85
+		$requires{$pkg}[0] = 0;
86
+	    }
68
+	    }
87
+	}
69
+	}
88
+    }
70
+    }
89
+
71
+
90
+}	# end pkgng
72
+}	# end pkgng
91
+elsif (-e '/usr/sbin/pkg_info') {	# begin pkg_install
73
+elsif (-e '/usr/sbin/pkg_info') {	# begin pkg_install
92
 
74
+
93
 my $PKGDIR="/var/db/pkg";
75
 my $PKGDIR="/var/db/pkg";
94
 
76
 
95
 opendir DIR,$PKGDIR or die "Couldn't open $PKGDIR";
77
 opendir DIR,$PKGDIR or die "Couldn't open $PKGDIR";
Lines 115-121 Link Here
115
 foreach $pkg (@dirs) {
97
 foreach $pkg (@dirs) {
116
     $required{$pkg}[0]=0;
98
     $required{$pkg}[0]=0;
117
     if (open FILE,$PKGDIR."/".$pkg."/+REQUIRED_BY") {
99
     if (open FILE,$PKGDIR."/".$pkg."/+REQUIRED_BY") {
118
@@ -101,6 +165,11 @@ foreach $pkg (@dirs) {
100
@@ -101,6 +147,10 @@ foreach $pkg (@dirs) {
119
     }
101
     }
120
 }
102
 }
121
 
103
 
Lines 123-133 Link Here
123
+else {
105
+else {
124
+	die;
106
+	die;
125
+}
107
+}
126
+
127
 
108
 
128
 #
109
 #
129
 # Print the dependancies (recursive) of the packages
110
 # Print the dependancies (recursive) of the packages
130
@@ -150,8 +219,10 @@ foreach $pkg (@dirs) {
111
@@ -141,6 +191,11 @@ sub print_deps {
112
 # Print all packages or, if there is a command line argument, the ones which
113
 # matches one of the arguments.
114
 #
115
+if ($opt_r) {
116
+    my %t = %required;
117
+    %required = %requires;
118
+    %requires = %t;
119
+}
120
 foreach $pkg (@dirs) {
121
     if ($hasargs) {
122
 	my $found=0;
123
@@ -150,8 +205,10 @@ foreach $pkg (@dirs) {
131
 	}
124
 	}
132
 	next if (!$found);
125
 	next if (!$found);
133
     }
126
     }
(-)ports-mgmt/pkg_tree/files/patch-pkg__tree.pod (-3 / +14 lines)
Lines 1-15 Link Here
1
--- pkg_tree.pod.orig	2001-12-12 11:44:40 UTC
1
--- pkg_tree.pod.orig	2001-12-12 11:44:40 UTC
2
+++ pkg_tree.pod
2
+++ pkg_tree.pod
3
@@ -53,6 +53,12 @@ E<32>[~] edwin@k7E<gt>B<pkg_tree -v linu
3
@@ -8,7 +8,7 @@ B<pkg_tree> - Generate a graphical tree of packages an
4
 
5
 =head1 SYNOPSIS
6
 
7
-B<pkg_tree> [B<-v>] [I<package-prefix ...>]
8
+B<pkg_tree> [B<-bqrtv>] [I<package-prefix ...>]
9
 
10
 =head1 DESCRIPTION
11
 
12
@@ -52,6 +52,14 @@ E<32>[~] edwin@k7E<gt>B<pkg_tree -v linux-netscape>
13
  |\__ imake-4.1.0 (unknown)
4
  |\__ freetype2-2.0.5
14
  |\__ freetype2-2.0.5
5
   \__ XFree86-libraries-4.1.0 (unknown)
15
   \__ XFree86-libraries-4.1.0 (unknown)
6
 
16
+
7
+Use the B<-t> parameter to show only top level packages,
17
+Use the B<-t> parameter to show only top level packages,
8
+and B<-b> to show only bottom level packages. And B<-t> B<-q>
18
+and B<-b> to show only bottom level packages. And B<-t> B<-q>
9
+together will give the list of top level packages without their
19
+together will give the list of top level packages without their
10
+dependencies, installing only these packages should install all
20
+dependencies, installing only these packages should install all
11
+currently installed packages.
21
+currently installed packages.
12
+
22
+
23
+Use the B<-r> parameter to show requirements relation.
24
 
13
 =head1 RETURN VALUES
25
 =head1 RETURN VALUES
14
 
26
 
15
 Always 0.

Return to bug 256214