Browse code

Change tar format for ami,gce

Change-Id: I28c7852c57cda698f41f85a1c913be3b10809efe
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1671
Reviewed-by: suezzelur <anishs@vmware.com>
Tested-by: suezzelur <anishs@vmware.com>

suezzelur authored on 2016/11/12 05:19:34
Showing 1 changed files
... ...
@@ -149,13 +149,14 @@ if __name__ == '__main__':
149 149
         utils.runshellcommand("mount -o bind /sys {}".format(options.mount_path + "/sys"))
150 150
 
151 151
         if 'additionalfiles' in config:
152
+            print "  Copying additional files into the raw image ..."
152 153
             for filetuples in config['additionalfiles']:
153 154
                 for src,dest in filetuples.iteritems():
154 155
                     shutil.copyfile(options.build_scripts_path + '/' + options.image_name + '/' + src, options.mount_path + '/' + dest)
155 156
 
156 157
 
157 158
         if 'postinstallscripts' in config:
158
-            print "Running post install scripts ..."
159
+            print "  Running post install scripts ..."
159 160
             if not os.path.exists(options.mount_path + "/tempscripts"):
160 161
                 os.mkdir(options.mount_path + "/tempscripts")
161 162
             for script in config['postinstallscripts']:
... ...
@@ -171,6 +172,10 @@ if __name__ == '__main__':
171 171
         utils.runshellcommand("umount -l {}".format(options.mount_path + "/proc"))
172 172
         utils.runshellcommand("umount -l {}".format(options.mount_path))
173 173
 
174
+        mount_out = utils.runshellcommand("mount")
175
+        print "List of mounted devices:"
176
+        print mount_out
177
+
174 178
     finally:
175 179
         utils.runshellcommand("kpartx -d {}".format(disk_device))
176 180
         utils.runshellcommand("losetup -d {}".format(disk_device))
... ...
@@ -196,12 +201,13 @@ if __name__ == '__main__':
196 196
         if config['artifacttype'] == 'tgz':
197 197
             print "Generating the tar.gz artifact ..."
198 198
             tarname = img_path + '/photon-' + options.image_name + '-' + photon_release_ver + '-' + photon_build_num + '.tar.gz'
199
-            tgzout = tarfile.open(tarname, "w:gz", format = tarfile.USTAR_FORMAT)
199
+            tgzout = tarfile.open(tarname, "w:gz")
200 200
             tgzout.add(raw_image, arcname=os.path.basename(raw_image))
201 201
             tgzout.close()
202 202
         elif config['artifacttype'] == 'vhd':
203
-            imgconverter = tools_bin_path + '/imgconverter'
203
+            imgconverter = options.tools_bin_path + '/imgconverter'
204 204
             vhdname = img_path + '/photon-' + options.image_name + '-' + photon_release_ver + '-' + photon_build_num + '.vhd'
205
+            print "Converting raw disk to vhd ..."
205 206
             utils.runshellcommand("{} -i {} -v vhd -o {}".format(imgconverter, raw_image, vhdname))
206 207
         elif config['artifacttype'] == 'ova':
207 208
             create_ova_image(raw_image, options.tools_bin_path, options.build_scripts_path + '/' + options.image_name, config)
... ...
@@ -232,6 +238,11 @@ if __name__ == '__main__':
232 232
                         utils.runshellcommand("chroot {} /bin/bash -c '/tempscripts/{}'".format(custom_path, script))
233 233
                         shutil.rmtree(custom_path + "/tempscripts", ignore_errors=True)
234 234
                         utils.runshellcommand("umount -l {}".format(custom_path))
235
+
236
+                        mount_out = utils.runshellcommand("mount")
237
+                        print "List of mounted devices:"
238
+                        print mount_out
239
+
235 240
                         utils.runshellcommand("kpartx -d {}".format(disk_device))
236 241
                         utils.runshellcommand("losetup -d {}".format(disk_device))
237 242
                         create_ova_image(raw_image_custom, options.tools_bin_path, options.build_scripts_path + '/' + options.image_name, config)