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
@@ -19,6 +19,8 @@ class AptManager(PackageManager):
|
|||||||
env: Dict[str, str] = {}
|
env: Dict[str, str] = {}
|
||||||
if non_interactive:
|
if non_interactive:
|
||||||
env["DEBIAN_FRONTEND"] = "noninteractive"
|
env["DEBIAN_FRONTEND"] = "noninteractive"
|
||||||
|
env["NEEDRESTART_MODE"] = "a"
|
||||||
|
env["NEEDRESTART_SUSPEND"] = "1"
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def refresh_repositories(self) -> CommandResult:
|
def refresh_repositories(self) -> CommandResult:
|
||||||
|
|||||||
@@ -160,16 +160,24 @@ class PackageBuilder:
|
|||||||
shutil.copy2(str(control_dir / "control"), str(debian_meta / "control"))
|
shutil.copy2(str(control_dir / "control"), str(debian_meta / "control"))
|
||||||
subprocess.run(["dpkg-deb", "-b", str(pkg_tree), str(deb_output_path)], check=True)
|
subprocess.run(["dpkg-deb", "-b", str(pkg_tree), str(deb_output_path)], check=True)
|
||||||
else:
|
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"
|
ctrl_tar = root / "control.tar.gz"
|
||||||
data_tar = root / "data.tar.gz"
|
data_tar = root / "data.tar.gz"
|
||||||
|
|
||||||
with tarfile.open(str(ctrl_tar), "w:gz") as tar:
|
with tarfile.open(str(ctrl_tar), "w:gz", format=tarfile.GNU_FORMAT) as tar:
|
||||||
tar.add(str(control_dir / "control"), arcname="./control")
|
tar.add(str(control_dir / "control"), arcname="./control", filter=reset_tarinfo)
|
||||||
|
|
||||||
with tarfile.open(str(data_tar), "w:gz") as tar:
|
with tarfile.open(str(data_tar), "w:gz", format=tarfile.GNU_FORMAT) as tar:
|
||||||
for item in data_dir.iterdir():
|
for item in sorted(data_dir.iterdir()):
|
||||||
tar.add(str(item), arcname=f"./{item.name}")
|
tar.add(str(item), arcname=f"./{item.name}", filter=reset_tarinfo)
|
||||||
|
|
||||||
create_native_deb(ctrl_tar, data_tar, deb_output_path)
|
create_native_deb(ctrl_tar, data_tar, deb_output_path)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user