Skip to content

Commit

Permalink
Revert D66033287
Browse files Browse the repository at this point in the history
Summary:
This diff reverts D66033287
https://fb.workplace.com/groups/registryusers/posts/977713264117672

Test Plan: NA

Reviewed By: justintrudell

Differential Revision: D66151496

fbshipit-source-id: 81b17abc2bd628215ca6e01cba85f4fae4b12751
  • Loading branch information
Dark Knight authored and facebook-github-bot committed Nov 19, 2024
1 parent bec1c95 commit 213fb92
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions antlir/antlir2/antlir2_packager/src/rpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ AutoProv: {autoprov}
spec.push_str("%files\n");
for entry in walkdir::WalkDir::new(layer) {
let entry = entry.context("while walking layer")?;
if entry.file_type().is_dir() {
continue;
}
let relpath = Path::new("/").join(
entry
.path()
Expand All @@ -286,30 +289,6 @@ AutoProv: {autoprov}
if relpath == Path::new("/") {
continue;
}
if entry.file_type().is_dir() {
let is_empty = std::fs::read_dir(entry.path())?.next().is_none();
// non-empty directories are not marked as provided in the rpm spec,
// since they are likely to conflict with other RPMs. For example,
// an rpm that installs a binary to /usr/local/bin/foo should not conflict
// with one that installs a binary to /usr/local/bin/bar, but they would
// conflict if they were both declared to provide the dir /usr/local/bin.
// On the other hand, an RPM that explicitly creates an empty directory is
// probably done intentionally, so empty directories are recorded in the spec.
if !is_empty {
continue;
}
let mut dir_path_str = relpath
.to_str()
.expect("our paths are always valid utf8")
.to_owned();
if dir_path_str.contains(" ") {
dir_path_str = format!("\"{dir_path_str}\"");
}
spec.push_str("%dir ");
spec.push_str(&dir_path_str);
spec.push('\n');
continue;
}
if !entry.file_type().is_symlink() {
let f = std::fs::File::open(entry.path())?;
#[cfg(feature = "libcap")]
Expand Down

0 comments on commit 213fb92

Please sign in to comment.