diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-08-19 14:21:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-19 14:21:55 +0100 |
| commit | e74d95634cbf238b133c4cf1a57d04a806162199 (patch) | |
| tree | 79a81ac6bf0b747f34bfd4d358f18fa06a2c7f10 /scripts/package-build/linux-kernel | |
| parent | 05f0a675a09fea4415bf4aa3fbf524ed1c27d719 (diff) | |
| parent | e8705a61dfe56798f03b67dc42d141844438f94a (diff) | |
| download | vyos-build-e74d95634cbf238b133c4cf1a57d04a806162199.tar.gz vyos-build-e74d95634cbf238b133c4cf1a57d04a806162199.zip | |
Merge pull request #1008 from sever-sever/T7714-kernel
T7714: Exclude auxiliary directories from linux-kernel tarballs
Diffstat (limited to 'scripts/package-build/linux-kernel')
| -rwxr-xr-x | scripts/package-build/linux-kernel/build.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py index a6323357..1d69b150 100755 --- a/scripts/package-build/linux-kernel/build.py +++ b/scripts/package-build/linux-kernel/build.py @@ -95,11 +95,21 @@ def create_tarball(package_name, source_dir=None): if not os.path.isdir(source_dir): raise FileNotFoundError(f"Directory '{source_dir}' does not exist.") + base_dir = os.path.dirname(source_dir) or '.' + dir_name = os.path.basename(source_dir) + # Create the tarball try: - shutil.make_archive(base_name=output_tarball.replace('.tar.gz', ''), format='gztar', root_dir=source_dir) + subprocess.run([ + 'tar', + f'--exclude={dir_name}/.git', + f'--exclude={dir_name}/.github', + '-czf', output_tarball, + '-C', base_dir, + dir_name + ], check=True) print(f"I: Tarball created: {output_tarball}") - except Exception as e: + except subprocess.CalledProcessError as e: print(f"I: Failed to create tarball for {package_name}: {e}") |
