lib/checkout: add filter API to skip over files
This is analogous to the filtering support for the commit API: we allow library users to skip over checking out specific files. This is useful in some tricky situations where we *know* that the files to be checked out will conflict with existing files in subtle ways. One such example is in rpm-ostree support for multilib. There, we want to allow checking out a package onto an existing tree, but skipping over files that are not coloured to our preferred value (e.g. not overwriting an i686 version of `ldconfig` if we already have the `x86_64` version). See https://github.com/projectatomic/rpm-ostree/pull/1227 for details. Closes: #1441 Approved by: cgwalters
This commit is contained in:
1 parent
6bed647648
commit
2e95e06616
7 files changed
+226
-31
No files matched your search
@@ -1686,6 +1686,26 @@ _ostree_stbuf_to_gfileinfo (const struct stat *stbuf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* _ostree_gfileinfo_to_stbuf:
|
||||
* @file_info: File info
|
||||
* @out_stbuf: (out): stat buffer
|
||||
*
|
||||
* Map GFileInfo data from @file_info onto @out_stbuf.
|
||||
*/
|
||||
void
|
||||
_ostree_gfileinfo_to_stbuf (GFileInfo *file_info,
|
||||
struct stat *out_stbuf)
|
||||
{
|
||||
struct stat stbuf = {0,};
|
||||
stbuf.st_mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
|
||||
stbuf.st_uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
|
||||
stbuf.st_gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid");
|
||||
if (S_ISREG (stbuf.st_mode))
|
||||
stbuf.st_size = g_file_info_get_attribute_uint64 (file_info, "standard::size");
|
||||
*out_stbuf = stbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* _ostree_gfileinfo_equal:
|
||||
* @a: First file info
|
||||
|
||||
Reference in new issue
Block a user