Changeset View
Changeset View
Standalone View
Standalone View
build_files/package_spec/build_archive.py
| Context not available. | |||||
| if extension == 'zip': | if extension == 'zip': | ||||
| archive_cmd = ['zip', '-9', '-r', package_archive, package_dir] | archive_cmd = ['zip', '-9', '-r', package_archive, package_dir] | ||||
| elif extension == 'tar.bz2': | elif extension == 'tar.xz': | ||||
| archive_cmd = ['tar', 'cjf', package_archive, package_dir] | archive_cmd = ['tar', '-cI', 'xz -9', '--owner=0', '--group=0', '-f', package_archive, package_dir] | ||||
campbellbarton: The tar I'm using v1.32, has support for xz.
```
archive_cmd = ['tar', 'cJf', package_archive… | |||||
sybrenUnsubmitted Not Done Inline Actionsarchive_env = {'XZ_OPT': '-9'} should likely be replaced with archive_env = {**os.environ, 'XZ_OPT': '-9'} to get the correct semantics. When a not-None environment is passed, it completely replaces the parent environment. sybren: `archive_env = {'XZ_OPT': '-9'}` should likely be replaced with ` archive_env = {**os.environ… | |||||
campbellbartonUnsubmitted Not Done Inline ActionsThis was intentional, I didn't think it was useful/important to pass any other environment variables to tar, OTOH, it's using them at the moment. Updates patch: diff --git a/build_files/package_spec/build_archive.py b/build_files/package_spec/build_archive.py index 5ca2f319d87..d576bc8df53 100755 --- a/build_files/package_spec/build_archive.py +++ b/build_files/package_spec/build_archive.py @@ -49,15 +49,18 @@ try: if not os.path.exists(output_dir): os.mkdir(output_dir) + archive_env = os.environ.copy() + if extension == 'zip': archive_cmd = ['zip', '-9', '-r', package_archive, package_dir] - elif extension == 'tar.bz2': - archive_cmd = ['tar', 'cjf', package_archive, package_dir] + elif extension == 'tar.xz': + archive_cmd = ['tar', 'cJf', package_archive, package_dir] + archive_env['XZ_OPT'] = '-9' else: sys.stderr.write('Unknown archive extension: ' + extension) sys.exit(-1) - subprocess.call(archive_cmd) + subprocess.call(archive_cmd, env=archive_env) except Exception as ex: sys.stderr.write('Failed to create package archive: ' + str(ex) + '\n') sys.exit(1) campbellbarton: This was intentional, I didn't think it was useful/important to pass any other environment… | |||||
| else: | else: | ||||
| sys.stderr.write('Unknown archive extension: ' + extension) | sys.stderr.write('Unknown archive extension: ' + extension) | ||||
| sys.exit(-1) | sys.exit(-1) | ||||
| Context not available. | |||||
The tar I'm using v1.32, has support for xz.
To include compression level an environment variable needs to be set: