Browse code

build.py: build vixdiskutil only when required

vixdiskutil is incompatible with openssl-3.x currently.
So, build it only when required.

Change-Id: I8ce7df6b01db3351f82039398cfd5ea342fa9691
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/17908

Shreenidhi Shedi authored on 2022/09/21 00:59:17
Showing 2 changed files
... ...
@@ -3,4 +3,4 @@ ifndef CONF
3 3
 endif
4 4
 
5 5
 %:
6
-	@./build.py -c $(CONF) -t $@
6
+	@python3 ./build.py -c $(CONF) -t $@
... ...
@@ -118,6 +118,14 @@ curDir = os.getcwd()
118 118
 photonDir = os.path.dirname(os.path.realpath(__file__))
119 119
 
120 120
 
121
+def build_vixdiskutil():
122
+    if not os.path.exists(f"{photonDir}/tools/bin"):
123
+        cmdUtils.runShellCmd(f"mkdir -p {photonDir}/tools/bin")
124
+
125
+    if not os.path.exists(f"{photonDir}/tools/bin/vixdiskutil"):
126
+        runShellCmd(f"make -C {photonDir}/tools/src/vixDiskUtil")
127
+
128
+
121 129
 class Build_Config:
122 130
     buildThreads = 1
123 131
     stagePath = ""
... ...
@@ -817,6 +825,8 @@ class RpmBuildTarget:
817 817
         # TODO: should be moved to top
818 818
         import DistributedBuilder
819 819
 
820
+        build_vixdiskutil()
821
+
820 822
         print("Distributed Building using kubernetes ...")
821 823
         with open(Build_Config.distributedBuildFile, "r") as configFile:
822 824
             distributedBuildConfig = json.load(configFile)
... ...
@@ -892,7 +902,6 @@ class CheckTools:
892 892
         CheckTools.create_ph_builder_img()
893 893
         CheckTools.check_photon_installer()
894 894
         CheckTools.check_contain()
895
-        CheckTools.check_vixdiskutil()
896 895
         check_prerequesite["check-pre-reqs"] = True
897 896
 
898 897
     def create_ph_builder_img():
... ...
@@ -906,15 +915,6 @@ class CheckTools:
906 906
         cmd = f"{cmd} {ph_docker_img} {ph_builder_tag}"
907 907
         runShellCmd(cmd)
908 908
 
909
-    def check_vixdiskutil():
910
-        local_build = not configdict["photon-build-param"]["start-scheduler-server"]
911
-        if constants.buildArch == "x86_64" and local_build:
912
-            if not os.path.exists(f"{photonDir}/tools/bin"):
913
-                cmdUtils.runShellCmd(f"mkdir -p {photonDir}/tools/bin")
914
-
915
-            if not os.path.exists(f"{photonDir}/tools/bin/vixdiskutil"):
916
-                runShellCmd(f"make -C {photonDir}/tools/src/vixDiskUtil")
917
-
918 909
     def check_contain():
919 910
         if not os.path.exists(f"{photonDir}/tools/bin"):
920 911
             cmdUtils.runShellCmd(f"mkdir -p {photonDir}/tools/bin")
... ...
@@ -1116,6 +1116,9 @@ class BuildImage:
1116 1116
         BuildEnvironmentSetup.photon_stage()
1117 1117
 
1118 1118
         local_build = not configdict["photon-build-param"]["start-scheduler-server"]
1119
+        if constants.buildArch == "x86_64" and local_build:
1120
+            build_vixdiskutil()
1121
+
1119 1122
         if local_build:
1120 1123
             RpmBuildTarget.ostree_repo()
1121 1124
         print(f"Building {self.img_name} image")