Skip to content

Commit

Permalink
Add option to run installcheck after repository creation
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Jul 12, 2024
1 parent 2745ce6 commit 826fbff
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
10 changes: 10 additions & 0 deletions docs/build_description.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ By default only "the best" version of each rpm is taken.
Use this switch to put all candidates on the medium.
For example for maintenance repositories.

===== run_repository_check

Runs a repository closure test for each architecture. This will
report any missing dependencies.

===== enforce_repository_check

Runs a repository closure test for each architecture and
makes missing dependencies from run_repoclosure a fatal error.

===== ignore_missing_packages

Missing packages lead by default to a build failure.
Expand Down
2 changes: 2 additions & 0 deletions examples/ftp.productcompose
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ build_options:
### For maintenance, otherwise only "the best" version of each package is picked:
- take_all_available_versions
# - ignore_missing_packages
# - run_repository_check
# - enforce_repository_check
# - hide_flavor_in_product_directory_name
# - block_updates_under_embargo
# - add_slsa_provenance
Expand Down
21 changes: 18 additions & 3 deletions src/productcomposer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .core.Pool import Pool
from .wrappers import CreaterepoWrapper
from .wrappers import ModifyrepoWrapper
from .wrappers import DnfRepoclosureWrapper


__all__ = "main",
Expand Down Expand Up @@ -211,7 +212,7 @@ def get_product_dir(yml, flavor, release):
return name


def run_helper(args, cwd=None, stdout=None, stdin=None, failmsg=None):
def run_helper(args, cwd=None, fatal=True, stdout=None, stdin=None, failmsg=None):
if stdout is None:
stdout = subprocess.PIPE
if stdin is None:
Expand All @@ -220,9 +221,13 @@ def run_helper(args, cwd=None, stdout=None, stdin=None, failmsg=None):
if popen.wait():
output = popen.stdout.read()
if failmsg:
die("Failed to " + failmsg, details=output)
msg="Failed to " + failmsg
else:
die("Failed to run" + args[0], details=output)
msg="Failed to run" + args[0]
if fatal:
die(msg, details=output)
else:
print(msg, output)
return popen.stdout.read() if stdout == subprocess.PIPE else ''


Expand Down Expand Up @@ -329,6 +334,16 @@ def create_tree(outdir, product_base_dir, yml, pool, flavor, vcs=None, disturl=N
if sourcedir:
create_susedata_xml(sourcedir, yml)

if ('run_repository_check' or 'enforce_repository_check') in yml['build_options']:
import glob
for arch in yml['architectures']:
args = ['installcheck', arch, glob.glob(f"{maindir}/repodata/*primary.*")[0]]
if debugdir:
args.append(glob.glob(f"{debugdir}/repodata/*primary.*")[0])
if sourcedir:
args.append(glob.glob(f"{sourcedir}/repodata/*primary.*")[0])
run_helper(args, fatal=('enforce_repository_check' in yml['build_options']), failmsg="installcheck run")

create_updateinfo_xml(maindir, yml, pool, flavor, debugdir, sourcedir)

# Add License File and create extra .license directory
Expand Down

0 comments on commit 826fbff

Please sign in to comment.