Skip to content

Commit

Permalink
Merge pull request #65 from vmware/topic/okurth/tar-format-option
Browse files Browse the repository at this point in the history
ova-compose: add option to set tar format (default: `gnu`)
  • Loading branch information
oliverkurth committed Jun 24, 2024
2 parents 6c2bd90 + e0c5f5e commit 0018a44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ova-compose/example.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
system:
name: example
type: vmx-21
type: vmx-20
os_vmw: !param os=other4xLinux64Guest
firmware: !param firmware=efi
secure_boot: !param secure-boot=false
Expand Down
7 changes: 5 additions & 2 deletions ova-compose/ova-compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,9 +1247,10 @@ def main():
do_manifest = False
params = {}
checksum_type = "sha256"
tar_format = "gnu"

try:
opts, args = getopt.getopt(sys.argv[1:], 'f:hi:mo:q', longopts=['format=', 'input-file=', 'manifest', 'output-file=', 'param=', 'checksum-type='])
opts, args = getopt.getopt(sys.argv[1:], 'f:hi:mo:q', longopts=['format=', 'input-file=', 'manifest', 'output-file=', 'param=', 'checksum-type=', 'tar-format='])
except:
print ("invalid option")
sys.exit(2)
Expand All @@ -1268,6 +1269,8 @@ def main():
elif o in ['--param']:
k,v = a.split('=', maxsplit=1)
params[k] = yaml.safe_load(v)
elif o in ['--tar-format']:
tar_format = a
elif o in ['-q']:
do_quiet = True
elif o in ['-h']:
Expand Down Expand Up @@ -1336,7 +1339,7 @@ def main():
ovf.write_manifest(ovf_file=ovf_file, mf_file=mf_file, hash_type=checksum_type)

if output_format == "ova":
ret = subprocess.check_call(["tar", "--format=ustar", "-h",
ret = subprocess.check_call(["tar", f"--format={tar_format}", "-h",
"--owner=0", "--group=0", "--mode=0644",
"-cf",
os.path.join(pwd, output_file)] + all_files)
Expand Down

0 comments on commit 0018a44

Please sign in to comment.