fix(apt,packaging): add needrestart non-interactive env vars and enforce GNU tar format for dpkg compatibility
This commit is contained in:
1 parent
44c9423166
commit
76c6a2fc5f
2 files changed
+16
-6
No files matched your search
@@ -160,16 +160,24 @@ class PackageBuilder:
|
||||
shutil.copy2(str(control_dir / "control"), str(debian_meta / "control"))
|
||||
subprocess.run(["dpkg-deb", "-b", str(pkg_tree), str(deb_output_path)], check=True)
|
||||
else:
|
||||
# Pure Python build
|
||||
# Pure Python build with strict GNU_FORMAT (dpkg rejects PAX 'x' headers)
|
||||
def reset_tarinfo(tarinfo):
|
||||
tarinfo.uid = 0
|
||||
tarinfo.gid = 0
|
||||
tarinfo.uname = "root"
|
||||
tarinfo.gname = "root"
|
||||
tarinfo.pax_headers = {}
|
||||
return tarinfo
|
||||
|
||||
ctrl_tar = root / "control.tar.gz"
|
||||
data_tar = root / "data.tar.gz"
|
||||
|
||||
with tarfile.open(str(ctrl_tar), "w:gz") as tar:
|
||||
tar.add(str(control_dir / "control"), arcname="./control")
|
||||
with tarfile.open(str(ctrl_tar), "w:gz", format=tarfile.GNU_FORMAT) as tar:
|
||||
tar.add(str(control_dir / "control"), arcname="./control", filter=reset_tarinfo)
|
||||
|
||||
with tarfile.open(str(data_tar), "w:gz") as tar:
|
||||
for item in data_dir.iterdir():
|
||||
tar.add(str(item), arcname=f"./{item.name}")
|
||||
with tarfile.open(str(data_tar), "w:gz", format=tarfile.GNU_FORMAT) as tar:
|
||||
for item in sorted(data_dir.iterdir()):
|
||||
tar.add(str(item), arcname=f"./{item.name}", filter=reset_tarinfo)
|
||||
|
||||
create_native_deb(ctrl_tar, data_tar, deb_output_path)
|
||||
|
||||
|
||||
Reference in new issue
Block a user