summaryrefslogtreecommitdiffstats
path: root/po/ga.po
Commit message (Expand)AuthorAgeFilesLines
* updated po filesPablo Saratxaga2002-09-051-12/+2
* updated pot filePablo Saratxaga2002-09-051-390/+149
* updated all po with for removing fuzzy on "Is this OK?" as previously "Is itFrancois Pons2002-09-051-164/+407
* updated pot filePablo Saratxaga2002-08-301-99/+104
* updated pot filePablo Saratxaga2002-08-291-95/+102
* updated pot filePablo Saratxaga2002-08-281-35/+37
* updated pot filePablo Saratxaga2002-08-271-92/+97
* updated po filesPablo Saratxaga2002-08-271-191/+223
* Changed remaining gettext("foo $bar") into _("foo %s", $bar)Pablo Saratxaga2002-08-241-812/+657
* updated pot filePablo Saratxaga2002-08-131-379/+395
* updated pot filePablo Saratxaga2002-08-061-368/+387
* updated pot filePablo Saratxaga2002-07-241-333/+342
* updated po filesPablo Saratxaga2002-07-231-371/+376
* updated pot filePablo Saratxaga2002-07-221-243/+253
* updated pot filePablo Saratxaga2002-07-191-359/+371
* updated pot filePablo Saratxaga2002-07-151-427/+444
* updated pot filePablo Saratxaga2002-07-091-254/+379
* updated pot filePablo Saratxaga2002-02-261-291/+299
* updated pot filePablo Saratxaga2002-02-211-216/+225
* updated pot filePablo Saratxaga2002-02-181-299/+304
* updated pot filePablo Saratxaga2002-02-141-142/+162
* updated pot filePablo Saratxaga2002-02-061-472/+517
* updated Hungarian filePablo Saratxaga2002-01-301-136/+139
* fixed English typo; moved Chinese file namesPablo Saratxaga2002-01-281-38/+38
* updated Czech and Italian filesPablo Saratxaga2002-01-231-37/+37
* updated pot filePablo Saratxaga2002-01-231-174/+203
* updated pot filePablo Saratxaga2002-01-021-182/+275
* corrected some English typosPablo Saratxaga2001-12-101-237/+189
* updated pot filePablo Saratxaga2001-12-031-203/+239
* fixed some English typos; updated Hungarian filePablo Saratxaga2001-11-271-263/+356
* updated Hungarian and Danish filesPablo Saratxaga2001-11-241-17/+23
* updated Azeri filePablo Saratxaga2001-11-201-86/+115
* updated Turkish and Thai filesPablo Saratxaga2001-09-191-4/+4
* update Irish filePablo Saratxaga2001-09-131-4/+4
* updated pot filePablo Saratxaga2001-09-131-40/+40
* Updated Irish filePablo Saratxaga2001-09-061-66/+65
* updated pot filePablo Saratxaga2001-08-171-278/+266
* updated Croatian filePablo Saratxaga2001-07-191-120/+207
* Updated Danish filePablo Saratxaga2001-07-031-125/+131
* updated po filesPablo Saratxaga2001-06-281-121/+556
* updated Hungarian, Japanese and Braezilian filesPablo Saratxaga2001-05-141-5/+20
* Updated Turkish filePablo Saratxaga2001-04-231-30/+32
* Updated Finnish filePablo Saratxaga2001-04-041-26/+59
* updated Azeri filePablo Saratxaga2001-03-141-24/+24
* updated Slovak and Catalan filesPablo Saratxaga2001-03-061-11/+10
* updated Esperanto filePablo Saratxaga2001-03-031-31/+33
* fixed some English typosPablo Saratxaga2001-02-281-25/+25
* updated Danish filePablo Saratxaga2001-02-261-27/+27
* updated Turkish filePablo Saratxaga2001-02-171-39/+72
* i18n improvementsPablo Saratxaga2001-02-141-56/+154
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867
package MDV::Distribconf::Build;

