deb: strip VCS metadata from prepared build trees
CI / build (push) Successful in 2m53s
CI / test (push) Skipped
CI / snap (push) Failing after 23s

Copying a git checkout verbatim into /tmp/pkh-build-*/ ships '.git',
flipping autotools' building-from-VCS detection (GNU hello's
BUILD_FROM_GIT): the shipped man page gets cleaned and regenerated
via help2man, which is correctly not in Build-Depends. Skip VCS
dirs (.git/.hg/.svn/.bzr/CVS) in local/unshare/ssh copies, and
prune them after an unshare overlayfs mount.
This commit is contained in:
2026-08-24 17:33:44 +02:00
parent 9f47e7dae8
commit 86612efb00
4 changed files with 121 additions and 0 deletions
+9
View File
@@ -173,6 +173,15 @@ fn copy_dir_recursive(src: &Path, dest: &Path) -> io::Result<()> {
for entry in std::fs::read_dir(src)? {
let entry = entry?;
let path = entry.path();
// Never ship VCS metadata into the build tree: its presence
// flips autotools 'building from VCS' detection (see
// is_vcs_dir_name) and activates maintainer-only regeneration
// rules requiring undeclared tools (e.g. help2man).
if path.symlink_metadata().map(|m| m.is_dir()).unwrap_or(false)
&& super::is_vcs_dir_name(&entry.file_name())
{
continue;
}
let dest_path = dest.join(entry.file_name());
copy_dir_recursive(&path, &dest_path)?;
}