#1224 config: Deprecate runroot option
Merged 4 years ago by lsedlar. Opened 4 years ago by hlin.

file modified
-5
@@ -851,10 +851,6 @@ 

      to set up your Koji client profile. In the examples, the profile name is

      "koji", which points to Fedora's koji.fedoraproject.org.

  

- **runroot** [mandatory]

-     (*bool*) -- run some tasks such as buildinstall or createiso in koji build root (True) or locally (False).

-     There might also be other runroot methods available. These can be chosen by ``runroot_method`` option.

- 

  **runroot_method**

      (*str*) -- Runroot method to use. It can further specify the runroot method

      in case the ``runroot`` is set to True.
@@ -889,7 +885,6 @@ 

  ::

  

      koji_profile = "koji"

-     runroot = True

      runroot_channel = "runroot"

      runroot_tag = "f23-build"

  

file modified
+6 -15
@@ -65,8 +65,8 @@ 

      to check for it. Additionally, the syslinux package is only available on

      x86_64 and i386.

      """

-     runroot = conf.get('runroot', False)

-     if runroot and not _will_productimg_run(conf):

+     runroot_tag = conf.get('runroot_tag', '')

+     if runroot_tag and not _will_productimg_run(conf):

          return False

      if platform.machine() not in ('x86_64', 'i686', 'i386'):

          print('Not checking for /usr/bin/isohybrid due to current architecture. '
@@ -78,8 +78,8 @@ 

  def is_genisoimage_needed(conf):

      """This is only needed locally for productimg and createiso without runroot.

      """

-     runroot = conf.get('runroot', False)

-     if runroot and not _will_productimg_run(conf):

+     runroot_tag = conf.get('runroot_tag', '')

+     if runroot_tag and not _will_productimg_run(conf):

          return False

      return True

  
@@ -564,8 +564,7 @@ 

              },

  

              "runroot": {

-                 "type": "boolean",

-                 "default": False,

+                 "deprecated": "remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally",

              },

              "runroot_method": {

                  "type": "string",
@@ -1286,7 +1285,7 @@ 

  

          "required": ["release_name", "release_short", "release_version",

                       "variants_file",

-                      "runroot", "pkgset_source",

+                      "pkgset_source",

                       "gather_method"],

          "additionalProperties": False,

      }
@@ -1383,14 +1382,6 @@ 

              (lambda x: not x, ["base_product_name", "base_product_short"]),

          ),

      },

-     "runroot": {

-         "requires": (

-             (lambda x: x, ["koji_profile", "runroot_tag", "runroot_channel"]),

-         ),

-         "conflicts": (

-             (lambda x: not x, ["runroot_tag", "runroot_channel", "runroot_weights"]),

-         ),

-     },

      "product_id": {

          "conflicts": [

              (lambda x: not x, ['product_id_allow_missing']),

file modified
+2 -3
@@ -193,7 +193,6 @@ 

          if "mount" in cmd:

              mounts.append(cmd["mount"])

  

-         runroot = compose.conf["runroot"]

          bootable = cmd['bootable']

          log_file = compose.paths.log.log_file(

              arch, "createiso-%s" % os.path.basename(cmd["iso_path"]))
@@ -203,7 +202,7 @@ 

          self.pool.log_info("[BEGIN] %s" % msg)

  

          try:

-             run_createiso_command(runroot, num, compose, bootable, arch,

+             run_createiso_command(num, compose, bootable, arch,

                                    cmd['cmd'], mounts, log_file)

          except Exception:

              self.fail(compose, cmd, variant, arch)
@@ -267,7 +266,7 @@ 

      return img

  

  

- def run_createiso_command(runroot, num, compose, bootable, arch, cmd, mounts,

+ def run_createiso_command(num, compose, bootable, arch, cmd, mounts,

                            log_file, with_jigdo=True):

      packages = ["coreutils", "genisoimage", "isomd5sum"]

      if with_jigdo and compose.conf['create_jigdo']:

file modified
+1 -1
@@ -120,7 +120,7 @@ 

          with open(script_file, 'w') as f:

              createiso.write_script(opts, f)

  

-         run_createiso_command(compose.conf["runroot"], self.num, compose, bootable, arch,

+         run_createiso_command(self.num, compose, bootable, arch,

                                ['bash', script_file], [compose.topdir],

                                log_file=compose.paths.log.log_file(

                                    arch, "extraiso-%s" % os.path.basename(iso_path)),

file modified
+1 -1
@@ -11,7 +11,7 @@ 

  

  

  # KOJI SETTINGS

- runroot = False

+ runroot_tag = ''

  

  

  # PKGSET

file modified
-1
@@ -259,7 +259,6 @@ 

      release_name='Test',

      release_version='1.0',

      variants_file='variants.xml',

-     runroot=False,

      createrepo_checksum='sha256',

      gather_method='deps',

  )

file modified
+6 -6
@@ -63,7 +63,7 @@ 

          conf = {

              'bootable': True,

              'productimg': False,

-             'runroot': True,

+             'runroot_tag': 'dummy_tag',

          }

  

          with mock.patch('sys.stdout', new_callable=StringIO) as out:
@@ -77,7 +77,7 @@ 

      def test_isohybrid_not_required_on_not_bootable(self):

          conf = {

              'bootable': False,

-             'runroot': True,

+             'runroot_tag': 'dummy_tag',

          }

  

          with mock.patch('sys.stdout', new_callable=StringIO) as out:
@@ -92,7 +92,7 @@ 

          conf = {

              'bootable': True,

              'productimg': True,

-             'runroot': True,

+             'runroot_tag': 'dummy_tag',

          }

  

          with mock.patch('sys.stdout', new_callable=StringIO) as out:
@@ -107,7 +107,7 @@ 

  

      def test_isohybrid_not_needed_in_runroot(self):

          conf = {

-             'runroot': True,

+             'runroot_tag': 'dummy_tag',

          }

  

          with mock.patch('sys.stdout', new_callable=StringIO) as out:
@@ -120,7 +120,7 @@ 

  

      def test_genisoimg_not_needed_in_runroot(self):

          conf = {

-             'runroot': True,

+             'runroot_tag': 'dummy_tag',

          }

  

          with mock.patch('sys.stdout', new_callable=StringIO) as out:
@@ -133,7 +133,7 @@ 

  

      def test_genisoimg_needed_for_productimg(self):

          conf = {

-             'runroot': True,

+             'runroot_tag': 'dummy_tag',

              'productimg': True,

              'bootable': True,

          }

file modified
+4 -10
@@ -145,7 +145,7 @@ 

  

  

  class RunrootConfigTestCase(ConfigTestCase):

-     def test_runroot_without_deps(self):

+     def test_set_runroot_true(self):

          cfg = load_config(

              PKGSET_REPOS,

              runroot=True,
@@ -153,23 +153,17 @@ 

  

          self.assertValidation(

              cfg,

-             [checks.REQUIRES.format('runroot', 'True', 'koji_profile'),

-              checks.REQUIRES.format('runroot', 'True', 'runroot_tag'),

-              checks.REQUIRES.format('runroot', 'True', 'runroot_channel')])

+             warnings=["WARNING: Config option runroot was removed and has no effect; remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally."])

  

-     def test_koji_settings_without_runroot(self):

+     def test_set_runroot_false(self):

          cfg = load_config(

              PKGSET_REPOS,

              runroot=False,

-             koji_profile='koji',

-             runroot_tag='f25',

-             runroot_channel='compose',

          )

  

          self.assertValidation(

              cfg,

-             [checks.CONFLICTS.format('runroot', 'False', 'runroot_tag'),

-              checks.CONFLICTS.format('runroot', 'False', 'runroot_channel')])

+             warnings=["WARNING: Config option runroot was removed and has no effect; remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally."])

  

  

  class BuildinstallConfigTestCase(ConfigTestCase):

@@ -149,7 +149,7 @@ 

          )

          self.assertEqual(

              rcc.call_args_list,

-             [mock.call(False, 1, compose, True, 'x86_64',

+             [mock.call(1, compose, True, 'x86_64',

                         ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')],

                         [self.topdir],

                         log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'),
@@ -205,7 +205,7 @@ 

          )

          self.assertEqual(

              rcc.call_args_list,

-             [mock.call(False, 1, compose, True, 'x86_64',

+             [mock.call(1, compose, True, 'x86_64',

                         ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')],

                         [self.topdir],

                         log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'),
@@ -261,7 +261,7 @@ 

          )

          self.assertEqual(

              rcc.call_args_list,

-             [mock.call(False, 1, compose, True, "x86_64",

+             [mock.call(1, compose, True, "x86_64",

                         ["bash", os.path.join(self.topdir, "work/x86_64/tmp-Server/extraiso-my.iso.sh")],

                         [self.topdir],

                         log_file=os.path.join(self.topdir, "logs/x86_64/extraiso-my.iso.x86_64.log"),
@@ -316,7 +316,7 @@ 

          )

          self.assertEqual(

              rcc.call_args_list,

-             [mock.call(False, 1, compose, False, 'x86_64',

+             [mock.call(1, compose, False, 'x86_64',

                         ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')],

                         [self.topdir],

                         log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'),
@@ -371,7 +371,7 @@ 

          )

          self.assertEqual(

              rcc.call_args_list,

-             [mock.call(False, 1, compose, False, 'src',

+             [mock.call(1, compose, False, 'src',

                         ['bash', os.path.join(self.topdir, 'work/src/tmp-Server/extraiso-my.iso.sh')],

                         [self.topdir],

                         log_file=os.path.join(self.topdir, 'logs/src/extraiso-my.iso.src.log'),

Why not handle this with the deprecated property in the schema? That should be able to achieve the same warning with less code.

Why not handle this with the deprecated property in the schema? That should be able to achieve the same warning with less code.

Oh, why I not use it? IIRC I tried it first at the beginning, but pungi-koji exited after emitting the warning, probably I mistakenly thought it caused by using deprecated property at that time.
Much time wasted on this. :cry:

rebased onto c4ed2bf

4 years ago

Looks good to me. :thumbsup:

Pull-Request has been merged by lsedlar

4 years ago