Skip to content

Commit

Permalink
Merge pull request #14785 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] support to have a different bcntsynctag for each repository
  • Loading branch information
mlschroe committed Aug 9, 2023
2 parents b3601bb + a293668 commit c3dfad7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/backend/BSSched/BuildJob.pm
Original file line number Diff line number Diff line change
Expand Up @@ -832,10 +832,10 @@ sub addjobhist {
=cut

sub nextbcnt {
my ($ctx, $packid, $pdata) = @_;
my ($ctx, $packid, $pdata, $info) = @_;

return undef unless defined $packid;
return 1 unless exists $pdata->{'versrel'},;
return 1 unless exists $pdata->{'versrel'};
my $h;
my $gdst = $ctx->{'gdst'};
my $relsyncmax = $ctx->{'relsyncmax'};
Expand All @@ -846,7 +846,7 @@ sub nextbcnt {
$h = {'bcnt' => 0} unless $h;

# max with sync data
my $tag = $pdata->{'bcntsynctag'} || $packid;
my $tag = $pdata->{'bcntsynctag'} || ($info || {})->{'bcntsynctag'} || $packid;
if ($relsyncmax && $relsyncmax->{"$tag/$pdata->{'versrel'}"}) {
if ($h->{'bcnt'} + 1 < $relsyncmax->{"$tag/$pdata->{'versrel'}"}) {
$h->{'bcnt'} = $relsyncmax->{"$tag/$pdata->{'versrel'}"} - 1;
Expand Down Expand Up @@ -896,7 +896,7 @@ sub create_jobdata {
if (defined($packid) && exists($pdata->{'versrel'})) {
$binfo->{'versrel'} = $pdata->{'versrel'};
# find the last build count we used for this version/release
my $bcnt = nextbcnt($ctx, $packid, $pdata);
my $bcnt = nextbcnt($ctx, $packid, $pdata, $info);
$binfo->{'bcnt'} = $bcnt;
my $release = $pdata->{'versrel'};
$release = '0' unless defined $release;
Expand Down
9 changes: 8 additions & 1 deletion src/backend/BSSched/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ sub calcrelsynctrigger {
my $gctx = $ctx->{'gctx'};
my $gdst = $ctx->{'gdst'};
my $projid = $ctx->{'project'};
my $repoid = $ctx->{'repository'};

if ($ctx->{'conf'}->{'buildflags:norelsync'}) {
$ctx->{'relsynctrigger'} = {};
Expand All @@ -887,8 +888,14 @@ sub calcrelsynctrigger {
if ($relsyncmax && -s "$gdst/:relsync") {
my $relsync = BSUtil::retrieve("$gdst/:relsync", 2);
for my $packid (sort keys %$pdatas) {
my $tag = $pdatas->{$packid}->{'bcntsynctag'} || $packid;
next unless $relsync->{$packid};
my $pdata = $pdatas->{$packid};
my $tag = $pdata->{$packid};
if (!$tag) {
my $info = (grep {$_->{'repository'} eq $repoid} @{$pdata->{'info'} || []})[0];
$tag = $info->{'bcntsynctag'} if $info;
}
$tag ||= $packid;
next unless $relsync->{$packid} =~ /(.*)\.(\d+)$/;
next unless defined($relsyncmax->{"$tag/$1"}) && $2 < $relsyncmax->{"$tag/$1"};
$relsynctrigger{$packid} = 1;
Expand Down
1 change: 1 addition & 0 deletions src/backend/BSXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ our $packinfo = [
'nosrcpkgs', # kiwi
'nativebuild', # cross build: native
'hasbuildenv',
'bcntsynctag',
[[ 'path' =>
'project',
'repository',
Expand Down
8 changes: 7 additions & 1 deletion src/backend/bs_sched
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ sub sendrelsyncupdate {
my $relsyncmax = {};
for my $packid (sort keys %$relsync) {
next unless $relsync->{$packid} =~ /^(.*)\.([^-]*)$/;
my $tag = ($packs->{$packid} || {})->{'bcntsynctag'} || $packid;
my $pdata = $packs->{$packid} || {};
my $tag = $pdata->{'bcntsynctag'};
if (!$tag) {
my $info = (grep {$_->{'repository'} eq $repoid} @{$pdata->{'info'} || []})[0];
$tag = $info->{'bcntsynctag'} if $info;
}
$tag ||= $packid;
next if defined($relsyncmax->{"$tag/$1"}) && $relsyncmax->{"$tag/$1"} >= $2;
$relsyncmax->{"$tag/$1"} = $2;
}
Expand Down
1 change: 1 addition & 0 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,7 @@ sub getprojpack {
$rinfo->{'alsonative'} = $d->{'alsonative'} if @{$d->{'alsonative'} || []};
$rinfo->{'nativebuild'} = 1 if $d->{'nativebuild'};
$rinfo->{'constraint'} = $d->{'buildconstraint'} if @{$d->{'buildconstraint'} || []};
$rinfo->{'bcntsynctag'} = $d->{'bcntsynctag'} if $d->{'bcntsynctag'};
# add all source services to be used at build time
if ($files->{'_service'}) {
my $services = BSRevision::revreadxml($rev, '_service', $files->{'_service'}, $BSXML::services, 1) || {};
Expand Down

0 comments on commit c3dfad7

Please sign in to comment.