diff options
author | Jonathan Lebon <jlebon@redhat.com> | 2018-02-01 22:32:32 +0000 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-02-06 15:38:20 +0000 |
commit | 2e95e0661616786a0f7fc53fd6ce4504c7aecbe0 (patch) | |
tree | 025cd785c687f212c4adfd006b7ae5b9b6b11c8c /src/libostree/ostree-core.c | |
parent | 6bed64764856a46dde0749ea68f4111d8ec34bdb (diff) | |
download | ostree-2e95e0661616786a0f7fc53fd6ce4504c7aecbe0.tar.gz |
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
Diffstat (limited to 'src/libostree/ostree-core.c')
-rw-r--r-- | src/libostree/ostree-core.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index 7d7a08d7..f35714ce 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -1687,6 +1687,26 @@ _ostree_stbuf_to_gfileinfo (const struct stat *stbuf) } /** + * _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 * @b: Second file info |