Ignore:
Timestamp:
May 9, 2012, 3:33:18 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • pb.conf: installing project-builder requires --force-yes since the keys don't get installed into the virtual environment. (Eric Anderson from d3145b5c2c63cf9cf00ffa818fa03a432a2e6e45)
  • pb.conf.pod: Fix lots of typos (coma -> comma) Document new ftp_proxy and http_proxy options. Document the rbsmirrorsrv option (already supported, not documented) Document that sshlogin and sshport are now optional parameters; both have reasonable defaults (not in that patch, will come later) (Eric Anderson from d3145b5c2c63cf9cf00ffa818fa03a432a2e6e45)
  • Conf.pm: Use confess so when failing to get a parameter we get a stack trace. (Eric Anderson from d3145b5c2c63cf9cf00ffa818fa03a432a2e6e45)
  • Distribution.pm: Fix typo (Donwloading -> Downloading); Fix code so that you can try to setup a VE multiple times. Existing debian code would fail the second time since pb.conf would already exist. Unclear on correct semantics here; the rpm code just force overwrites the file, but the old debian code was trying not to. (Eric Anderson from d3145b5c2c63cf9cf00ffa818fa03a432a2e6e45)
  • Distribution.pm: Adding the internal function pb_distro_compare_repo to avoid code duplication between apt and yum repos treatment (Bruno Cornec)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r1505 r1507  
    1515use File::Basename;
    1616use File::Copy;
     17# requires perl 5.004 minimum in VM/VE
     18use File::Compare;
    1719
    1820# Global vars
     
    441443}
    442444
     445# Internal
     446sub pb_distro_compare_repo {
     447
     448my $src = shift;
     449my $dest = shift;
     450
     451if (-f $dest && -s $dest == 0) {
     452    pb_log(1, "Overwriting empty file $dest");
     453} elsif (-f $dest && compare("$src", $dest) == 0) {
     454    pb_log(1, "Overwriting identical file $dest");
     455} elsif (not -f $dest) {
     456    pb_log(1, "Creating new $dest");
     457} else {
     458    pb_log(0, "ERROR: destination file $dest exists and is different than source $src\n");
     459    return(0);
     460}
     461# TRUE
     462return(1);
     463}
     464
    443465=item B<pb_distro_setuprepo_gen>
    444466
     
    469491    # The repo file can be local or remote. download or copy at the right place
    470492    if (($scheme eq "ftp") || ($scheme eq "http")) {
    471         pb_system("wget -O $ENV{'PBTMP'}/$bn $i","Donwloading additional repository file $i");
     493        pb_system("wget -O $ENV{'PBTMP'}/$bn $i","Downloading additional repository file $i");
    472494    } else {
    473495        copy($i,$ENV{'PBTMP'}/$bn);
     
    484506        } elsif ($bn =~ /\.repo$/) {
    485507            # Yum repo
     508            my $dest = "/etc/yum.repos.d/$bn";
     509            return if (pb_distro_compare_repo($ENV{'PBTMP'}/$bn,$dest));
    486510            pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/yum.repos.d","Adding yum repository") if (not -f "/etc/yum.repos.d/$bn");
    487511        } elsif ($bn =~ /\.addmedia/) {
     
    490514            pb_system("chmod 755 $ENV{'PBTMP'}/$bn ; sudo $ENV{'PBTMP'}/$bn 2>&1 > /dev/null","Adding urpmi repository");
    491515        } else {
    492             pb_log(0,"Unable to deal with repository file $i on rpm distro ! Please report to dev team\n");
     516            pb_log(0,"ERROR: Unable to deal with repository file $i on rpm distro ! Please report to dev team\n");
    493517        }
    494518    } elsif ($pbos->{'type'} eq "deb") {
    495         if (($bn =~ /\.sources.list$/) && (not -f "/etc/apt/sources.list.d/$bn")) {
     519        if ($bn =~ /\.sources.list$/) {
     520            my $dest = "/etc/apt/sources.list.d/$bn";
     521            return if (pb_distro_compare_repo($ENV{'PBTMP'}/$bn,$dest));
    496522            pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/apt/sources.list.d","Adding apt repository");
    497523            pb_system("sudo apt-get update","Updating apt repository");
    498524        } else {
    499             pb_log(0,"Unable to deal with repository file $i on deb distro ! Please report to dev team\n");
     525            pb_log(0,"ERROR: Unable to deal with repository file $i on deb distro ! Please report to dev team\n");
    500526        }
    501527    } else {
    502         pb_log(0,"Unable to deal with repository file $i on that distro ! Please report to dev team\n");
     528        pb_log(0,"ERROR: Unable to deal with repository file $i on that distro ! Please report to dev team\n");
    503529    }
    504530}
Note: See TracChangeset for help on using the changeset viewer.