Import xattr code from OSTree, use it to make gs_shutil_cp_a() copy xattrs

For SELinux, it's crucial that we actually copy the "security.selinux"
xattr which provides the security context.  the "cp_a" name kind of
strongly implies that we do what coreutils "cp -a" does, and this patch
moves us a lot closer to what it says on the tin.

Concretely, we now match directory modes (and ownership), and we copy
all xattrs for directories.

We're not (yet) copying xattrs for files, but sadly this is a GLib bug.

This patch will allow OSTree to simply use gs_shutil_cp_a() for merging
configuration.

Still TODO:

* Timestamps

https://bugzilla.gnome.org/show_bug.cgi?id=711058