Skip to content

Commit

Permalink
Merge pull request #17289 from bluca/mkosi_multi_sign
Browse files Browse the repository at this point in the history
[backend]: support multi-stage signing for mkosi
  • Loading branch information
mlschroe authored Jan 27, 2025
2 parents 09f7c57 + d19fd3c commit d1c038e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/backend/BSXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ our $buildinfo = [
]],
'containerannotation', # temporary hack
'expanddebug',
'followupfile', # for two-stage builds
'followupfile', # for multi-stage builds
'signingstage', # for multi-stage builds, to avoid loops
'masterdispatched', # dispatched through a master dispatcher
'nounchanged', # do not check for "unchanged" builds
[ 'module' ], # list of modules to use
Expand Down
10 changes: 8 additions & 2 deletions src/backend/bs_signer
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,8 @@ sub signjob {
unlink("$jobdir/.checksums");

my $followupfile;
# check for followup files
if (!$info->{'followupfile'} && ($info->{'file'} || '') ne '_aggregate') {
# check for followup files, but don't allow more than 10 stages to avoid loops
if ((!$info->{'signingstage'} || $info->{'signingstage'} < 10) && ($info->{'file'} || '') ne '_aggregate') {
if (grep {/\.rsasign$/} @signfiles) {
$followupfile = (grep {/\.(spec|dsc)$/} @files)[0];
@signfiles = grep {/\.rsasign$/} @signfiles if $followupfile;
Expand Down Expand Up @@ -1074,6 +1074,12 @@ sub signjob {
# we need to create a followup job to integrate the signatures
$info->{'followupfile'} = $followupfile;
$info->{'readytime'} = time();
# to avoid loops keep track of how many stages we have done for this job
if (!$info->{'signingstage'}) {
$info->{'signingstage'} = 0;
} else {
$info->{'signingstage'}++;
}
writexml("$jobsdir/$arch/.$job", "$jobsdir/$arch/$job", $info, $BSXML::buildinfo);
updateredisjobstatus($arch, $job, $info);
unlink("$jobsdir/$arch/$job:status");
Expand Down

0 comments on commit d1c038e

Please sign in to comment.