Skip to content

Commit d2a1ec1

Browse files
committed
T7714: Exclude auxiliary directories from linux-kernel tarballs
Exclude auxiliary directories from linux-kernel and related to linux-kernel tarballs
1 parent 65cc127 commit d2a1ec1

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • scripts/package-build/linux-kernel

scripts/package-build/linux-kernel/build.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,20 @@ def create_tarball(package_name, source_dir=None):
9595
if not os.path.isdir(source_dir):
9696
raise FileNotFoundError(f"Directory '{source_dir}' does not exist.")
9797

98+
base_dir = os.path.dirname(source_dir) or '.'
99+
dir_name = os.path.basename(source_dir)
100+
98101
# Create the tarball
99102
try:
100-
shutil.make_archive(base_name=output_tarball.replace('.tar.gz', ''), format='gztar', root_dir=source_dir)
103+
subprocess.run([
104+
'tar',
105+
f'--exclude={dir_name}/.*',
106+
'-czf', output_tarball,
107+
'-C', base_dir,
108+
dir_name
109+
], check=True)
101110
print(f"I: Tarball created: {output_tarball}")
102-
except Exception as e:
111+
except subprocess.CalledProcessError as e:
103112
print(f"I: Failed to create tarball for {package_name}: {e}")
104113

105114

0 commit comments

Comments
 (0)