#750 live-images: Honor global settings for target
Merged 8 years ago by ausil. Opened 8 years ago by lsedlar.
lsedlar/pungi live-target  into  master

file modified
+4 -6
@@ -973,11 +973,12 @@ 

   * ``image_build_ksurl``

   * ``live_images_ksurl``

  

- Target is specified by these settings. For live images refer to ``live_target``.

+ Target is specified by these settings.

  

   * ``global_target`` -- global fallback setting

   * ``live_media_target``

   * ``image_build_target``

+  * ``live_images_target``

  

  Version is specified by these options. If no version is set, a default value

  will be provided according to :ref:`automatic versioning <auto-version>`.
@@ -1006,10 +1007,6 @@ 

  Live Images Settings

  ====================

  

- **live_target**

-     (*str*) -- Koji build target for which to build the images. This gets

-     passed to ``koji spin-livecd``.

- 

  **live_images**

      (*list*) -- Configuration for the particular image. The elements of the

      list should be tuples ``(variant_uid_regex, {arch|*: config})``. The config
@@ -1019,6 +1016,7 @@ 

        * ``ksurl`` (*str*) [optional] -- where to get the kickstart from

        * ``name`` (*str*)

        * ``version`` (*str*)

+       * ``target`` (*str*)

        * ``repo`` (*str|[str]*) -- repos specified by URL or variant UID

        * ``specfile`` (*str*) -- for images wrapped in RPM

        * ``scratch`` (*bool*) -- only RPM-wrapped images can use scratch builds,
@@ -1050,7 +1048,6 @@ 

  

        * ``name`` (*str*)

        * ``version`` (*str*)

-       * ``target`` (*str*)

        * ``arches`` (*[str]*) -- what architectures to build the media for; by default uses

          all arches for the variant.

        * ``kickstart`` (*str*) -- name of the kickstart file
@@ -1060,6 +1057,7 @@ 

        * ``ksurl`` (*str*)

        * ``ksversion`` (*str*)

        * ``scratch`` (*bool*)

+       * ``target`` (*str*)

        * ``release`` (*str*) -- a string with the release, or

          ``!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN`` to automatically generate a

          suitable value. See :ref:`automatic versioning <auto-version>` for

file modified
+4 -4
@@ -462,6 +462,7 @@ 

                      "ksurl": {"type": "string"},

                      "name": {"type": "string"},

                      "subvariant": {"type": "string"},

+                     "target": {"type": "string"},

                      "version": {"type": "string"},

                      "repo": {

                          "$ref": "#/definitions/repos",
@@ -759,6 +760,7 @@ 

                  "default": False,

              },

              "live_images_ksurl": {"type": "string"},

+             "live_images_target": {"type": "string"},

              "live_images_release": {"$ref": "#/definitions/optional_string"},

              "live_images_version": {"type": "string"},

  
@@ -805,10 +807,8 @@ 

                  "default": False

              },

  

-             "live_target": {

-                 "type": "string",

-                 "default": "rhel-7.0-candidate",

-             },

+             # Deprecated in favour of regular local/phase/global setting.

+             "live_target": {"type": "string"},

  

              "tree_arches": {

                  "$ref": "#/definitions/list_of_strings",

file modified
+5 -2
@@ -92,6 +92,9 @@ 

                          "label": "",  # currently not used

                          "subvariant": subvariant,

                          "failable_arches": data.get('failable', []),

+                         # First see if live_target is specified, then fall back

+                         # to regular setup of local, phase and global setting.

+                         "target": self.compose.conf.get('live_target') or self.get_config(data, 'target'),

                      }

  

                      cmd["repos"] = self._get_repos(arch, variant, data)
@@ -161,8 +164,8 @@ 

          if cmd["specfile"] and not cmd["scratch"]:

              # Non scratch build are allowed only for rpm wrapped images

              archive = True

-         target = compose.conf["live_target"]

