Browse Source

Clifford Wolf:


			
			
				rocklinux
			
			
		
Clifford Wolf 18 years ago
parent
commit
9860b395f3
1 changed files with 57 additions and 13 deletions
  1. +57
    -13
      scripts/Create-DepList

+ 57
- 13
scripts/Create-DepList

@ -8,6 +8,11 @@ my $rootdir = "";
my $showinst = 0;
my $showdups = 0;
my $showopt = 0;
my $listmode = 0;
my @ignore_list;
sub help()
{
@ -16,14 +21,19 @@ sub help()
print "\n";
print "Options:\n";
print "\n";
print " -cfg <config> Use package list from config\n";
print " -root <dir> Use dir as root directory\n";
print " -depdb <file> Use file as dependency database\n";
print " -cfg <config> Use package list from config\n";
print " -root <dir> Use dir as root directory\n";
print " -depdb <file> Use file as dependency database\n";
print "\n";
print " -ignore <regex> Ignore all packages matching the regex\n";
print "\n";
print " -chroot Use 'build/<config>../' as root\n";
print " -chroot Use 'build/<config>../' as root\n";
print "\n";
print " -showinst Also show already installed deps\n";
print " -showdups Also show already printed deps\n";
print " -showinst Also show already installed deps\n";
print " -showdups Also show already printed deps\n";
print " -showopt Also show packages marked as optional\n";
print "\n";
print " -listmod Run in list mode\n";
print "\n";
exit 1;
@ -44,6 +54,10 @@ while ( $#ARGV >= 0 and $ARGV[0] =~ /^-/ )
$depdb = shift @ARGV;
next;
}
if ( $opt eq "-ignore" ) {
push @ignore_list, shift @ARGV;
next;
}
if ( $opt eq "-chroot" ) {
my $cfgfile = $pkgfile;
$cfgfile =~ s/packages$/config/;
@ -59,6 +73,14 @@ while ( $#ARGV >= 0 and $ARGV[0] =~ /^-/ )
$showdups = 1;
next;
}
if ( $opt eq "-showopt" ) {
$showopt = 1;
next;
}
if ( $opt eq "-listmode" ) {
$listmode = 1;
next;
}
help;
}
@ -69,7 +91,7 @@ my %pkgs_reverse;
open(F, "<$pkgfile") or die "Can't open $pkgfile: $!";
while (<F>) {
next unless /^X/;
next unless /^X/ or $showopt;
my @f = split /\s+/;
if ( $f[4] =~ /(.*)=(.*)/ ) {
$pkgs{$2} = $1;
@ -97,13 +119,19 @@ while () {
close F;
my %duptags;
my @rawlist;
sub showdeps($$);
sub showdeps($$)
{
my $depth = $_[0];
my $sp = " " x $_[0];
my $p = $_[1];
foreach (@ignore_list) {
return if $p =~ /$_/;
}
my $is_dup = defined $duptags{$p};
$duptags{$p} = 1;
@ -117,18 +145,22 @@ sub showdeps($$)
return if $is_inst and not $showinst;
}
print "${sp}$p";
print " (already_installed)" if $is_inst;
print " (duplicate)" if $is_dup;
print "\n";
if ($listmode) {
push @{$rawlist[$depth]}, $p;
} else {
print "${sp}$p";
print " (already_installed)" if $is_inst;
print " (duplicate)" if $is_dup;
print "\n";
}
if ( $_[0] > 0 ) {
if ( $depth > 0 ) {
return if $is_dup;
return if $is_inst;
}
foreach (@{$deps{$p}}) {
showdeps($_[0]+1, $_)
showdeps($depth+1, $_)
if defined $_ and defined $deps{$_};
}
}
@ -137,3 +169,15 @@ foreach my $p (@ARGV) {
showdeps(0, $p);
}
if ($listmode) {
my $isfirst = 1;
foreach my $l (reverse @rawlist) {
foreach (@{$l}) {
print " " unless $isfirst;
$isfirst = 0;
print $_;
}
}
print "\n";
}

Loading…
Cancel
Save