Skip to content

Commit

Permalink
Merge pull request #11608 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] automatically enable the module we're building for
  • Loading branch information
mlschroe committed Sep 13, 2021
2 parents bec6330 + 1606360 commit 6fa9c32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/backend/BSSched/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ sub setup {
my $modulemd = $pdata->{'modulemd'};
my $dependency = BSSched::Modulemd::select_dependency($bconf, $modulemd);
return ('broken', 'cannot build this module') unless $dependency;
my $errors = BSSched::Modulemd::extend_modules($bconf, $dependency->{'buildrequires'} || []);
my $errors = BSSched::Modulemd::extend_modules($bconf, $modulemd, $dependency->{'buildrequires'} || []);
return ('broken', join(', ', @$errors)) if $errors;
my $ml = BSSched::Modulemd::calc_modularitylabel($bconf, $modulemd, $dependency->{'requires'} || []);
return ('broken', 'modularitylabel calculation failed') unless $ml;
Expand Down
9 changes: 8 additions & 1 deletion src/backend/BSSched/Modulemd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,17 @@ sub check_conflicting_modules {
}

sub extend_modules {
my ($bconf, $buildrequires) = @_;
my ($bconf, $modulemd, $buildrequires) = @_;
my $pfdata = $bconf->{'buildflags:modulemdplatform'};
return [ "buildflags:modulemdplatform is not set" ] unless $pfdata;
my ($versionprefix, $distprefix, @distprovides) = split(':', $pfdata);
# automatically enable the module we're building
if (!$bconf->{'expandflags:noautoenablemodule'}) {
my $ourmodule = "$modulemd->{'name'}:$modulemd->{'stream'}";
if (!grep {$_ eq $ourmodule} @{$bconf->{'modules'} || []}) {
$bconf->{'modules'} = [ sort (@{$bconf->{'modules'}}, $ourmodule) ];
}
}
my %distprovides = map {$_ => 1} @distprovides;
my @errors = @{ check_conflicting_modules($bconf) || [] };
my @have = (@{$bconf->{'modules'} || []}, @distprovides);
Expand Down

0 comments on commit 6fa9c32

Please sign in to comment.