-         koji_cmd = koji_wrapper.get_create_image_cmd(name, version, target,

+         koji_cmd = koji_wrapper.get_create_image_cmd(name, version,

+                                                      cmd["target"],

                                                       cmd["build_arch"],

                                                       cmd["ks_file"],

                                                       cmd["repos"],

file modified
+29 -6
@@ -25,6 +25,7 @@ 

                          'kickstart': 'test.ks',

                          'repo': ['http://example.com/repo/', 'Everything', 'Server-optional'],

                          'release': None,

+                         'target': 'f27',

                      }

                  })

              ],
@@ -60,7 +61,8 @@ 

                                             'release': '20151203.t.0',

                                             'subvariant': 'Client',

                                             'failable_arches': [],

-                                            'ksurl': None},

+                                            'ksurl': None,

+                                            'target': 'f27'},

                                            compose.variants['Client'],

                                            'amd64'))])

          self.assertItemsEqual(
@@ -77,6 +79,7 @@ 

                          'kickstart': 'test.ks',

                          'repo': ['http://example.com/repo/', 'Everything'],

                          'release': None,

+                         'target': 'f27',

                      }

                  })

              ],
@@ -110,7 +113,8 @@ 

                                             'release': '20151203.t.0',

                                             'subvariant': 'Client',

                                             'failable_arches': [],

-                                            'ksurl': None},

+                                            'ksurl': None,

+                                            'target': 'f27'},

                                            compose.variants['Client'],

                                            'amd64'))])

  
@@ -124,6 +128,7 @@ 

                          'kickstart': 'test.ks',

                          'repo': ['http://example.com/repo/', 'Everything'],

                          'release': None,

+                         'target': 'f27',

                      }

                  })

              ],
@@ -157,7 +162,8 @@ 

                                             'release': '20151203.t.0',

                                             'subvariant': 'Client',

                                             'failable_arches': [],

-                                            'ksurl': None},

+                                            'ksurl': None,

+                                            'target': 'f27'},

                                            compose.variants['Client'],

                                            'amd64'))])

  
@@ -169,9 +175,11 @@ 

                      'amd64': [{

                          'kickstart': 'test.ks',

                          'repo': ['http://example.com/repo/', 'Everything'],

+                         'target': 'f27',

                      }, {

                          'kickstart': 'another.ks',

                          'repo': ['http://example.com/repo/', 'Everything'],

+                         'target': 'f27',

                      }]

                  })

              ],
@@ -205,6 +213,7 @@ 

                                             'release': None,

                                             'subvariant': 'Client',

                                             'failable_arches': [],

+                                            'target': 'f27',

                                             'ksurl': None},

                                            compose.variants['Client'],

                                            'amd64')),
@@ -226,6 +235,7 @@ 

                                             'release': None,

                                             'subvariant': 'Client',

                                             'failable_arches': [],

+                                            'target': 'f27',

                                             'ksurl': None},

                                            compose.variants['Client'],

                                            'amd64'))])
@@ -241,6 +251,7 @@ 

                          'ksurl': 'https://git.example.com/kickstarts.git?#HEAD',

                          'repo': ['http://example.com/repo/', 'Everything'],

                          'type': 'appliance',

+                         'target': 'f27',

                      }

                  })

              ],
@@ -276,6 +287,7 @@ 

                                             'release': None,

                                             'subvariant': 'Client',

                                             'failable_arches': [],

+                                            'target': 'f27',

                                             'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},

                                            compose.variants['Client'],

                                            'amd64'))])
@@ -289,6 +301,7 @@ 

              'live_images_ksurl': 'https://git.example.com/kickstarts.git?#HEAD',

              'live_images_release': None,

              'live_images_version': 'Rawhide',

+             'live_images_target': 'f27',

              'live_images': [

                  ('^Client$', {

                      'amd64': {
@@ -330,6 +343,7 @@ 

                                             'release': '20151203.t.0',

                                             'subvariant': 'Client',

                                             'failable_arches': [],

+                                            'target': 'f27',

                                             'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},

                                            compose.variants['Client'],

                                            'amd64'))])
