"Andras Vass" <[EMAIL PROTECTED]> writes:

> >
> > ha yes, I had this problem before, I check that tomorrow (a bit tired
> tonight)

I have corrected the mkcd.pl script, waiting for the webmaster to update the
mandrake website, here is the last version:

#!/usr/bin/perl

use strict;

my ($rep,$iso) = @ARGV;
$iso or usage();

my @cd;
open A, "$rep/Mandrake/base/rpmslist";
my ($num,@a);
my %list;
while(<A>){
        /<\/CD>/ and $num = 0;
        /<CD num=(\d+)>/ and do { $num = $1; push @cd, $num};
#       s/\+/\\\+/g;
        /(?:<.*>)*([^<]*)\n/; 
        $1 and do {
                @a = split ' ', $1;
                @list{@a} = map $num,@a;
        }
}

my $depslist = "$rep/Mandrake/base/depslist.ordered";
my $hdlist   = "$rep/Mandrake/base/hdlist.cz2";
my $dir      = "$rep/Mandrake/RPMS";
$ENV{PATH} = "$ENV{PATH}:$rep/misc";

my $tmpdir = $ENV{TMPDIR} || "/tmp";
my $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;

# build the hdlists
my (@list, %keys, @keys);

opendir DIR, $dir or die "unable to opendir $dir: $!\n";
while ($_ = readdir DIR) {
    my ($key, $arch) = /(.*)\.(.*)\.rpm$/ or next;
    system("$rep/misc/rpm2header $dir/$_ > $_") unless -e $_;
    $? == 0 or unlink($_), die "bad rpm $dir/$_\n";
    -s $_ or unlink($_), die "bad rpm $dir/$_\n";
    my ($name, $tail) = $key =~ /(.*)(-[^-]*-[^-]*)/;
    my $n = $list{$name};
    push @{$list[$n]}, $_;
    if ($keys{$n}{$key}) {
        $keys{$n}{"$name($keys{$key})$tail"} = $keys{$n}{$key}; unlink 
"$name($keys{$n}{$key})$tail"; link "$key.$keys{$n}{$key}.rpm", 
"$name($keys{$n}{$key})$tail";
        $keys{$n}{"$name($arch)$tail"} = $arch; unlink "$name($arch)$tail"; link $_, 
"$name($arch)$tail";
        delete $keys{$n}{$key};
    } else {
        $keys{$n}{$key} = $arch; unlink $key; link $_, $key;
    }
}

my @dkeys;
if (-e "$rep/Mandrake/base/depslist.ordered") {
    open F, $depslist;
    @dkeys = map { (split)[0] } <F>;
}
open C, ">$work_dir/hdlists";
my $cmddep = "$rep/misc/genbasefiles $work_dir/";
foreach my $n (@cd){
        my @keys = grep { delete $keys{$n}{$_} } @dkeys; 

        open B, "| $rep/misc/packdrake -b9s $work_dir/hdlist$n.cz 400000";
        foreach (@keys, keys %{$keys{$n}}) { print B "$_\n" }
        close B or die "packdrake failed\n";
        print C "hdlist$n.cz Mandrake/RPMS$n CD $n Cooker\n";
        $cmddep .= " $work_dir/hdlist$n.cz"
        
}
close C;
system $cmddep;

my $mkiso = qq{mkisofs -r -J -graft-points -nobak -V "Cooker_CD_1" -b images/cdrom.img 
-c images/boot.cat -o "$iso/1-Cooker-i586.iso" \\
        images/=$rep/images                     \\
        COPYING=$rep/COPYING                    \\
        LICENSE-APPS.txt=$rep/LICENSE-APPS.txt  \\
        RPM-GPG-KEYS=$rep/RPM-GPG-KEYS          \\
        autorun.inf=$rep/autorun.inf            \\
        doc/=$rep/doc                           \\
        install.htm=$rep/install.htm            \\
        lnx4win/=$rep/lnx4win                   \\
        tutorial/=$rep/tutorial                 \\
        INSTALL.txt=$rep/INSTALL.txt            \\
        LICENSE.txt=$rep/LICENSE.txt            \\
        README.txt=$rep/README.txt              \\
        VERSION=$rep/VERSION                    \\
        boot/=$rep/boot                         \\
        dosutils/=$rep/dosutils                 \\
        index.htm=$rep/index.htm                \\
        live_update=$rep/live_update            \\
        misc/=$rep/misc                         \\
        Mandrake/mdkinst/=$rep/Mandrake/mdkinst \\
        Mandrake/base/=$rep/Mandrake/base/compssUsers           \\
        Mandrake/base/=$rep/Mandrake/base/mdkinst_stage2.gz     \\
        Mandrake/base/=$rep/Mandrake/base/rescue_stage2.gz      \\
        Mandrake/base/=$rep/Mandrake/base/rpmslist              \\
        Mandrake/base/=$rep/Mandrake/base/rpmsrate              \\
        Mandrake/base/=$work_dir/compss                         \\
        Mandrake/base/=$work_dir/depslist.ordered               \\
        Mandrake/base/=$work_dir/provides                       \\
        Mandrake/base/=$work_dir/hdlists};

foreach (@cd) {
        $mkiso .= "\\\n Mandrake/base/=$work_dir/hdlist$_.cz"
}

foreach (@{$list[1]}){
        $mkiso .= "\\\n Mandrake/RPMS1/=$rep/Mandrake/RPMS/$_" 
}

#print "$mkiso\n"; 
#exit;
system $mkiso;

foreach my $n (@cd){
        $n == 1 and next;
        $mkiso = qq{mkisofs -r -J -graft-points -nobak -V "Cooker_CD_$n" -o 
"$iso/$n-Cooker-i586.iso"}; 
        foreach (@{$list[$n]}){
                $mkiso .= "\\\n Mandrake/RPMS$n/=$rep/Mandrake/RPMS/$_"
        }
#       print "$mkiso\n";
        system $mkiso;
}

# system("rm -rf $work_dir");

exit;

sub usage{
        print "usage:
        $0 <repository dir> <iso creation dir>\n";
        exit
}

-- 
Warly

Reply via email to