Changeset 2012 in ProjectBuilder for devel/rpmbootstrap


Ignore:
Timestamp:
Oct 12, 2015, 12:17:48 PM (9 years ago)
Author:
Bruno Cornec
Message:

Adds dnf support

Starting with Fedora 22 the package manager is dnf and not yum anymore
pb needed some adaptations to support it, which have been mostly been
coded in this patch. Tests to be done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/rpmbootstrap/bin/rpmbootstrap

    r1982 r2012  
    354354    if (($pbos->{'name'} eq "fedora") && ($pbos->{'version'} > 8)) {
    355355        $oscachedir = "$vepath/var/cache/yum/$pbos->{'arch'}/$pbos->{'version'}/fedora/packages";
    356         $osupdcachedir = "$vepath/var/cache/yum/$pbos->{'arch'}/$pbos->{'version'}/updates/packages";
     356        #$osupdcachedir = "$vepath/var/cache/yum/$pbos->{'arch'}/$pbos->{'version'}/updates/packages";
    357357        $osupdcachedir = "$vepath/var/cache/yum/updates-released/packages/";
    358358    }
     359} elsif ($pbos->{'install'} =~ /dnf/) {
     360    $osupdname = "DNF";
     361    $oscachedir = "$vepath/var/cache/dnf/$pbos->{'arch'}/$pbos->{'version'}/fedora/packages";
     362    $osupdcachedir = "$vepath/var/cache/dnf/updates-released/packages/";
    359363} elsif ($pbos->{'install'} =~ /zypper/) {
    360364    $oscachedir = "$vepath/var/cache/zypp/packages/opensuse/suse/$pbos->{'arch'}";
     
    442446
    443447# yum needs that distro-release package be installed, so force it
    444 if ($pbos->{'install'} =~ /yum/) {
     448if (($pbos->{'install'} =~ /yum/) || ($pbos->{'install'} =~ /dnf/)) {
    445449    my $ddir = $pbos->{'name'};
    446450    foreach my $p1 (<$cachedir/($ddir|redhat)-release-*.rpm>) {
     
    504508
    505509pb_log(1,"Adapting $osupdname repository entries\n");
    506 if ($pbos->{'install'} =~ /yum/) {
     510if (($pbos->{'install'} =~ /yum/) || ($pbos->{'install'} =~ /dnf/)) {
    507511    #
    508     # Force the architecture for yum
     512    # Force the architecture for yum/dnf
    509513    # The goal is to allow i386 chroot on x86_64
    510514    #
    511     # FIX: Not sufficient to have yum working
     515    # FIX: Not sufficient to have yum/dnf working
    512516    # mirrorlist is not usable
    513517    # $releasever also needs to be filtered
    514518    # yum.conf as well
    515     foreach my $i (<$vepath/etc/yum.repos.d/*.repo>,"$vepath/etc/yum.conf") {
     519    foreach my $i (<$vepath/etc/yum.repos.d/*.repo>,"$vepath/etc/yum.conf","$vepath/etc/dnf/dnf.conf") {
    516520        pb_system("sed -i -e 's/\$basearch/$pbos->{'arch'}/g' $i","","quiet");
    517521        pb_system("sed -i -e 's/\$releasever/$pbos->{'version'}/g' $i","","quiet");
     
    521525        pb_system("sed -i -e 's|^#baseurl.*\$|baseurl=$repo|' $i","","quiet");
    522526    }
    523     $minipkglist = "ldconfig yum passwd vim-minimal dhclient authconfig";
     527    my $pkgmgr = "";
     528    if ($pbos->{'install'} =~ /yum/) {
     529        $pkgmgr = "yum";
     530    }
     531    if ($pbos->{'install'} =~ /dnf/) {
     532        $pkgmgr = "dnf";
     533    }
     534    $minipkglist = "ldconfig $pkgmgr passwd vim-minimal dhclient authconfig";
    524535} elsif ($pbos->{'install'} =~ /zypper/) {
    525536    pb_mkdir_p("$vepath/etc/zypp/repos.d");
     
    626637    pb_system("chroot $vepath /usr/bin/yum clean all","Cleaning yum");
    627638}
     639if ($pbos->{'install'} =~ /dnf/) {
     640    pb_system("chroot $vepath /usr/bin/dnf clean all","Cleaning dnf");
     641}
    628642pb_system("umount $vepath/proc","Unmounting /proc");
    629643find(\&unlink_old_conf, $vepath);
     
    704718my $repo = $mirror;
    705719my $found = 0;
    706 if ($pbos->{'install'} =~ /yum/) {
     720if (($pbos->{'install'} =~ /yum/) || ($pbos->{'install'} =~ /dnf/)) {
    707721    my $response1;
    708722    while ($found == 0) {
Note: See TracChangeset for help on using the changeset viewer.