#20 productimg and buildinstall fixes
Merged 3 years ago by ausil. Opened 3 years ago by dmach.

file modified
+37

@@ -399,3 +399,40 @@ 

              ],

          }),

      ]

+ 

+ 

+ Productimg Settings

+ ===================

+ Product images are placed on installation media and provide additional branding

+ and Anaconda changes specific to product variants.

+ 

+ Options

+ -------

+ 

+ **productimg** = False

+     (*bool*) -- create product images; requires bootable=True

+ 

+ **productimg_install_class**

+     (*scm_dict*, *str*) -- reference to install class **file**

+ 

+ **productimg_po_files**

+     (*scm_dict*, *str*) -- reference to a **directory** with po files for install class translations

+ 

+ 

+ Example

+ -------

+ ::

+ 

+     productimg = True

+     productimg_install_class = {

+         "scm": "git",

+         "repo": "http://git.example.com/productimg.git",

+         "branch": None,

+         "file": "fedora23/%(variant_id)s.py",

+     }

+     productimg_po_files = {

+         "scm": "git",

+         "repo": "http://git.example.com/productimg.git",

+         "branch": None,

+         "dir": "po",

+     }

file modified
+4 -2

@@ -28,6 +28,7 @@ 

  from kobo.shortcuts import run, read_checksum_file, relative_path

  from productmd.images import Image

  

+ from pungi.arch import get_valid_arches

  from pungi.util import get_buildroot_rpms, get_volid

  from pungi.wrappers.lorax import LoraxWrapper

  from pungi.wrappers.kojiwrapper import KojiWrapper

@@ -90,11 +91,12 @@ 

              repo_baseurl = self.compose.paths.work.arch_repo(arch)

              output_dir = self.compose.paths.work.buildinstall_dir(arch)

              volid = get_volid(self.compose, arch)

+             buildarch = get_valid_arches(arch)[0]

  

              if buildinstall_method == "lorax":

-                 cmd = lorax.get_lorax_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=arch, volid=volid, nomacboot=True, noupgrade=noupgrade)

+                 cmd = lorax.get_lorax_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid, nomacboot=True, noupgrade=noupgrade)

              elif buildinstall_method == "buildinstall":

-                 cmd = lorax.get_buildinstall_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=arch, volid=volid)

+                 cmd = lorax.get_buildinstall_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid)

              else:

                  raise ValueError("Unsupported buildinstall method: %s" % buildinstall_method)

              self.pool.add(BuildinstallThread(self.pool))

file modified
+22 -5

@@ -58,9 +58,22 @@ 

  

      config_options = (

          {

-             "name": "bootable",

+             "name": "productimg",

              "expected_types": [bool],

-             "expected_values": [True],

+             "requires": (

+                 (lambda x: bool(x) is True, ["productimg_install_class"]),

+                 (lambda x: bool(x) is True, ["productimg_po_files"]),

+             ),

+         },

+         {

+             "name": "productimg_install_class",

+             "expected_types": [dict],

+             "optional": True,

+         },

+         {

+             "name": "productimg_po_files",

+             "expected_types": [dict],

+             "optional": True,

          },

      )

  

@@ -72,7 +85,11 @@ 

      def skip(self):

          if PhaseBase.skip(self):

              return True

-         if not self.compose.conf.get("bootable"):

+         if not self.compose.conf.get("productimg", False):

+             msg = "Config option 'productimg' not set. Skipping creating product images."

+             self.compose.log_debug(msg)

+             return True

+         if not self.compose.conf.get("bootable", False):

              msg = "Not a bootable product. Skipping creating product images."

              self.compose.log_debug(msg)

              return True

@@ -118,13 +135,13 @@ 

      compose.log_info("[BEGIN] %s" % msg)

  

      product_tmp = tempfile.mkdtemp(prefix="product_img_")

-     install_class = compose.conf["install_class"].copy()

+     install_class = compose.conf["productimg_install_class"].copy()

      install_class["file"] = install_class["file"] % {"variant_id": variant.id.lower()}

      install_dir = os.path.join(product_tmp, "installclasses")

      makedirs(install_dir)

      get_file_from_scm(install_class, target_path=install_dir, logger=None)

  

-     po_files = compose.conf["po_files"]

+     po_files = compose.conf["productimg_po_files"]

      po_tmp = tempfile.mkdtemp(prefix="pofiles_")

      get_dir_from_scm(po_files, po_tmp, logger=compose._logger)

      for po_file in os.listdir(po_tmp):

file modified
+12

@@ -36,12 +36,23 @@ 

          arches = get_valid_arches("x86_64", add_src=True)

          self.assertEqual(arches, ['x86_64', 'athlon', 'i686', 'i586', 'i486', 'i386', 'noarch', 'src'])

  

+     def test_armhfp(self):

+         arches = get_valid_arches("armhfp")

+         self.assertEqual(arches, ['armv7hnl', 'armv7hl', 'armv6hl', 'noarch'])

+ 

+         arches = get_valid_arches("armhfp", multilib=False)

+         self.assertEqual(arches, ['armv7hnl', 'armv7hl', 'armv6hl', 'noarch'])

+ 

+         arches = get_valid_arches("armhfp", add_src=True)

+         self.assertEqual(arches, ['armv7hnl', 'armv7hl', 'armv6hl', 'noarch', 'src'])

+ 

      def test_get_compatible_arches(self):

          self.assertEqual(get_compatible_arches("noarch"), ["noarch"])

          self.assertEqual(get_compatible_arches("i386"), get_valid_arches("i386"))

          self.assertEqual(get_compatible_arches("i586"), get_valid_arches("i386"))

          self.assertEqual(get_compatible_arches("x86_64"), get_valid_arches("x86_64", multilib=False))

          self.assertEqual(get_compatible_arches("ppc64p7"), get_valid_arches("ppc64", multilib=False))

+         self.assertEqual(get_compatible_arches("armhfp"), get_valid_arches("armv7hnl", multilib=False))

  

      def test_is_valid_arch(self):

          self.assertEqual(is_valid_arch("i386"), True)

@@ -50,6 +61,7 @@ 

          self.assertEqual(is_valid_arch("src"), True)

          self.assertEqual(is_valid_arch("nosrc"), True)

          self.assertEqual(is_valid_arch("foo"), False)

+         self.assertEqual(is_valid_arch("armhfp"), False)

  

      def test_split_name_arch(self):

          self.assertEqual(split_name_arch("package"), ("package", None))