Browse code

Architecture dependent package installation

This involves using an extra key apart from 'packages'
such as 'packages_x86_64' and maintaining architecture
dependent packages under that key.

This solves issue of package installation failure when
installed on different architecture.

For ex - 'grub2-pc' is built for x86_64 and not for aarch64.
So, while installing developer version in arm grub2-pc should
not be included in list of packages to install.

Change-Id: Ia277dcd6f5afbfbb4c479ff69fb09a581cb22cfa
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/11520
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>

Piyush Gupta authored on 2020/10/16 22:08:19
Showing 4 changed files
... ...
@@ -798,7 +798,7 @@ class BuildImage:
798 798
             rpmBuildTarget.packages_rt()
799 799
         else:
800 800
             rpmBuildTarget.packages_minimal()
801
-        if self.img_name == "rt-iso" or "minimal-iso" and not check_prerequesite["packages-initrd"]:
801
+        if self.img_name in ["rt-iso", "minimal-iso"] and not check_prerequesite["packages-initrd"]:
802 802
             rpmBuildTarget.packages_initrd()
803 803
         if not check_prerequesite["create-repo"]:
804 804
             RpmBuildTarget.create_repo()
... ...
@@ -9,7 +9,6 @@
9 9
                  "git",
10 10
                  "tar",
11 11
                  "grub2",
12
-                 "grub2-pc",
13 12
                  "grub2-efi",
14 13
                  "less",
15 14
                  "device-mapper",
... ...
@@ -21,5 +20,6 @@
21 21
                  "texinfo",
22 22
                  "wget",
23 23
                  "sudo"
24
-                 ]
24
+                 ],
25
+    "packages_x86_64":["grub2-pc"]
25 26
 }
... ...
@@ -171,7 +171,10 @@ class Installer(object):
171 171
                 plf = os.path.join(os.path.dirname(__file__), plf)
172 172
             json_wrapper_package_list = JsonWrapper(plf)
173 173
             package_list_json = json_wrapper_package_list.read()
174
-            packages.extend(package_list_json["packages"])
174
+            if "packages_" + install_config['arch'] in package_list_json:
175
+                packages.extend(package_list_json["packages"] + package_list_json["packages_"+install_config['arch']])
176
+            else:
177
+                packages.extend(package_list_json["packages"])
175 178
 
176 179
         if 'additional_packages' in install_config:
177 180
             packages.extend(install_config['additional_packages'])
... ...
@@ -35,7 +35,13 @@ class PackageSelector(object):
35 35
             json_wrapper_package_list = JsonWrapper(os.path.join(output_data_path,
36 36
                                                 option['packagelist_file']))
37 37
             package_list_json = json_wrapper_package_list.read()
38
+
39
+            import platform
40
+            platform_packages = "packages_" + platform.machine()
41
+            if platform_packages in package_list_json:
42
+                return package_list_json["packages"] + package_list_json[platform_packages]
38 43
             return package_list_json["packages"]
44
+
39 45
         elif 'packages' in option:
40 46
             return option["packages"]
41 47
         else: