#253 Allow setting the "check_deps" Pungi option using the "check_deps" compose flag.
Merged 3 months ago by jkaluza. Opened 3 months ago by jkaluza.
jkaluza/odcs repoclosure-flag  into  master

file modified
+1

@@ -136,6 +136,7 @@ 

  - `flags` - List of flags to further modify the compose output:

      - `no_deps` - For `tag` `source_type`, do not resolve dependencies between packages and include only packages listed in the `packages` in the compose. For `module` `source_type`, do not resolve dependencies between modules and include only the requested module in the compose.

      - `include_unpublished_pulp_repos` - For `pulp` `source_type`, include also unpublished repositories for input content-sets.

+     - `check_deps` - When set, abort the compose when some package has broken dependencies.

  - `sigkeys` - List of signature keys IDs. Only packages signed by one of these keys will be included in a compose. If there is no signed version of a package, compose will fail. It is also possible to pass an empty-string in a list meaning unsigned packages are allowed. For example if you want to prefer packages signed by key with ID `123` and also allow unsigned packages to appear in a compose, you can do it by setting sigkeys to `["123", ""]`.

  - `results` - List of additional results which will be generated as part of a compose. Valid keys are:

      - `iso` - Generates non-installable ISO files with RPMs from a compose.

@@ -99,6 +99,8 @@ 

      "no_inheritance": 2,

      # For "pulp" source_type, include unpublished Pulp repos.

      "include_unpublished_pulp_repos": 4,

+     # Abort the compose when some package has broken dependencies.

+     "check_deps": 8,

  }

  

  INVERSE_COMPOSE_FLAGS = {v: k for k, v in COMPOSE_FLAGS.items()}

file modified
+3 -1

@@ -76,7 +76,7 @@ 

  {%- if config.comps_file %}

  comps_file = '{{ config.comps_file }}'

  {%- endif %}

- check_deps = False

+ check_deps = {{ config.check_deps }}

  greedy_method = 'build'

  

  # CREATEREPO

@@ -110,3 +110,5 @@ 

  

  koji_profile = '{{ config.koji_profile }}'

  

+ repoclosure_strictness = [('.*', {'*': 'off'})]

+ 

@@ -642,7 +642,7 @@ 

                                      arches=compose.arches.split(" "),

                                      multilib_arches=multilib_arches,

                                      multilib_method=compose.multilib_method,

-                                     builds=builds)

+                                     builds=builds, flags=compose.flags)

              if compose.flags & COMPOSE_FLAGS["no_deps"]:

                  pungi_cfg.gather_method = "nodeps"

              if compose.flags & COMPOSE_FLAGS["no_inheritance"]:

file modified
+5 -2

@@ -36,7 +36,7 @@ 

  from odcs.server import comps

  from odcs.common.types import (

      PungiSourceType, COMPOSE_RESULTS, MULTILIB_METHODS,

-     INVERSE_PUNGI_SOURCE_TYPE_NAMES)

+     INVERSE_PUNGI_SOURCE_TYPE_NAMES, COMPOSE_FLAGS)

  from odcs.server.utils import makedirs, clone_repo, copytree

  

  

@@ -112,7 +112,8 @@ 

  class PungiConfig(BasePungiConfig):

      def __init__(self, release_name, release_version, source_type, source,

                   packages=None, arches=None, sigkeys=None, results=0,

-                  multilib_arches=None, multilib_method=0, builds=None):

+                  multilib_arches=None, multilib_method=0, builds=None,

+                  flags=0):

          self.release_name = release_name

          self.release_version = release_version

          self.bootable = False

@@ -166,6 +167,8 @@ 

          else:

              raise ValueError("Unknown source_type %r" % source_type)

  

+         self.check_deps = flags & COMPOSE_FLAGS["check_deps"]

+ 

      @property

      def source_type_str(self):

          return INVERSE_PUNGI_SOURCE_TYPE_NAMES[self.source_type]

file modified
+21 -1

@@ -34,7 +34,7 @@ 

  import odcs.server.pungi

  from odcs.server import conf, db

  from odcs.server.models import Compose

- from odcs.common.types import COMPOSE_STATES, COMPOSE_RESULTS

+ from odcs.common.types import COMPOSE_STATES, COMPOSE_RESULTS, COMPOSE_FLAGS

  from odcs.server.utils import makedirs

  from .utils import ConfigPatcher, AnyStringWith, ModelsBaseTest

  

@@ -156,6 +156,26 @@ 

              cfg = self._load_pungi_cfg(template)

              self.assertTrue(cfg["pkgset_koji_inherit"])

  

+     def test_get_pungi_conf_check_deps(self):

+         _, mock_path = tempfile.mkstemp()

+         template_path = os.path.abspath(os.path.join(test_dir,

+                                                      "../conf/pungi.conf"))

+         shutil.copy2(template_path, mock_path)

+ 

+         with patch("odcs.server.pungi.conf.pungi_conf_path", mock_path):

+             pungi_cfg = PungiConfig("MBS-512", "1", PungiSourceType.KOJI_TAG,

+                                     "f26")

+ 

+             template = pungi_cfg.get_pungi_config()

+             cfg = self._load_pungi_cfg(template)

+             self.assertFalse(cfg["check_deps"])

+ 

+             pungi_cfg = PungiConfig("MBS-512", "1", PungiSourceType.KOJI_TAG,

+                                     "f26", flags=COMPOSE_FLAGS["check_deps"])

+             template = pungi_cfg.get_pungi_config()

+             cfg = self._load_pungi_cfg(template)

+             self.assertTrue(cfg["check_deps"])

+ 

      def test_get_pungi_conf_multilib(self):

          _, mock_path = tempfile.mkstemp()

          template_path = os.path.abspath(os.path.join(test_dir,

This is needed when user wants to abort the compose in case the dependencies
between packages cannot be satisfied. This is not the default behaviour, but
it is useful when creating compose for tests.

Actually this is not correct, the option works for each variant and arch separately. The value should be [('.*': {'*': 'off'})] to apply to everything.

rebased onto b0f5821

3 months ago

rebased onto fe2be4f

3 months ago

Pull-Request has been merged by jkaluza

3 months ago