diff options
| author | Viacheslav <v.gletenko@vyos.io> | 2025-08-13 12:44:17 +0000 |
|---|---|---|
| committer | Viacheslav <v.gletenko@vyos.io> | 2025-08-19 09:50:04 +0000 |
| commit | e8705a61dfe56798f03b67dc42d141844438f94a (patch) | |
| tree | cff37626428858fe45fbdb1c480d395e56dfad22 /scripts/package-build/linux-kernel/build.py | |
| parent | 65cc12735ae8b435955e4ccf4f5ad0e1e2e99786 (diff) | |
| download | vyos-build-e8705a61dfe56798f03b67dc42d141844438f94a.tar.gz vyos-build-e8705a61dfe56798f03b67dc42d141844438f94a.zip | |
T7714: Exclude auxiliary directories from linux-kernel tarballs
Exclude auxiliary directories from linux-kernel and related to
linux-kernel tarballs
Diffstat (limited to 'scripts/package-build/linux-kernel/build.py')
| -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}") |
