Ignore:
Timestamp:
Feb 20, 2017, 7:40:38 AM (7 years ago)
Author:
Bruno Cornec
Message:

Solve an issue with dependency optimization

When adding a new repo, we may have some packages which are updates from
already installed packages. In order for them to be updated, we need to
invalidate the optimisation computed on the deps so that all packages are
analyzed again, not just te one not installed yet.
This requires a modification of the interface of the functions
pb_distro_installdeps and pb_distro_getdeps so that they support a new
forcedep parameter which trigger the full analyze vs the optimized one.
This fix is mandatory for python-redfish package build on Mageia 5.

File:
1 edited

Legend:

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

    r2181 r2182  
    331331
    332332This function install the dependencies required to build the package on a distro.
    333 Dependencies can be passed as a parameter in which case they are not computed
     333If $forcerepo is defined then do not assumer package are alredy installed, but reinstall them
     334(useful if you add a repo which contains more up to date packages that you need)
     335Dependencies can be passed as the 4th parameter in which case they are not computed
    334336
    335337=cut
     
    340342my $f = shift;
    341343my $pbos = shift;
    342 my $deps = shift;
     344my $forcerepo = shift;
     345my $deps = shift;   # optional list of deps to install
    343346
    344347# Protection
    345348confess "Missing install command for $pbos->{name}-$pbos->{version}-$pbos->{arch}" unless (defined $pbos->{install} && $pbos->{install} =~ /\w/);
    346349pb_apply_conf_proxy($pbos);
    347 
    348 # Get dependencies in the build file if not forced
    349 $deps = pb_distro_getdeps($f,$pbos) if (not defined $deps);
    350350pb_log(1, "ftp_proxy=$ENV{ftp_proxy}\n") if (defined $ENV{ftp_proxy});
    351351pb_log(1, "http_proxy=$ENV{http_proxy}\n")  if (defined $ENV{http_proxy});
     352
     353# Get dependencies in the build file if not forced
     354$deps = pb_distro_getdeps($f,$pbos, $forcerepo) if ((not defined $deps) || (defined $forcerepo));
    352355pb_log(2,"deps: $deps\n");
    353356return if ((not defined $deps) || ($deps =~ /^\s*$/));
     
    361364}
    362365# Check that all deps have been installed correctly
    363 $deps = pb_distro_getdeps($f, $pbos);
     366$deps = pb_distro_getdeps($f, $pbos, $forcerepo);
    364367confess "Some dependencies did not install ($deps)" if ((defined $deps) && ($deps =~ /\S/) && ($Global::pb_stop_on_error));
    365368}
     
    375378my $f = shift;
    376379my $pbos = shift;
     380my $forcerepo = shift;
    377381
    378382my $regexp = "";
     
    453457$/ = $oldsep;
    454458pb_log(2,"now deps: $deps\n");
    455 my $deps2 = pb_distro_only_deps_needed($pbos,$deps);
    456 return($deps2);
     459if (defined $forcerepo) {
     460    # We want to force installation of all pkgs
     461    # because a repo was setup in between, which may contains updated versions
     462    pb_log(0,"Forcing installation of all packages due to previous repo setup\n");
     463    return($deps);
     464} else {
     465    pb_log(0,"Installation of only necessary packages\n");
     466    my $deps2 = pb_distro_only_deps_needed($pbos,$deps);
     467    return($deps2);
     468}
    457469}
    458470
     
    516528my $pbos = shift;
    517529
    518 pb_distro_setuprepo_gen($pbos,pb_distro_conffile(),"osrepo");
     530return(pb_distro_setuprepo_gen($pbos,pb_distro_conffile(),"osrepo"));
    519531}
    520532
     
    529541my $pbos = shift;
    530542
    531 pb_distro_setuprepo_gen($pbos,"$ENV{'PBDESTDIR'}/pbrc","addrepo");
     543return(pb_distro_setuprepo_gen($pbos,"$ENV{'PBDESTDIR'}/pbrc","addrepo"));
    532544}
    533545
     
    566578my $pbkey = shift;
    567579
    568 return if (not defined $pbconf);
    569 return if (not defined $pbkey);
     580return undef if (not defined $pbconf);
     581return undef if (not defined $pbkey);
    570582my ($addrepo) = pb_conf_read($pbconf,$pbkey);
    571 return if (not defined $addrepo);
     583return undef if (not defined $addrepo);
    572584
    573585my $param = pb_distro_get_param($pbos,$addrepo);
    574 return if ($param eq "");
     586return undef if ($param eq "");
    575587
    576588pb_apply_conf_proxy($pbos);
     
    615627            }
    616628            my $dest = "$dirdest/$bn";
    617             return if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1);
     629            return undef if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1);
    618630            confess "Missing directory $dirdest ($reponame)" unless (-d $dirdest);
    619631            pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding $reponame repository") if (not -f "$dest");
     
    657669    }
    658670}
    659 return;
     671return("forcerepo");
    660672}
    661673
Note: See TracChangeset for help on using the changeset viewer.