deb: strip VCS metadata from prepared build trees
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:
@@ -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)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user