New upstream version 2017.6

This commit is contained in:
Simon McVittie 2017-05-24 19:00:16 +01:00
commit e3060b1b87
168 changed files with 5181 additions and 3686 deletions

View File

@ -38,6 +38,12 @@ libostree_public_headers = \
src/libostree/ostree-repo-deprecated.h \
$(NULL)
if ENABLE_EXPERIMENTAL_API
libostree_public_headers += \
src/libostree/ostree-remote.h \
$(NULL)
endif
# This one is generated via configure.ac, and the gtk-doc
# code hence needs to look in the builddir.
libostree_public_built_headers = src/libostree/ostree-version.h

View File

@ -94,6 +94,8 @@ libostree_1_la_SOURCES = \
src/libostree/ostree-linuxfsutil.c \
src/libostree/ostree-diff.c \
src/libostree/ostree-mutable-tree.c \
src/libostree/ostree-remote.c \
src/libostree/ostree-remote-private.h \
src/libostree/ostree-repo.c \
src/libostree/ostree-repo-checkout.c \
src/libostree/ostree-repo-commit.c \
@ -113,6 +115,7 @@ libostree_1_la_SOURCES = \
src/libostree/ostree-sysroot-cleanup.c \
src/libostree/ostree-sysroot-deploy.c \
src/libostree/ostree-sysroot-upgrader.c \
src/libostree/ostree-impl-system-generator.c \
src/libostree/ostree-bootconfig-parser.c \
src/libostree/ostree-deployment.c \
src/libostree/ostree-bootloader.h \
@ -146,6 +149,11 @@ libostree_1_la_SOURCES += \
src/libostree/ostree-tls-cert-interaction.h \
$(NULL)
endif
if !ENABLE_EXPERIMENTAL_API
libostree_1_la_SOURCES += \
src/libostree/ostree-remote.h \
$(NULL)
endif
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_OPENSSL_CFLAGS) \
@ -156,7 +164,15 @@ libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la libostree-kernel-ar
libostree_1_la_LIBADD += $(bupsplitpath)
EXTRA_libostree_1_la_DEPENDENCIES = $(top_srcdir)/src/libostree/libostree.sym
EXTRA_DIST += src/libostree/libostree.sym
EXTRA_DIST += \
src/libostree/libostree.sym \
src/libostree/libostree-experimental.sym \
$(NULL)
if ENABLE_EXPERIMENTAL_API
libostree_1_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libostree/libostree-experimental.sym
EXTRA_libostree_1_la_DEPENDENCIES += $(top_srcdir)/src/libostree/libostree-experimental.sym
endif
if USE_LIBARCHIVE
libostree_1_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)

View File

@ -27,6 +27,7 @@ ostree_prepare_root_SOURCES = \
src/switchroot/ostree-mount-util.h \
src/switchroot/ostree-prepare-root.c \
$(NULL)
ostree_prepare_root_CPPFLAGS = $(AM_CPPFLAGS)
if BUILDOPT_USE_STATIC_COMPILER
# ostree-prepare-root can be used as init in a system without a populated /lib.
@ -45,7 +46,6 @@ ostree-prepare-root : $(ostree_prepare_root_SOURCES)
$(STATIC_COMPILER) -o $@ -static $(ostree_prepare_root_SOURCES) $(AM_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES)
else
ostree_boot_PROGRAMS += ostree-prepare-root
ostree_prepare_root_CFLAGS = $(AM_CFLAGS) -Isrc/switchroot
endif
@ -53,4 +53,19 @@ ostree_remount_SOURCES = \
src/switchroot/ostree-mount-util.h \
src/switchroot/ostree-remount.c \
$(NULL)
ostree_remount_CFLAGS = $(AM_CFLAGS) -Isrc/switchroot
ostree_remount_CPPFLAGS = $(AM_CPPFLAGS) -Isrc/switchroot
# This is the "new mode" of using a generator for /var; see
# https://github.com/ostreedev/ostree/issues/855
if BUILDOPT_SYSTEMD_AND_LIBMOUNT
ostree_prepare_root_CPPFLAGS += -DHAVE_SYSTEMD_AND_LIBMOUNT=1
ostree_remount_CPPFLAGS += -DHAVE_SYSTEMD_AND_LIBMOUNT=1
systemdsystemgenerator_PROGRAMS = ostree-system-generator
GITIGNOREFILES += $(systemdsystemgenerator_PROGRAMS)
ostree_system_generator_SOURCES = src/switchroot/ostree-mount-util.h \
src/switchroot/ostree-system-generator.c
ostree_system_generator_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libglnx -I$(srcdir)/src/libostree
ostree_system_generator_CFLAGS = $(AM_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
ostree_system_generator_LDADD = $(AM_LDFLAGS) libglnx.la libostree-1.la $(OT_INTERNAL_GIO_UNIX_LIBS)
endif

View File

@ -34,6 +34,7 @@ TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \
LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd)$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}} \
PATH=$$(cd $(top_builddir)/tests && pwd):$${PATH} \
OSTREE_FEATURES="$(OSTREE_FEATURES)" \
$(NULL)
if BUILDOPT_ASAN
TESTS_ENVIRONMENT += OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc
@ -42,12 +43,20 @@ endif
uninstalled_test_data = tests/ostree-symlink-stamp tests/ostree-prepare-root-symlink-stamp \
tests/ostree-remount-symlink-stamp tests/rofiles-fuse-symlink-stamp
dist_uninstalled_test_scripts = tests/test-symbols.sh
dist_uninstalled_test_scripts = tests/test-symbols.sh tests/coccinelle.sh
dist_test_scripts = \
# This logic implements ENABLE_INSTALLED_TESTS_EXCLUSIVE; see below.
# The goal here if installed tests are enabled, we explicitly make the
# tests *only* run installed, to avoid having to run them twice in CI.
# This overrides the glib-tap.mk emphasis on doing both, if we'd
# used e.g. `dist_test_scripts`.
dist_test_scripts = $(NULL)
test_programs = $(NULL)
_installed_or_uninstalled_test_scripts = \
tests/test-basic.sh \
tests/test-basic-user.sh \
tests/test-basic-user-only.sh \
tests/test-basic-root.sh \
tests/test-pull-subpath.sh \
tests/test-archivez.sh \
tests/test-remote-add.sh \
@ -68,7 +77,6 @@ dist_test_scripts = \
tests/test-pull-resume.sh \
tests/test-pull-repeated.sh \
tests/test-pull-untrusted.sh \
tests/test-pull-many.sh \
tests/test-pull-override-url.sh \
tests/test-local-pull.sh \
tests/test-local-pull-depth.sh \
@ -88,7 +96,6 @@ dist_test_scripts = \
tests/test-admin-pull-deploy-split.sh \
tests/test-admin-locking.sh \
tests/test-admin-deploy-clean.sh \
tests/test-repo-checkout-subpath.sh \
tests/test-reset-nonlinear.sh \
tests/test-oldstyle-partial.sh \
tests/test-delta.sh \
@ -100,23 +107,23 @@ dist_test_scripts = \
tests/test-switchroot.sh \
tests/test-pull-contenturl.sh \
tests/test-pull-mirrorlist.sh \
tests/coccinelle.sh \
tests/test-summary-view.sh \
$(NULL)
if BUILDOPT_FUSE
dist_test_scripts += tests/test-rofiles-fuse.sh
_installed_or_uninstalled_test_scripts += tests/test-rofiles-fuse.sh
else
EXTRA_DIST += tests/test-rofiles-fuse.sh
endif
if USE_LIBSOUP
dist_test_scripts += tests/test-remote-cookies.sh
_installed_or_uninstalled_test_scripts += tests/test-remote-cookies.sh
endif
# These call into gjs scripts
js_tests = tests/test-corruption.sh tests/test-pull-corruption.sh
if BUILDOPT_GJS
dist_test_scripts += $(js_tests)
_installed_or_uninstalled_test_scripts += $(js_tests)
else
EXTRA_DIST += $(js_tests)
endif
@ -127,6 +134,7 @@ dist_installed_test_data = tests/archive-test.sh \
tests/basic-test.sh \
tests/pre-endian-deltas-repo-big.tar.xz \
tests/pre-endian-deltas-repo-little.tar.xz \
tests/libtest-core.sh \
$(NULL)
EXTRA_DIST += tests/libtest.sh
@ -179,7 +187,7 @@ if !ENABLE_INSTALLED_TESTS
libreaddir_rand_la_LDFLAGS += -rpath $(abs_builddir)
endif
test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \
_installed_or_uninstalled_test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \
tests/test-keyfile-utils tests/test-ot-opt-utils tests/test-ot-tool-util \
tests/test-gpg-verify-result tests/test-checksum tests/test-lzma tests/test-rollsum \
tests/test-basic-c tests/test-sysroot-c tests/test-pull-c
@ -188,7 +196,7 @@ test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tes
noinst_PROGRAMS += tests/test-rollsum-cli
if USE_LIBARCHIVE
test_programs += tests/test-libarchive-import
_installed_or_uninstalled_test_programs += tests/test-libarchive-import
endif
common_tests_cflags = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx
@ -285,6 +293,17 @@ tests/%-symlink-stamp: % Makefile
ln -sf "$${real_bin}" tests/$*; \
touch $@
# See above comment on binding the tests to be either installed or not.
if ENABLE_INSTALLED_TESTS_EXCLUSIVE
dist_installed_test_scripts = $(_installed_or_uninstalled_test_scripts)
installed_test_programs = $(_installed_or_uninstalled_test_programs)
check-local:
echo "NOTE: Exclusive installed tests are enabled; to run them, make install, then: gnome-desktop-testing-runner -p 0 libostree/"
else
dist_test_scripts += $(_installed_or_uninstalled_test_scripts)
test_programs += $(_installed_or_uninstalled_test_programs)
endif
# Unfortunately the glib test data APIs don't actually handle
# non-recursive Automake, so we change our code to canonically look
# for tests/ which is just a symlink when installed.

View File

@ -19,7 +19,7 @@ include Makefile-decls.am
shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||')
OSTREE_GITREV=$(shell if command -v git >/dev/null 2>&1 && test -d $(srcdir)/.git; then git describe --abbrev=42 --tags --always HEAD; fi)
OSTREE_GITREV=$(shell cd $(srcdir) && if command -v git >/dev/null 2>&1 && test -d .git; then git describe --abbrev=42 --tags --always HEAD; fi)
ACLOCAL_AMFLAGS = -I buildutil -I libglnx ${ACLOCAL_FLAGS}
AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
@ -113,11 +113,11 @@ include Makefile-boot.am
include Makefile-man.am
release-tag:
git tag -m "Release $(VERSION)" v$(VERSION)
cd $(srcdir) && git $(srcdir) tag -m "Release $(VERSION)" v$(VERSION)
embed_dependency=tar -C $(srcdir) --append --exclude='.git/*' --transform="s,^embedded-dependencies/,ostree-embeddeps-$${GITVERSION}/embedded-dependencies/," --file=$${TARFILE_TMP}
git_version_rpm = $$(git describe | sed -e 's,-,\.,g' -e 's,^v,,')
git_version_rpm = $$(cd $(srcdir) && git describe | sed -e 's,-,\.,g' -e 's,^v,,')
release-tarball-embedded:
set -x; \

File diff suppressed because it is too large Load Diff

View File

@ -120,6 +120,7 @@ include $(top_srcdir)/gtk-doc.make
EXTRA_DIST += \
version.xml \
ostree-sections.txt \
ostree-experimental-sections.txt \
$(NULL)
-include $(top_srcdir)/git.mk

View File

@ -130,6 +130,10 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_1 = \
@ENABLE_EXPERIMENTAL_API_TRUE@ src/libostree/ostree-remote.h \
@ENABLE_EXPERIMENTAL_API_TRUE@ $(NULL)
subdir = apidoc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/buildutil/attributes.m4 \
@ -352,31 +356,26 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemgeneratordir = @systemdsystemgeneratordir@
systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
libostree_public_headers = \
src/libostree/ostree.h \
libostree_public_headers = src/libostree/ostree.h \
src/libostree/ostree-async-progress.h \
src/libostree/ostree-autocleanups.h \
src/libostree/ostree-core.h \
src/libostree/ostree-dummy-enumtypes.h \
src/libostree/ostree-mutable-tree.h \
src/libostree/ostree-repo.h \
src/libostree/ostree-types.h \
src/libostree/ostree-repo-file.h \
src/libostree/ostree-diff.h \
src/libostree/ostree-repo.h src/libostree/ostree-types.h \
src/libostree/ostree-repo-file.h src/libostree/ostree-diff.h \
src/libostree/ostree-gpg-verify-result.h \
src/libostree/ostree-sepolicy.h \
src/libostree/ostree-sysroot.h \
src/libostree/ostree-sepolicy.h src/libostree/ostree-sysroot.h \
src/libostree/ostree-sysroot-upgrader.h \
src/libostree/ostree-deployment.h \
src/libostree/ostree-bootconfig-parser.h \
src/libostree/ostree-repo-deprecated.h \
$(NULL)
src/libostree/ostree-repo-deprecated.h $(NULL) $(am__append_1)
# This one is generated via configure.ac, and the gtk-doc
# code hence needs to look in the builddir.
@ -499,7 +498,7 @@ SETUP_FILES = \
# This includes the standard gtk-doc make rules, copied by gtkdocize.
EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) version.xml \
ostree-sections.txt $(NULL)
ostree-sections.txt ostree-experimental-sections.txt $(NULL)
DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \
html-build.stamp pdf-build.stamp \
sgml.stamp html.stamp pdf.stamp

View File

@ -14,7 +14,7 @@
<div class="titlepage">
<div>
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">OSTree API references</p></th></tr></table></div>
<div><p class="releaseinfo">for OSTree 2017.4</p></div>
<div><p class="releaseinfo">for OSTree 2017.6</p></div>
</div>
<hr>
</div>

View File

