@@ -125,7 +125,6 @@ struct OstreeTarWriter<'a, W: std::io::Write> {
125125 wrote_dirtree : HashSet < String > ,
126126 wrote_dirmeta : HashSet < String > ,
127127 wrote_content : HashSet < String > ,
128- wrote_xattrs : HashSet < String > ,
129128}
130129
131130pub ( crate ) fn object_path ( objtype : ostree:: ObjectType , checksum : & str ) -> Utf8PathBuf {
@@ -142,11 +141,6 @@ pub(crate) fn object_path(objtype: ostree::ObjectType, checksum: &str) -> Utf8Pa
142141}
143142
144143fn v1_xattrs_object_path ( checksum : & str ) -> Utf8PathBuf {
145- let ( first, rest) = checksum. split_at ( 2 ) ;
146- format ! ( "{OSTREEDIR}/repo/objects/{first}/{rest}.file-xattrs" ) . into ( )
147- }
148-
149- fn v1_xattrs_link_object_path ( checksum : & str ) -> Utf8PathBuf {
150144 let ( first, rest) = checksum. split_at ( 2 ) ;
151145 format ! ( "{OSTREEDIR}/repo/objects/{first}/{rest}.file-xattrs-link" ) . into ( )
152146}
@@ -196,7 +190,6 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
196190 wrote_dirmeta : HashSet :: new ( ) ,
197191 wrote_dirtree : HashSet :: new ( ) ,
198192 wrote_content : HashSet :: new ( ) ,
199- wrote_xattrs : HashSet :: new ( ) ,
200193 } ;
201194 Ok ( r)
202195 }
@@ -225,18 +218,6 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
225218 tar_append_default_data ( self . out , path, buf)
226219 }
227220
228- /// Add an hardlink entry with default permissions (root/root 0644)
229- fn append_default_hardlink ( & mut self , path : & Utf8Path , link_target : & Utf8Path ) -> Result < ( ) > {
230- let mut h = tar:: Header :: new_gnu ( ) ;
231- h. set_entry_type ( tar:: EntryType :: Link ) ;
232- h. set_uid ( 0 ) ;
233- h. set_gid ( 0 ) ;
234- h. set_mode ( 0o644 ) ;
235- h. set_size ( 0 ) ;
236- self . out . append_link ( & mut h, path, link_target) ?;
237- Ok ( ( ) )
238- }
239-
240221 /// Write the initial /sysroot/ostree/repo structure.
241222 fn write_repo_structure ( & mut self ) -> Result < ( ) > {
242223 if self . wrote_initdirs {
@@ -386,24 +367,8 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
386367 let xattrs_data = xattrs. data_as_bytes ( ) ;
387368 let xattrs_data = xattrs_data. as_ref ( ) ;
388369
389- let xattrs_checksum = {
390- let digest = openssl:: hash:: hash ( openssl:: hash:: MessageDigest :: sha256 ( ) , xattrs_data) ?;
391- hex:: encode ( digest)
392- } ;
393-
394- let path = v1_xattrs_object_path ( & xattrs_checksum) ;
395- // Write xattrs content into a separate `.file-xattrs` object.
396- if !self . wrote_xattrs . contains ( & xattrs_checksum) {
397- let inserted = self . wrote_xattrs . insert ( xattrs_checksum) ;
398- debug_assert ! ( inserted) ;
399- self . append_default_data ( & path, xattrs_data) ?;
400- }
401- // Write a `.file-xattrs-link` which links the file object to
402- // the corresponding detached xattrs.
403- {
404- let link_obj_path = v1_xattrs_link_object_path ( checksum) ;
405- self . append_default_hardlink ( & link_obj_path, & path) ?;
406- }
370+ let path = v1_xattrs_object_path ( & checksum) ;
371+ self . append_default_data ( & path, xattrs_data) ?;
407372
408373 Ok ( true )
409374 }
@@ -934,17 +899,9 @@ mod tests {
934899
935900 #[ test]
936901 fn test_v1_xattrs_object_path ( ) {
937- let checksum = "b8627e3ef0f255a322d2bd9610cfaaacc8f122b7f8d17c0e7e3caafa160f9fc7" ;
938- let expected = "sysroot/ostree/repo/objects/b8/627e3ef0f255a322d2bd9610cfaaacc8f122b7f8d17c0e7e3caafa160f9fc7.file-xattrs" ;
939- let output = v1_xattrs_object_path ( checksum) ;
940- assert_eq ! ( & output, expected) ;
941- }
942-
943- #[ test]
944- fn test_v1_xattrs_link_object_path ( ) {
945902 let checksum = "b8627e3ef0f255a322d2bd9610cfaaacc8f122b7f8d17c0e7e3caafa160f9fc7" ;
946903 let expected = "sysroot/ostree/repo/objects/b8/627e3ef0f255a322d2bd9610cfaaacc8f122b7f8d17c0e7e3caafa160f9fc7.file-xattrs-link" ;
947- let output = v1_xattrs_link_object_path ( checksum) ;
904+ let output = v1_xattrs_object_path ( checksum) ;
948905 assert_eq ! ( & output, expected) ;
949906 }
950907}
0 commit comments