@@ -125,7 +125,6 @@ struct OstreeTarWriter<'a, W: std::io::Write> {
125
125
wrote_dirtree : HashSet < String > ,
126
126
wrote_dirmeta : HashSet < String > ,
127
127
wrote_content : HashSet < String > ,
128
- wrote_xattrs : HashSet < String > ,
129
128
}
130
129
131
130
pub ( 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
142
141
}
143
142
144
143
fn 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 {
150
144
let ( first, rest) = checksum. split_at ( 2 ) ;
151
145
format ! ( "{OSTREEDIR}/repo/objects/{first}/{rest}.file-xattrs-link" ) . into ( )
152
146
}
@@ -196,7 +190,6 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
196
190
wrote_dirmeta : HashSet :: new ( ) ,
197
191
wrote_dirtree : HashSet :: new ( ) ,
198
192
wrote_content : HashSet :: new ( ) ,
199
- wrote_xattrs : HashSet :: new ( ) ,
200
193
} ;
201
194
Ok ( r)
202
195
}
@@ -225,18 +218,6 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
225
218
tar_append_default_data ( self . out , path, buf)
226
219
}
227
220
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
-
240
221
/// Write the initial /sysroot/ostree/repo structure.
241
222
fn write_repo_structure ( & mut self ) -> Result < ( ) > {
242
223
if self . wrote_initdirs {
@@ -386,24 +367,8 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
386
367
let xattrs_data = xattrs. data_as_bytes ( ) ;
387
368
let xattrs_data = xattrs_data. as_ref ( ) ;
388
369
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) ?;
407
372
408
373
Ok ( true )
409
374
}
@@ -934,17 +899,9 @@ mod tests {
934
899
935
900
#[ test]
936
901
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 ( ) {
945
902
let checksum = "b8627e3ef0f255a322d2bd9610cfaaacc8f122b7f8d17c0e7e3caafa160f9fc7" ;
946
903
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) ;
948
905
assert_eq ! ( & output, expected) ;
949
906
}
950
907
}
0 commit comments