Skip to content

Commit

Permalink
backend: worker to not call keygen for source builds
Browse files Browse the repository at this point in the history
In the commit d87321b we skipped the
"signing" job itself, but the problem also happens for downloading
pubkey from copr-keygen.

Complements: d87321b
Fixes: fedora-copr#2942
  • Loading branch information
praiskup committed Nov 6, 2023
1 parent 3a0eb1c commit c197398
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 15 additions & 0 deletions backend/copr_backend/background_worker_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
BuildBackgroundWorker class + internals.
"""

import functools
import glob
import logging
import os
Expand Down Expand Up @@ -110,6 +111,18 @@ def filter(self, record):

return 1


def skipped_for_source_build(f):
""" Mark method no-op for the source build (srpm-builds dir) """
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
if self.job.chroot == 'srpm-builds':
self.log.debug("Skipping method %s for source build", f.__name__)
return None
return f(self, *args, **kwargs)
return wrapper


class BuildBackgroundWorker(BackendBackgroundWorker):
"""
The (S)RPM build logic.
Expand Down Expand Up @@ -593,6 +606,7 @@ def _check_build_success(self):
if not os.path.exists(successfile):
raise BackendError("No success file => build failure")

@skipped_for_source_build
def _sign_built_packages(self):
"""
Sign built rpms
Expand Down Expand Up @@ -703,6 +717,7 @@ def _get_build_details(self, job):

return build_details

@skipped_for_source_build
def _add_pubkey(self):
"""
Adds pubkey.gpg with public key to ``chroot_dir`` using
Expand Down
4 changes: 0 additions & 4 deletions backend/copr_backend/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ def sign_rpms_in_dir(username, projectname, path, chroot, opts, log):
:raises: :py:class:`backend.exceptions.CoprSignError` failed to sign at least one package
"""

if chroot == 'srpm-builds':
log.info("Source builds are not signed")
return

rpm_list = [
os.path.join(path, filename)
for filename in os.listdir(path)
Expand Down

0 comments on commit c197398

Please sign in to comment.