@ -881,7 +881,7 @@
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">OstreeRepoCommitIterResult</span>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitIterResult" title="enum OstreeRepoCommitIterResult"><span class="returnvalue">OstreeRepoCommitIterResult</span></a>
</td>
<td class="function_name">
<a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-commit-traverse-iter-next" title="ostree_repo_commit_traverse_iter_next ()">ostree_repo_commit_traverse_iter_next</a> <span class="c_punctuation">()</span>
@ -1044,6 +1044,18 @@
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoResolveRevExtFlags" title="enum OstreeRepoResolveRevExtFlags">OstreeRepoResolveRevExtFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoListRefsExtFlags" title="enum OstreeRepoListRefsExtFlags">OstreeRepoListRefsExtFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitState" title="enum OstreeRepoCommitState">OstreeRepoCommitState</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitFilterResult" title="enum OstreeRepoCommitFilterResult">OstreeRepoCommitFilterResult</a></td>
</tr>
<tr>
@ -1076,6 +1088,14 @@
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitTraverseFlags" title="enum OstreeRepoCommitTraverseFlags">OstreeRepoCommitTraverseFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitIterResult" title="enum OstreeRepoCommitIterResult">OstreeRepoCommitIterResult</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoPruneFlags" title="enum OstreeRepoPruneFlags">OstreeRepoPruneFlags</a></td>
</tr>
<tr>
@ -1971,7 +1991,10 @@ ostree_repo_remote_fetch_summary_with_options
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Like <a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-remote-fetch-summary" title="ostree_repo_remote_fetch_summary ()"><code class="function">ostree_repo_remote_fetch_summary()</code></a>, but supports an extensible set of flags.
The following are currently defined:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>override-url (s): Fetch summary from this URL if remote specifies no metalink in options</p></li></ul></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>override-url (s): Fetch summary from this URL if remote specifies no metalink in options</p></li>
<li class="listitem"><p>http-headers (a(ss)): Additional headers to add to all HTTP requests</p></li>
</ul></div>
<div class="refsect3">
<a name="ostree-repo-remote-fetch-summary-with-options.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
@ -2504,8 +2527,8 @@ arguments.</p>
</tr>
<tr>
<td class="parameter_name"><p>checksum</p></td>
<td class="parameter_description"><p>The checksum to point it to</p></td>
<td class="parameter_annotations"> </td>
<td class="parameter_description"><p> The checksum to point it to. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/nullable"><span class="acronym">nullable</span></a>]</span></td>
</tr>
</tbody>
</table></div>
@ -2558,8 +2581,8 @@ be made to the repository.</p>
</tr>
<tr>
<td class="parameter_name"><p>checksum</p></td>
<td class="parameter_description"><p>The checksum to point it to</p></td>
<td class="parameter_annotations"> </td>
<td class="parameter_description"><p> The checksum to point it to. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/nullable"><span class="acronym">nullable</span></a>]</span></td>
</tr>
</tbody>
</table></div>
@ -3349,7 +3372,7 @@ is true and it does not exist. </p></td>
ostree_repo_resolve_rev_ext (<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *refspec</code></em>,
<em class="parameter"><code><span class="type">gboolean</span> allow_noent</code></em>,
<em class="parameter"><code><span class="type">OstreeRepoResolveRevExtFlags</span> flags</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoResolveRevExtFlags" title="enum OstreeRepoResolveRevExtFlags"><span class="type">OstreeRepoResolveRevExtFlags</span></a> flags</code></em>,
<em class="parameter"><code><span class="type">char</span> **out_rev</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Look up the given refspec, returning the checksum it references in
@ -3461,7 +3484,7 @@ refspecs which have <em class="parameter"><code>refspec_prefix</code></em>
ostree_repo_list_refs_ext (<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *refspec_prefix</code></em>,
<em class="parameter"><code><span class="type">GHashTable</span> **out_all_refs</code></em>,
<em class="parameter"><code><span class="type">OstreeRepoListRefsExtFlags</span> flags</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoListRefsExtFlags" title="enum OstreeRepoListRefsExtFlags"><span class="type">OstreeRepoListRefsExtFlags</span></a> flags</code></em>,
<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>If <em class="parameter"><code>refspec_prefix</code></em>
@ -3621,11 +3644,11 @@ result in <em class="parameter"><code>out_variant</code></em>
ostree_repo_load_commit (<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *checksum</code></em>,
<em class="parameter"><code><span class="type">GVariant</span> **out_commit</code></em>,
<em class="parameter"><code><span class="type">OstreeRepoCommitState</span> *out_state</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitState" title="enum OstreeRepoCommitState"><span class="type">OstreeRepoCommitState</span></a> *out_state</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>A version of <a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-load-variant" title="ostree_repo_load_variant ()"><code class="function">ostree_repo_load_variant()</code></a> specialized to commits,
capable of returning extended state information. Currently
the only extended state is <code class="literal">OSTREE_REPO_COMMIT_STATE_PARTIAL</code>, which
the only extended state is <a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-STATE-PARTIAL:CAPS"><code class="literal">OSTREE_REPO_COMMIT_STATE_PARTIAL</code></a>, which
means that only a sub-path of the commit is available.</p>
<div class="refsect3">
<a name="ostree-repo-load-commit.parameters"></a><h4>Parameters</h4>
@ -5734,7 +5757,7 @@ ostree_repo_commit_traverse_iter_get_dir
<em class="parameter"><code><span class="type">char</span> **out_content_checksum</code></em>,
<em class="parameter"><code><span class="type">char</span> **out_meta_checksum</code></em>);</pre>
<p>Return information on the current directory. This function may
only be called if <code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_DIR</code> was returned
only be called if <a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-DIR:CAPS"><code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_DIR</code></a> was returned
from <a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-commit-traverse-iter-next" title="ostree_repo_commit_traverse_iter_next ()"><code class="function">ostree_repo_commit_traverse_iter_next()</code></a>.</p>
<div class="refsect3">
<a name="ostree-repo-commit-traverse-iter-get-dir.parameters"></a><h4>Parameters</h4>
@ -5778,7 +5801,7 @@ ostree_repo_commit_traverse_iter_get_file
<em class="parameter"><code><span class="type">char</span> **out_name</code></em>,
<em class="parameter"><code><span class="type">char</span> **out_checksum</code></em>);</pre>
<p>Return information on the current file. This function may only be
called if <code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_FILE</code> was returned from
called if <a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-FILE:CAPS"><code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_FILE</code></a> was returned from
<a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-commit-traverse-iter-next" title="ostree_repo_commit_traverse_iter_next ()"><code class="function">ostree_repo_commit_traverse_iter_next()</code></a>.</p>
<div class="refsect3">
<a name="ostree-repo-commit-traverse-iter-get-file.parameters"></a><h4>Parameters</h4>
@ -5816,7 +5839,7 @@ ostree_repo_commit_traverse_iter_init_commit
(<em class="parameter"><code><span class="type">OstreeRepoCommitTraverseIter</span> *iter</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *repo</code></em>,
<em class="parameter"><code><span class="type">GVariant</span> *commit</code></em>,
<em class="parameter"><code><span class="type">OstreeRepoCommitTraverseFlags</span> flags</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitTraverseFlags" title="enum OstreeRepoCommitTraverseFlags"><span class="type">OstreeRepoCommitTraverseFlags</span></a> flags</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Initialize (in place) an iterator over the root of a commit object.</p>
<div class="refsect3">
@ -5865,7 +5888,7 @@ ostree_repo_commit_traverse_iter_init_dirtree
(<em class="parameter"><code><span class="type">OstreeRepoCommitTraverseIter</span> *iter</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *repo</code></em>,
<em class="parameter"><code><span class="type">GVariant</span> *dirtree</code></em>,
<em class="parameter"><code><span class="type">OstreeRepoCommitTraverseFlags</span> flags</code></em>,
<em class="parameter"><code><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitTraverseFlags" title="enum OstreeRepoCommitTraverseFlags"><span class="type">OstreeRepoCommitTraverseFlags</span></a> flags</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Initialize (in place) an iterator over a directory tree.</p>
<div class="refsect3">
@ -5909,19 +5932,19 @@ ostree_repo_commit_traverse_iter_init_dirtree
<hr>
<div class="refsect2">
<a name="ostree-repo-commit-traverse-iter-next"></a><h3>ostree_repo_commit_traverse_iter_next ()</h3>
<pre class="programlisting"><span class="returnvalue">OstreeRepoCommitIterResult</span>
<pre class="programlisting"><a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitIterResult" title="enum OstreeRepoCommitIterResult"><span class="returnvalue">OstreeRepoCommitIterResult</span></a>
ostree_repo_commit_traverse_iter_next (<em class="parameter"><code><span class="type">OstreeRepoCommitTraverseIter</span> *iter</code></em>,
<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Step the interator to the next item. Files will be returned first,
then subdirectories. Call this in a loop; upon encountering
<code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_END</code>, there will be no more files or
directories. If <code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_DIR</code> is returned,
<a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-END:CAPS"><code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_END</code></a>, there will be no more files or
directories. If <a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-DIR:CAPS"><code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_DIR</code></a> is returned,
then call <a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-commit-traverse-iter-get-dir" title="ostree_repo_commit_traverse_iter_get_dir ()"><code class="function">ostree_repo_commit_traverse_iter_get_dir()</code></a> to retrieve
data for that directory. Similarly, if
<code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_FILE</code> is returned, call
<a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-FILE:CAPS"><code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_FILE</code></a> is returned, call
<a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-commit-traverse-iter-get-file" title="ostree_repo_commit_traverse_iter_get_file ()"><code class="function">ostree_repo_commit_traverse_iter_get_file()</code></a>.</p>
<p>If <code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_ERROR</code> is returned, it is a
<p>If <a class="link" href="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-ERROR:CAPS"><code class="literal">OSTREE_REPO_COMMIT_ITER_RESULT_ERROR</code></a> is returned, it is a
program error to call any further API on <em class="parameter"><code>iter</code></em>
except for
<a class="link" href="ostree-Content-addressed-object-store.html#ostree-repo-commit-traverse-iter-clear" title="ostree_repo_commit_traverse_iter_clear ()"><code class="function">ostree_repo_commit_traverse_iter_clear()</code></a>.</p>
@ -6314,7 +6337,7 @@ The following are currently defined:</p>
<li class="listitem"><p>override-commit-ids (as): Array of specific commit IDs to fetch for refs</p></li>
<li class="listitem"><p>dry-run (b): Only print information on what will be downloaded (requires static deltas)</p></li>
<li class="listitem"><p>override-url (s): Fetch objects from this URL if remote specifies no metalink in options</p></li>
<li class="listitem"><p>inherit-transaction (b): Don't initiate, finish or abort a transaction, usefult to do mutliple pulls in one transaction.</p></li>
<li class="listitem"><p>inherit-transaction (b): Don't initiate, finish or abort a transaction, usefult to do multiple pulls in one transaction.</p></li>
<li class="listitem"><p>http-headers (a(ss)): Additional headers to add to all HTTP requests</p></li>
<li class="listitem"><p>update-frequency (u): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are valid</p></li>
</ul></div>
@ -6882,6 +6905,10 @@ ostree_repo_regenerate_summary (<em class="parameter"><code><a class="link" href
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>An OSTree repository can contain a high level "summary" file that
describes the available branches and other metadata.</p>
<p>If the timetable for making commits and updating the summary file is fairly
regular, setting the <code class="literal">ostree.summary.expires</code> key in <em class="parameter"><code>additional_metadata</code></em>
will aid clients in working out when to check for updates.</p>
<p>It is regenerated automatically after a commit if
<code class="literal">core/commit-update-summary</code> is set.</p>
<div class="refsect3">
@ -7099,6 +7126,67 @@ in bytes, counting only content objects.</p></td>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoResolveRevExtFlags"></a><h3>enum OstreeRepoResolveRevExtFlags</h3>
<div class="refsect3">
<a name="OstreeRepoResolveRevExtFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-RESOLVE-REV-EXT-NONE:CAPS"></a>OSTREE_REPO_RESOLVE_REV_EXT_NONE</p></td>
<td class="enum_member_description">
<p>No flags.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoListRefsExtFlags"></a><h3>enum OstreeRepoListRefsExtFlags</h3>
<div class="refsect3">
<a name="OstreeRepoListRefsExtFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-LIST-REFS-EXT-NONE:CAPS"></a>OSTREE_REPO_LIST_REFS_EXT_NONE</p></td>
<td class="enum_member_description">
<p>No flags.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoCommitState"></a><h3>enum OstreeRepoCommitState</h3>
<div class="refsect3">
<a name="OstreeRepoCommitState.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-COMMIT-STATE-PARTIAL:CAPS"></a>OSTREE_REPO_COMMIT_STATE_PARTIAL</p></td>
<td> </td>
<td> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoCommitFilterResult"></a><h3>enum OstreeRepoCommitFilterResult</h3>
<div class="refsect3">
<a name="OstreeRepoCommitFilterResult.members"></a><h4>Members</h4>
@ -7337,6 +7425,61 @@ as - List of pack file checksums in which this object appears</p>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoCommitTraverseFlags"></a><h3>enum OstreeRepoCommitTraverseFlags</h3>
<div class="refsect3">
<a name="OstreeRepoCommitTraverseFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-COMMIT-TRAVERSE-FLAG-NONE:CAPS"></a>OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE</p></td>
<td> </td>
<td> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoCommitIterResult"></a><h3>enum OstreeRepoCommitIterResult</h3>
<div class="refsect3">
<a name="OstreeRepoCommitIterResult.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-COMMIT-ITER-RESULT-ERROR:CAPS"></a>OSTREE_REPO_COMMIT_ITER_RESULT_ERROR</p></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-COMMIT-ITER-RESULT-END:CAPS"></a>OSTREE_REPO_COMMIT_ITER_RESULT_END</p></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-COMMIT-ITER-RESULT-FILE:CAPS"></a>OSTREE_REPO_COMMIT_ITER_RESULT_FILE</p></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-COMMIT-ITER-RESULT-DIR:CAPS"></a>OSTREE_REPO_COMMIT_ITER_RESULT_DIR</p></td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="OstreeRepoPruneFlags"></a><h3>enum OstreeRepoPruneFlags</h3>
<div class="refsect3">
<a name="OstreeRepoPruneFlags.members"></a><h4>Members</h4>

View File

@ -2289,9 +2289,9 @@ content, the other types are metadata.</p>
<pre class="programlisting">#define OSTREE_DIRMETA_GVARIANT_FORMAT G_VARIANT_TYPE (OSTREE_DIRMETA_GVARIANT_STRING)
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>u - uid</p></li>
<li class="listitem"><p>u - gid</p></li>
<li class="listitem"><p>u - mode</p></li>
<li class="listitem"><p>u - uid (big-endian)</p></li>
<li class="listitem"><p>u - gid (big-endian)</p></li>
<li class="listitem"><p>u - mode (big-endian)</p></li>
<li class="listitem"><p>a(ayay) - xattrs</p></li>
</ul></div>
</div>
@ -2311,9 +2311,9 @@ in bare-user repositories. This allows us to store metadata information that we
can't store in the real filesystem but we can still use a regular .file object
that we can hardlink to in the case of a user-mode checkout.</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>u - uid</p></li>
<li class="listitem"><p>u - gid</p></li>
<li class="listitem"><p>u - mode</p></li>
<li class="listitem"><p>u - uid (big-endian)</p></li>
<li class="listitem"><p>u - gid (big-endian)</p></li>
<li class="listitem"><p>u - mode (big-endian)</p></li>
<li class="listitem"><p>a(ayay) - xattrs</p></li>
</ul></div>
</div>
@ -2350,7 +2350,7 @@ that we can hardlink to in the case of a user-mode checkout.</p>
<li class="listitem"><p>a(say) - Related objects</p></li>
<li class="listitem"><p>s - subject</p></li>
<li class="listitem"><p>s - body</p></li>
<li class="listitem"><p>t - Timestamp in seconds since the epoch (UTC)</p></li>
<li class="listitem"><p>t - Timestamp in seconds since the epoch (UTC, big-endian)</p></li>
<li class="listitem"><p>ay - Root tree contents</p></li>
<li class="listitem"><p>ay - Root tree metadata</p></li>
</ul></div>
@ -2370,9 +2370,21 @@ that we can hardlink to in the case of a user-mode checkout.</p>
<li class="listitem"><p>a(s(taya{sv})) - Map of ref name -&gt; (latest commit size, latest commit checksum, additional metadata), sorted by ref name</p></li>
<li class="listitem">
<p>a{sv} - Additional metadata, at the current time the following are defined:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>key: "ostree.static-deltas", value: a{sv}, static delta name -&gt; 32 bytes of checksum</p></li></ul></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem"><p>key: "ostree.static-deltas", value: a{sv}, static delta name -&gt; 32 bytes of checksum</p></li>
<li class="listitem"><p>key: "ostree.summary.last-modified", value: t, timestamp (seconds since
the Unix epoch in UTC, big-endian) when the summary was last regenerated
(similar to the HTTP <code class="literal">Last-Modified</code> header)</p></li>
<li class="listitem"><p>key: "ostree.summary.expires", value: t, timestamp (seconds since the
Unix epoch in UTC, big-endian) after which the summary is considered
stale and should be re-downloaded if possible (similar to the HTTP
<code class="literal">Expires</code> header)</p></li>
</ul></div>
</li>
</ul></div>
<p>The currently defined keys for the <code class="literal">a{sv}</code> of additional metadata for each commit are:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>key: <code class="literal">ostree.commit.timestamp</code>, value: <code class="literal">t</code>, timestamp (seconds since the
Unix epoch in UTC, big-endian) when the commit was committed</p></li></ul></div>
</div>
</div>
</div>

View File

@ -65,6 +65,22 @@
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get" title="ostree_async_progress_get ()">ostree_async_progress_get</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GVariant</span> *
</td>
<td class="function_name">
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-variant" title="ostree_async_progress_get_variant ()">ostree_async_progress_get_variant</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint</span>
</td>
<td class="function_name">
@ -92,6 +108,22 @@
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set" title="ostree_async_progress_set ()">ostree_async_progress_set</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-variant" title="ostree_async_progress_set_variant ()">ostree_async_progress_set_variant</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-uint" title="ostree_async_progress_set_uint ()">ostree_async_progress_set_uint</a> <span class="c_punctuation">()</span>
</td>
</tr>
@ -138,6 +170,10 @@ operations to communicate back with callers. It transparently
handles thread safety, ensuring that the progress change
notification occurs in the thread-default context of the calling
operation.</p>
<p>The <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-status" title="ostree_async_progress_get_status ()"><code class="function">ostree_async_progress_get_status()</code></a> and <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-status" title="ostree_async_progress_set_status ()"><code class="function">ostree_async_progress_set_status()</code></a>
methods get and set a well-known <code class="literal">status</code> key of type <code class="literal">G_VARIANT_TYPE_STRING</code>.
This key may be accessed using the other <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> methods, but it
must always have the correct type.</p>
</div>
<div class="refsect1">
<a name="ostree-Progress-notification-system-for-asynchronous-operations.functions_details"></a><h2>Functions</h2>
@ -163,6 +199,141 @@ ostree_async_progress_new_and_connect (<em class="parameter"><code><span class="
<a name="ostree-async-progress-get-status"></a><h3>ostree_async_progress_get_status ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *
ostree_async_progress_get_status (<em class="parameter"><code><a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> *self</code></em>);</pre>
<p>Get the human-readable status string from the <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a>. This
operation is thread-safe. The retuned value may be <code class="literal">NULL</code> if no status is
set.</p>
<p>This is a convenience function to get the well-known <code class="literal">status</code> key.</p>
<div class="refsect3">
<a name="ostree-async-progress-get-status.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="ostree-async-progress-get-status.returns"></a><h4>Returns</h4>
<p> the current status, or <code class="literal">NULL</code> if none is set. </p>
<p><span class="annotation">[<a href="http://foldoc.org/transfer%20full"><span class="acronym">transfer full</span></a>][<a href="http://foldoc.org/nullable"><span class="acronym">nullable</span></a>]</span></p>
</div>
<p class="since">Since: 2017.6</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-async-progress-get"></a><h3>ostree_async_progress_get ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
ostree_async_progress_get (<em class="parameter"><code><a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> *self</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Get the values corresponding to zero or more keys from the
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a>. Each key is specified in @... as the key name, followed
by a <span class="type">GVariant</span> format string, followed by the necessary arguments for that
format string, just as for <code class="function">g_variant_get()</code>. After those arguments is the
next key name. The varargs list must be <code class="literal">NULL</code>-terminated.</p>
<p>Each format string must make deep copies of its value, as the values stored
in the <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> may be freed from another thread after this
function returns.</p>
<p>This operation is thread-safe, and all the keys are queried atomically.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">guint32</span><span class="normal"> outstanding_fetches</span><span class="symbol">;</span>
<span class="usertype">guint64</span><span class="normal"> bytes_received</span><span class="symbol">;</span>
<span class="usertype">g_autofree</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">status </span><span class="symbol">=</span><span class="normal"> NULL</span><span class="symbol">;</span>
<span class="function">g_autoptr</span><span class="symbol">(</span><span class="normal">GVariant</span><span class="symbol">)</span><span class="normal"> refs_variant </span><span class="symbol">=</span><span class="normal"> NULL</span><span class="symbol">;</span>
<span class="function"><a href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get">ostree_async_progress_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">progress</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"outstanding-fetches"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"u"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">outstanding_fetches</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"bytes-received"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"t"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">bytes_received</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"status"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">status</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"refs"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"@a{ss}"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">refs_variant</span><span class="symbol">,</span>
<span class="normal"> NULL</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<div class="refsect3">
<a name="ostree-async-progress-get.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>key name, format string, <span class="type">GVariant</span> return locations, …, followed by <code class="literal">NULL</code></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2017.6</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-async-progress-get-variant"></a><h3>ostree_async_progress_get_variant ()</h3>
<pre class="programlisting"><span class="returnvalue">GVariant</span> *
ostree_async_progress_get_variant (<em class="parameter"><code><a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *key</code></em>);</pre>
<p>Look up a key in the <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> and return the <span class="type">GVariant</span> associated
with it. The lookup is thread-safe.</p>
<div class="refsect3">
<a name="ostree-async-progress-get-variant.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>a key to look up</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="ostree-async-progress-get-variant.returns"></a><h4>Returns</h4>
<p> value for the given <em class="parameter"><code>key</code></em>
, or <code class="literal">NULL</code> if
it was not set. </p>
<p><span class="annotation">[<a href="http://foldoc.org/transfer%20full"><span class="acronym">transfer full</span></a>][<a href="http://foldoc.org/nullable"><span class="acronym">nullable</span></a>]</span></p>
</div>
<p class="since">Since: 2017.6</p>
</div>
<hr>
<div class="refsect2">
@ -184,6 +355,145 @@ ostree_async_progress_get_uint64 (<em class="parameter"><code><a class="link" hr
<pre class="programlisting"><span class="returnvalue">void</span>
ostree_async_progress_set_status (<em class="parameter"><code><a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *status</code></em>);</pre>
<p>Set the human-readable status string for the <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a>. This
operation is thread-safe. <code class="literal">NULL</code> may be passed to clear the status.</p>
<p>This is a convenience function to set the well-known <code class="literal">status</code> key.</p>
<div class="refsect3">
<a name="ostree-async-progress-set-status.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>status</p></td>
<td class="parameter_description"><p> new status string, or <code class="literal">NULL</code> to clear the status. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/nullable"><span class="acronym">nullable</span></a>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2017.6</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-async-progress-set"></a><h3>ostree_async_progress_set ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
ostree_async_progress_set (<em class="parameter"><code><a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> *self</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Set the values for zero or more keys in the <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a>. Each key is
specified in @... as the key name, followed by a <span class="type">GVariant</span> format string,
followed by the necessary arguments for that format string, just as for
<code class="function">g_variant_new()</code>. After those arguments is the next key name. The varargs list
must be <code class="literal">NULL</code>-terminated.</p>
<p>g_variant_ref_sink() will be called as appropriate on the <span class="type">GVariant</span>
parameters, so they may be floating.</p>
<p>This operation is thread-safe, and all the keys are set atomically.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">guint32</span><span class="normal"> outstanding_fetches </span><span class="symbol">=</span><span class="normal"> </span><span class="number">15</span><span class="symbol">;</span>
<span class="usertype">guint64</span><span class="normal"> bytes_received </span><span class="symbol">=</span><span class="normal"> </span><span class="number">1000</span><span class="symbol">;</span>
<span class="function"><a href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set">ostree_async_progress_set</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">progress</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"outstanding-fetches"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"u"</span><span class="symbol">,</span><span class="normal"> outstanding_fetches</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"bytes-received"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"t"</span><span class="symbol">,</span><span class="normal"> bytes_received</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"status"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Updated status"</span><span class="symbol">,</span>
<span class="normal"> </span><span class="string">"refs"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"@a{ss}"</span><span class="symbol">,</span><span class="normal"> </span><span class="function">g_variant_new_parsed</span><span class="normal"> </span><span class="symbol">(</span><span class="string">"@a{ss} {}"</span><span class="symbol">),</span>
<span class="normal"> NULL</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<div class="refsect3">
<a name="ostree-async-progress-set.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>key name, format string, <span class="type">GVariant</span> parameters, …, followed by <code class="literal">NULL</code></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2017.6</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-async-progress-set-variant"></a><h3>ostree_async_progress_set_variant ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
ostree_async_progress_set_variant (<em class="parameter"><code><a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
<em class="parameter"><code><span class="type">GVariant</span> *value</code></em>);</pre>
<p>Assign a new <em class="parameter"><code>value</code></em>
to the given <em class="parameter"><code>key</code></em>
, replacing any existing value. The
operation is thread-safe. <em class="parameter"><code>value</code></em>
may be a floating reference;
<code class="function">g_variant_ref_sink()</code> will be called on it.</p>
<p>Any watchers of the <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a> will be notified of the change if
<em class="parameter"><code>value</code></em>
differs from the existing value for <em class="parameter"><code>key</code></em>
.</p>
<div class="refsect3">
<a name="ostree-async-progress-set-variant.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#OstreeAsyncProgress" title="OstreeAsyncProgress"><span class="type">OstreeAsyncProgress</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>a key to set</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>the value to assign to <em class="parameter"><code>key</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2017.6</p>
</div>
<hr>
<div class="refsect2">

View File

@ -207,6 +207,9 @@
<keyword type="enum" name="enum OstreeRepoMode" link="ostree-Content-addressed-object-store.html#OstreeRepoMode"/>
<keyword type="enum" name="enum OstreeRepoRemoteChange" link="ostree-Content-addressed-object-store.html#OstreeRepoRemoteChange"/>
<keyword type="struct" name="struct OstreeRepoTransactionStats" link="ostree-Content-addressed-object-store.html#OstreeRepoTransactionStats"/>
<keyword type="enum" name="enum OstreeRepoResolveRevExtFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoResolveRevExtFlags"/>
<keyword type="enum" name="enum OstreeRepoListRefsExtFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoListRefsExtFlags"/>
<keyword type="enum" name="enum OstreeRepoCommitState" link="ostree-Content-addressed-object-store.html#OstreeRepoCommitState"/>
<keyword type="enum" name="enum OstreeRepoCommitFilterResult" link="ostree-Content-addressed-object-store.html#OstreeRepoCommitFilterResult"/>
<keyword type="typedef" name="OstreeRepoCommitModifier" link="ostree-Content-addressed-object-store.html#OstreeRepoCommitModifier"/>
<keyword type="enum" name="enum OstreeRepoCommitModifierFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoCommitModifierFlags"/>
@ -215,6 +218,8 @@
<keyword type="enum" name="enum OstreeRepoListObjectsFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoListObjectsFlags"/>
<keyword type="macro" name="OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-LIST-OBJECTS-VARIANT-TYPE:CAPS"/>
<keyword type="enum" name="enum OstreeStaticDeltaGenerateOpt" link="ostree-Content-addressed-object-store.html#OstreeStaticDeltaGenerateOpt"/>
<keyword type="enum" name="enum OstreeRepoCommitTraverseFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoCommitTraverseFlags"/>
<keyword type="enum" name="enum OstreeRepoCommitIterResult" link="ostree-Content-addressed-object-store.html#OstreeRepoCommitIterResult"/>
<keyword type="enum" name="enum OstreeRepoPruneFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoPruneFlags"/>
<keyword type="enum" name="enum OstreeRepoPullFlags" link="ostree-Content-addressed-object-store.html#OstreeRepoPullFlags"/>
<keyword type="function" name="ostree_mutable_tree_new ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-new"/>
@ -268,10 +273,14 @@
<keyword type="enum" name="enum OstreeSysrootSimpleWriteDeploymentFlags" link="ostree-Root-partition-mount-point.html#OstreeSysrootSimpleWriteDeploymentFlags"/>
<keyword type="function" name="ostree_async_progress_new ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-new"/>
<keyword type="function" name="ostree_async_progress_new_and_connect ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-new-and-connect"/>
<keyword type="function" name="ostree_async_progress_get_status ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-status"/>
<keyword type="function" name="ostree_async_progress_get_status ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-status" since="2017.6"/>
<keyword type="function" name="ostree_async_progress_get ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get" since="2017.6"/>
<keyword type="function" name="ostree_async_progress_get_variant ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-variant" since="2017.6"/>
<keyword type="function" name="ostree_async_progress_get_uint ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-uint"/>
<keyword type="function" name="ostree_async_progress_get_uint64 ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-uint64"/>
<keyword type="function" name="ostree_async_progress_set_status ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-status"/>
<keyword type="function" name="ostree_async_progress_set_status ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-status" since="2017.6"/>
<keyword type="function" name="ostree_async_progress_set ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set" since="2017.6"/>
<keyword type="function" name="ostree_async_progress_set_variant ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-variant" since="2017.6"/>
<keyword type="function" name="ostree_async_progress_set_uint ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-uint"/>
<keyword type="function" name="ostree_async_progress_set_uint64 ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-uint64"/>
<keyword type="function" name="ostree_async_progress_finish ()" link="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-finish"/>
@ -379,6 +388,9 @@
<keyword type="constant" name="OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-REMOTE-CHANGE-ADD-IF-NOT-EXISTS:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_REMOTE_CHANGE_DELETE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-REMOTE-CHANGE-DELETE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-REMOTE-CHANGE-DELETE-IF-EXISTS:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_RESOLVE_REV_EXT_NONE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-RESOLVE-REV-EXT-NONE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_LIST_REFS_EXT_NONE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-LIST-REFS-EXT-NONE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_STATE_PARTIAL" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-STATE-PARTIAL:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_FILTER_ALLOW" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-FILTER-ALLOW:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_FILTER_SKIP" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-FILTER-SKIP:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-MODIFIER-FLAGS-NONE:CAPS"/>
@ -397,6 +409,11 @@
<keyword type="constant" name="OSTREE_REPO_LIST_OBJECTS_NO_PARENTS" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-LIST-OBJECTS-NO-PARENTS:CAPS"/>
<keyword type="constant" name="OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY" link="ostree-Content-addressed-object-store.html#OSTREE-STATIC-DELTA-GENERATE-OPT-LOWLATENCY:CAPS"/>
<keyword type="constant" name="OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR" link="ostree-Content-addressed-object-store.html#OSTREE-STATIC-DELTA-GENERATE-OPT-MAJOR:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-TRAVERSE-FLAG-NONE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_ITER_RESULT_ERROR" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-ERROR:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_ITER_RESULT_END" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-END:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_ITER_RESULT_FILE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-FILE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_COMMIT_ITER_RESULT_DIR" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-COMMIT-ITER-RESULT-DIR:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_PRUNE_FLAGS_NONE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-PRUNE-FLAGS-NONE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-PRUNE-FLAGS-NO-PRUNE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY" link="ostree-Content-addressed-object-store.html#OSTREE-REPO-PRUNE-FLAGS-REFS-ONLY:CAPS"/>

View File

@ -80,6 +80,10 @@
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get" title="ostree_async_progress_get ()">ostree_async_progress_get</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-status" title="ostree_async_progress_get_status ()">ostree_async_progress_get_status</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
@ -92,6 +96,10 @@
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-get-variant" title="ostree_async_progress_get_variant ()">ostree_async_progress_get_variant</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-new" title="ostree_async_progress_new ()">ostree_async_progress_new</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
@ -100,6 +108,10 @@
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set" title="ostree_async_progress_set ()">ostree_async_progress_set</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-status" title="ostree_async_progress_set_status ()">ostree_async_progress_set_status</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
@ -111,6 +123,10 @@
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-uint64" title="ostree_async_progress_set_uint64 ()">ostree_async_progress_set_uint64</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html#ostree-async-progress-set-variant" title="ostree_async_progress_set_variant ()">ostree_async_progress_set_variant</a>, function in <a class="link" href="ostree-Progress-notification-system-for-asynchronous-operations.html" title="Progress notification system for asynchronous operations">Progress notification system for asynchronous operations</a>
</dt>
<dd></dd>
<a name="idxB"></a><h3 class="title">B</h3>
<dt>
<a class="link" href="ostree-ostree-bootconfig-parser.html#OstreeBootconfigParser" title="OstreeBootconfigParser">OstreeBootconfigParser</a>, struct in <a class="link" href="ostree-ostree-bootconfig-parser.html" title="ostree-bootconfig-parser">ostree-bootconfig-parser</a>
@ -598,6 +614,10 @@ OSTREE_RELEASE_VERSION, macro in ostree-version
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitIterResult" title="enum OstreeRepoCommitIterResult">OstreeRepoCommitIterResult</a>, enum in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitModifier" title="OstreeRepoCommitModifier">OstreeRepoCommitModifier</a>, typedef in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
@ -610,6 +630,14 @@ OSTREE_RELEASE_VERSION, macro in ostree-version
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitState" title="enum OstreeRepoCommitState">OstreeRepoCommitState</a>, enum in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoCommitTraverseFlags" title="enum OstreeRepoCommitTraverseFlags">OstreeRepoCommitTraverseFlags</a>, enum in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-ostree-repo-file.html#OstreeRepoFile" title="OstreeRepoFile">OstreeRepoFile</a>, typedef in <a class="link" href="ostree-ostree-repo-file.html" title="ostree-repo-file">ostree-repo-file</a>
</dt>
<dd></dd>
@ -618,6 +646,10 @@ OSTREE_RELEASE_VERSION, macro in ostree-version
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoListRefsExtFlags" title="enum OstreeRepoListRefsExtFlags">OstreeRepoListRefsExtFlags</a>, enum in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoMode" title="enum OstreeRepoMode">OstreeRepoMode</a>, enum in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
@ -634,6 +666,10 @@ OSTREE_RELEASE_VERSION, macro in ostree-version
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoResolveRevExtFlags" title="enum OstreeRepoResolveRevExtFlags">OstreeRepoResolveRevExtFlags</a>, enum in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-Content-addressed-object-store.html#OstreeRepoTransactionStats" title="struct OstreeRepoTransactionStats">OstreeRepoTransactionStats</a>, struct in <a class="link" href="ostree-Content-addressed-object-store.html" title="Content-addressed object store">Content-addressed object store</a>
</dt>
<dd></dd>

View File

@ -0,0 +1,6 @@
<SECTION>
<FILE>ostree-remote</FILE>
OstreeRemote
ostree_remote_ref
ostree_remote_unref
</SECTION>

View File

@ -4,9 +4,13 @@ OstreeAsyncProgress
ostree_async_progress_new
ostree_async_progress_new_and_connect
ostree_async_progress_get_status
ostree_async_progress_get
ostree_async_progress_get_variant
ostree_async_progress_get_uint
ostree_async_progress_get_uint64
ostree_async_progress_set_status
ostree_async_progress_set
ostree_async_progress_set_variant
ostree_async_progress_set_uint
ostree_async_progress_set_uint64
ostree_async_progress_finish
@ -316,11 +320,14 @@ ostree_repo_write_content_trusted
ostree_repo_write_content_async
ostree_repo_write_content_finish
ostree_repo_resolve_rev
OstreeRepoResolveRevExtFlags
ostree_repo_resolve_rev_ext
ostree_repo_list_refs
OstreeRepoListRefsExtFlags
ostree_repo_list_refs_ext
ostree_repo_remote_list_refs
ostree_repo_load_variant
OstreeRepoCommitState
ostree_repo_load_commit
ostree_repo_load_variant_if_exists
ostree_repo_load_file
@ -376,8 +383,10 @@ ostree_repo_commit_traverse_iter_cleanup
ostree_repo_commit_traverse_iter_clear
ostree_repo_commit_traverse_iter_get_dir
ostree_repo_commit_traverse_iter_get_file
OstreeRepoCommitTraverseFlags
ostree_repo_commit_traverse_iter_init_commit
ostree_repo_commit_traverse_iter_init_dirtree
OstreeRepoCommitIterResult
ostree_repo_commit_traverse_iter_next
OstreeRepoPruneFlags
ostree_repo_prune

View File

@ -6,6 +6,7 @@ ostree_deployment_get_type
ostree_diff_item_get_type
ostree_gpg_verify_result_get_type
ostree_mutable_tree_get_type
ostree_remote_get_type
ostree_repo_commit_modifier_get_type
ostree_repo_devino_cache_get_type
ostree_repo_file_get_type

View File

@ -1 +1 @@
2017.4
2017.6

View File

@ -1,17 +1,21 @@
dnl GLIB_TESTS
dnl
dnl NOTE: this file has been modified from upstream glib; see
dnl https://github.com/ostreedev/ostree/pull/837
AC_DEFUN([GLIB_TESTS],
[
AC_ARG_ENABLE(installed-tests,
AS_HELP_STRING([--enable-installed-tests],
[Enable installation of some test cases]),
[case ${enableval} in
[enable_installed_tests=${enableval};
case ${enableval} in
yes) ENABLE_INSTALLED_TESTS="1" ;;
exclusive) ENABLE_INSTALLED_TESTS="1"; ENABLE_INSTALLED_TESTS_EXCLUSIVE=1 ;;
no) ENABLE_INSTALLED_TESTS="" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;;
esac])
AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1")
AM_CONDITIONAL([ENABLE_INSTALLED_TESTS_EXCLUSIVE], test "$ENABLE_INSTALLED_TESTS_EXCLUSIVE" = "1")
AC_ARG_ENABLE(always-build-tests,
AS_HELP_STRING([--enable-always-build-tests],
[Enable always building tests during 'make all']),

View File

@ -3,6 +3,9 @@
/* Define if we are enabling ostree trivial-httpd entrypoint */
#undef BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE
/* Define if systemd and libmount */
#undef BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT
/* Define if we should avoid using O_TMPFILE */
#undef DISABLE_OTMPFILE
@ -85,6 +88,9 @@
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Define if experimental API should be enabled */
#undef OSTREE_ENABLE_EXPERIMENTAL_API
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

122
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libostree 2017.5.
# Generated by GNU Autoconf 2.69 for libostree 2017.6.
#
# Report bugs to <walters@verbum.org>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libostree'
PACKAGE_TARNAME='libostree'
PACKAGE_VERSION='2017.5'
PACKAGE_STRING='libostree 2017.5'
PACKAGE_VERSION='2017.6'
PACKAGE_STRING='libostree 2017.6'
PACKAGE_BUGREPORT='walters@verbum.org'
PACKAGE_URL=''
@ -635,6 +635,8 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
ENABLE_EXPERIMENTAL_API_FALSE
ENABLE_EXPERIMENTAL_API_TRUE
BUILDOPT_GJS_FALSE
BUILDOPT_GJS_TRUE
GJS
@ -644,8 +646,11 @@ BUILDOPT_USE_STATIC_COMPILER_TRUE
GRUB2_MKCONFIG
BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE
BUILDOPT_BUILTIN_GRUB2_MKCONFIG_TRUE
BUILDOPT_SYSTEMD_AND_LIBMOUNT_FALSE
BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE
BUILDOPT_SYSTEMD_FALSE
BUILDOPT_SYSTEMD_TRUE
systemdsystemgeneratordir
systemdsystemunitdir
BUILDOPT_LIBSYSTEMD_FALSE
BUILDOPT_LIBSYSTEMD_TRUE
@ -758,6 +763,8 @@ installed_testdir
installed_test_metadir
ENABLE_ALWAYS_BUILD_TESTS_FALSE
ENABLE_ALWAYS_BUILD_TESTS_TRUE
ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE
ENABLE_INSTALLED_TESTS_EXCLUSIVE_TRUE
ENABLE_INSTALLED_TESTS_FALSE
ENABLE_INSTALLED_TESTS_TRUE
OSTREE_FEATURES
@ -926,9 +933,11 @@ enable_rofiles_fuse
with_dracut
with_mkinitcpio
with_systemdsystemunitdir
with_systemdsystemgeneratordir
with_builtin_grub2_mkconfig
with_grub2_mkconfig_path
with_static_compiler
enable_experimental_api
'
ac_precious_vars='build_alias
host_alias
@ -1513,7 +1522,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libostree 2017.5 to adapt to many kinds of systems.
\`configure' configures libostree 2017.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1583,7 +1592,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libostree 2017.5:";;
short | recursive ) echo "Configuration of libostree 2017.6:";;
esac
cat <<\_ACEOF
@ -1631,6 +1640,9 @@ Optional Features:
--enable-rust-debug Build Rust code with debugging information
[default=no]
--enable-rofiles-fuse generate rofiles-fuse helper [default=yes]
--enable-experimental-api
Enable unstable experimental API in libostree
[default=no]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -1656,6 +1668,8 @@ Optional Packages:
--with-mkinitcpio Install mkinitcpio module (default: no)
--with-systemdsystemunitdir=DIR
Directory for systemd service files
--with-systemdsystemgeneratordir=DIR
Directory for systemd generators
--with-builtin-grub2-mkconfig
Use a builtin minimal grub2-mkconfig to generate a
GRUB2 configuration file (default: no)
@ -1809,7 +1823,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libostree configure 2017.5
libostree configure 2017.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2224,7 +2238,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libostree $as_me 2017.5, which was
It was created by libostree $as_me 2017.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -3091,7 +3105,7 @@ fi
# Define the identity of the package.
PACKAGE='libostree'
VERSION='2017.5'
VERSION='2017.6'
# Some tools Automake needs.
@ -5825,9 +5839,9 @@ test -n "$YACC" || YACC="yacc"
YEAR_VERSION=2017
RELEASE_VERSION=5
RELEASE_VERSION=6
PACKAGE_VERSION=2017.5
PACKAGE_VERSION=2017.6
@ -13584,8 +13598,10 @@ OSTREE_FEATURES=""
# Check whether --enable-installed-tests was given.
if test "${enable_installed_tests+set}" = set; then :
enableval=$enable_installed_tests; case ${enableval} in
enableval=$enable_installed_tests; enable_installed_tests=${enableval};
case ${enableval} in
yes) ENABLE_INSTALLED_TESTS="1" ;;
exclusive) ENABLE_INSTALLED_TESTS="1"; ENABLE_INSTALLED_TESTS_EXCLUSIVE=1 ;;
no) ENABLE_INSTALLED_TESTS="" ;;
*) as_fn_error $? "bad value ${enableval} for --enable-installed-tests" "$LINENO" 5 ;;
esac
@ -13599,6 +13615,14 @@ else
ENABLE_INSTALLED_TESTS_FALSE=
fi
if test "$ENABLE_INSTALLED_TESTS_EXCLUSIVE" = "1"; then
ENABLE_INSTALLED_TESTS_EXCLUSIVE_TRUE=
ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE='#'
else
ENABLE_INSTALLED_TESTS_EXCLUSIVE_TRUE='#'
ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE=
fi
# Check whether --enable-always-build-tests was given.
if test "${enable_always_build_tests+set}" = set; then :
enableval=$enable_always_build_tests; case ${enableval} in
@ -16820,6 +16844,20 @@ fi
systemdsystemunitdir=$with_systemdsystemunitdir
fi
# Check whether --with-systemdsystemgeneratordir was given.
if test "${with_systemdsystemgeneratordir+set}" = set; then :
withval=$with_systemdsystemgeneratordir;
else
with_systemdsystemgeneratordir=$($PKG_CONFIG --variable=systemdsystemgeneratordir systemd)
fi
if test "x$with_systemdsystemgeneratordir" != "xno"; then :
systemdsystemgeneratordir=$with_systemdsystemgeneratordir
fi
fi
@ -16831,6 +16869,19 @@ else
BUILDOPT_SYSTEMD_FALSE=
fi
if test x$with_systemd = xyes && test x$with_libmount = xyes; then
BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE=
BUILDOPT_SYSTEMD_AND_LIBMOUNT_FALSE='#'
else
BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE='#'
BUILDOPT_SYSTEMD_AND_LIBMOUNT_FALSE=
fi
if test -z "$BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE"; then :
$as_echo "#define BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT 1" >>confdefs.h
fi
# Check whether --with-builtin-grub2-mkconfig was given.
@ -16993,6 +17044,35 @@ else
fi
# Do we enable building experimental (non-stable) API?
# The OSTREE_ENABLE_EXPERIMENTAL_API #define is used internally and in public
# headers, so any consumer of libostree who wants to use experimental API must
# #define OSTREE_ENABLE_EXPERIMENTAL_API 1
# before including libostree headers. This means the name in the AC_DEFINE below
# is public API.
# Check whether --enable-experimental-api was given.
if test "${enable_experimental_api+set}" = set; then :
enableval=$enable_experimental_api;
else
enable_experimental_api=no
fi
if test x$enable_experimental_api = xyes; then :
$as_echo "#define OSTREE_ENABLE_EXPERIMENTAL_API 1" >>confdefs.h
OSTREE_FEATURES="$OSTREE_FEATURES experimental"
fi
if test x$enable_experimental_api = xyes; then
ENABLE_EXPERIMENTAL_API_TRUE=
ENABLE_EXPERIMENTAL_API_FALSE='#'
else
ENABLE_EXPERIMENTAL_API_TRUE='#'
ENABLE_EXPERIMENTAL_API_FALSE=
fi
ac_config_files="$ac_config_files Makefile apidoc/Makefile src/libostree/ostree-1.pc src/libostree/ostree-version.h"
cat >confcache <<\_ACEOF
@ -17144,6 +17224,10 @@ if test -z "${ENABLE_INSTALLED_TESTS_TRUE}" && test -z "${ENABLE_INSTALLED_TESTS
as_fn_error $? "conditional \"ENABLE_INSTALLED_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_INSTALLED_TESTS_EXCLUSIVE_TRUE}" && test -z "${ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_INSTALLED_TESTS_EXCLUSIVE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_ALWAYS_BUILD_TESTS_TRUE}" && test -z "${ENABLE_ALWAYS_BUILD_TESTS_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_ALWAYS_BUILD_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@ -17252,6 +17336,10 @@ if test -z "${BUILDOPT_SYSTEMD_TRUE}" && test -z "${BUILDOPT_SYSTEMD_FALSE}"; th
as_fn_error $? "conditional \"BUILDOPT_SYSTEMD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILDOPT_SYSTEMD_AND_LIBMOUNT_TRUE}" && test -z "${BUILDOPT_SYSTEMD_AND_LIBMOUNT_FALSE}"; then
as_fn_error $? "conditional \"BUILDOPT_SYSTEMD_AND_LIBMOUNT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILDOPT_BUILTIN_GRUB2_MKCONFIG_TRUE}" && test -z "${BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE}"; then
as_fn_error $? "conditional \"BUILDOPT_BUILTIN_GRUB2_MKCONFIG\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@ -17264,6 +17352,10 @@ if test -z "${BUILDOPT_GJS_TRUE}" && test -z "${BUILDOPT_GJS_FALSE}"; then
as_fn_error $? "conditional \"BUILDOPT_GJS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_EXPERIMENTAL_API_TRUE}" && test -z "${ENABLE_EXPERIMENTAL_API_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_EXPERIMENTAL_API\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
@ -17661,7 +17753,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libostree $as_me 2017.5, which was
This file was extended by libostree $as_me 2017.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -17727,7 +17819,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libostree config.status 2017.5
libostree config.status 2017.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@ -19436,10 +19528,12 @@ echo "
wrpseudo-compat: $enable_wrpseudo_compat
man pages (xsltproc): $enable_man
api docs (gtk-doc): $enable_gtk_doc
installed tests: $enable_installed_tests
gjs-based tests: $have_gjs
dracut: $with_dracut
mkinitcpio: $with_mkinitcpio
Static compiler for ostree-prepare-root: $with_static_compiler"
Static compiler for ostree-prepare-root: $with_static_compiler
Experimental API $enable_experimental_api"
if test x$with_builtin_grub2_mkconfig = xyes; then :
echo " builtin grub2-mkconfig (instead of system): $with_builtin_grub2_mkconfig"

View File

@ -1,7 +1,7 @@
AC_PREREQ([2.63])
dnl If incrementing the version here, remember to update libostree.sym too
m4_define([year_version], [2017])
m4_define([release_version], [5])
m4_define([release_version], [6])
m4_define([package_version], [year_version.release_version])
AC_INIT([libostree], [package_version], [walters@verbum.org])
@ -389,8 +389,19 @@ AS_IF([test "x$have_libsystemd" = "xyes"], [
AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
])
AC_ARG_WITH([systemdsystemgeneratordir],
AS_HELP_STRING([--with-systemdsystemgeneratordir=DIR], [Directory for systemd generators]),
[],
[with_systemdsystemgeneratordir=$($PKG_CONFIG --variable=systemdsystemgeneratordir systemd)])
AS_IF([test "x$with_systemdsystemgeneratordir" != "xno"], [
AC_SUBST([systemdsystemgeneratordir], [$with_systemdsystemgeneratordir])
])
])
AM_CONDITIONAL(BUILDOPT_SYSTEMD, test x$with_systemd = xyes)
dnl If we have both, we use the "new /var" model with ostree-system-generator
AM_CONDITIONAL(BUILDOPT_SYSTEMD_AND_LIBMOUNT,[test x$with_systemd = xyes && test x$with_libmount = xyes])
AM_COND_IF(BUILDOPT_SYSTEMD_AND_LIBMOUNT,
AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if systemd and libmount]))
AC_ARG_WITH(builtin-grub2-mkconfig,
AS_HELP_STRING([--with-builtin-grub2-mkconfig],
@ -429,6 +440,22 @@ AS_IF([test "x$found_introspection" = xyes && test x$using_asan != xyes], [
], [have_gjs=no])
AM_CONDITIONAL(BUILDOPT_GJS, test x$have_gjs = xyes)
# Do we enable building experimental (non-stable) API?
# The OSTREE_ENABLE_EXPERIMENTAL_API #define is used internally and in public
# headers, so any consumer of libostree who wants to use experimental API must
# #define OSTREE_ENABLE_EXPERIMENTAL_API 1
# before including libostree headers. This means the name in the AC_DEFINE below
# is public API.
AC_ARG_ENABLE([experimental-api],
[AS_HELP_STRING([--enable-experimental-api],
[Enable unstable experimental API in libostree [default=no]])],,
[enable_experimental_api=no])
AS_IF([test x$enable_experimental_api = xyes],
[AC_DEFINE([OSTREE_ENABLE_EXPERIMENTAL_API],[1],[Define if experimental API should be enabled])
OSTREE_FEATURES="$OSTREE_FEATURES experimental"]
)
AM_CONDITIONAL([ENABLE_EXPERIMENTAL_API],[test x$enable_experimental_api = xyes])
AC_CONFIG_FILES([
Makefile
apidoc/Makefile
@ -457,10 +484,12 @@ echo "
wrpseudo-compat: $enable_wrpseudo_compat
man pages (xsltproc): $enable_man
api docs (gtk-doc): $enable_gtk_doc
installed tests: $enable_installed_tests
gjs-based tests: $have_gjs
dracut: $with_dracut
mkinitcpio: $with_mkinitcpio
Static compiler for ostree-prepare-root: $with_static_compiler"
Static compiler for ostree-prepare-root: $with_static_compiler
Experimental API $enable_experimental_api"
AS_IF([test x$with_builtin_grub2_mkconfig = xyes], [
echo " builtin grub2-mkconfig (instead of system): $with_builtin_grub2_mkconfig"
], [

View File

@ -209,13 +209,12 @@ glnx_dirfd_iterator_next_dent_ensure_dtype (GLnxDirFdIterator *dfd_iter,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
struct dirent *ret_dent;
g_return_val_if_fail (out_dent, FALSE);
if (!glnx_dirfd_iterator_next_dent (dfd_iter, out_dent, cancellable, error))
goto out;
return FALSE;
ret_dent = *out_dent;
@ -226,17 +225,12 @@ glnx_dirfd_iterator_next_dent_ensure_dtype (GLnxDirFdIterator *dfd_iter,
{
struct stat stbuf;
if (TEMP_FAILURE_RETRY (fstatat (dfd_iter->fd, ret_dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW)) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno (error);
ret_dent->d_type = IFTODT (stbuf.st_mode);
}
}
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
@ -348,3 +342,70 @@ glnx_mkdtempat (int dfd,
"mkstempat ran out of combinations to try.");
return FALSE;
}
/**
* glnx_mkdtempat_open:
* @dfd: Directory FD
* @tmpl: (type filename): template directory name, last 6 characters will be replaced
* @mode: permissions to create the temporary directory with
* @out_dfd: (out caller-allocates): Return location for an FD for the new
* temporary directory, or `-1` on error
* @error: Return location for a #GError, or %NULL
*
* Similar to glnx_mkdtempat(), except it will open the resulting temporary
* directory and return a directory FD to it.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
*/
gboolean
glnx_mkdtempat_open (int dfd,
gchar *tmpl,
int mode,
int *out_dfd,
GError **error)
{
/* FIXME: Ideally we could use openat(O_DIRECTORY | O_CREAT | O_EXCL) here
* to create and open the directory atomically, but thats not supported by
* current kernel versions: http://www.openwall.com/lists/oss-security/2014/11/26/14
* (Tested on kernel 4.10.10-200.fc25.x86_64). For the moment, accept a
* TOCTTOU race here. */
*out_dfd = -1;
if (!glnx_mkdtempat (dfd, tmpl, mode, error))
return FALSE;
return glnx_opendirat (dfd, tmpl, FALSE, out_dfd, error);
}
/**
* glnx_mkdtempat_open_in_system:
* @tmpl: (type filename): template directory name, last 6 characters will be replaced
* @mode: permissions to create the temporary directory with
* @out_dfd: (out caller-allocates): Return location for an FD for the new
* temporary directory, or `-1` on error
* @error: Return location for a #GError, or %NULL
*
* Similar to glnx_mkdtempat_open(), except it will use the system temporary
* directory (from g_get_tmp_dir()) as the parent directory to @tmpl.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
*/
gboolean
glnx_mkdtempat_open_in_system (gchar *tmpl,
int mode,
int *out_dfd,
GError **error)
{
glnx_fd_close int tmp_dfd = -1;
*out_dfd = -1;
if (!glnx_opendirat (-1, g_get_tmp_dir (), TRUE, &tmp_dfd, error))
return FALSE;
return glnx_mkdtempat_open (tmp_dfd, tmpl, mode, out_dfd, error);
}

View File

@ -88,4 +88,15 @@ gboolean glnx_mkdtempat (int dfd,
int mode,
GError **error);
gboolean glnx_mkdtempat_open (int dfd,
gchar *tmpl,
int mode,
int *out_dfd,
GError **error);
gboolean glnx_mkdtempat_open_in_system (gchar *tmpl,
int mode,
int *out_dfd,
GError **error);
G_END_DECLS

View File

@ -23,6 +23,22 @@
#include <glnx-backport-autocleanups.h>
#include <glnx-errors.h>
void
glnx_real_set_prefix_error_va (GError *error,
const char *format,
va_list args)
{
if (error == NULL)
return;
g_autofree char *old_msg = g_steal_pointer (&error->message);
g_autoptr(GString) buf = g_string_new ("");
g_string_append_vprintf (buf, format, args);
g_string_append (buf, ": ");
g_string_append (buf, old_msg);
error->message = g_string_free (g_steal_pointer (&buf), FALSE);
}
void
glnx_real_set_prefix_error_from_errno_va (GError **error,
gint errsv,
@ -32,13 +48,9 @@ glnx_real_set_prefix_error_from_errno_va (GError **error,
if (!error)
return;
/* TODO - enhance GError to have a "set and take ownership" API */
g_autoptr(GString) buf = g_string_new ("");
g_string_append_vprintf (buf, format, args);
g_string_append (buf, ": ");
g_string_append (buf, g_strerror (errsv));
g_set_error_literal (error,
G_IO_ERROR,
g_io_error_from_errno (errsv),
buf->str);
g_strerror (errsv));
glnx_real_set_prefix_error_va (*error, format, args);
}

View File

@ -30,7 +30,7 @@ G_BEGIN_DECLS
* This function returns %FALSE so it can be used conveniently in a single
* statement:
*
* ``
* ```
* if (strcmp (foo, "somevalue") != 0)
* return glnx_throw (error, "key must be somevalue, not '%s'", foo);
* ```
@ -49,13 +49,47 @@ glnx_throw (GError **error, const char *fmt, ...)
return FALSE;
}
/* Like `glnx_throw ()`, but returns %NULL. */
#define glnx_null_throw(error, args...) \
({glnx_throw (error, args); NULL;})
/* Implementation detail of glnx_throw_prefix() */
void glnx_real_set_prefix_error_va (GError *error,
const char *format,
va_list args) G_GNUC_PRINTF (2,0);
/* Prepend to @error's message by `$prefix: ` where `$prefix` is computed via
* printf @fmt. Returns %FALSE so it can be used conveniently in a single
* statement:
*
* ```
* if (!function_that_fails (s, error))
* return glnx_throw_prefix (error, "while handling '%s'", s);
* ```
* */
static inline gboolean G_GNUC_PRINTF (2,3)
glnx_prefix_error (GError **error, const char *fmt, ...)
{
if (error == NULL)
return FALSE;
va_list args;
va_start (args, fmt);
glnx_real_set_prefix_error_va (*error, fmt, args);
va_end (args);
return FALSE;
}
/* Like `glnx_prefix_error ()`, but returns %NULL. */
#define glnx_prefix_error_null(error, args...) \
({glnx_prefix_error (error, args); NULL;})
/* Set @error using the value of `g_strerror (errno)`.
*
* This function returns %FALSE so it can be used conveniently in a single
* statement:
*
* ``
* ```
* if (unlinkat (fd, somepathname) < 0)
* return glnx_throw_errno (error);
* ```
@ -79,6 +113,10 @@ glnx_throw_errno (GError **error)
return FALSE;
}
/* Like glnx_throw_errno(), but yields a NULL pointer. */
#define glnx_null_throw_errno(error) \
({glnx_throw_errno (error); NULL;})
/* Implementation detail of glnx_throw_errno_prefix() */
void glnx_real_set_prefix_error_from_errno_va (GError **error,
gint errsv,
@ -108,6 +146,10 @@ glnx_throw_errno_prefix (GError **error, const char *fmt, ...)
return FALSE;
}
/* Like glnx_throw_errno_prefix(), but yields a NULL pointer. */
#define glnx_null_throw_errno_prefix(error, args...) \
({glnx_throw_errno_prefix (error, args); NULL;})
/* BEGIN LEGACY APIS */
#define glnx_set_error_from_errno(error) \
@ -117,9 +159,7 @@ glnx_throw_errno_prefix (GError **error, const char *fmt, ...)
#define glnx_set_prefix_error_from_errno(error, format, args...) \
do { \
glnx_set_error_from_errno (error); \
g_prefix_error (error, format, args); \
glnx_throw_errno_prefix (error, format, args); \
} while (0);
G_END_DECLS

View File

@ -102,10 +102,7 @@ rename_file_noreplace_at (int olddirfd, const char *oldpath,
return TRUE;
}
else
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno (error);
}
return TRUE;
}
@ -172,10 +169,7 @@ glnx_open_tmpfile_linkable_at (int dfd,
#if defined(O_TMPFILE) && !defined(DISABLE_OTMPFILE) && !defined(ENABLE_WRPSEUDO_COMPAT)
fd = openat (dfd, subpath, O_TMPFILE|flags, 0600);
if (fd == -1 && !(errno == ENOSYS || errno == EISDIR || errno == EOPNOTSUPP))
{
glnx_set_prefix_error_from_errno (error, "%s", "open(O_TMPFILE)");
return FALSE;
}
return glnx_throw_errno_prefix (error, "open(O_TMPFILE)");
if (fd != -1)
{
*out_fd = fd;
@ -199,10 +193,7 @@ glnx_open_tmpfile_linkable_at (int dfd,
if (errno == EEXIST)
continue;
else
{
glnx_set_prefix_error_from_errno (error, "%s", "Creating temp file");
return FALSE;
}
return glnx_throw_errno_prefix (error, "Creating temp file");
}
else
{
@ -246,9 +237,10 @@ glnx_link_tmpfile_at (int dfd,
*/
if (renameat (dfd, tmpfile_path, target_dfd, target) < 0)
{
int errsv = errno;
(void) unlinkat (dfd, tmpfile_path, 0);
glnx_set_error_from_errno (error);
return FALSE;
errno = errsv;
return glnx_throw_errno_prefix (error, "renameat");
}
}
else
@ -293,10 +285,7 @@ glnx_link_tmpfile_at (int dfd,
if (errno == EEXIST)
continue;
else
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno_prefix (error, "linkat");
}
else
break;
@ -311,9 +300,10 @@ glnx_link_tmpfile_at (int dfd,
/* This is currently the only case where we need to have
* a cleanup unlinkat() still with O_TMPFILE.
*/
int errsv = errno;
(void) unlinkat (target_dfd, tmpname_buf, 0);
glnx_set_error_from_errno (error);
return FALSE;
errno = errsv;
return glnx_throw_errno_prefix (error, "renameat");
}
}
else
@ -323,10 +313,7 @@ glnx_link_tmpfile_at (int dfd,
if (errno == EEXIST && mode == GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST)
;
else
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno_prefix (error, "linkat");
}
}
@ -341,46 +328,34 @@ glnx_fd_readall_malloc (int fd,
GCancellable *cancellable,
GError **error)
{
gboolean success = FALSE;
const guint maxreadlen = 4096;
int res;
struct stat stbuf;
guint8* buf = NULL;
if (TEMP_FAILURE_RETRY (fstat (fd, &stbuf)) < 0)
return glnx_null_throw_errno (error);
gsize buf_allocated;
gsize buf_size = 0;
gssize bytes_read;
do
res = fstat (fd, &stbuf);
while (G_UNLIKELY (res == -1 && errno == EINTR));
if (res == -1)
{
glnx_set_error_from_errno (error);
goto out;
}
if (S_ISREG (stbuf.st_mode) && stbuf.st_size > 0)
buf_allocated = stbuf.st_size;
else
buf_allocated = 16;
buf = g_malloc (buf_allocated);
g_autofree guint8* buf = g_malloc (buf_allocated);
gsize buf_size = 0;
while (TRUE)
{
gsize readlen = MIN (buf_allocated - buf_size, maxreadlen);
if (g_cancellable_set_error_if_cancelled (cancellable, error))
goto out;
return FALSE;
gssize bytes_read;
do
bytes_read = read (fd, buf + buf_size, readlen);
while (G_UNLIKELY (bytes_read == -1 && errno == EINTR));
if (G_UNLIKELY (bytes_read == -1))
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_null_throw_errno (error);
if (bytes_read == 0)
break;
@ -396,15 +371,8 @@ glnx_fd_readall_malloc (int fd,
buf[buf_size] = '\0';
}
success = TRUE;
out:
if (success)
{
*out_len = buf_size;
return buf;
}
g_free (buf);
return NULL;
*out_len = buf_size;
return g_steal_pointer (&buf);
}
/**
@ -423,13 +391,10 @@ glnx_fd_readall_bytes (int fd,
GCancellable *cancellable,
GError **error)
{
guint8 *buf;
gsize len;
buf = glnx_fd_readall_malloc (fd, &len, FALSE, cancellable, error);
guint8 *buf = glnx_fd_readall_malloc (fd, &len, FALSE, cancellable, error);
if (!buf)
return NULL;
return g_bytes_new_take (buf, len);
}
@ -451,13 +416,10 @@ glnx_fd_readall_utf8 (int fd,
GCancellable *cancellable,
GError **error)
{
gboolean success = FALSE;
guint8 *buf;
gsize len;
buf = glnx_fd_readall_malloc (fd, &len, TRUE, cancellable, error);
g_autofree guint8 *buf = glnx_fd_readall_malloc (fd, &len, TRUE, cancellable, error);
if (!buf)
goto out;
return FALSE;
if (!g_utf8_validate ((char*)buf, len, NULL))
{
@ -465,19 +427,12 @@ glnx_fd_readall_utf8 (int fd,
G_IO_ERROR,
G_IO_ERROR_INVALID_DATA,
"Invalid UTF-8");
goto out;
return FALSE;
}
success = TRUE;
out:
if (success)
{
if (out_len)
*out_len = len;
return (char*)buf;
}
g_free (buf);
return NULL;
if (out_len)
*out_len = len;
return (char*)g_steal_pointer (&buf);
}
/**
@ -501,36 +456,20 @@ glnx_file_get_contents_utf8_at (int dfd,
GCancellable *cancellable,
GError **error)
{
gboolean success = FALSE;
glnx_fd_close int fd = -1;
char *buf = NULL;
gsize len;
dfd = glnx_dirfd_canonicalize (dfd);
do
fd = openat (dfd, subpath, O_RDONLY | O_NOCTTY | O_CLOEXEC);
while (G_UNLIKELY (fd == -1 && errno == EINTR));
glnx_fd_close int fd = TEMP_FAILURE_RETRY (openat (dfd, subpath, O_RDONLY | O_NOCTTY | O_CLOEXEC));
if (G_UNLIKELY (fd == -1))
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_null_throw_errno_prefix (error, "open(%s)", subpath);
buf = glnx_fd_readall_utf8 (fd, &len, cancellable, error);
gsize len;
g_autofree char *buf = glnx_fd_readall_utf8 (fd, &len, cancellable, error);
if (G_UNLIKELY(!buf))
goto out;
return FALSE;
success = TRUE;
out:
if (success)
{
if (out_len)
*out_len = len;
return buf;
}
g_free (buf);
return NULL;
if (out_len)
*out_len = len;
return g_steal_pointer (&buf);
}
/**
@ -555,25 +494,20 @@ glnx_readlinkat_malloc (int dfd,
for (;;)
{
char *c;
g_autofree char *c = NULL;
ssize_t n;
c = g_malloc (l);
n = TEMP_FAILURE_RETRY (readlinkat (dfd, subpath, c, l-1));
if (n < 0)
{
glnx_set_error_from_errno (error);
g_free (c);
return FALSE;
}
return glnx_null_throw_errno (error);
if ((size_t) n < l-1)
{
c[n] = 0;
return c;
return g_steal_pointer (&c);
}
g_free (c);
l *= 2;
}
@ -590,18 +524,12 @@ copy_symlink_at (int src_dfd,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_autofree char *buf = NULL;
buf = glnx_readlinkat_malloc (src_dfd, src_subpath, cancellable, error);
g_autofree char *buf = glnx_readlinkat_malloc (src_dfd, src_subpath, cancellable, error);
if (!buf)
goto out;
return FALSE;
if (TEMP_FAILURE_RETRY (symlinkat (buf, dest_dfd, dest_subpath)) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno_prefix (error, "symlinkat");
if (!(copyflags & GLNX_FILE_COPY_NOXATTRS))
{
@ -609,139 +537,158 @@ copy_symlink_at (int src_dfd,
if (!glnx_dfd_name_get_all_xattrs (src_dfd, src_subpath, &xattrs,
cancellable, error))
goto out;
return FALSE;
if (!glnx_dfd_name_set_all_xattrs (dest_dfd, dest_subpath, xattrs,
cancellable, error))
goto out;
return FALSE;
}
if (TEMP_FAILURE_RETRY (fchownat (dest_dfd, dest_subpath,
src_stbuf->st_uid, src_stbuf->st_gid,
AT_SYMLINK_NOFOLLOW)) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno (error);
ret = TRUE;
out:
return ret;
return TRUE;
}
#define COPY_BUFFER_SIZE (16*1024)
/* From systemd */
/* Most of the code below is from systemd, but has been reindented to GNU style,
* and changed to use POSIX error conventions (return -1, set errno) to more
* conveniently fit in with the rest of libglnx.
*/
static int btrfs_reflink(int infd, int outfd) {
int r;
g_return_val_if_fail(infd >= 0, -1);
g_return_val_if_fail(outfd >= 0, -1);
r = ioctl(outfd, BTRFS_IOC_CLONE, infd);
if (r < 0)
return -errno;
return 0;
return ioctl (outfd, BTRFS_IOC_CLONE, infd);
}
int glnx_loop_write(int fd, const void *buf, size_t nbytes) {
const uint8_t *p = buf;
/* Like write(), but loop until @nbytes are written, or an error
* occurs.
*
* On error, -1 is returned an @errno is set. NOTE: This is an
* API change from previous versions of this function.
*/
int
glnx_loop_write(int fd, const void *buf, size_t nbytes)
{
const uint8_t *p = buf;
g_return_val_if_fail(fd >= 0, -1);
g_return_val_if_fail(buf, -1);
g_return_val_if_fail(fd >= 0, -1);
g_return_val_if_fail(buf, -1);
errno = 0;
errno = 0;
while (nbytes > 0) {
ssize_t k;
while (nbytes > 0)
{
ssize_t k;
k = write(fd, p, nbytes);
if (k < 0) {
if (errno == EINTR)
continue;
k = write(fd, p, nbytes);
if (k < 0)
{
if (errno == EINTR)
continue;
return -errno;
}
if (k == 0) /* Can't really happen */
return -EIO;
p += k;
nbytes -= k;
return -1;
}
return 0;
if (k == 0) /* Can't really happen */
{
errno = EIO;
return -1;
}
p += k;
nbytes -= k;
}
return 0;
}
static int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink) {
bool try_sendfile = true;
int r;
/* Read from @fdf until EOF, writing to @fdt. If @try_reflink is %TRUE,
* attempt to use any "reflink" functionality; see e.g. https://lwn.net/Articles/331808/
*
* The file descriptor @fdf must refer to a regular file.
*
* If provided, @max_bytes specifies the maximum number of bytes to read from @fdf.
* On error, this function returns `-1` and @errno will be set.
*/
int
glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes, gboolean try_reflink)
{
bool try_sendfile = true;
int r;
g_return_val_if_fail (fdf >= 0, -1);
g_return_val_if_fail (fdt >= 0, -1);
/* Try btrfs reflinks first. */
if (try_reflink && max_bytes == (off_t) -1) {
r = btrfs_reflink(fdf, fdt);
if (r >= 0)
return r;
}
for (;;) {
size_t m = COPY_BUFFER_SIZE;
ssize_t n;
if (max_bytes != (off_t) -1) {
if (max_bytes <= 0)
return -EFBIG;
if ((off_t) m > max_bytes)
m = (size_t) max_bytes;
}
/* First try sendfile(), unless we already tried */
if (try_sendfile) {
n = sendfile(fdt, fdf, NULL, m);
if (n < 0) {
if (errno != EINVAL && errno != ENOSYS)
return -errno;
try_sendfile = false;
/* use fallback below */
} else if (n == 0) /* EOF */
break;
else if (n > 0)
/* Succcess! */
goto next;
}
/* As a fallback just copy bits by hand */
{
char buf[m];
n = read(fdf, buf, m);
if (n < 0)
return -errno;
if (n == 0) /* EOF */
break;
r = glnx_loop_write(fdt, buf, (size_t) n);
if (r < 0)
return r;
}
next:
if (max_bytes != (off_t) -1) {
g_assert(max_bytes >= n);
max_bytes -= n;
}
}
g_return_val_if_fail (fdf >= 0, -1);
g_return_val_if_fail (fdt >= 0, -1);
g_return_val_if_fail (max_bytes >= -1, -1);
/* Try btrfs reflinks first. */
if (try_reflink && max_bytes == (off_t) -1)
{
r = btrfs_reflink(fdf, fdt);
if (r >= 0)
return 0;
/* Fall through */
}
while (TRUE)
{
size_t m = COPY_BUFFER_SIZE;
ssize_t n;
if (max_bytes != (off_t) -1)
{
if ((off_t) m > max_bytes)
m = (size_t) max_bytes;
}
/* First try sendfile(), unless we already tried */
if (try_sendfile)
{
n = sendfile (fdt, fdf, NULL, m);
if (n < 0)
{
if (errno != EINVAL && errno != ENOSYS)
return -1;
try_sendfile = false;
/* use fallback below */
}
else if (n == 0) /* EOF */
break;
else if (n > 0)
/* Succcess! */
goto next;
}
/* As a fallback just copy bits by hand */
{ char buf[m];
n = read (fdf, buf, m);
if (n < 0)
return -1;
if (n == 0) /* EOF */
break;
if (glnx_loop_write (fdt, buf, (size_t) n) < 0)
return -1;
}
next:
if (max_bytes != (off_t) -1)
{
g_assert(max_bytes >= n);
max_bytes -= n;
if (max_bytes == 0)
break;
}
}
return 0;
}
/**
@ -829,10 +776,9 @@ glnx_file_copy_at (int src_dfd,
goto out;
}
r = copy_bytes (src_fd, dest_fd, (off_t) -1, TRUE);
r = glnx_regfile_copy_bytes (src_fd, dest_fd, (off_t) -1, TRUE);
if (r < 0)
{
errno = -r;
glnx_set_error_from_errno (error);
goto out;
}
@ -921,7 +867,6 @@ glnx_file_replace_contents_at (int dfd,
return glnx_file_replace_contents_with_perms_at (dfd, subpath, buf, len,
(mode_t) -1, (uid_t) -1, (gid_t) -1,
flags, cancellable, error);
}
/**
@ -953,8 +898,6 @@ glnx_file_replace_contents_with_perms_at (int dfd,
int r;
char *dnbuf = strdupa (subpath);
const char *dn = dirname (dnbuf);
g_autofree char *tmpfile_path = NULL;
glnx_fd_close int fd = -1;
dfd = glnx_dirfd_canonicalize (dfd);
@ -964,6 +907,8 @@ glnx_file_replace_contents_with_perms_at (int dfd,
if (mode == (mode_t) -1)
mode = 0644;
glnx_fd_close int fd = -1;
g_autofree char *tmpfile_path = NULL;
if (!glnx_open_tmpfile_linkable_at (dfd, dn, O_WRONLY | O_CLOEXEC,
&fd, &tmpfile_path,
error))
@ -979,17 +924,12 @@ glnx_file_replace_contents_with_perms_at (int dfd,
if (r != 0)
{
errno = r;
glnx_set_error_from_errno (error);
return FALSE;
return glnx_throw_errno_prefix (error, "fallocate");
}
}
if ((r = glnx_loop_write (fd, buf, len)) != 0)
{
errno = -r;
glnx_set_error_from_errno (error);
return FALSE;
}
if (glnx_loop_write (fd, buf, len) < 0)
return glnx_throw_errno (error);
if (!(flags & GLNX_FILE_REPLACE_NODATASYNC))
{
@ -999,10 +939,7 @@ glnx_file_replace_contents_with_perms_at (int dfd,
if (fstatat (dfd, subpath, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
{
if (errno != ENOENT)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno (error);
do_sync = (flags & GLNX_FILE_REPLACE_DATASYNC_NEW) > 0;
}
else
@ -1011,27 +948,18 @@ glnx_file_replace_contents_with_perms_at (int dfd,
if (do_sync)
{
if (fdatasync (fd) != 0)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno_prefix (error, "fdatasync");
}
}
if (uid != (uid_t) -1)
{
if (fchown (fd, uid, gid) != 0)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno (error);
}
if (fchmod (fd, mode) != 0)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno (error);
if (!glnx_link_tmpfile_at (dfd, GLNX_LINK_TMPFILE_REPLACE,
fd, tmpfile_path, dfd, subpath, error))
@ -1060,10 +988,7 @@ glnx_stream_fstat (GFileDescriptorBased *stream,
int fd = g_file_descriptor_based_get_fd (stream);
if (fstat (fd, stbuf) == -1)
{
glnx_set_prefix_error_from_errno (error, "%s", "fstat");
return FALSE;
}
return glnx_throw_errno_prefix (error, "fstat");
return TRUE;
}

View File

@ -35,6 +35,8 @@
#include <libgen.h>
#undef basename
#include <glnx-errors.h>
G_BEGIN_DECLS
/* Irritatingly, g_basename() which is what we want
@ -129,6 +131,9 @@ glnx_readlinkat_malloc (int dfd,
int
glnx_loop_write (int fd, const void *buf, size_t nbytes);
int
glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes, gboolean try_reflink);
typedef enum {
GLNX_FILE_COPY_OVERWRITE = (1 << 0),
GLNX_FILE_COPY_NOXATTRS = (1 << 1),
@ -155,5 +160,54 @@ int glnx_renameat2_noreplace (int olddirfd, const char *oldpath,
int glnx_renameat2_exchange (int olddirfd, const char *oldpath,
int newdirfd, const char *newpath);
/**
* glnx_fstat:
* @fd: FD to stat
* @buf: (out caller-allocates): Return location for stat details
* @error: Return location for a #GError, or %NULL
*
* Wrapper around fstat() which adds #GError support and ensures that it retries
* on %EINTR.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
*/
static inline gboolean
glnx_fstat (int fd,
struct stat *buf,
GError **error)
{
if (TEMP_FAILURE_RETRY (fstat (fd, buf)) != 0)
return glnx_throw_errno (error);
return TRUE;
}
/**
* glnx_fstatat:
* @dfd: Directory FD to stat beneath
* @path: Path to stat beneath @dfd
* @buf: (out caller-allocates): Return location for stat details
* @flags: Flags to pass to fstatat()
* @error: Return location for a #GError, or %NULL
*
* Wrapper around fstatat() which adds #GError support and ensures that it
* retries on %EINTR.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
*/
static inline gboolean
glnx_fstatat (int dfd,
const gchar *path,
struct stat *buf,
int flags,
GError **error)
{
if (TEMP_FAILURE_RETRY (fstatat (dfd, path, buf, flags)) != 0)
return glnx_throw_errno (error);
return TRUE;
}
G_END_DECLS

View File

@ -201,7 +201,7 @@ glnx_cleanup_close_fdp (int *fdp)
g_assert (fdp);
fd = *fdp;
if (fd != -1)
if (fd >= 0)
{
errsv = errno;
(void) close (fd);

View File

@ -61,7 +61,6 @@
*/
gboolean
glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_lock, GError **error) {
gboolean ret = FALSE;
glnx_fd_close int fd = -1;
g_autofree char *t = NULL;
int r;
@ -89,10 +88,8 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
struct stat st;
fd = openat(dfd, p, O_CREAT|O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NOCTTY, 0600);
if (fd < 0) {
glnx_set_error_from_errno(error);
goto out;
}
if (fd < 0)
return glnx_throw_errno(error);
/* Unfortunately, new locks are not in RHEL 7.1 glibc */
#ifdef F_OFD_SETLK
@ -107,10 +104,8 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
if (errno == EINVAL)
r = flock(fd, operation);
if (r < 0) {
glnx_set_error_from_errno(error);
goto out;
}
if (r < 0)
return glnx_throw_errno(error);
}
/* If we acquired the lock, let's check if the file
@ -120,10 +115,8 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
* hence try again. */
r = fstat(fd, &st);
if (r < 0) {
glnx_set_error_from_errno(error);
goto out;
}
if (r < 0)
return glnx_throw_errno(error);
if (st.st_nlink > 0)
break;
@ -142,9 +135,7 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
fd = -1;
t = NULL;
ret = TRUE;
out:
return ret;
return TRUE;
}
void glnx_release_lock_file(GLnxLockFile *f) {

View File

@ -31,14 +31,12 @@ glnx_shutil_rm_rf_children (GLnxDirFdIterator *dfd_iter,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
struct dirent *dent;
while (TRUE)
{
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (dfd_iter, &dent, cancellable, error))
goto out;
return FALSE;
if (dent == NULL)
break;
@ -48,33 +46,25 @@ glnx_shutil_rm_rf_children (GLnxDirFdIterator *dfd_iter,
if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, dent->d_name, FALSE,
&child_dfd_iter, error))
goto out;
return FALSE;
if (!glnx_shutil_rm_rf_children (&child_dfd_iter, cancellable, error))
goto out;
return FALSE;
if (unlinkat (dfd_iter->fd, dent->d_name, AT_REMOVEDIR) == -1)
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno_prefix (error, "unlinkat");
}
else
{
if (unlinkat (dfd_iter->fd, dent->d_name, 0) == -1)
{
if (errno != ENOENT)
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno_prefix (error, "unlinkat");
}
}
}
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
@ -94,7 +84,6 @@ glnx_shutil_rm_rf_at (int dfd,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
glnx_fd_close int target_dfd = -1;
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
@ -114,40 +103,28 @@ glnx_shutil_rm_rf_at (int dfd,
else if (errsv == ENOTDIR || errsv == ELOOP)
{
if (unlinkat (dfd, path, 0) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno_prefix (error, "unlinkat");
}
else
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno_prefix (error, "open(%s)", path);
}
else
{
if (!glnx_dirfd_iterator_init_take_fd (target_dfd, &dfd_iter, error))
goto out;
return FALSE;
target_dfd = -1;
if (!glnx_shutil_rm_rf_children (&dfd_iter, cancellable, error))
goto out;
return FALSE;
if (unlinkat (dfd, path, AT_REMOVEDIR) == -1)
{
int errsv = errno;
if (errsv != ENOENT)
{
glnx_set_error_from_errno (error);
goto out;
}
if (errno != ENOENT)
return glnx_throw_errno_prefix (error, "unlinkat");
}
}
ret = TRUE;
out:
return ret;
return TRUE;
}
static gboolean
@ -157,11 +134,10 @@ mkdir_p_at_internal (int dfd,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gboolean did_recurse = FALSE;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
goto out;
return FALSE;
again:
if (mkdirat (dfd, path, mode) == -1)
@ -179,7 +155,7 @@ mkdir_p_at_internal (int dfd,
if (!glnx_shutil_mkdir_p_at (dfd, path, mode,
cancellable, error))
goto out;
return FALSE;
/* Now restore it for another mkdir attempt */
*lastslash = '/';
@ -194,15 +170,10 @@ mkdir_p_at_internal (int dfd,
*/
}
else
{
glnx_set_error_from_errno (error);
goto out;
}
return glnx_throw_errno_prefix (error, "mkdir(%s)", path);
}
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
@ -223,26 +194,58 @@ glnx_shutil_mkdir_p_at (int dfd,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
struct stat stbuf;
char *buf;
/* Fast path stat to see whether it already exists */
if (fstatat (dfd, path, &stbuf, AT_SYMLINK_NOFOLLOW) == 0)
{
/* Note early return */
if (S_ISDIR (stbuf.st_mode))
{
ret = TRUE;
goto out;
}
return TRUE;
}
buf = strdupa (path);
if (!mkdir_p_at_internal (dfd, buf, mode, cancellable, error))
goto out;
return FALSE;
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
* glnx_shutil_mkdir_p_at_open:
* @dfd: Directory fd
* @path: Directory path to be created
* @mode: Mode for newly created directories
* @out_dfd: (out caller-allocates): Return location for an FD to @dfd/@path,
* or `-1` on error
* @cancellable: (nullable): Cancellable, or %NULL
* @error: Return location for a #GError, or %NULL
*
* Similar to glnx_shutil_mkdir_p_at(), except it opens the resulting directory
* and returns a directory FD to it. Currently, this is not guaranteed to be
* race-free.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
*/
gboolean
glnx_shutil_mkdir_p_at_open (int dfd,
const char *path,
int mode,
int *out_dfd,
GCancellable *cancellable,
GError **error)
{
/* FIXME: Its not possible to eliminate the race here until
* openat(O_DIRECTORY | O_CREAT) works (and returns a directory rather than a
* file). It appears to be not supported in current kernels. (Tested with
* 4.10.10-200.fc25.x86_64.) */
*out_dfd = -1;
if (!glnx_shutil_mkdir_p_at (dfd, path, mode, cancellable, error))
return FALSE;
return glnx_opendirat (dfd, path, TRUE, out_dfd, error);
}

View File

@ -37,4 +37,12 @@ glnx_shutil_mkdir_p_at (int dfd,
GCancellable *cancellable,
GError **error);
gboolean
glnx_shutil_mkdir_p_at_open (int dfd,
const char *path,
int mode,
int *out_dfd,
GCancellable *cancellable,
GError **error);
G_END_DECLS

View File

@ -33,6 +33,19 @@ test_error_throw (void)
g_assert (!glnx_throw (&error, "foo: %s %d", "hello", 42));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "foo: hello 42");
g_clear_error (&error);
gpointer dummy = glnx_null_throw (&error, "literal foo");
g_assert (dummy == NULL);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "literal foo");
g_clear_error (&error);
gpointer dummy2 = glnx_null_throw (&error, "foo: %s %d", "hola", 24);
g_assert (dummy2 == NULL);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "foo: hola 24");
g_clear_error (&error);
}
static void
@ -47,6 +60,9 @@ test_error_errno (void)
{
g_assert (!glnx_throw_errno (&error));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (!glnx_prefix_error (&error, "myprefix"));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, "myprefix: "));
g_clear_error (&error);
}
else
@ -55,8 +71,53 @@ test_error_errno (void)
fd = open (noent_path, O_RDONLY);
if (fd < 0)
{
gpointer dummy = glnx_null_throw_errno (&error);
g_assert (dummy == NULL);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
dummy = glnx_prefix_error_null (&error, "myprefix");
g_assert (dummy == NULL);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, "myprefix: "));
g_clear_error (&error);
}
else
g_assert_cmpint (fd, ==, -1);
fd = open (noent_path, O_RDONLY);
if (fd < 0)
{
g_autofree char *expected_prefix = g_strdup_printf ("Failed to open %s", noent_path);
g_assert (!glnx_throw_errno_prefix (&error, "Failed to open %s", noent_path));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, expected_prefix));
g_clear_error (&error);
/* And test the legacy wrapper */
glnx_set_prefix_error_from_errno (&error, "Failed to open %s", noent_path);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, expected_prefix));
g_clear_error (&error);
}
else
g_assert_cmpint (fd, ==, -1);
fd = open (noent_path, O_RDONLY);
if (fd < 0)
{
gpointer dummy = glnx_null_throw_errno_prefix (&error, "Failed to open file");
g_assert (dummy == NULL);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, "Failed to open file"));
g_clear_error (&error);
}
else
g_assert_cmpint (fd, ==, -1);
fd = open (noent_path, O_RDONLY);
if (fd < 0)
{
gpointer dummy = glnx_null_throw_errno_prefix (&error, "Failed to open %s", noent_path);
g_assert (dummy == NULL);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, glnx_strjoina ("Failed to open ", noent_path)));
g_clear_error (&error);
}

View File

@ -244,6 +244,21 @@ test_xattr_races (void)
if (!glnx_opendirat (AT_FDCWD, tmpdir, TRUE, &dfd, error))
goto out;
/* Support people building/testing on tmpfs https://github.com/flatpak/flatpak/issues/686 */
if (fsetxattr (dfd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
{
if (errno == EOPNOTSUPP)
{
g_test_skip ("no xattr support");
return;
}
else
{
glnx_set_error_from_errno (error);
goto out;
}
}
for (guint i = 0; i < nprocs; i++)
{
struct XattrWorker *worker = &wdata[i];

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin cleanup
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin cleanup
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin config-diff
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/14/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin config-diff
.\" Source: OSTree
.\" Language: English
@ -37,9 +37,9 @@ ostree-admin-config-diff \- Diff current /etc configuration versus default
Prints the differences between the current /etc directory and the default configuration in /usr/etc\&. Newly added files (present in /etc but not in /usr/etc) will be prefixed with \*(AqA\*(Aq\&. Modified files will be prefixed with \*(AqM\*(Aq, and deleted files with \*(AqD\*(Aq\&.
.SH "OPTIONS"
.PP
\fB\-\-os\fR="OSNAME"
\fB\-\-os\fR="STATEROOT"
.RS 4
Use a different operating system root than the current one\&.
Use a different operating system stateroot than the current one\&.
.RE
.SH "EXAMPLE"
.PP

View File

@ -66,10 +66,10 @@ Boston, MA 02111-1307, USA.
<variablelist>
<varlistentry>
<term><option>--os</option>="OSNAME"</term>
<term><option>--os</option>="STATEROOT"</term>
<listitem><para>
Use a different operating system root than the current one.
Use a different operating system stateroot than the current one.
</para></listitem>
</varlistentry>
</variablelist>

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin deploy
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/14/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin deploy
.\" Source: OSTree
.\" Language: English
@ -37,7 +37,7 @@ ostree-admin-deploy \- Checkout a revision as the new default deployment
Takes a commit or revision REFSPEC, and queues the new deployment as default upon reboot\&.
.SH "OPTIONS"
.PP
\fB\-\-os\fR="OSNAME"
\fB\-\-os\fR="STATEROOT"
.RS 4
Use a different operating system root than the current one\&.
.RE

View File

@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA.
<variablelist>
<varlistentry>
<term><option>--os</option>="OSNAME"</term>
<term><option>--os</option>="STATEROOT"</term>
<listitem><para>
Use a different operating system root than the current one.

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin init-fs
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin init-fs
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin instutil
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin instutil
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin os-init
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/14/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin os-init
.\" Source: OSTree
.\" Language: English
@ -31,21 +31,21 @@
ostree-admin-os-init \- Initialize empty state for a given operating system
.SH "SYNOPSIS"
.HP \w'\fBostree\ admin\ os\-init\fR\ 'u
\fBostree admin os\-init\fR {OSNAME}
\fBostree admin os\-init\fR {STATEROOT}
.SH "DESCRIPTION"
.PP
Initializes an new state for an operating system\&. Ensures that the core subdirectories of /var (/tmp, /lib, /run, and /lock) exist and initialize the given OSNAME as OSTree root\&. Each deployment location is comprised of a single shared
Initializes an new stateroot (AKA "osname") for an operating system\&. Ensures that the core subdirectories of /var (/tmp, /lib, /run, and /lock) exist and initialize the given STATEROOT as OSTree stateroot\&. Each deployment location is comprised of a single shared
var
and a set of deployments (chroots)\&.
.SH "EXAMPLE"
.PP
\fB$ ostree admin os\-init gnome\-ostree\fR
\fB$ ostree admin os\-init exampleos\fR
.sp
.if n \{\
.RS 4
.\}
.nf
ostree/deploy/gnome\-ostree initialized as OSTree root
ostree/deploy/exampleos initialized as OSTree root
.fi
.if n \{\

View File

@ -49,7 +49,7 @@ Boston, MA 02111-1307, USA.
<refsynopsisdiv>
<cmdsynopsis>
<command>ostree admin os-init</command> <arg choice="req">OSNAME</arg>
<command>ostree admin os-init</command> <arg choice="req">STATEROOT</arg>
</cmdsynopsis>
</refsynopsisdiv>
@ -57,15 +57,19 @@ Boston, MA 02111-1307, USA.
<title>Description</title>
<para>
Initializes an new state for an operating system. Ensures that the core subdirectories of /var (/tmp, /lib, /run, and /lock) exist and initialize the given OSNAME as OSTree root. Each deployment location is comprised of a single shared <filename>var</filename> and a set of deployments (chroots).
Initializes an new stateroot (AKA "osname") for an operating system.
Ensures that the core subdirectories of /var (/tmp, /lib, /run, and
/lock) exist and initialize the given STATEROOT as OSTree stateroot.
Each deployment location is comprised of a single shared
<filename>var</filename> and a set of deployments (chroots).
</para>
</refsect1>
<refsect1>
<title>Example</title>
<para><command>$ ostree admin os-init gnome-ostree</command></para>
<para><command>$ ostree admin os-init exampleos</command></para>
<programlisting>
ostree/deploy/gnome-ostree initialized as OSTree root
ostree/deploy/exampleos initialized as OSTree root
</programlisting>
</refsect1>
</refentry>

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin set-origin
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin set-origin
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin status
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin status
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin switch
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/14/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin switch
.\" Source: OSTree
.\" Language: English
@ -38,7 +38,7 @@ Choose a different REF forom the current remote to track\&. This is the ref that
\fBostree admin upgrade\fR\&. Like an upgrade, the operating system state will be preserved\&.
.SH "OPTIONS"
.PP
\fB\-\-os\fR="OSNAME"
\fB\-\-os\fR="STATEROOT"
.RS 4
Use a different operating system root than the current one\&.
.RE

View File

@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA.
<variablelist>
<varlistentry>
<term><option>--os</option>="OSNAME"</term>
<term><option>--os</option>="STATEROOT"</term>
<listitem><para>
Use a different operating system root than the current one.

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin undeploy
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin undeploy
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin unlock
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin unlock
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin upgrade
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/14/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin upgrade
.\" Source: OSTree
.\" Language: English
@ -40,7 +40,7 @@ and
\fB\-\-deploy\-only\fR\&.
.SH "OPTIONS"
.PP
\fB\-\-os\fR="OSNAME"
\fB\-\-os\fR="STATEROOT"
.RS 4
Use a different operating system root than the current one\&.
.RE

View File

@ -69,7 +69,7 @@ Boston, MA 02111-1307, USA.
<variablelist>
<varlistentry>
<term><option>--os</option>="OSNAME"</term>
<term><option>--os</option>="STATEROOT"</term>
<listitem><para>
Use a different operating system root than the current one.

View File

@ -2,7 +2,7 @@
.\" Title: ostree admin
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree admin
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree cat
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree cat
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree checkout
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree checkout
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree checksum
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree checksum
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree commit
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree commit
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree config
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree config
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree diff
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/11/2017
.\" Date: 05/17/2017
.\" Manual: ostree diff
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree export
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree export
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree fsck
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree fsck
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree gpg-sign
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree gpg-sign
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree init
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree init
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree log
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree log
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree ls
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree ls
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree prune
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree prune
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree pull-local
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree pull-local
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree pull
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree pull
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree refs
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree refs
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree remote
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree remote
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree reset
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree reset
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree rev-parse
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree rev-parse
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree show
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree show
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree static-delta
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree static-delta
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree summary
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree summary
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree trivial-httpd
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree trivial-httpd
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/14/2017
.\" Date: 05/17/2017
.\" Manual: ostree
.\" Source: OSTree
.\" Language: English
@ -37,8 +37,10 @@ ostree \- Manage multiple bootable versioned filesystem trees
OSTree is a tool for managing multiple bootable versioned filesystem trees, or just "tree" for short\&. In the OSTree model, operating systems no longer live in the physical "/" root directory\&. Instead, they parallel install to the new toplevel
/ostree
directory\&. Each installed system gets its own
/ostree/deploy/\fIosname\fR
directory\&.
/ostree/deploy/\fIstateroot\fR
directory\&. (stateroot
is the newer term for
osname)\&.
.PP
Unlike
rpm

View File

@ -2,7 +2,7 @@
.\" Title: ostree.repo-config
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree.repo-config
.\" Source: OSTree
.\" Language: English

View File

@ -2,7 +2,7 @@
.\" Title: ostree.repo
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: ostree.repo
.\" Source: OSTree
.\" Language: English

View File

@ -65,8 +65,9 @@ Boston, MA 02111-1307, USA.
Instead, they parallel install to the new toplevel
<filename>/ostree</filename> directory. Each
installed system gets its own
<filename>/ostree/deploy/<replaceable>osname</replaceable></filename>
directory.
<filename>/ostree/deploy/<replaceable>stateroot</replaceable></filename>
directory. (<literal>stateroot</literal> is the
newer term for <literal>osname</literal>).
</para>
<para>
Unlike <literal>rpm</literal> or

View File

@ -2,7 +2,7 @@
.\" Title: rofiles-fuse
.\" Author: Colin Walters <walters@verbum.org>
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 04/05/2017
.\" Date: 05/17/2017
.\" Manual: rofiles-fuse
.\" Source: rofiles-fuse
.\" Language: English

View File

@ -0,0 +1,31 @@
/*
* Copyright © 2017 Endless Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* - Philip Withnall <withnall@endlessm.com>
*/
/* Symbols in this file are added to the build if OSTree is configured with
* --enable-experimental-api. They are not stable or officially supported, and
* might disappear or change in future releases. */
LIBOSTREE_2017.6_EXPERIMENTAL {
global:
ostree_remote_ref;
ostree_remote_unref;
} LIBOSTREE_2017.6;

View File

@ -389,17 +389,24 @@ global:
ostree_sysroot_write_deployments_with_options;
} LIBOSTREE_2017.3;
LIBOSTREE_2017.6 {
global:
ostree_async_progress_get;
ostree_async_progress_set;
ostree_async_progress_get_variant;
ostree_async_progress_set_variant;
} LIBOSTREE_2017.4;
/* NOTE NOTE NOTE
* Versions above here are released. Only add symbols below this line.
* NOTE NOTE NOTE
*/
/* Uncomment when adding the first new symbol */
/*
LIBOSTREE_2017.$NEWVERSION {
global:
someostree_symbol_deleteme;
} LIBOSTREE_2017.4;
} LIBOSTREE_2017.6;
*/
/* Stub section for the stable release *after* this development one; don't

View File

@ -2,6 +2,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
features=@OSTREE_FEATURES@
Name: OSTree
Description: Git for operating system binaries

View File

@ -22,6 +22,8 @@
#include "ostree-async-progress.h"
#include "libglnx.h"
/**
* SECTION:ostree-async-progress
* @title: Progress notification system for asynchronous operations
@ -37,14 +39,13 @@
* handles thread safety, ensuring that the progress change
* notification occurs in the thread-default context of the calling
* operation.
*
* The ostree_async_progress_get_status() and ostree_async_progress_set_status()
* methods get and set a well-known `status` key of type %G_VARIANT_TYPE_STRING.
* This key may be accessed using the other #OstreeAsyncProgress methods, but it
* must always have the correct type.
*/
#if GLIB_SIZEOF_VOID_P == 8
#define _OSTREE_HAVE_LP64 1
#else
#define _OSTREE_HAVE_LP64 0
#endif
enum {
CHANGED,
LAST_SIGNAL
@ -59,12 +60,9 @@ struct OstreeAsyncProgress
GMutex lock;
GMainContext *maincontext;
GSource *idle_source;
GHashTable *uint_values;
GHashTable *uint64_values;
GHashTable *values; /* (element-type uint GVariant) */
gboolean dead;
char *status;
};
G_DEFINE_TYPE (OstreeAsyncProgress, ostree_async_progress, G_TYPE_OBJECT)
@ -79,9 +77,7 @@ ostree_async_progress_finalize (GObject *object)
g_mutex_clear (&self->lock);
g_clear_pointer (&self->maincontext, g_main_context_unref);
g_clear_pointer (&self->idle_source, g_source_unref);
g_hash_table_unref (self->uint_values);
g_hash_table_unref (self->uint64_values);
g_free (self->status);
g_hash_table_unref (self->values);
G_OBJECT_CLASS (ostree_async_progress_parent_class)->finalize (object);
}
@ -114,46 +110,115 @@ ostree_async_progress_init (OstreeAsyncProgress *self)
{
g_mutex_init (&self->lock);
self->maincontext = g_main_context_ref_thread_default ();
self->uint_values = g_hash_table_new (NULL, NULL);
#if _OSTREE_HAVE_LP64
self->uint64_values = g_hash_table_new (NULL, NULL);
#else
self->uint64_values = g_hash_table_new_full (NULL, NULL,
NULL, g_free);
#endif
self->values = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_variant_unref);
}
/**
* ostree_async_progress_get_variant:
* @self: an #OstreeAsyncProgress
* @key: a key to look up
*
* Look up a key in the #OstreeAsyncProgress and return the #GVariant associated
* with it. The lookup is thread-safe.
*
* Returns: (transfer full) (nullable): value for the given @key, or %NULL if
* it was not set
* Since: 2017.6
*/
GVariant *
ostree_async_progress_get_variant (OstreeAsyncProgress *self,
const char *key)
{
GVariant *rval;
g_return_val_if_fail (OSTREE_IS_ASYNC_PROGRESS (self), NULL);
g_return_val_if_fail (key != NULL, NULL);
g_mutex_lock (&self->lock);
rval = g_hash_table_lookup (self->values, GUINT_TO_POINTER (g_quark_from_string (key)));
if (rval != NULL)
g_variant_ref (rval);
g_mutex_unlock (&self->lock);
return rval;
}
guint
ostree_async_progress_get_uint (OstreeAsyncProgress *self,
const char *key)
{
guint rval;
g_mutex_lock (&self->lock);
rval = GPOINTER_TO_UINT (g_hash_table_lookup (self->uint_values,
GUINT_TO_POINTER (g_quark_from_string (key))));
g_mutex_unlock (&self->lock);
return rval;
g_autoptr(GVariant) rval = ostree_async_progress_get_variant (self, key);
return (rval != NULL) ? g_variant_get_uint32 (rval) : 0;
}
guint64
ostree_async_progress_get_uint64 (OstreeAsyncProgress *self,
const char *key)
{
#if _OSTREE_HAVE_LP64
guint64 rval;
g_autoptr(GVariant) rval = ostree_async_progress_get_variant (self, key);
return (rval != NULL) ? g_variant_get_uint64 (rval) : 0;
}
/**
* ostree_async_progress_get:
* @self: an #OstreeAsyncProgress
* @...: key name, format string, #GVariant return locations, , followed by %NULL
*
* Get the values corresponding to zero or more keys from the
* #OstreeAsyncProgress. Each key is specified in @... as the key name, followed
* by a #GVariant format string, followed by the necessary arguments for that
* format string, just as for g_variant_get(). After those arguments is the
* next key name. The varargs list must be %NULL-terminated.
*
* Each format string must make deep copies of its value, as the values stored
* in the #OstreeAsyncProgress may be freed from another thread after this
* function returns.
*
* This operation is thread-safe, and all the keys are queried atomically.
*
* |[<!-- language="C" -->
* guint32 outstanding_fetches;
* guint64 bytes_received;
* g_autofree gchar *status = NULL;
* g_autoptr(GVariant) refs_variant = NULL;
*
* ostree_async_progress_get (progress,
* "outstanding-fetches", "u", &outstanding_fetches,
* "bytes-received", "t", &bytes_received,
* "status", "s", &status,
* "refs", "@a{ss}", &refs_variant,
* NULL);
* ]|
*
* Since: 2017.6
*/
void
ostree_async_progress_get (OstreeAsyncProgress *self,
...)
{
va_list ap;
const char *key, *format_string;
g_mutex_lock (&self->lock);
rval = (guint64) g_hash_table_lookup (self->uint64_values, GUINT_TO_POINTER (g_quark_from_string (key)));
va_start (ap, self);
for (key = va_arg (ap, const char *), format_string = va_arg (ap, const char *);
key != NULL;
key = va_arg (ap, const char *), format_string = va_arg (ap, const char *))
{
GVariant *variant;
g_assert (format_string != NULL);
variant = g_hash_table_lookup (self->values, GUINT_TO_POINTER (g_quark_from_string (key)));
g_assert (variant != NULL);
g_assert (g_variant_check_format_string (variant, format_string, TRUE));
g_variant_get_va (variant, format_string, NULL, &ap);
}
va_end (ap);
g_mutex_unlock (&self->lock);
return rval;
#else
guint64 *rval;
g_mutex_lock (&self->lock);
rval = g_hash_table_lookup (self->uint64_values, (gpointer)g_quark_from_string (key));
g_mutex_unlock (&self->lock);
if (rval)
return *rval;
return 0;
#endif
}
static gboolean
@ -180,50 +245,162 @@ ensure_callback_locked (OstreeAsyncProgress *self)
g_source_attach (self->idle_source, self->maincontext);
}
/**
* ostree_async_progress_set_status:
* @self: an #OstreeAsyncProgress
* @status: (nullable): new status string, or %NULL to clear the status
*
* Set the human-readable status string for the #OstreeAsyncProgress. This
* operation is thread-safe. %NULL may be passed to clear the status.
*
* This is a convenience function to set the well-known `status` key.
*
* Since: 2017.6
*/
void
ostree_async_progress_set_status (OstreeAsyncProgress *self,
const char *status)
{
g_mutex_lock (&self->lock);
if (!self->dead)
{
g_free (self->status);
self->status = g_strdup (status);
ensure_callback_locked (self);
}
g_mutex_unlock (&self->lock);
ostree_async_progress_set_variant (self, "status",
g_variant_new_string ((status != NULL) ? status : ""));
}
/**
* ostree_async_progress_get_status:
* @self: an #OstreeAsyncProgress
*
* Get the human-readable status string from the #OstreeAsyncProgress. This
* operation is thread-safe. The retuned value may be %NULL if no status is
* set.
*
* This is a convenience function to get the well-known `status` key.
*
* Returns: (transfer full) (nullable): the current status, or %NULL if none is set
* Since: 2017.6
*/
char *
ostree_async_progress_get_status (OstreeAsyncProgress *self)
{
char *ret;
g_mutex_lock (&self->lock);
ret = g_strdup (self->status);
g_mutex_unlock (&self->lock);
return ret;
g_autoptr(GVariant) rval = ostree_async_progress_get_variant (self, "status");
const gchar *status = (rval != NULL) ? g_variant_get_string (rval, NULL) : NULL;
if (status != NULL && *status == '\0')
status = NULL;
return g_strdup (status);
}
static void
update_key (OstreeAsyncProgress *self,
GHashTable *hash,
const char *key,
gpointer value)
/**
* ostree_async_progress_set:
* @self: an #OstreeAsyncProgress
* @...: key name, format string, #GVariant parameters, , followed by %NULL
*
* Set the values for zero or more keys in the #OstreeAsyncProgress. Each key is
* specified in @... as the key name, followed by a #GVariant format string,
* followed by the necessary arguments for that format string, just as for
* g_variant_new(). After those arguments is the next key name. The varargs list
* must be %NULL-terminated.
*
* g_variant_ref_sink() will be called as appropriate on the #GVariant
* parameters, so they may be floating.
*
* This operation is thread-safe, and all the keys are set atomically.
*
* |[<!-- language="C" -->
* guint32 outstanding_fetches = 15;
* guint64 bytes_received = 1000;
*
* ostree_async_progress_set (progress,
* "outstanding-fetches", "u", outstanding_fetches,
* "bytes-received", "t", bytes_received,
* "status", "s", "Updated status",
* "refs", "@a{ss}", g_variant_new_parsed ("@a{ss} {}"),
* NULL);
* ]|
*
* Since: 2017.6
*/
void
ostree_async_progress_set (OstreeAsyncProgress *self,
...)
{
gpointer orig_value;
gpointer qkey = GUINT_TO_POINTER (g_quark_from_string (key));
va_list ap;
const char *key, *format_string;
gboolean changed;
g_mutex_lock (&self->lock);
if (self->dead)
goto out;
if (g_hash_table_lookup_extended (hash, qkey, NULL, &orig_value))
changed = FALSE;
va_start (ap, self);
for (key = va_arg (ap, const char *), format_string = va_arg (ap, const char *);
key != NULL;
key = va_arg (ap, const char *), format_string = va_arg (ap, const char *))
{
if (orig_value == value)
GVariant *orig_value;
g_autoptr(GVariant) new_value = NULL;
gpointer qkey = GUINT_TO_POINTER (g_quark_from_string (key));
new_value = g_variant_ref_sink (g_variant_new_va (format_string, NULL, &ap));
if (g_hash_table_lookup_extended (self->values, qkey, NULL, (gpointer *) &orig_value) &&
g_variant_equal (orig_value, new_value))
continue;
g_hash_table_replace (self->values, qkey, g_steal_pointer (&new_value));
changed = TRUE;
}
va_end (ap);
if (changed)
ensure_callback_locked (self);
out:
g_mutex_unlock (&self->lock);
}
/**
* ostree_async_progress_set_variant:
* @self: an #OstreeAsyncProgress
* @key: a key to set
* @value: the value to assign to @key
*
* Assign a new @value to the given @key, replacing any existing value. The
* operation is thread-safe. @value may be a floating reference;
* g_variant_ref_sink() will be called on it.
*
* Any watchers of the #OstreeAsyncProgress will be notified of the change if
* @value differs from the existing value for @key.
*
* Since: 2017.6
*/
void
ostree_async_progress_set_variant (OstreeAsyncProgress *self,
const char *key,
GVariant *value)
{
GVariant *orig_value;
g_autoptr(GVariant) new_value = g_variant_ref_sink (value);
gpointer qkey = GUINT_TO_POINTER (g_quark_from_string (key));
g_return_if_fail (OSTREE_IS_ASYNC_PROGRESS (self));
g_return_if_fail (key != NULL);
g_return_if_fail (value != NULL);
g_mutex_lock (&self->lock);
if (self->dead)
goto out;
if (g_hash_table_lookup_extended (self->values, qkey, NULL, (gpointer *) &orig_value))
{
if (g_variant_equal (orig_value, new_value))
goto out;
}
g_hash_table_replace (hash, qkey, value);
g_hash_table_replace (self->values, qkey, g_steal_pointer (&new_value));
ensure_callback_locked (self);
out:
@ -235,7 +412,7 @@ ostree_async_progress_set_uint (OstreeAsyncProgress *self,
const char *key,
guint value)
{
update_key (self, self->uint_values, key, GUINT_TO_POINTER (value));
ostree_async_progress_set_variant (self, key, g_variant_new_uint32 (value));
}
void
@ -243,18 +420,7 @@ ostree_async_progress_set_uint64 (OstreeAsyncProgress *self,
const char *key,
guint64 value)
{
gpointer valuep;
#if _OSTREE_HAVE_LP64
valuep = (gpointer)value;
#else
{
guint64 *boxed = g_malloc (sizeof (guint64));
*boxed = value;
valuep = boxed;
}
#endif
update_key (self, self->uint64_values, key, valuep);
ostree_async_progress_set_variant (self, key, g_variant_new_uint64 (value));
}
/**

View File

@ -53,17 +53,28 @@ OstreeAsyncProgress *ostree_async_progress_new_and_connect (void (*changed) (Ost
_OSTREE_PUBLIC
char *ostree_async_progress_get_status (OstreeAsyncProgress *self);
_OSTREE_PUBLIC
void ostree_async_progress_get (OstreeAsyncProgress *self,
...) G_GNUC_NULL_TERMINATED;
_OSTREE_PUBLIC
guint ostree_async_progress_get_uint (OstreeAsyncProgress *self,
const char *key);
_OSTREE_PUBLIC
guint64 ostree_async_progress_get_uint64 (OstreeAsyncProgress *self,
const char *key);
_OSTREE_PUBLIC
GVariant *ostree_async_progress_get_variant (OstreeAsyncProgress *self,
const char *key);
_OSTREE_PUBLIC
void ostree_async_progress_set_status (OstreeAsyncProgress *self,
const char *status);
_OSTREE_PUBLIC
void ostree_async_progress_set (OstreeAsyncProgress *self,
...) G_GNUC_NULL_TERMINATED;
_OSTREE_PUBLIC
void ostree_async_progress_set_uint (OstreeAsyncProgress *self,
const char *key,
@ -72,6 +83,10 @@ _OSTREE_PUBLIC
void ostree_async_progress_set_uint64 (OstreeAsyncProgress *self,
const char *key,
guint64 value);
_OSTREE_PUBLIC
void ostree_async_progress_set_variant (OstreeAsyncProgress *self,
const char *key,
GVariant *value);
_OSTREE_PUBLIC
void ostree_async_progress_finish (OstreeAsyncProgress *self);

View File

@ -59,6 +59,10 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSysrootUpgrader, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (OstreeRepoCommitTraverseIter, ostree_repo_commit_traverse_iter_clear)
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRemote, ostree_remote_unref)
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
#endif
G_END_DECLS

View File

@ -79,19 +79,14 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_autofree char *contents = NULL;
char **lines = NULL;
char **iter = NULL;
g_return_val_if_fail (!self->parsed, FALSE);
contents = glnx_file_get_contents_utf8_at (dfd, path, NULL, cancellable, error);
g_autofree char *contents = glnx_file_get_contents_utf8_at (dfd, path, NULL, cancellable, error);
if (!contents)
goto out;
return FALSE;
lines = g_strsplit (contents, "\n", -1);
for (iter = lines; *iter; iter++)
g_auto(GStrv) lines = g_strsplit (contents, "\n", -1);
for (char **iter = lines; *iter; iter++)
{
const char *line = *iter;
char *keyname = "";
@ -116,10 +111,7 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
self->parsed = TRUE;
ret = TRUE;
out:
g_strfreev (lines);
return ret;
return TRUE;
}
gboolean
@ -166,16 +158,10 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
GHashTableIter hashiter;
gpointer hashkey, hashvalue;
GString *buf = g_string_new ("");
guint i;
g_autoptr(GHashTable) written_overrides = NULL;
g_autoptr(GString) buf = g_string_new ("");
g_autoptr(GHashTable) written_overrides = g_hash_table_new (g_str_hash, g_str_equal);
written_overrides = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < self->lines->len; i++)
for (guint i = 0; i < self->lines->len; i++)
{
GVariant *linedata = self->lines->pdata[i];
const char *key;
@ -197,6 +183,8 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
}
}
GHashTableIter hashiter;
gpointer hashkey, hashvalue;
g_hash_table_iter_init (&hashiter, self->options);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
@ -208,13 +196,9 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
if (!glnx_file_replace_contents_at (dfd, path, (guint8*)buf->str, buf->len,
GLNX_FILE_REPLACE_NODATASYNC,
cancellable, error))
goto out;
return FALSE;
ret = TRUE;
out:
if (buf)
g_string_free (buf, TRUE);
return ret;
return TRUE;
}
gboolean

View File

@ -148,7 +148,7 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
GError **error)
{
gboolean ret = FALSE;
GString *output = g_string_new ("");
g_autoptr(GString) output = g_string_new ("");
g_autoptr(GOutputStream) out_stream = NULL;
g_autoptr(GPtrArray) loader_configs = NULL;
guint i;
@ -260,8 +260,6 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
ret = TRUE;
out:
if (output)
g_string_free (output, TRUE);
return ret;
}

View File

@ -45,6 +45,7 @@ const OstreeCmdPrivateVTable *
ostree_cmd__private__ (void)
{
static OstreeCmdPrivateVTable table = {
_ostree_impl_system_generator,
impl_ostree_generate_grub2_config,
_ostree_repo_static_delta_dump,
_ostree_repo_static_delta_query_exists,

View File

@ -24,7 +24,10 @@
G_BEGIN_DECLS
gboolean _ostree_impl_system_generator (const char *ostree_cmdline, const char *normal_dir, const char *early_dir, const char *late_dir, GError **error);
typedef struct {
gboolean (* ostree_system_generator) (const char *ostree_cmdline, const char *normal_dir, const char *early_dir, const char *late_dir, GError **error);
gboolean (* ostree_generate_grub2_config) (OstreeSysroot *sysroot, int bootversion, int target_fd, GCancellable *cancellable, GError **error);
gboolean (* ostree_static_delta_dump) (OstreeRepo *repo, const char *delta_id, GCancellable *cancellable, GError **error);
gboolean (* ostree_static_delta_query_exists) (OstreeRepo *repo, const char *delta_id, gboolean *out_exists, GCancellable *cancellable, GError **error);

View File

@ -90,6 +90,14 @@ _ostree_make_temporary_symlink_at (int tmp_dirfd,
GFileInfo * _ostree_header_gfile_info_new (mode_t mode, uid_t uid, gid_t gid);
static inline void
_ostree_checksum_inplace_from_bytes_v (GVariant *csum_v, char *buf)
{
const guint8*csum = ostree_checksum_bytes_peek (csum_v);
g_assert (csum);
ostree_checksum_inplace_from_bytes (csum, buf);
}
/* XX/checksum-2.extension, but let's just use 256 for a
* bit of overkill.
*/

View File

@ -579,57 +579,45 @@ ostree_content_stream_parse (gboolean compressed,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
guint32 archive_header_size;
guchar dummy[4];
gsize bytes_read;
g_autoptr(GInputStream) ret_input = NULL;
g_autoptr(GFileInfo) ret_file_info = NULL;
g_autoptr(GVariant) ret_xattrs = NULL;
g_autoptr(GVariant) file_header = NULL;
g_autofree guchar *buf = NULL;
if (!g_input_stream_read_all (input,
&archive_header_size, 4, &bytes_read,
cancellable, error))
goto out;
return FALSE;
archive_header_size = GUINT32_FROM_BE (archive_header_size);
if (archive_header_size > input_length)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"File header size %u exceeds size %" G_GUINT64_FORMAT,
(guint)archive_header_size, input_length);
goto out;
}
if (archive_header_size == 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"File header size is zero");
goto out;
}
return glnx_throw (error, "File header size %u exceeds size %" G_GUINT64_FORMAT,
(guint)archive_header_size, input_length);
else if (archive_header_size == 0)
return glnx_throw (error, "File header size is zero");
/* Skip over padding */
if (!g_input_stream_read_all (input,
dummy, 4, &bytes_read,
cancellable, error))
goto out;
return FALSE;
buf = g_malloc (archive_header_size);
g_autofree guchar *buf = g_malloc (archive_header_size);
if (!g_input_stream_read_all (input, buf, archive_header_size, &bytes_read,
cancellable, error))
goto out;
file_header = g_variant_new_from_data (compressed ? _OSTREE_ZLIB_FILE_HEADER_GVARIANT_FORMAT : _OSTREE_FILE_HEADER_GVARIANT_FORMAT,
buf, archive_header_size, trusted,
g_free, buf);
return FALSE;
g_autoptr(GVariant) file_header =
g_variant_new_from_data (compressed ? _OSTREE_ZLIB_FILE_HEADER_GVARIANT_FORMAT : _OSTREE_FILE_HEADER_GVARIANT_FORMAT,
buf, archive_header_size, trusted,
g_free, buf);
buf = NULL;
g_autoptr(GFileInfo) ret_file_info = NULL;
g_autoptr(GVariant) ret_xattrs = NULL;
if (compressed)
{
if (!zlib_file_header_parse (file_header,
out_file_info ? &ret_file_info : NULL,
out_xattrs ? &ret_xattrs : NULL,
error))
goto out;
return FALSE;
}
else
{
@ -637,11 +625,12 @@ ostree_content_stream_parse (gboolean compressed,
out_file_info ? &ret_file_info : NULL,
out_xattrs ? &ret_xattrs : NULL,
error))
goto out;
return FALSE;
if (ret_file_info)
g_file_info_set_size (ret_file_info, input_length - archive_header_size - 8);
}
g_autoptr(GInputStream) ret_input = NULL;
if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR
&& out_input)
{
@ -658,12 +647,10 @@ ostree_content_stream_parse (gboolean compressed,
ret_input = g_object_ref (input);
}
ret = TRUE;
ot_transfer_out_value (out_input, &ret_input);
ot_transfer_out_value (out_file_info, &ret_file_info);
ot_transfer_out_value (out_xattrs, &ret_xattrs);
out:
return ret;
return TRUE;
}
/**
@ -820,43 +807,39 @@ ostree_checksum_file (GFile *f,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_autoptr(GFileInfo) file_info = NULL;
g_autoptr(GInputStream) in = NULL;
g_autoptr(GVariant) xattrs = NULL;
g_autofree guchar *ret_csum = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
file_info = g_file_query_info (f, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, error);
g_autoptr(GFileInfo) file_info =
g_file_query_info (f, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, error);
if (!file_info)
goto out;
return FALSE;
g_autoptr(GInputStream) in = NULL;
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
{
in = (GInputStream*)g_file_read (f, cancellable, error);
if (!in)
goto out;
return FALSE;
}
g_autoptr(GVariant) xattrs = NULL;
if (objtype == OSTREE_OBJECT_TYPE_FILE)
{
if (!glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (f),
&xattrs, cancellable, error))
goto out;
return FALSE;
}
g_autofree guchar *ret_csum = NULL;
if (!ostree_checksum_file_from_input (file_info, xattrs, in, objtype,
&ret_csum, cancellable, error))
goto out;
return FALSE;
ret = TRUE;
ot_transfer_out_value(out_csum, &ret_csum);
out:
return ret;
return TRUE;
}
typedef struct {
@ -1623,27 +1606,21 @@ file_header_parse (GVariant *metadata,
GVariant **out_xattrs,
GError **error)
{
gboolean ret = FALSE;
guint32 uid, gid, mode, rdev;
const char *symlink_target;
g_autoptr(GFileInfo) ret_file_info = NULL;
g_autoptr(GVariant) ret_xattrs = NULL;
g_variant_get (metadata, "(uuuu&s@a(ayay))",
&uid, &gid, &mode, &rdev,
&symlink_target, &ret_xattrs);
if (rdev != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Corrupted archive file; invalid rdev %u", GUINT32_FROM_BE (rdev));
goto out;
}
return glnx_throw (error, "Corrupted archive file; invalid rdev %u", GUINT32_FROM_BE (rdev));
uid = GUINT32_FROM_BE (uid);
gid = GUINT32_FROM_BE (gid);
mode = GUINT32_FROM_BE (mode);
ret_file_info = _ostree_header_gfile_info_new (mode, uid, gid);
g_autoptr(GFileInfo) ret_file_info = _ostree_header_gfile_info_new (mode, uid, gid);
if (S_ISREG (mode))
{
@ -1655,16 +1632,12 @@ file_header_parse (GVariant *metadata,
}
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Corrupted archive file; invalid mode %u", mode);
goto out;
return glnx_throw (error, "Corrupted archive file; invalid mode %u", mode);
}
ret = TRUE;
ot_transfer_out_value(out_file_info, &ret_file_info);
ot_transfer_out_value(out_xattrs, &ret_xattrs);
out:
return ret;
return TRUE;
}
/*
@ -1683,28 +1656,21 @@ zlib_file_header_parse (GVariant *metadata,
GVariant **out_xattrs,
GError **error)
{
gboolean ret = FALSE;
guint64 size;
guint32 uid, gid, mode, rdev;
const char *symlink_target;
g_autoptr(GFileInfo) ret_file_info = NULL;
g_autoptr(GVariant) ret_xattrs = NULL;
g_variant_get (metadata, "(tuuuu&s@a(ayay))", &size,
&uid, &gid, &mode, &rdev,
&symlink_target, &ret_xattrs);
if (rdev != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Corrupted archive file; invalid rdev %u", GUINT32_FROM_BE (rdev));
goto out;
}
return glnx_throw (error, "Corrupted archive file; invalid rdev %u", GUINT32_FROM_BE (rdev));
uid = GUINT32_FROM_BE (uid);
gid = GUINT32_FROM_BE (gid);
mode = GUINT32_FROM_BE (mode);
ret_file_info = _ostree_header_gfile_info_new (mode, uid, gid);
g_autoptr(GFileInfo) ret_file_info = _ostree_header_gfile_info_new (mode, uid, gid);
g_file_info_set_size (ret_file_info, GUINT64_FROM_BE (size));
if (S_ISREG (mode))
@ -1717,16 +1683,12 @@ zlib_file_header_parse (GVariant *metadata,
}
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Corrupted archive file; invalid mode %u", mode);
goto out;
return glnx_throw (error, "Corrupted archive file; invalid mode %u", mode);
}
ret = TRUE;
ot_transfer_out_value(out_file_info, &ret_file_info);
ot_transfer_out_value(out_xattrs, &ret_xattrs);
out:
return ret;
return TRUE;
}
/**
@ -1829,34 +1791,30 @@ gboolean
ostree_validate_structureof_commit (GVariant *commit,
GError **error)
{
gboolean ret = FALSE;
g_autoptr(GVariant) parent_csum_v = NULL;
g_autoptr(GVariant) content_csum_v = NULL;
g_autoptr(GVariant) metadata_csum_v = NULL;
gsize n_elts;
if (!validate_variant (commit, OSTREE_COMMIT_GVARIANT_FORMAT, error))
goto out;
return FALSE;
g_autoptr(GVariant) parent_csum_v = NULL;
g_variant_get_child (commit, 1, "@ay", &parent_csum_v);
gsize n_elts;
(void) g_variant_get_fixed_array (parent_csum_v, &n_elts, 1);
if (n_elts > 0)
{
if (!ostree_validate_structureof_csum_v (parent_csum_v, error))
goto out;
return FALSE;
}
g_autoptr(GVariant) content_csum_v = NULL;
g_variant_get_child (commit, 6, "@ay", &content_csum_v);
if (!ostree_validate_structureof_csum_v (content_csum_v, error))
goto out;
return FALSE;
g_autoptr(GVariant) metadata_csum_v = NULL;
g_variant_get_child (commit, 7, "@ay", &metadata_csum_v);
if (!ostree_validate_structureof_csum_v (metadata_csum_v, error))
goto out;
return FALSE;
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
@ -1873,14 +1831,13 @@ gboolean
ostree_validate_structureof_dirtree (GVariant *dirtree,
GError **error)
{
gboolean ret = FALSE;
const char *filename;
g_autoptr(GVariant) content_csum_v = NULL;
g_autoptr(GVariant) meta_csum_v = NULL;
GVariantIter *contents_iter = NULL;
g_autoptr(GVariantIter) contents_iter = NULL;
if (!validate_variant (dirtree, OSTREE_TREE_GVARIANT_FORMAT, error))
goto out;
return FALSE;
g_variant_get_child (dirtree, 0, "a(say)", &contents_iter);
@ -1888,10 +1845,13 @@ ostree_validate_structureof_dirtree (GVariant *dirtree,
&filename, &content_csum_v))
{
if (!ot_util_filename_validate (filename, error))
goto out;
return FALSE;
if (!ostree_validate_structureof_csum_v (content_csum_v, error))
goto out;
return FALSE;
}
/* Note we only use autoptr in case we broke out of the loop early;
* g_variant_iter_loop() has special semantics.
*/
content_csum_v = NULL;
g_variant_iter_free (contents_iter);
@ -1901,40 +1861,29 @@ ostree_validate_structureof_dirtree (GVariant *dirtree,
&filename, &content_csum_v, &meta_csum_v))
{
if (!ot_util_filename_validate (filename, error))
goto out;
return FALSE;
if (!ostree_validate_structureof_csum_v (content_csum_v, error))
goto out;
return FALSE;
if (!ostree_validate_structureof_csum_v (meta_csum_v, error))
goto out;
return FALSE;
}
content_csum_v = NULL;
meta_csum_v = NULL;
ret = TRUE;
out:
if (contents_iter)
g_variant_iter_free (contents_iter);
return ret;
return TRUE;
}
static gboolean
validate_stat_mode_perms (guint32 mode,
GError **error)
{
gboolean ret = FALSE;
guint32 otherbits = (~S_IFMT & ~S_IRWXU & ~S_IRWXG & ~S_IRWXO &
~S_ISUID & ~S_ISGID & ~S_ISVTX);
if (mode & otherbits)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid mode %u; invalid bits in mode", mode);
goto out;
}
return glnx_throw (error, "Invalid mode %u; invalid bits in mode", mode);
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
@ -1948,21 +1897,13 @@ gboolean
ostree_validate_structureof_file_mode (guint32 mode,
GError **error)
{
gboolean ret = FALSE;
if (!(S_ISREG (mode) || S_ISLNK (mode)))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid file metadata mode %u; not a valid file type", mode);
goto out;
}
return glnx_throw (error, "Invalid file metadata mode %u; not a valid file type", mode);
if (!validate_stat_mode_perms (mode, error))
goto out;
return FALSE;
ret = TRUE;
out:
return ret;
return TRUE;
}
/**
@ -1978,28 +1919,21 @@ gboolean
ostree_validate_structureof_dirmeta (GVariant *dirmeta,
GError **error)
{
gboolean ret = FALSE;
guint32 mode;
if (!validate_variant (dirmeta, OSTREE_DIRMETA_GVARIANT_FORMAT, error))
goto out;
return FALSE;
g_variant_get_child (dirmeta, 2, "u", &mode);
mode = GUINT32_FROM_BE (mode);
if (!S_ISDIR (mode))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid directory metadata mode %u; not a directory", mode);
goto out;
}
return glnx_throw (error, "Invalid directory metadata mode %u; not a directory", mode);
if (!validate_stat_mode_perms (mode, error))
goto out;
return FALSE;
ret = TRUE;
out:
return ret;
return TRUE;
}
/**

View File

@ -104,9 +104,9 @@ typedef enum {
/**
* OSTREE_DIRMETA_GVARIANT_FORMAT:
*
* - u - uid
* - u - gid
* - u - mode
* - u - uid (big-endian)
* - u - gid (big-endian)
* - u - mode (big-endian)
* - a(ayay) - xattrs
*/
#define OSTREE_DIRMETA_GVARIANT_STRING "(uuua(ayay))"
@ -120,9 +120,9 @@ typedef enum {
* can't store in the real filesystem but we can still use a regular .file object
* that we can hardlink to in the case of a user-mode checkout.
*
* - u - uid
* - u - gid
* - u - mode
* - u - uid (big-endian)
* - u - gid (big-endian)
* - u - mode (big-endian)
* - a(ayay) - xattrs
*/
#define OSTREE_FILEMETA_GVARIANT_STRING "(uuua(ayay))"
@ -145,7 +145,7 @@ typedef enum {
* - a(say) - Related objects
* - s - subject
* - s - body
* - t - Timestamp in seconds since the epoch (UTC)
* - t - Timestamp in seconds since the epoch (UTC, big-endian)
* - ay - Root tree contents
* - ay - Root tree metadata
*/
@ -158,6 +158,17 @@ typedef enum {
* - a(s(taya{sv})) - Map of ref name -> (latest commit size, latest commit checksum, additional metadata), sorted by ref name
* - a{sv} - Additional metadata, at the current time the following are defined:
* - key: "ostree.static-deltas", value: a{sv}, static delta name -> 32 bytes of checksum
* - key: "ostree.summary.last-modified", value: t, timestamp (seconds since
* the Unix epoch in UTC, big-endian) when the summary was last regenerated
* (similar to the HTTP `Last-Modified` header)
* - key: "ostree.summary.expires", value: t, timestamp (seconds since the
* Unix epoch in UTC, big-endian) after which the summary is considered
* stale and should be re-downloaded if possible (similar to the HTTP
* `Expires` header)
*
* The currently defined keys for the `a{sv}` of additional metadata for each commit are:
* - key: `ostree.commit.timestamp`, value: `t`, timestamp (seconds since the
* Unix epoch in UTC, big-endian) when the commit was committed
*/
#define OSTREE_SUMMARY_GVARIANT_STRING "(a(s(taya{sv}))a{sv})"
#define OSTREE_SUMMARY_GVARIANT_FORMAT G_VARIANT_TYPE (OSTREE_SUMMARY_GVARIANT_STRING)

View File

@ -39,6 +39,12 @@ ostree_deployment_get_bootcsum (OstreeDeployment *self)
return self->bootcsum;
}
/*
* ostree_deployment_get_osname:
* @self: Deployemnt
*
* Returns: The "stateroot" name, also known as an "osname"
*/
const char *
ostree_deployment_get_osname (OstreeDeployment *self)
{

View File

@ -35,9 +35,7 @@ get_file_checksum (OstreeDiffFlags flags,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_autofree char *ret_checksum = NULL;
g_autofree guchar *csum = NULL;
if (OSTREE_IS_REPO_FILE (f))
{
@ -52,27 +50,26 @@ get_file_checksum (OstreeDiffFlags flags,
{
if (!glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (f),
&xattrs, cancellable, error))
goto out;
return FALSE;
}
if (g_file_info_get_file_type (f_info) == G_FILE_TYPE_REGULAR)
{
in = (GInputStream*)g_file_read (f, cancellable, error);
if (!in)
goto out;
return FALSE;
}
g_autofree guchar *csum = NULL;
if (!ostree_checksum_file_from_input (f_info, xattrs, in,
OSTREE_OBJECT_TYPE_FILE,
&csum, cancellable, error))
goto out;
return FALSE;
ret_checksum = ostree_checksum_from_bytes (csum);
}
ret = TRUE;
ot_transfer_out_value(out_checksum, &ret_checksum);
out:
return ret;
return TRUE;
}
OstreeDiffItem *
@ -130,28 +127,22 @@ diff_files (OstreeDiffFlags flags,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_autofree char *checksum_a = NULL;
g_autofree char *checksum_b = NULL;
OstreeDiffItem *ret_item = NULL;
if (!get_file_checksum (flags, a, a_info, &checksum_a, cancellable, error))
goto out;
return FALSE;
if (!get_file_checksum (flags, b, b_info, &checksum_b, cancellable, error))
goto out;
return FALSE;
g_autoptr(OstreeDiffItem) ret_item = NULL;
if (strcmp (checksum_a, checksum_b) != 0)
{
ret_item = diff_item_new (a, a_info, b, b_info,
checksum_a, checksum_b);
}
ret = TRUE;
ot_transfer_out_value(out_item, &ret_item);
out:
if (ret_item)
ostree_diff_item_unref (ret_item);
return ret;
return TRUE;
}
static gboolean
@ -160,47 +151,38 @@ diff_add_dir_recurse (GFile *d,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
GError *temp_error = NULL;
g_autoptr(GFileEnumerator) dir_enum = NULL;
g_autoptr(GFile) child = NULL;
g_autoptr(GFileInfo) child_info = NULL;
dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable,
error);
g_autoptr(GFileEnumerator) dir_enum =
g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable,
error);
if (!dir_enum)
goto out;
return FALSE;
while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)) != NULL)
while (TRUE)
{
GFileInfo *child_info;
const char *name;
if (!g_file_enumerator_iterate (dir_enum, &child_info, NULL,
cancellable, error))
return FALSE;
if (child_info == NULL)
break;
name = g_file_info_get_name (child_info);
g_clear_object (&child);
child = g_file_get_child (d, name);
g_autoptr(GFile) child = g_file_get_child (d, name);
g_ptr_array_add (added, g_object_ref (child));
if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY)
{
if (!diff_add_dir_recurse (child, added, cancellable, error))
goto out;
return FALSE;
}
g_clear_object (&child_info);
}
if (temp_error != NULL)
{
g_propagate_error (error, temp_error);
goto out;
}
ret = TRUE;
out:
return ret;
return TRUE;
}
/**

View File

@ -272,7 +272,7 @@ ensure_tmpfile (FetcherRequest *req, GError **error)
if (req->out_tmpfile_fd == -1)
{
if (!glnx_open_tmpfile_linkable_at (req->fetcher->tmpdir_dfd, ".",
O_WRONLY, &req->out_tmpfile_fd,
O_WRONLY | O_CLOEXEC, &req->out_tmpfile_fd,
&req->out_tmpfile,
error))
return FALSE;

View File

@ -116,7 +116,7 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier *self,
if (result == NULL)
goto out;
if (!ot_gpgme_ctx_tmp_home_dir (result->context, NULL,
if (!ot_gpgme_ctx_tmp_home_dir (result->context,
&tmp_dir, &target_stream,
cancellable, error))
goto out;

View File

@ -562,6 +562,14 @@ ostree_gpg_verify_result_describe_variant (GVariant *variant,
key_id = (len > 16) ? fingerprint + len - 16 : fingerprint;
date_time_utc = g_date_time_new_from_unix_utc (timestamp);
if (date_time_utc == NULL)
{
g_string_append_printf (output_buffer,
"Can't check signature: timestamp %" G_GINT64_FORMAT " is invalid\n",
timestamp);
return;
}
date_time_local = g_date_time_to_local (date_time_utc);
formatted_date_time = g_date_time_format (date_time_local, "%c");
@ -606,6 +614,14 @@ ostree_gpg_verify_result_describe_variant (GVariant *variant,
if (exp_timestamp > 0)
{
date_time_utc = g_date_time_new_from_unix_utc (exp_timestamp);
if (date_time_utc == NULL)
{
g_string_append_printf (output_buffer,
"Signature expiry timestamp (%" G_GINT64_FORMAT ") is invalid\n",
exp_timestamp);
return;
}
date_time_local = g_date_time_to_local (date_time_utc);
formatted_date_time = g_date_time_format (date_time_local, "%c");

View File

@ -0,0 +1,229 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2017 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-unix.h>
#include <gio/gunixoutputstream.h>
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_LIBMOUNT
#include <libmount.h>
#endif
#include <stdbool.h>
#include "otutil.h"
#include "ostree.h"
#include "ostree-core-private.h"
#include "ostree-cmdprivate.h"
#ifdef HAVE_LIBMOUNT
typedef FILE OtLibMountFile;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtLibMountFile, endmntent);
/* Taken from systemd path-util.c */
static bool
is_path (const char *p)
{
return !!strchr (p, '/');
}
/* Taken from systemd path-util.c */
static char*
path_kill_slashes (char *path)
{
char *f, *t;
bool slash = false;
/* Removes redundant inner and trailing slashes. Modifies the
* passed string in-place.
*
* For example: ///foo///bar/ becomes /foo/bar
*/
for (f = path, t = path; *f; f++)
{
if (*f == '/')
{
slash = true;
continue;
}
if (slash)
{
slash = false;
*(t++) = '/';
}
*(t++) = *f;
}
/* Special rule, if we are talking of the root directory, a
trailing slash is good */
if (t == path && slash)
*(t++) = '/';
*t = 0;
return path;
}
/* Written by ostree-sysroot-deploy.c. We parse out the stateroot here since we
* need to know it to mount /var. Unfortunately we can't easily use the
* libostree API to find the booted deployment since /boot might not have been
* mounted yet.
*/
static char *
stateroot_from_ostree_cmdline (const char *ostree_cmdline,
GError **error)
{
static GRegex *regex;
static gsize regex_initialized;
if (g_once_init_enter (&regex_initialized))
{
regex = g_regex_new ("^/ostree/boot.[01]/([^/]+)/", 0, 0, NULL);
g_assert (regex);
g_once_init_leave (&regex_initialized, 1);
}
g_autoptr(GMatchInfo) match = NULL;
if (!g_regex_match (regex, ostree_cmdline, 0, &match))
return glnx_null_throw (error, "Failed to parse %s", ostree_cmdline);
return g_match_info_fetch (match, 1);
}
#endif
/* Implementation of ostree-system-generator */
gboolean
_ostree_impl_system_generator (const char *ostree_cmdline,
const char *normal_dir,
const char *early_dir,
const char *late_dir,
GError **error)
{
#ifdef HAVE_LIBMOUNT
/* Not currently cancellable, but define a var in case we care later */
GCancellable *cancellable = NULL;
/* Some path constants to avoid typos */
static const char fstab_path[] = "/etc/fstab";
static const char var_path[] = "/var";
/* ostree-prepare-root was patched to write the stateroot to this file */
g_autofree char *stateroot = stateroot_from_ostree_cmdline (ostree_cmdline, error);
if (!stateroot)
return FALSE;
/* Load /etc/fstab if it exists, and look for a /var mount */
g_autoptr(OtLibMountFile) fstab = setmntent (fstab_path, "re");
gboolean found_var_mnt = FALSE;
if (!fstab)
{
if (errno != ENOENT)
return glnx_throw_errno_prefix (error, "Reading %s", fstab_path);
}
else
{
/* Parse it */
struct mntent *me;
while ((me = getmntent (fstab)))
{
g_autofree char *where = g_strdup (me->mnt_dir);
if (is_path (where))
path_kill_slashes (where);
/* We're only looking for /var here */
if (strcmp (where, var_path) != 0)
continue;
found_var_mnt = TRUE;
break;
}
}
/* If we found /var, we're done */
if (found_var_mnt)
return TRUE;
/* Prepare to write to the output unit dir; we use the "normal" dir
* that overrides /usr, but not /etc.
*/
glnx_fd_close int normal_dir_dfd = -1;
if (!glnx_opendirat (AT_FDCWD, normal_dir, TRUE, &normal_dir_dfd, error))
return FALSE;
/* Generate our bind mount unit */
const char *stateroot_var_path = glnx_strjoina ("/sysroot/ostree/deploy/", stateroot, "/var");
glnx_fd_close int tmpfd = -1;
g_autofree char *tmppath = NULL;
if (!glnx_open_tmpfile_linkable_at (normal_dir_dfd, ".", O_WRONLY | O_CLOEXEC,
&tmpfd, &tmppath, error))
return FALSE;
g_autoptr(GOutputStream) outstream = g_unix_output_stream_new (tmpfd, FALSE);
gsize bytes_written;
/* This code is inspired by systemd's fstab-generator.c.
*
* Note that our unit doesn't run if systemd.volatile is enabled;
* see https://github.com/ostreedev/ostree/pull/856
*/
if (!g_output_stream_printf (outstream, &bytes_written, cancellable, error,
"##\n# Automatically generated by ostree-system-generator\n##\n\n"
"[Unit]\n"
"Documentation=man:ostree(1)\n"
"ConditionKernelCommandLine=!systemd.volatile\n"
/* We need /sysroot mounted writable first */
"After=ostree-remount.service\n"
"Before=local-fs.target\n"
"\n"
"[Mount]\n"
"Where=%s\n"
"What=%s\n"
"Options=bind\n",
var_path,
stateroot_var_path))
return FALSE;
if (!g_output_stream_flush (outstream, cancellable, error))
return FALSE;
g_clear_object (&outstream);
/* It should be readable */
if (fchmod (tmpfd, 0644) < 0)
return glnx_throw_errno_prefix (error, "fchmod");
/* Error out if somehow it already exists, that'll help us debug conflicts */
if (!glnx_link_tmpfile_at (normal_dir_dfd, GLNX_LINK_TMPFILE_NOREPLACE,
tmpfd, tmppath, normal_dir_dfd,
"var.mount", error))
return FALSE;
/* And ensure it's required; newer systemd will auto-inject fs dependencies
* via RequiresMountsFor and the like, but on older versions (e.g. CentOS) we
* need this. It's what the fstab generator does. And my mother always said,
* listen to the fstab generator.
*/
if (!glnx_shutil_mkdir_p_at (normal_dir_dfd, "local-fs.target.requires", 0755, cancellable, error))
return FALSE;
if (symlinkat ("../var.mount", normal_dir_dfd, "local-fs.target.requires/var.mount") < 0)
return glnx_throw_errno_prefix (error, "symlinkat");
return TRUE;
#else
return glnx_throw (error, "Not implemented");
#endif
}

View File

@ -0,0 +1,59 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright © 2011 Colin Walters <walters@verbum.org>
* Copyright © 2015 Red Hat, Inc.
* Copyright © 2017 Endless Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* - Colin Walters <walters@verbum.org>
* - Philip Withnall <withnall@endlessm.com>
*/
#pragma once
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include "libglnx.h"
#include "ostree-remote.h"
#include "ostree-types.h"
G_BEGIN_DECLS
struct OstreeRemote {
volatile int ref_count;
char *name;
char *group; /* group name in options */
char *keyring; /* keyring name (NAME.trustedkeys.gpg) */
GFile *file; /* NULL if remote defined in repo/config */
GKeyFile *options;
};
G_GNUC_INTERNAL
OstreeRemote *ostree_remote_new (void);
G_GNUC_INTERNAL
OstreeRemote *ostree_remote_new_from_keyfile (GKeyFile *keyfile,
const gchar *group);
#if (defined(OSTREE_COMPILATION) || GLIB_CHECK_VERSION(2, 44, 0)) && !defined(OSTREE_ENABLE_EXPERIMENTAL_API)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRemote, ostree_remote_unref)
#endif
G_END_DECLS

Some files were not shown because too many files have changed in this diff Show More