=head1 NAME

MDV::Distribconf::Build - Subclass to MDV::Distribconf to build configuration

=head1 METHODS

=over 4

=cut

use strict;
use warnings;
use File::Path;
use RPM4;
use MDV::Packdrakeng;
use File::Temp qw(tempfile);
use File::Copy qw(cp);
use Digest::MD5;

use base qw(MDV::Distribconf MDV::Distribconf::Checks);
our $VERSION = (qq$Revision$ =~ /(\d+)/)[0];

=item MDV::Distribconf::Build->new($root_of_distrib)

Returns a new MDV::Distribconf::Build object.

=cut

sub new {
    my $class = shift;
    my $self = $class->SUPER::new(@_);
    bless $self, $class;
}

=item $distrib->init($flavour)

Create initals directories in the distrib tree if missing.

$flavour is either 'mandriva' or 'mandrake', depending the tree type
you want to create.

See also L<MDV::Distribconf/settree>

Return 1 on success, 0 otherwise.

=cut

sub init {
    my ($self, $flavour) = @_;
    $self->settree($flavour || 'mandriva') unless($self->{infodir});
    if (!-d $self->getfullpath(undef, 'root')) {
        if (!mkdir($self->getfullpath(undef, 'root'))) {
            warn 'Cannot create ' . $self->getfullpath(undef, 'root') .": $!\n";
            return 0;
        }
    }
    foreach my $dir (map { $self->getfullpath(undef, $_) } qw(mediadir infodir)) {
        if (!-d $dir) {
            eval { mkpath($dir) };
            if ($@) {
                warn "Cannot create $dir: $@\n";
                return 0;
            }
        }
    }

    foreach my $media ($self->listmedia()) {
        $self->create_media($media) or return 0;
    }

    1;
}

=item $distrib->create_media($media)

Create a media $media if not exists and its directories if need.

See also L<setvalue>

Return 1 on success, 0 otherwise

=cut

sub create_media {
    my ($self, $media) = @_;
    $self->setvalue($media, undef, undef);
    foreach my $dir (map { $self->getfullmediapath($media, $_) } qw(path infodir)) {
        if (!-d $dir) {
            eval { mkpath($dir) };
            if ($@) {
                warn "Cannot create $dir: $@\n";
                $self->delvalue($media, undef);
                return 0;
            }
        }
    }

    1;
}

=item $distrib->setvalue($media, $var, $val)

Sets or adds $var parameter from $media to $val. If $media doesn't exist,
it is implicitly created. If $var is C<undef>, a new media is created with
no defined parameters.

=cut

sub setvalue {
    my ($distrib, $media, $var, $val) = @_;
    $media ||= 'media_info';
    $distrib->{cfg}->AddSection($media);
    if ($var) {
        if ($media && !$distrib->mediaexists($media)) {
            $distrib->setvalue($media);
        }
        $var =~ /^(?:media|info)dir\z/ and do {
            $distrib->{$var} = $val;
            return 1;
        };
        if ($val) {
            $distrib->{cfg}->newval($media, $var, $val)
	        or warn "Can't set value [$var=$val] for $media\n";
        } else {
            $distrib->{cfg}->delval($media, $var);
        }
    }
    $distrib->_post_setvalue($media, $var, $val) if ($media);
}