@@ -343,6 +357,7 @@ 

              'global_ksurl': 'https://git.example.com/kickstarts.git?#HEAD',

              'global_release': None,

              'global_version': 'Rawhide',

+             'global_target': 'f27',

              'live_images': [

                  ('^Client$', {

                      'amd64': {
@@ -384,6 +399,7 @@ 

                                             'release': '20151203.t.0',

                                             'subvariant': 'Client',

                                             'failable_arches': [],

+                                            'target': 'f27',

                                             'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},

                                            compose.variants['Client'],

                                            'amd64'))])
@@ -400,6 +416,7 @@ 

                          'kickstart': 'test.ks',

                          'repo': ['http://example.com/repo/', 'Everything'],

                          'release': None,

+                         'target': 'f27',

                      }

                  })

              ],
@@ -433,6 +450,7 @@ 

                                             'release': '20151203.t.0',

                                             'subvariant': 'Client',

                                             'failable_arches': [],

+                                            'target': 'f27',

                                             'ksurl': None},

                                            compose.variants['Client'],

                                            'amd64'))])
@@ -468,6 +486,7 @@ 

              'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',

              'release': None,

              'subvariant': 'Something',

+             'target': 'f27',

          }

  

          koji_wrapper = KojiWrapper.return_value
@@ -500,7 +519,7 @@ 

          ])

          self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)])

          self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,

-                          [mock.call('test-Something-Live-amd64', '20151203.0.t', 'rhel-7.0-candidate',

+                          [mock.call('test-Something-Live-amd64', '20151203.0.t', 'f27',

                                      'amd64', '/path/to/ks_file',

                                      ['/repo/amd64/Client',

                                       'http://example.com/repo/',
@@ -547,6 +566,7 @@ 

              'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE',

              'release': None,

              'subvariant': 'Client',

+             'target': 'f27',

          }

  

          koji_wrapper = KojiWrapper.return_value
@@ -579,7 +599,7 @@ 

          ])

          self.assertEqual(run.mock_calls, [mock.call(write_manifest_cmd)])

          self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,

-                          [mock.call('test-Client-Live-amd64', '20151203.0.t', 'rhel-7.0-candidate',

+                          [mock.call('test-Client-Live-amd64', '20151203.0.t', 'f27',

                                      'amd64', '/path/to/ks_file',

                                      ['/repo/amd64/Client',

                                       'http://example.com/repo/',
@@ -627,6 +647,7 @@ 

              'ksurl': None,

              'release': None,

              'subvariant': 'Client',

+             'target': 'f27',

          }

  

          koji_wrapper = KojiWrapper.return_value
@@ -655,7 +676,7 @@ 

  

          self.assertEqual(run.mock_calls, [])

          self.assertEqual(koji_wrapper.get_create_image_cmd.mock_calls,

-                          [mock.call('test-Client-Disk-amd64', '20151203.0.t', 'rhel-7.0-candidate',

+                          [mock.call('test-Client-Disk-amd64', '20151203.0.t', 'f27',

                                      'amd64', '/path/to/ks_file',

                                      ['/repo/amd64/Client',

                                       'http://example.com/repo/',
@@ -703,6 +724,7 @@ 

              'release': 'xyz',

              'type': 'live',

              'failable_arches': ['*'],

+             'target': 'f27',

          }

  

          koji_wrapper = KojiWrapper.return_value
@@ -747,6 +769,7 @@ 

              'release': 'xyz',

              'type': 'live',

              'failable_arches': ['*'],

+             'target': 'f27',

          }

  

          koji_wrapper = KojiWrapper.return_value

Instead of the old default value and custom handling introduce new option live_images_target (for consistency with other phases) and use the usual inheritance rules.

Fixes: https://pagure.io/pungi/issue/749

Pull-Request has been merged by ausil

8 years ago