diff options
Diffstat (limited to 'genhdlist_cz2')
-rw-r--r-- | genhdlist_cz2 | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/genhdlist_cz2 b/genhdlist_cz2 deleted file mode 100644 index 513358c..0000000 --- a/genhdlist_cz2 +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/perl - -($noclean, @ARGV) = @ARGV if $ARGV[0] eq "--noclean"; -(undef, $depslist, @ARGV) = @ARGV if $ARGV[0] eq "--ordered-depslist"; -(undef, $hdlist, @ARGV) = @ARGV if $ARGV[0] eq "-o"; -(undef, $root, @ARGV) = @ARGV if $ARGV[0] eq "--distrib"; - -$hdlist && @ARGV == 1 || $root && @ARGV == 0 or die -"usage: genhdlist_cz2 [--noclean] [--ordered-depslist <depslist>] -o <hdlist_cz2> <rpm dir> - or genhdlist_cz2 [--noclean] --distrib <root distrib> -"; - -chop($pwd = `pwd`); - -if ($root) { - $root = "$pwd/$root" if $root !~ m|^/|; - $depslist = "$root/Mandrake/base/depslist.ordered"; - $hdlist = "$root/Mandrake/base/hdlist.cz2"; - $dir = "$root/Mandrake/RPMS"; - $ENV{PATH} = "$ENV{PATH}:$root/misc"; -} else { - ($dir) = @ARGV; -} - -$depslist = "$pwd/$depslist" if $depslist !~ m|^/|; -$hdlist = "$pwd/$hdlist" if $hdlist !~ m|^/|; -$dir = "$pwd/$dir" if $dir !~ m|^/|; - -$tmpdir = $ENV{TMPDIR} || "/tmp"; -$work_dir = "$tmpdir/.build_hdlist"; - - --e $work_dir && !-d $work_dir and unlink($work_dir) || die "cannot use $work_dir as a working directory"; -chmod 0755, $work_dir or system("rm -rf $work_dir"); --d $work_dir or mkdir $work_dir, 0755 or die "cannot create working directory $work_dir\n"; -chdir $work_dir; - -my (%keys, @keys); - -opendir DIR, $dir or die "unable to opendir $dir: $!\n"; -while ($_ = readdir DIR) { - my ($key, $arch) = /(.*)\.(.*)\.rpm$/ or next; - system("rpm2header $dir/$_ > $_") unless -e $_; - $? == 0 or unlink($_), die "bad rpm $dir/$_\n"; - -s $_ or unlink($_), die "bad rpm $dir/$_\n"; - if ($keys{$key}) { - my ($name, $tail) = $key =~ /(.*)(-[^-]*-[^-]*)/; - $keys{"$name($keys{$key})$tail"} = $keys{$key}; unlink "$name($keys{$key})$tail"; link "$key.$keys{$key}.rpm", "$name($keys{$key})$tail"; - $keys{"$name($arch)$tail"} = $arch; unlink "$name($arch)$tail"; link $_, "$name($arch)$tail"; - delete $keys{$key}; - } else { - $keys{$key} = $arch; unlink $key; link $_, $key; - } -} -if (-e $depslist) { - open F, $depslist; - @keys = map { (split)[0] } <F>; -} -@keys = grep { delete $keys{$_} } @keys; - -open B, "| packdrake -b9s $hdlist 400000"; -foreach (@keys, keys %keys) { print B "$_\n" } -close B or die "packdrake failed\n"; - -system("rm -rf $work_dir") unless $noclean; |