sub _post_setvalue {
    my ($distrib, $cmedia, $cvar, $cval) = @_;
    if ($cvar) {
        my $vsettings = MDV::Distribconf::MediaCFG::_value_info($cvar);
        if ($vsettings->{cross}) {
            my %pointed_media = map { $_ => 1 } split(/\s/, $cval);
            foreach my $media ($distrib->listmedia()) {
                my %ml = map { $_ => 1 }
                    split(/\s/, $distrib->getvalue($media, $vsettings->{cross}));

                if (exists($pointed_media{$media})) {
                    exists($ml{$cmedia}) and next;
                    $ml{$cmedia} = 1;
                } else {
                    exists($ml{$cmedia}) or next;
                    delete($ml{$cmedia});
                }
                $distrib->setvalue(
                    $media,
                    $vsettings->{cross},
                    join(" ", keys %ml),
                );
            }
        }
    } else {
        foreach my $media ($distrib->listmedia()) {
            foreach my $val ($distrib->{cfg}->Parameters($media)) {
            my $vsettings = MDV::Distribconf::MediaCFG::_value_info($val);
                if ($vsettings->{cross}) {
                    if (grep { $_ eq $cmedia } 
                        split(/\s/, $distrib->getvalue($media, $val))) {
                        my %ml = map { $_ => 1 }
                            split(/\s/, $distrib->getvalue($cmedia, $vsettings->{cross}));
                        exists($ml{$media}) and next;
                        $ml{$media} = 1;
                        $distrib->setvalue(
                            $cmedia,
                            $vsettings->{cross},
                            join(" ", keys %ml),
                        );
                    }
                }
            }
        }
    }
    1;
}

=item $distrib->delvalue($media, $var)

Delete $var parameter from $media. If $var is not specified, the media is
is deleted. If $media is not specified, $var is remove from global settings.

=cut

sub delvalue {
    my ($distrib, $media, $var) = @_;
    if ($var) {
        $distrib->{cfg}->delval($media, $var);
    } else {
        $distrib->{cfg}->DeleteSection($media);
    }
    $distrib->_post_delvalue($media, $var);
}

sub _post_delvalue {
    my ($distrib, $cmedia, $cvar) = @_;
    foreach my $media ($distrib->listmedia()) {
        if ($cvar) {
            my $vsettings = MDV::Distribconf::MediaCFG::_value_info($cvar);
            if ($vsettings->{cross}) {
                if($distrib->getvalue($media, $vsettings->{cross})) {
                    my %ml = map { $_ => 1 } split(/\s/, $distrib->getvalue($media, $vsettings->{cross}));
                    exists($ml{$cmedia}) or next;
                    delete($ml{$cmedia});

                    $distrib->setvalue(
                        $media,
                        $vsettings->{cross},
                        join(" ", keys %ml)
                    );
                }
            }
        } else {
            foreach my $val ($distrib->{cfg}->Parameters($media)) {
                my $vsettings = MDV::Distribconf::MediaCFG::_value_info($val);
                if ($vsettings->{ismedialist} && $distrib->getvalue($media, $val)) {
                    my %ml = map { $_ => 1 } split(/\s/, $distrib->getvalue($media, $val));
                    exists($ml{$cmedia}) or next;
                    delete($ml{$cmedia});
                    $distrib->setvalue(
                        $media,
                        $val,
                        join(" ", keys %ml)
                    );
                }
            }
        }
    }
    1;
}

=item $distrib->write_hdlists($hdlists)

Writes the F<hdlists> file to C<$hdlists>, or if no parameter is given, in
the media information directory. C<$hdlists> can be a file path or a file
handle. Returns 1 on success, 0 on error.

=cut

sub write_hdlists {
    my ($distrib, $hdlists) = @_;
    my $h_hdlists;
    if (ref $hdlists eq 'GLOB') {
        $h_hdlists = $hdlists;
    } else {
        $hdlists ||= "$distrib->{root}/$distrib->{infodir}/hdlists";
        open $h_hdlists, ">", $hdlists
	    or return 0;
    }
    foreach my $media ($distrib->listmedia) {
        printf($h_hdlists "%s%s\t%s\t%s\t%s\n",
            join('', map { "$_:" } grep { $distrib->getvalue($media, $_) } qw/askmedia suppl noauto/) || "",
            $distrib->getvalue($media, 'hdlist'),
            $distrib->getpath($media, 'path'),
            $distrib->getvalue($media, 'name'),
            $distrib->getvalue($media, 'size') ? '('.$distrib->getvalue($media, 'size'). ')' : "",
        ) or return 0;
    }
    return 1;
}

