Skip to content

Commit

Permalink
[backend] automatically enable the module we're building for
Browse files Browse the repository at this point in the history
This is a prerequistite to putting the module information into
the :full tree.
  • Loading branch information
mlschroe committed Sep 13, 2021
1 parent 6160079 commit 1606360
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 1606360

Please sign in to comment.