From 3811c0a176f102effe49e78bcec7835363b7a16a Mon Sep 17 00:00:00 2001
From: Haibo Lin <hlin@redhat.com>
Date: Jul 22 2019 08:51:38 +0000
Subject: config: Deprecate bootable option


JIRA: COMPOSE-2635
Fixes: https://pagure.io/pungi/issue/976
Signed-off-by: Haibo Lin <hlin@redhat.com>

---

diff --git a/pungi/checks.py b/pungi/checks.py
index 7073f83..17ff8b5 100644
--- a/pungi/checks.py
+++ b/pungi/checks.py
@@ -52,7 +52,7 @@ from . import util
 
 
 def _will_productimg_run(conf):
-    return conf.get('productimg', False) and conf.get('bootable', False)
+    return conf.get('productimg', False) and conf.get('buildinstall_method', '')
 
 
 def is_jigdo_needed(conf):
@@ -600,8 +600,7 @@ def make_schema():
                 "default": False,
             },
             "bootable": {
-                "type": "boolean",
-                "default": False
+                "deprecated": "remove it. Setting buildinstall_method option if you want a bootable installer"
             },
 
             "gather_method": {
@@ -1347,14 +1346,6 @@ CONFIG_DEPS = {
         ),
     },
 
-    "bootable": {
-        "requires": (
-            (lambda x: x, ["buildinstall_method"]),
-        ),
-        "conflicts": (
-            (lambda x: not x, ["buildinstall_method"]),
-        ),
-    },
     "buildinstall_method": {
         "conflicts": (
             (lambda val: val == "buildinstall", ["lorax_options"]),
diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py
index e8feea0..130f0fb 100644
--- a/pungi/phases/buildinstall.py
+++ b/pungi/phases/buildinstall.py
@@ -53,7 +53,7 @@ class BuildinstallPhase(PhaseBase):
     def skip(self):
         if PhaseBase.skip(self):
             return True
-        if not self.compose.conf.get("bootable"):
+        if not self.compose.conf.get("buildinstall_method"):
             if not self.warned_skipped:
                 msg = "Not a bootable product. Skipping buildinstall."
                 self.compose.log_debug(msg)
diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py
index 2108a45..1c9a38a 100644
--- a/pungi/phases/createiso.py
+++ b/pungi/phases/createiso.py
@@ -63,7 +63,7 @@ class CreateisoPhase(PhaseLoggerMixin, PhaseBase):
         if skip == [True]:
             # Buildinstall is skipped for this tree. Can't create a bootable ISO.
             return False
-        return self.compose.conf["bootable"]
+        return bool(self.compose.conf.get('buildinstall_method', ''))
 
     def run(self):
         symlink_isos_to = self.compose.conf.get("symlink_isos_to")
diff --git a/pungi/phases/extra_isos.py b/pungi/phases/extra_isos.py
index 9922939..d84cef9 100644
--- a/pungi/phases/extra_isos.py
+++ b/pungi/phases/extra_isos.py
@@ -86,7 +86,7 @@ class ExtraIsosThread(WorkerThread):
 
         get_extra_files(compose, variant, arch, config.get('extra_files', []))
 
-        bootable = arch != "src" and compose.conf['bootable']
+        bootable = arch != "src" and bool(compose.conf.get('buildinstall_method'))
 
         graft_points = get_iso_contents(
             compose,
diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py
index 1a7bf3a..6564963 100644
--- a/pungi/phases/pkgset/sources/source_koji.py
+++ b/pungi/phases/pkgset/sources/source_koji.py
@@ -529,7 +529,7 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event):
         comps = CompsWrapper(compose.paths.work.comps())
         for group in groups:
             packages_to_gather += comps.get_packages(group)
-    if compose.conf["gather_method"] == "nodeps" and not compose.conf.get('bootable'):
+    if compose.conf["gather_method"] == "nodeps" and not compose.conf.get('buildinstall_method'):
         populate_only_packages_to_gather = True
     else:
         populate_only_packages_to_gather = False
diff --git a/pungi/phases/product_img.py b/pungi/phases/product_img.py
index c956674..2449917 100644
--- a/pungi/phases/product_img.py
+++ b/pungi/phases/product_img.py
@@ -66,7 +66,7 @@ class ProductimgPhase(PhaseBase):
             msg = "Config option 'productimg' not set. Skipping creating product images."
             self.compose.log_debug(msg)
             return True
-        if not self.compose.conf["bootable"]:
+        if not self.compose.conf["buildinstall_method"]:
             msg = "Not a bootable product. Skipping creating product images."
             self.compose.log_debug(msg)
             return True