=item $distrib->write_mediacfg($mediacfg)

Write the media.cfg file into the media information directory, or into the
$mediacfg given as argument. $mediacfg can be a file path, or a glob reference
(\*STDOUT for example).

Returns 1 on success, 0 on error.

=cut

sub write_mediacfg {
    my ($distrib, $hdlistscfg) = @_;
    $hdlistscfg ||= "$distrib->{root}/$distrib->{infodir}/media.cfg";
    $distrib->{cfg}->WriteConfig($hdlistscfg);
}

=item $distrib->write_version($version)

Write the VERSION file. Returns 0 on error, 1 on success.

=cut

sub write_version {
    my ($distrib, $version) = @_;
    my $h_version;
    if (ref($version) eq 'GLOB') {
        $h_version = $version;
    } else {
        $version ||= $distrib->getfullpath(undef, 'VERSION');
        open($h_version, ">", $version) or return 0;
    }

    my @gmt = gmtime(time);

    printf($h_version "Mandriva Linux %s %s-%s-%s%s %s\n",
        $distrib->getvalue(undef, 'version') || 'cooker',
        $distrib->getvalue(undef, 'branch') || 'cooker',
        $distrib->getvalue(undef, 'arch') || 'noarch',
        $distrib->getvalue(undef, 'product'),
        $distrib->getvalue(undef, 'tag') ? '-' . $distrib->getvalue(undef, 'tag') : '',
        sprintf("%04d%02d%02d %02d:%02d", $gmt[5] + 1900, $gmt[4]+1, $gmt[3], $gmt[2], $gmt[1])
    );

    if (ref($version) ne 'GLOB') {
        close($h_version);
    }
    return 1;
}

=item $distrib->write_productid($productid)

Write the productid file. Returns 0 on error, 1 on success.

=cut

sub write_productid {
    my ($distrib, $productid) = @_;
    my $h_productid;
    if (ref($productid) eq 'GLOB') {
        $h_productid = $productid;
    } else {
        $productid ||= $distrib->getfullpath(undef, 'product.id');
        open($h_productid, ">", $productid) or return 0;
    }

    print $h_productid $distrib->getvalue(undef, 'productid') . "\n";

    if (ref($productid) ne 'GLOB') {
        close($h_productid);
    }

    return 1;
}

sub DESTROY {
    my ($self) = @_;
    return if($self->{noclean});
    foreach (@{$self->{tempfiles} || []}, keys %{$self->{tempfile} || {}}) {
        unlink($_);
    }
}

