diff --git a/CHANGELOG.md b/CHANGELOG.md index c12a816..1312dd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Using file capabilities now adds the appropriate rpmlib() dependency +- RPM packages that use large files (>4gb) now correctly declare rpmlib() dependency ## 0.13.1 diff --git a/src/rpm/builder.rs b/src/rpm/builder.rs index 6180b44..8786307 100644 --- a/src/rpm/builder.rs +++ b/src/rpm/builder.rs @@ -817,6 +817,8 @@ impl PackageBuilder { } cpio::newc::trailer(&mut archive)?; + let large_package = combined_file_sizes > u32::MAX.into(); + self.provides .push(Dependency::eq(self.name.clone(), self.version.clone())); self.provides.push(Dependency::eq( @@ -842,6 +844,12 @@ impl PackageBuilder { self.requires .push(Dependency::rpmlib("FileCaps", "4.6.1-1".to_owned())); } + + if large_package { + self.requires + .push(Dependency::rpmlib("LargeFiles", "4.12.0-1".to_owned())); + } + // TODO: as per https://rpm-software-management.github.io/rpm/manual/users_and_groups.html, // at some point in the future this might make sense as hard requirements, but since it's a new feature, // they have to be weak requirements to avoid breaking things. @@ -934,7 +942,6 @@ impl PackageBuilder { } let offset = 0; - let small_package = combined_file_sizes <= u32::MAX.into(); let mut actual_records = vec![ // Existence of this tag is how rpm decides whether or not a package is a source rpm or binary rpm @@ -985,7 +992,13 @@ impl PackageBuilder { offset, IndexData::I18NString(vec![self.summary]), ), - if small_package { + if large_package { + IndexEntry::new( + IndexTag::RPMTAG_LONGSIZE, + offset, + IndexData::Int64(vec![combined_file_sizes]), + ) + } else { let combined_file_sizes = combined_file_sizes .try_into() .expect("combined_file_sizes should be smaller than 4 GiB"); @@ -994,12 +1007,6 @@ impl PackageBuilder { offset, IndexData::Int32(vec![combined_file_sizes]), ) - } else { - IndexEntry::new( - IndexTag::RPMTAG_LONGSIZE, - offset, - IndexData::Int64(vec![combined_file_sizes]), - ) }, IndexEntry::new( IndexTag::RPMTAG_LICENSE, @@ -1056,7 +1063,13 @@ impl PackageBuilder { // if we have an empty RPM, we have to leave out all file related index entries. if !self.files.is_empty() { - let size_entry = if small_package { + let size_entry = if large_package { + IndexEntry::new( + IndexTag::RPMTAG_LONGFILESIZES, + offset, + IndexData::Int64(file_sizes), + ) + } else { let file_sizes = file_sizes .into_iter() .map(u32::try_from) @@ -1070,12 +1083,6 @@ impl PackageBuilder { offset, IndexData::Int32(file_sizes), ) - } else { - IndexEntry::new( - IndexTag::RPMTAG_LONGFILESIZES, - offset, - IndexData::Int64(file_sizes), - ) }; actual_records.extend([ size_entry,