sub _first_pass {
    my ($self, $header) = @_;
    #print $header->fullname() . "\n";

    my $r = $header->dep('REQUIRENAME', 0);
    push(@{$self->{packageinfo}}, { n => scalar($header->fullname()), r => $r } );
    $r->init();
    while ($r->next() >= 0) {
        $r->flags & (1 << 24) and next; # rpmlib dep
        push(@{$self->{requires}{$r->name()}}, { id => $#{$self->{packageinfo}}, dep => $r });
    }
}

sub list_medias_exists {
    my ($self) = @_;
    grep { -d $self->getfullmediapath($_, 'path') } $self->listmedia();
}

sub clean_info {
    my ($self) = @_;
    $self->{requires} = {};
    $self->{packageinfo} = [];
    $self->{depslist} = {};
    $self->{group} = {};
    $self->{provides} = {};
    $self->{media} = {};
}

sub traverse_media {
    my ($self, $media, $callback) = @_;
    my ($onlyh, $onlyd);

    my ($hdlisttoread, $pack);
    my $dir = $self->getfullpath($media, 'path');
    if ($self->{media}{$media}{temphdlist}) {
        $hdlisttoread = $self->{media}{$media}{temphdlist};
    } elsif (-f $self->getfullmediapath($media, 'hdlist')) {
        ($onlyh, $onlyd) = MDV::Distribconf::Utils::hdlist_vs_dir(
            $self->getfullmediapath($media, 'hdlist'),
            $dir,
        );
        if (@{$onlyh || []} + @{$onlyd || []}) {
            printf(
                "Delta for %s, +%d -%d\n",
                $media,
                scalar(@{$onlyd || []}),
                scalar(@{$onlyh || []}),
            );
        }
        my @countindir = glob("$dir/*.rpm");
        if (@countindir && (@{$onlyh || []} / @countindir) < 0.50) {
            $hdlisttoread = $self->getfullmediapath($media, 'hdlist');
        } else {
            @{$onlyd} = ();
            if (opendir(my $dh, $dir)) {
                while (my $f = readdir($dh)) {
                    $f =~ /\.rpm$/ and push(@{$onlyd}, $f);
                }
                close($dh);
            }
        }
        if (@{$onlyh || []} + @{$onlyd || []}) {
            $self->{media}{$media}{unsych} = 1;
            ($self->{media}{$media}{temphdlist}, $pack) = $self->get_temp_pack(
                $self->getfullmediapath($media, 'hdlist')
            );
        }
    } else {
        if (opendir(my $dh, $dir)) {
            while (my $f = readdir($dh)) {
                $f =~ /\.rpm$/ and push(@{$onlyd}, $f);
            }
            close($dh);
        }
        $self->{media}{$media}{unsych} = 1;
        ($self->{media}{$media}{temphdlist}, $pack) = $self->get_temp_pack(
            $self->getfullmediapath($media, 'hdlist')
        );
    }
    $self->{media}{$media}{temphdlist} ||= $self->getfullmediapath($media, 'hdlist');

    my $addtopack = sub {
        my ($header) = @_;
        if ($pack) {
            my $tmp = new File::Temp( UNLINK => 1, SUFFIX => '.hdr' );
            $header->write($tmp);
            seek($tmp, 0, 0);
            $pack->add_virtual('f', scalar($header->fullname()), $tmp);
            close($tmp);
        }
    };

    my @rpmsneed = map { "$dir/" . $_ } @{$onlyd || []};
    RPM4::parserpms(
        rpms => \@rpmsneed,
        checkrpms => 0,
        callback => sub { 
            my %args = @_; 
            $args{header} or do {
                warn "invalid rpm $args{rpm}\n";
                return 1;
            };
            my $ba = ($args{rpm} =~ m:.*/([^/]*)$:)[0];
            if ($ba ne $args{header}->fullname() . ".rpm") {
                warn "$media/$ba differ of header info (" . $args{header}->fullname() . ")\n";
            }
            #printf "+ %s\n", scalar($args{header}->fullname());
            #$self->_first_pass($args{header}, $pack);
            $addtopack->($args{header});
            $callback->($args{header});
            1;
        },
    );

    if ($hdlisttoread && open(my $hz, "zcat '$hdlisttoread' 2>/dev/null |")) {
        while(my $h = RPM4::stream2header($hz)) {
            if (grep { $h->fullname() . '.rpm' eq $_} @{$onlyh || []}) {
                next;
            }
            $addtopack->($h);
            $callback->($h);
            #$self->_first_pass($args{header}, $pack);
        }
        close($hz);
    }
}

sub list_unsynch_medias {
    my ($self) = @_;
    grep { $self->{media}{$_}{unsych} } keys %{ $self->{media} || {} }
}

sub load_media {
    my ($self, $media, $callback) = @_;
    if ($self->{media}{$media}{load_done}) {
        return;
    } else {
        $self->{media}{$media}{load_done} = 1;
    }

    $callback ||= sub {};
    $self->{media}{$media}{start} = $#{$self->{packageinfo} || []} + 1;
    $self->traverse_media(
        $media,
        sub {
            $self->_first_pass($_[0]);
            $callback->($_[0]);
        }
    );
}

sub populate_media {
    my ($self, $media) = @_;
    
    if ($self->{media}{$media}{populate_done}) {
        return;
    } else {
        $self->{media}{$media}{populate_done} = 1;
    }
    $self->load_media($media);

    my $count = $self->{media}{$media}{start};
    my $synthhandle;
    if ($self->list_unsynch_medias()) {
        my $synthf = $self->get_temp_file(
            $self->getfullmediapath($media, 'synthesis')
        );

        open($synthhandle, "| gzip --best > '$synthf'");
    }

    $self->traverse_media(
        $media, 
        sub {
            my ($h) = @_;
            my $synthinfo;
            if ($synthhandle) {
                $synthinfo = {
                    fullname => scalar($h->fullname()),
                    summary => $h->tag(1004),
                    epoch => $h->tag(1003) || 0,
                    size => $h->tag(1009),
                    group => $h->tag(1016),
                    os => $h->tag('OS'),
                    hdrid => pack("H*",$h->tag('HDRID')),
                    provides => [],
                    requires => [],
                    obsoletes => [],
                    conflicts => [],
                };
            }

            push(@{$self->{group}{$h->tag('group')}}, $count);

            if (my $f = $h->files()) {
                $f->init();
                while ($f->next() >= 0) {
                    exists($self->{requires}{$f->filename}) or next;
                    push(@{$synthinfo->{requires}}, $f->filename) if ($synthinfo);
                    foreach my $po (@{$self->{requires}{$f->filename}}) {
                        exists($self->{depslist}{$po->{id}}{$count}) and next;
                        while((my $idx = $po->{dep}->next()) >= 0) {
                            if ($po->{dep}->name eq $f->filename) {
                                push(@{$self->{provides}{$f->filename}}, $count);
                                $self->{depslist}{$po->{id}}{$idx}{$count} = 1;
                                last;
                            }
                        }
                    }
                }
            }
            if (my $p = $h->dep('PROVIDENAME')) {
                $p->init();
                while ($p->next() >= 0) {
                    push(@{$self->{provides}{$p->name}}, $count);
                    if ($synthinfo) {
                        my @d = $p->info();
                        push(@{$synthinfo->{provides}}, sprintf(
                        "%s%s%s",
                        "$d[1]",
                        ($p->flags() & RPM4::flagvalue('sense', [ 'PREREQ' ])) ? '[*]' : '',
                        $d[2] ? '[' . ($d[2] eq '=' ? '==' : $d[2]) . " $d[3]\]" : '' ));
                    }
                    exists($self->{requires}{$p->name}) or next;
                    foreach my $po (@{$self->{requires}{$p->name}}) {
                        exists($self->{depslist}{$po->{id}}{$count}) and next;
                        $po->{dep}->init();
                        while((my $idx = $po->{dep}->next()) >= 0) {
                            if ($po->{dep}->overlap($p)) {
                                $self->{depslist}{$po->{id}}{$idx}{$count} = 1;
                                last;
                            }
                        }
                    }
                }
            }
            if ($synthinfo) {
            if (my $p = $self->{packageinfo}[$count]->{r}) {
                $p->init();
                while ($p->next() >= 0) {
                    $p->flags & (1 << 24) and next; # rpmlib dep
                    my @d = $p->info();
                    push(@{$synthinfo->{requires}}, sprintf(
                    "%s%s%s",
                    "$d[1]",
                    ($p->flags() & RPM4::flagvalue('sense', [ 'PREREQ' ])) ? '[*]' : '',
                    $d[2] ? '[' . ($d[2] eq '=' ? '==' : $d[2]) . " $d[3]\]" : '' ));
                }
            }
            if (my $p = $h->dep('OBSOLETENAME')) {
                $p->init();
                while ($p->next() >= 0) {
                    my @d = $p->info();
                    push(@{$synthinfo->{obsoletes}}, sprintf(
                    "%s%s%s",
                    "$d[1]",
                    ($p->flags() & RPM4::flagvalue('sense', [ 'PREREQ' ])) ? '[*]' : '',
                    $d[2] ? '[' . ($d[2] eq '=' ? '==' : $d[2]) . " $d[3]\]" : '' ));
                }
            }
            if (my $p = $h->dep('CONFLICTNAME')) {
                $p->init();
                while ($p->next() >= 0) {
                    if ($synthinfo) {
                        my @d = $p->info();
                        push(@{$synthinfo->{conflicts}}, sprintf(
                        "%s%s%s",
                        "$d[1]",
                        ($p->flags() & RPM4::flagvalue('sense', [ 'PREREQ' ])) ? '[*]' : '',
                        $d[2] ? '[' . ($d[2] eq '=' ? '==' : $d[2]) . " $d[3]\]" : '' ));
                    }
                }
            }

            foreach my $deptag (qw(provides conflicts obsoletes requires)) {
                my @deps;
                { my %uniq; @uniq{@{$synthinfo->{$deptag} || []}} = (); @deps = keys(%uniq); }
                printf($synthhandle '@%s@%s'."\n",
                $deptag,
                join('@', @deps)) if (@deps);
            }
            printf($synthhandle '@summary@%s'. "\n",
                $synthinfo->{summary},
            );
            printf($synthhandle '@info@%s@%d@%d@%s'."\n",
                $synthinfo->{fullname},
                $synthinfo->{epoch},
                $synthinfo->{size},
                $synthinfo->{group},
            );
            }

            $count++;
        }
    );
    close($synthhandle) if ($synthhandle);
}

sub set_media_size {
    my ($self, $media) = @_;
    my $size = 0;
    foreach (glob($self->getfullmediapath($media, 'path') . '/*.rpm')) {
        $size += (stat($_))[7];
    }
    my $blk = 1;
    my $showsize = $size;
    my @unit = (' ', qw(k m g));
    while (@unit) {
        my $u = shift(@unit);
        if ($size / $blk < 1) {
            last;
        }
        $showsize = sprintf('%d%s', $size / $blk, $u);
        $blk *= 1024;
    }
    $self->setvalue($media, 'size', $showsize);
}

sub set_all_medias_size {
    my ($self) = @_;
    foreach my $media ($self->list_medias_exists()) {
        $self->set_media_size($media);
    }
}

sub load_all_medias {
    my ($self) = @_;
    foreach my $media ($self->list_medias_exists()) {
        $self->load_media($media);
    }
}

sub populate_all_medias {
    my ($self) = @_;
    $self->load_all_medias();
    foreach my $media ($self->list_medias_exists()) {
        $self->populate_media($media);
    }
}

sub generate_base_files {
    my ($self) = @_;
    $self->populate_all_medias();
    $self->generate_depslist();
    $self->generate_compss();
    $self->generate_provides();
}

sub generate_depslist {
    my ($self) = @_;
    if (open(my $hdepl, '>', $self->get_temp_file($self->getfullpath(undef, 'depslist.ordered')))) {
        my %ordered;
        foreach my $id (keys %{$self->{depslist} || {}}) {
            foreach my $depindex (keys %{$self->{depslist}{$id} || {}}) {
                foreach (keys %{$self->{depslist}{$id}{$depindex} || {}}) {
                    $ordered{$_} ||= 0; $ordered{$_}++;
                }
            }
        }

        my (@ord, %map);

        foreach my $id (sort { ($ordered{$a} || 0) <=> ($ordered{$b} || 0) } (0..$#{$self->{packageinfo}})) {
            push(@ord, $id);
            $map{$id} = $#ord;
        }

        foreach my $id (@ord) {
            my $r = ${$self->{packageinfo}}[$id]->{r} or next;
            $r->init;
            my %found;
            while ((my $idx = $r->next) >= 0) {
                $r->flags & (1 << 24) and next; # rpmlib dep
                if (exists($self->{depslist}{$id}{$idx}) && $self->{depslist}{$id}{$idx}) {
                    @found{