New upstream version 2018.5+42+gecdebeb2

This commit is contained in:
Simon McVittie committed 2018-06-08 09:11:07 +01:00
commit f92733af4a
112 files changed
+4463 -3226

No files matched your search

+55 -2
View File
@@ -18,13 +18,66 @@
***/
/* Add new symbols here. Release commits should copy this section into -released.sym. */
LIBOSTREE_2018.6 {
global:
ostree_collection_ref_dup;
ostree_collection_ref_dupv;
ostree_collection_ref_equal;
ostree_collection_ref_free;
ostree_collection_ref_freev;
ostree_collection_ref_get_type;
ostree_collection_ref_hash;
ostree_collection_ref_new;
ostree_remote_get_name;
ostree_remote_get_type;
ostree_remote_get_url;
ostree_remote_ref;
ostree_remote_unref;
ostree_repo_find_remotes_async;
ostree_repo_find_remotes_finish;
ostree_repo_finder_avahi_get_type;
ostree_repo_finder_avahi_new;
ostree_repo_finder_avahi_start;
ostree_repo_finder_avahi_stop;
ostree_repo_finder_config_get_type;
ostree_repo_finder_config_new;
ostree_repo_finder_get_type;
ostree_repo_finder_mount_get_type;
ostree_repo_finder_mount_new;
ostree_repo_finder_override_add_uri;
ostree_repo_finder_override_get_type;
ostree_repo_finder_override_new;
ostree_repo_finder_resolve_all_async;
ostree_repo_finder_resolve_all_finish;
ostree_repo_finder_resolve_async;
ostree_repo_finder_resolve_finish;
ostree_repo_finder_result_compare;
ostree_repo_finder_result_dup;
ostree_repo_finder_result_free;
ostree_repo_finder_result_freev;
ostree_repo_finder_result_get_type;
ostree_repo_finder_result_new;
ostree_repo_get_collection_id;
ostree_repo_list_collection_refs;
ostree_repo_pull_from_remotes_async;
ostree_repo_pull_from_remotes_finish;
ostree_repo_remote_list_collection_refs;
ostree_repo_resolve_collection_ref;
ostree_repo_resolve_keyring_for_collection;
ostree_repo_set_collection_id;
ostree_repo_set_collection_ref_immediate;
ostree_repo_transaction_set_collection_ref;
ostree_repo_traverse_reachable_refs;
ostree_sysroot_cleanup_prune_repo;
ostree_validate_collection_id;
} LIBOSTREE_2018.5;
/* Stub section for the stable release *after* this development one; don't
* edit this other than to update the last number. This is just a copy/paste
* source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION
* with whatever the next version with new symbols will be.
LIBOSTREE_2017.$NEWVERSION {
LIBOSTREE_2018.$NEWVERSION {
global:
someostree_symbol_deleteme;
} LIBOSTREE_2017.$LASTSTABLE;
} LIBOSTREE_2018.$LASTSTABLE;
*/
-97
View File
@@ -1,97 +0,0 @@
/*
* 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;
LIBOSTREE_2017.7_EXPERIMENTAL {
global:
ostree_remote_get_name;
} LIBOSTREE_2017.6_EXPERIMENTAL;
LIBOSTREE_2017.8_EXPERIMENTAL {
global:
ostree_collection_ref_dup;
ostree_collection_ref_dupv;
ostree_collection_ref_equal;
ostree_collection_ref_free;
ostree_collection_ref_freev;
ostree_collection_ref_get_type;
ostree_collection_ref_hash;
ostree_collection_ref_new;
ostree_repo_find_remotes_async;
ostree_repo_find_remotes_finish;
ostree_repo_finder_avahi_get_type;
ostree_repo_finder_avahi_new;
ostree_repo_finder_avahi_start;
ostree_repo_finder_avahi_stop;
ostree_repo_finder_config_get_type;
ostree_repo_finder_config_new;
ostree_repo_finder_get_type;
ostree_repo_finder_mount_get_type;
ostree_repo_finder_mount_new;
ostree_repo_finder_resolve_async;
ostree_repo_finder_resolve_all_async;
ostree_repo_finder_resolve_all_finish;
ostree_repo_finder_resolve_finish;
ostree_repo_finder_result_compare;
ostree_repo_finder_result_dup;
ostree_repo_finder_result_free;
ostree_repo_finder_result_freev;
ostree_repo_finder_result_get_type;
ostree_repo_finder_result_new;
ostree_repo_get_collection_id;
ostree_repo_list_collection_refs;
ostree_repo_pull_from_remotes_async;
ostree_repo_pull_from_remotes_finish;
ostree_repo_remote_list_collection_refs;
ostree_repo_resolve_keyring_for_collection;
ostree_repo_set_collection_id;
ostree_repo_set_collection_ref_immediate;
ostree_repo_transaction_set_collection_ref;
ostree_validate_collection_id;
} LIBOSTREE_2017.7_EXPERIMENTAL;
LIBOSTREE_2017.12_EXPERIMENTAL {
global:
ostree_repo_resolve_collection_ref;
} LIBOSTREE_2017.8_EXPERIMENTAL;
LIBOSTREE_2017.13_EXPERIMENTAL {
global:
ostree_repo_finder_override_add_uri;
ostree_repo_finder_override_get_type;
ostree_repo_finder_override_new;
} LIBOSTREE_2017.12_EXPERIMENTAL;
LIBOSTREE_2017.14_EXPERIMENTAL {
global:
ostree_remote_get_type;
ostree_remote_get_url;
} LIBOSTREE_2017.13_EXPERIMENTAL;
-2
View File
@@ -60,7 +60,6 @@ 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 (OstreeCollectionRef, ostree_collection_ref_free)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeCollectionRefv, ostree_collection_ref_freev, NULL)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRemote, ostree_remote_unref)
@@ -71,7 +70,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderMount, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderOverride, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, ostree_repo_finder_result_free)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, ostree_repo_finder_result_freev, NULL)
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
#endif
+2
View File
@@ -28,6 +28,8 @@
#include <glib.h>
#include <glib-object.h>
#include "libglnx.h"
G_BEGIN_DECLS
/**
+4
View File
@@ -140,6 +140,10 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image%s=%s", index_suffix, val));
val = ostree_bootconfig_parser_get (config, "devicetree");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("fdt_file%s=%s", index_suffix, val));
val = ostree_bootconfig_parser_get (config, "options");
if (val)
{
-28
View File
@@ -207,10 +207,6 @@ _ostree_raw_file_to_archive_stream (GInputStream *input,
GCancellable *cancellable,
GError **error);
#ifndef OSTREE_ENABLE_EXPERIMENTAL_API
gboolean ostree_validate_collection_id (const char *collection_id, GError **error);
#endif /* !OSTREE_ENABLE_EXPERIMENTAL_API */
gboolean
_ostree_compare_timestamps (const char *current_rev,
guint64 current_ts,
@@ -218,28 +214,4 @@ _ostree_compare_timestamps (const char *current_rev,
guint64 new_ts,
GError **error);
#if (defined(OSTREE_COMPILATION) || GLIB_CHECK_VERSION(2, 44, 0)) && !defined(OSTREE_ENABLE_EXPERIMENTAL_API)
#include <libglnx.h>
#include "ostree-ref.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeCollectionRef, ostree_collection_ref_free)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeCollectionRefv, ostree_collection_ref_freev, NULL)
#include "ostree-repo-finder.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinder, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, ostree_repo_finder_result_free)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, ostree_repo_finder_result_freev, NULL)
#include "ostree-repo-finder-avahi.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderAvahi, g_object_unref)
#include "ostree-repo-finder-config.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderConfig, g_object_unref)
#include "ostree-repo-finder-mount.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderMount, g_object_unref)
#include "ostree-repo-finder-override.h"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderOverride, g_object_unref)
#endif
G_END_DECLS
+1
View File
@@ -302,6 +302,7 @@ ostree_validate_remote_name (const char *remote_name,
*
* Returns: %TRUE if @collection_id is a valid collection ID, %FALSE if it is invalid
* or %NULL
* Since: 2018.6
*/
gboolean
ostree_validate_collection_id (const char *collection_id, GError **error)
+1 -5
View File
@@ -271,11 +271,9 @@ typedef enum {
* This is most useful in concert with `OSTREE_COMMIT_META_KEY_REF_BINDING`,
* as it more strongly binds the commit to the repository and branch.
*
* Since: 2017.9
* Since: 2018.6
*/
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
#define OSTREE_COMMIT_META_KEY_COLLECTION_BINDING "ostree.collection-binding"
#endif
_OSTREE_PUBLIC
const GVariantType *ostree_metadata_variant_type (OstreeObjectType objtype);
@@ -324,10 +322,8 @@ int ostree_cmp_checksum_bytes (const guchar *a, const guchar *b);
_OSTREE_PUBLIC
gboolean ostree_validate_rev (const char *rev, GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
gboolean ostree_validate_collection_id (const char *collection_id, GError **error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
gboolean ostree_validate_remote_name (const char *remote_name, GError **error);
+1 -13
View File
@@ -337,19 +337,7 @@ check_multi_info (OstreeFetcher *fetcher)
curl_easy_getinfo (easy, CURLINFO_RESPONSE_CODE, &response);
if (!is_file && !(response >= 200 && response < 300))
{
GIOErrorEnum giocode;
/* TODO - share with soup */
switch (response)
{
case 404:
case 403:
case 410:
giocode = G_IO_ERROR_NOT_FOUND;
break;
default:
giocode = G_IO_ERROR_FAILED;
}
GIOErrorEnum giocode = _ostree_fetcher_http_status_code_to_io_error (response);
if (req->idx + 1 == req->mirrorlist->len)
{
+17 -5
View File
@@ -1070,15 +1070,27 @@ on_request_sent (GObject *object,
soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
GIOErrorEnum code;
switch (msg->status_code)
{
case 404:
case 403:
case 410:
code = G_IO_ERROR_NOT_FOUND;
/* These statuses are internal to libsoup, and not standard HTTP ones: */
case SOUP_STATUS_CANCELLED:
code = G_IO_ERROR_CANCELLED;
break;
case SOUP_STATUS_CANT_RESOLVE:
case SOUP_STATUS_CANT_CONNECT:
code = G_IO_ERROR_HOST_NOT_FOUND;
break;
case SOUP_STATUS_IO_ERROR:
#if !GLIB_CHECK_VERSION(2, 44, 0)
code = G_IO_ERROR_BROKEN_PIPE;
#else
code = G_IO_ERROR_CONNECTION_CLOSED;
#endif
break;
default:
code = G_IO_ERROR_FAILED;
code = _ostree_fetcher_http_status_code_to_io_error (msg->status_code);
break;
}
{
+103 -10
View File
@@ -52,15 +52,15 @@ fetch_uri_sync_on_complete (GObject *object,
data->done = TRUE;
}
gboolean
_ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
GPtrArray *mirrorlist,
const char *filename,
OstreeFetcherRequestFlags flags,
GBytes **out_contents,
guint64 max_size,
GCancellable *cancellable,
GError **error)
static gboolean
_ostree_fetcher_mirrored_request_to_membuf_once (OstreeFetcher *fetcher,
GPtrArray *mirrorlist,
const char *filename,
OstreeFetcherRequestFlags flags,
GBytes **out_contents,
guint64 max_size,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
g_autoptr(GMainContext) mainctx = NULL;
@@ -108,11 +108,42 @@ _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
return ret;
}
gboolean
_ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
GPtrArray *mirrorlist,
const char *filename,
OstreeFetcherRequestFlags flags,
guint n_network_retries,
GBytes **out_contents,
guint64 max_size,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GError) local_error = NULL;
guint n_retries_remaining = n_network_retries;
do
{
g_clear_error (&local_error);
if (_ostree_fetcher_mirrored_request_to_membuf_once (fetcher, mirrorlist,
filename, flags,
out_contents, max_size,
cancellable, &local_error))
return TRUE;
}
while (_ostree_fetcher_should_retry_request (local_error, n_retries_remaining--));
g_assert (local_error != NULL);
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
/* Helper for callers who just want to fetch single one-off URIs */
gboolean
_ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
OstreeFetcherURI *uri,
OstreeFetcherRequestFlags flags,
guint n_network_retries,
GBytes **out_contents,
guint64 max_size,
GCancellable *cancellable,
@@ -121,7 +152,7 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
g_autoptr(GPtrArray) mirrorlist = g_ptr_array_new ();
g_ptr_array_add (mirrorlist, uri); /* no transfer */
return _ostree_fetcher_mirrored_request_to_membuf (fetcher, mirrorlist, NULL, flags,
out_contents, max_size,
n_network_retries, out_contents, max_size,
cancellable, error);
}
@@ -144,3 +175,65 @@ _ostree_fetcher_journal_failure (const char *remote_name,
NULL);
#endif
}
/* Check whether a particular operation should be retried. This is entirely
* based on how it failed (if at all) last time, and whether the operation has
* some retries left. The retry count is set when the operation is first
* created, and must be decremented by the caller. (@n_retries_remaining == 0)
* will always return %FALSE from this function.
*
* FIXME: In future, we may decide to use transient failures like this as a hint
* to prioritise other mirrors for a particular pull operation (for example). */
gboolean
_ostree_fetcher_should_retry_request (const GError *error,
guint n_retries_remaining)
{
if (error == NULL)
g_debug ("%s: error: unset, n_retries_remaining: %u",
G_STRFUNC, n_retries_remaining);
else
g_debug ("%s: error: %u:%u %s, n_retries_remaining: %u",
G_STRFUNC, error->domain, error->code, error->message,
n_retries_remaining);
if (error == NULL || n_retries_remaining == 0)
return FALSE;
/* Return TRUE for transient errors. */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE) ||
#if !GLIB_CHECK_VERSION(2, 44, 0)
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE) ||
#else
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED) ||
#endif
g_error_matches (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND) ||
g_error_matches (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_TEMPORARY_FAILURE))
{
g_debug ("Should retry request (remaining: %u retries), due to transient error: %s",
n_retries_remaining, error->message);
return TRUE;
}
return FALSE;
}
/* Convert a HTTP status code representing an error from libsoup or libcurl to
* a #GIOError. This will return %G_IO_ERROR_FAILED if the status code is
* unknown or otherwise unhandled. */
GIOError
_ostree_fetcher_http_status_code_to_io_error (guint status_code)
{
switch (status_code)
{
case 403: /* SOUP_STATUS_FORBIDDEN */
case 404: /* SOUP_STATUS_NOT_FOUND */
case 410: /* SOUP_STATUS_GONE */
return G_IO_ERROR_NOT_FOUND;
case 408: /* SOUP_STATUS_REQUEST_TIMEOUT */
return G_IO_ERROR_TIMED_OUT;
default:
return G_IO_ERROR_FAILED;
}
}
+6
View File
@@ -56,6 +56,7 @@ gboolean _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
GPtrArray *mirrorlist,
const char *filename,
OstreeFetcherRequestFlags flags,
guint n_network_retries,
GBytes **out_contents,
guint64 max_size,
GCancellable *cancellable,
@@ -64,6 +65,7 @@ gboolean _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
gboolean _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
OstreeFetcherURI *uri,
OstreeFetcherRequestFlags flags,
guint n_network_retries,
GBytes **out_contents,
guint64 max_size,
GCancellable *cancellable,
@@ -73,6 +75,10 @@ void _ostree_fetcher_journal_failure (const char *remote_name,
const char *url,
const char *msg);
gboolean _ostree_fetcher_should_retry_request (const GError *error,
guint n_retries_remaining);
GIOError _ostree_fetcher_http_status_code_to_io_error (guint status_code);
G_END_DECLS
+8 -2
View File
@@ -50,6 +50,7 @@ struct OstreeMetalink
OstreeFetcher *fetcher;
char *requested_file;
guint64 max_size;
guint n_network_retries;
};
G_DEFINE_TYPE (OstreeMetalink, _ostree_metalink, G_TYPE_OBJECT)
@@ -401,7 +402,8 @@ OstreeMetalink *
_ostree_metalink_new (OstreeFetcher *fetcher,
const char *requested_file,
guint64 max_size,
OstreeFetcherURI *uri)
OstreeFetcherURI *uri,
guint n_network_retries)
{
OstreeMetalink *self = (OstreeMetalink*)g_object_new (OSTREE_TYPE_METALINK, NULL);
@@ -409,6 +411,7 @@ _ostree_metalink_new (OstreeFetcher *fetcher,
self->requested_file = g_strdup (requested_file);
self->max_size = max_size;
self->uri = _ostree_fetcher_uri_clone (uri);
self->n_network_retries = n_network_retries;
return self;
}
@@ -432,7 +435,9 @@ try_one_url (OstreeMetalinkRequest *self,
gssize n_bytes;
if (!_ostree_fetcher_request_uri_to_membuf (self->metalink->fetcher,
uri, 0, &bytes,
uri, 0,
self->metalink->n_network_retries,
&bytes,
self->metalink->max_size,
self->cancellable,
error))
@@ -613,6 +618,7 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
request.parser = g_markup_parse_context_new (&metalink_parser, G_MARKUP_PREFIX_ERROR_POSITION, &request, NULL);
if (!_ostree_fetcher_request_uri_to_membuf (self->fetcher, self->uri, 0,
self->n_network_retries,
&contents, self->max_size,
cancellable, error))
goto out;
+2 -1
View File
@@ -48,7 +48,8 @@ GType _ostree_metalink_get_type (void) G_GNUC_CONST;
OstreeMetalink *_ostree_metalink_new (OstreeFetcher *fetcher,
const char *requested_file,
guint64 max_size,
OstreeFetcherURI *uri);
OstreeFetcherURI *uri,
guint n_network_retries);
gboolean _ostree_metalink_request_sync (OstreeMetalink *self,
OstreeFetcherURI **out_target_uri,
+7 -7
View File
@@ -48,7 +48,7 @@ G_DEFINE_BOXED_TYPE (OstreeCollectionRef, ostree_collection_ref,
* operations.
*
* Returns: (transfer full): a new #OstreeCollectionRef
* Since: 2017.8
* Since: 2018.6
*/
OstreeCollectionRef *
ostree_collection_ref_new (const gchar *collection_id,
@@ -74,7 +74,7 @@ ostree_collection_ref_new (const gchar *collection_id,
* Create a copy of the given @ref.
*
* Returns: (transfer full): a newly allocated copy of @ref
* Since: 2017.8
* Since: 2018.6
*/
OstreeCollectionRef *
ostree_collection_ref_dup (const OstreeCollectionRef *ref)
@@ -90,7 +90,7 @@ ostree_collection_ref_dup (const OstreeCollectionRef *ref)
*
* Free the given @ref.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_collection_ref_free (OstreeCollectionRef *ref)
@@ -110,7 +110,7 @@ ostree_collection_ref_free (OstreeCollectionRef *ref)
* @ref must be non-%NULL.
*
* Returns: hash value for @ref
* Since: 2017.8
* Since: 2018.6
*/
guint
ostree_collection_ref_hash (gconstpointer ref)
@@ -132,7 +132,7 @@ ostree_collection_ref_hash (gconstpointer ref)
* ref name, and %FALSE otherwise. Both @ref1 and @ref2 must be non-%NULL.
*
* Returns: %TRUE if @ref1 and @ref2 are equal, %FALSE otherwise
* Since: 2017.8
* Since: 2018.6
*/
gboolean
ostree_collection_ref_equal (gconstpointer ref1,
@@ -153,7 +153,7 @@ ostree_collection_ref_equal (gconstpointer ref1,
* %NULL.
*
* Returns: (transfer full) (array zero-terminated=1): a newly allocated copy of @refs
* Since: 2017.8
* Since: 2018.6
*/
OstreeCollectionRef **
ostree_collection_ref_dupv (const OstreeCollectionRef * const *refs)
@@ -179,7 +179,7 @@ ostree_collection_ref_dupv (const OstreeCollectionRef * const *refs)
* Free the given array of @refs, including freeing all its elements. @refs
* must be %NULL-terminated; it may be empty, but must not be %NULL.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_collection_ref_freev (OstreeCollectionRef **refs)
+2 -2
View File
@@ -42,7 +42,7 @@ G_BEGIN_DECLS
* (@collection_id, @ref_name). For backwards compatibility, @collection_id may be %NULL,
* indicating a ref name which is not globally unique.
*
* Since: 2017.8
* Since: 2018.6
*/
typedef struct
{
@@ -82,7 +82,7 @@ void ostree_collection_ref_freev (OstreeCollectionRef **refs);
* g_auto(OstreeCollectionRefv) refs = NULL;
* ]|
*
* Since: 2017.8
* Since: 2018.6
*/
typedef OstreeCollectionRef** OstreeCollectionRefv;
-4
View File
@@ -60,8 +60,4 @@ 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
+5 -7
View File
@@ -50,7 +50,7 @@
* refs are currently on a remote, or the commits they currently point to. Use
* #OstreeRepo in combination with an #OstreeRemote to query that information.
*
* Since: 2017.6
* Since: 2018.6
*/
OstreeRemote *
@@ -119,7 +119,7 @@ ostree_remote_new_from_keyfile (GKeyFile *keyfile,
* Increase the reference count on the given @remote.
*
* Returns: (transfer full): a copy of @remote, for convenience
* Since: 2017.6
* Since: 2018.6
*/
OstreeRemote *
ostree_remote_ref (OstreeRemote *remote)
@@ -138,7 +138,7 @@ ostree_remote_ref (OstreeRemote *remote)
* Decrease the reference count on the given @remote and free it if the
* reference count reaches 0.
*
* Since: 2017.6
* Since: 2018.6
*/
void
ostree_remote_unref (OstreeRemote *remote)
@@ -158,11 +158,9 @@ ostree_remote_unref (OstreeRemote *remote)
}
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
G_DEFINE_BOXED_TYPE(OstreeRemote, ostree_remote,
ostree_remote_ref,
ostree_remote_unref);
#endif
/**
* ostree_remote_get_name:
@@ -173,7 +171,7 @@ G_DEFINE_BOXED_TYPE(OstreeRemote, ostree_remote,
* arbitrary, string.
*
* Returns: remote’s name
* Since: 2017.7
* Since: 2018.6
*/
const gchar *
ostree_remote_get_name (OstreeRemote *remote)
@@ -191,7 +189,7 @@ ostree_remote_get_name (OstreeRemote *remote)
* Get the URL from the remote.
*
* Returns: (transfer full): the remote's URL
* Since: 2017.14
* Since: 2018.6
*/
gchar *
ostree_remote_get_url (OstreeRemote *remote)
+1 -5
View File
@@ -42,12 +42,8 @@ G_BEGIN_DECLS
* remotes can only be passed around as (reference counted) opaque handles. In
* future, more API may be added to create and interrogate them.
*
* Since: 2017.6
* Since: 2018.6
*/
#ifndef OSTREE_ENABLE_EXPERIMENTAL_API
/* This is in ostree-types.h otherwise */
typedef struct OstreeRemote OstreeRemote;
#endif
_OSTREE_PUBLIC
GType ostree_remote_get_type (void) G_GNUC_CONST;
+2 -2
View File
@@ -1961,7 +1961,7 @@ ostree_repo_transaction_set_ref (OstreeRepo *self,
*
* Multithreading: Since v2017.15 this function is MT safe.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_transaction_set_collection_ref (OstreeRepo *self,
@@ -2045,7 +2045,7 @@ ostree_repo_set_alias_ref_immediate (OstreeRepo *self,
* case where we're creating or overwriting an existing ref.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: 2017.8
* Since: 2018.6
*/
gboolean
ostree_repo_set_collection_ref_immediate (OstreeRepo *self,
@@ -29,6 +29,7 @@
#include <avahi-common/strlst.h>
#include <glib.h>
#include <glib-object.h>
#include <libglnx.h>
#include <string.h>
#include "ostree-autocleanups.h"
+6 -5
View File
@@ -36,7 +36,6 @@
#include <avahi-common/strlst.h>
#include <avahi-glib/glib-malloc.h>
#include <avahi-glib/glib-watch.h>
#include <libsoup/soup.h>
#include <netinet/in.h>
#include <string.h>
#endif /* HAVE_AVAHI */
@@ -44,6 +43,7 @@
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <libglnx.h>
#include "ostree-autocleanups.h"
#include "ostree-repo-finder.h"
@@ -55,6 +55,7 @@
#include "ostree-repo-private.h"
#include "ostree-repo.h"
#include "ostree-repo-finder-avahi-private.h"
#include "ostree-soup-uri.h"
#include "otutil.h"
#endif /* HAVE_AVAHI */
@@ -98,7 +99,7 @@
* and the resolver is used to retrieve information about services advertised by
* each peer, including the services’ TXT records.
*
* Since: 2017.8
* Since: 2018.6
*/
#ifdef HAVE_AVAHI
@@ -1363,7 +1364,7 @@ ostree_repo_finder_avahi_init (OstreeRepoFinderAvahi *self)
* If @context is %NULL, the current thread-default #GMainContext is used.
*
* Returns: (transfer full): a new #OstreeRepoFinderAvahi
* Since: 2017.8
* Since: 2018.6
*/
OstreeRepoFinderAvahi *
ostree_repo_finder_avahi_new (GMainContext *context)
@@ -1412,7 +1413,7 @@ ostree_repo_finder_avahi_new (GMainContext *context)
* #OstreeRepoFinderAvahi instance, or to call it after
* ostree_repo_finder_avahi_stop().
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_finder_avahi_start (OstreeRepoFinderAvahi *self,
@@ -1494,7 +1495,7 @@ static gboolean stop_cb (gpointer user_data);
* #OstreeRepoFinderAvahi instance, or to call it before
* ostree_repo_finder_avahi_start().
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_finder_avahi_stop (OstreeRepoFinderAvahi *self)
+2 -2
View File
@@ -56,7 +56,7 @@
* intersection is non-empty, that remote is returned as a result. Remotes which
* do not have their `collection-id` key configured are ignored.
*
* Since: 2017.8
* Since: 2018.6
*/
static void ostree_repo_finder_config_iface_init (OstreeRepoFinderInterface *iface);
@@ -234,7 +234,7 @@ ostree_repo_finder_config_iface_init (OstreeRepoFinderInterface *iface)
* Create a new #OstreeRepoFinderConfig.
*
* Returns: (transfer full): a new #OstreeRepoFinderConfig
* Since: 2017.8
* Since: 2018.6
*/
OstreeRepoFinderConfig *
ostree_repo_finder_config_new (void)
+3 -3
View File
@@ -68,7 +68,7 @@
* The volume monitor used to find mounted volumes can be overridden by setting
* #OstreeRepoFinderMount:monitor. By default, g_volume_monitor_get() is used.
*
* Since: 2017.8
* Since: 2018.6
*/
typedef GList/*<owned GObject>*/ ObjectList;
@@ -649,7 +649,7 @@ ostree_repo_finder_mount_class_init (OstreeRepoFinderMountClass *klass)
*
* Volume monitor to use to look up mounted volumes when queried.
*
* Since: 2017.8
* Since: 2018.6
*/
g_object_class_install_property (object_class, PROP_MONITOR,
g_param_spec_object ("monitor",
@@ -680,7 +680,7 @@ ostree_repo_finder_mount_iface_init (OstreeRepoFinderInterface *iface)
* be used.
*
* Returns: (transfer full): a new #OstreeRepoFinderMount
* Since: 2017.8
* Since: 2018.6
*/
OstreeRepoFinderMount *
ostree_repo_finder_mount_new (GVolumeMonitor *monitor)
+3 -3
View File
@@ -61,7 +61,7 @@
* which uses #OstreeRepoFinder. For production use, #OstreeRepoFinderConfig is
* recommended instead.
*
* Since: 2017.13
* Since: 2018.6
*/
static void ostree_repo_finder_override_iface_init (OstreeRepoFinderInterface *iface);
@@ -296,7 +296,7 @@ ostree_repo_finder_override_iface_init (OstreeRepoFinderInterface *iface)
* Create a new #OstreeRepoFinderOverride.
*
* Returns: (transfer full): a new #OstreeRepoFinderOverride
* Since: 2017.13
* Since: 2018.6
*/
OstreeRepoFinderOverride *
ostree_repo_finder_override_new (void)
@@ -311,7 +311,7 @@ ostree_repo_finder_override_new (void)
* Add the given @uri to the set of URIs which the repo finder will search for
* matching refs when ostree_repo_finder_resolve_async() is called on it.
*
* Since: 2017.13
* Since: 2018.6
*/
void
ostree_repo_finder_override_add_uri (OstreeRepoFinderOverride *self,
+10 -9
View File
@@ -27,6 +27,7 @@
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <libglnx.h>
#include "ostree-autocleanups.h"
#include "ostree-core.h"
@@ -138,7 +139,7 @@ static void resolve_cb (GObject *obj,
* Pass the results to ostree_repo_pull_from_remotes_async() to pull the given
* @refs from those remotes.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_finder_resolve_async (OstreeRepoFinder *self,
@@ -196,7 +197,7 @@ resolve_cb (GObject *obj,
*
* Returns: (transfer full) (element-type OstreeRepoFinderResult): array of zero
* or more results
* Since: 2017.8
* Since: 2018.6
*/
GPtrArray *
ostree_repo_finder_resolve_finish (OstreeRepoFinder *self,
@@ -254,7 +255,7 @@ static void resolve_all_finished_one (GTask *task);
* A version of ostree_repo_finder_resolve_async() which queries one or more
* @finders in parallel and combines the results.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_finder_resolve_all_async (OstreeRepoFinder * const *finders,
@@ -411,7 +412,7 @@ resolve_all_finished_one (GTask *task)
*
* Returns: (transfer full) (element-type OstreeRepoFinderResult): array of zero
* or more results
* Since: 2017.8
* Since: 2018.6
*/
GPtrArray *
ostree_repo_finder_resolve_all_finish (GAsyncResult *result,
@@ -446,7 +447,7 @@ G_DEFINE_BOXED_TYPE (OstreeRepoFinderResult, ostree_repo_finder_result,
* are as described in the #OstreeRepoFinderResult documentation.
*
* Returns: (transfer full): a new #OstreeRepoFinderResult
* Since: 2017.8
* Since: 2018.6
*/
OstreeRepoFinderResult *
ostree_repo_finder_result_new (OstreeRemote *remote,
@@ -480,7 +481,7 @@ ostree_repo_finder_result_new (OstreeRemote *remote,
* Copy an #OstreeRepoFinderResult.
*
* Returns: (transfer full): a newly allocated copy of @result
* Since: 2017.8
* Since: 2018.6
*/
OstreeRepoFinderResult *
ostree_repo_finder_result_dup (OstreeRepoFinderResult *result)
@@ -502,7 +503,7 @@ ostree_repo_finder_result_dup (OstreeRepoFinderResult *result)
*
* Returns: <0 if @a is ordered before @b, 0 if they are ordered equally,
* >0 if @b is ordered before @a
* Since: 2017.8
* Since: 2018.6
*/
gint
ostree_repo_finder_result_compare (const OstreeRepoFinderResult *a,
@@ -549,7 +550,7 @@ ostree_repo_finder_result_compare (const OstreeRepoFinderResult *a,
*
* Free the given @result.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_finder_result_free (OstreeRepoFinderResult *result)
@@ -571,7 +572,7 @@ ostree_repo_finder_result_free (OstreeRepoFinderResult *result)
*
* Free the given @results array, freeing each element and the container.
*
* Since: 2017.8
* Since: 2018.6
*/
void
ostree_repo_finder_result_freev (OstreeRepoFinderResult **results)
+2 -2
View File
@@ -133,7 +133,7 @@ GPtrArray *ostree_repo_finder_resolve_all_finish (GAsyncResult *result,
* ostree_repo_find_remotes_async (2) there was an error in trying to get the
* commit metadata (3) the checksum for this ref is %NULL in @ref_to_checksum.
*
* Since: 2017.8
* Since: 2018.6
*/
typedef struct
{
@@ -176,7 +176,7 @@ void ostree_repo_finder_result_free (OstreeRepoFinderResult *result);
* g_auto(OstreeRepoFinderResultv) results = NULL;
* ]|
*
* Since: 2017.8
* Since: 2018.6
*/
typedef OstreeRepoFinderResult** OstreeRepoFinderResultv;
-29
View File
@@ -460,33 +460,4 @@ OstreeRepoAutoLock * _ostree_repo_auto_lock_push (OstreeRepo *self,
void _ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *lock);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoAutoLock, _ostree_repo_auto_lock_cleanup)
#ifndef OSTREE_ENABLE_EXPERIMENTAL_API
/* These APIs are duplicated in the public headers when doing an
* experimental-API build.
*/
const gchar * ostree_repo_get_collection_id (OstreeRepo *self);
gboolean ostree_repo_set_collection_id (OstreeRepo *self,
const gchar *collection_id,
GError **error);
gboolean ostree_repo_list_collection_refs (OstreeRepo *self,
const char *match_collection_id,
GHashTable **out_all_refs,
OstreeRepoListRefsExtFlags flags,
GCancellable *cancellable,
GError **error);
void ostree_repo_transaction_set_collection_ref (OstreeRepo *self,
const OstreeCollectionRef *ref,
const char *checksum);
gboolean ostree_repo_set_collection_ref_immediate (OstreeRepo *self,
const OstreeCollectionRef *ref,
const char *checksum,
GCancellable *cancellable,
GError **error);
#endif /* !OSTREE_ENABLE_EXPERIMENTAL_API */
G_END_DECLS
+59 -28
View File
@@ -301,6 +301,64 @@ repo_prune_internal (OstreeRepo *self,
return TRUE;
}
/**
* ostree_repo_traverse_reachable_refs:
* @self: Repo
* @depth: Depth of traversal
* @reachable: (element-type GVariant GVariant): Set of reachable objects (will be modified)
* @cancellable: Cancellable
* @error: Error
*
* Add all commit objects directly reachable via a ref to @reachable.
*
* Locking: shared
* Since: 2018.6
*/
gboolean
ostree_repo_traverse_reachable_refs (OstreeRepo *self,
guint depth,
GHashTable *reachable,
GCancellable *cancellable,
GError **error)
{
g_autoptr(OstreeRepoAutoLock) lock =
_ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_SHARED, cancellable, error);
if (!lock)
return FALSE;
/* Ignoring collections. */
g_autoptr(GHashTable) all_refs = NULL; /* (element-type utf8 utf8) */
if (!ostree_repo_list_refs (self, NULL, &all_refs,
cancellable, error))
return FALSE;
GLNX_HASH_TABLE_FOREACH_V (all_refs, const char*, checksum)
{
g_debug ("Finding objects to keep for commit %s", checksum);
if (!ostree_repo_traverse_commit_union (self, checksum, depth, reachable,
cancellable, error))
return FALSE;
}
/* Using collections. */
g_autoptr(GHashTable) all_collection_refs = NULL; /* (element-type OstreeChecksumRef utf8) */
if (!ostree_repo_list_collection_refs (self, NULL, &all_collection_refs,
OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES, cancellable, error))
return FALSE;
GLNX_HASH_TABLE_FOREACH_V (all_collection_refs, const char*, checksum)
{
g_debug ("Finding objects to keep for commit %s", checksum);
if (!ostree_repo_traverse_commit_union (self, checksum, depth, reachable,
cancellable, error))
return FALSE;
}
return TRUE;
}
/**
* ostree_repo_prune:
* @self: Repo
@@ -355,35 +413,8 @@ ostree_repo_prune (OstreeRepo *self,
if (refs_only)
{
/* Ignoring collections. */
g_autoptr(GHashTable) all_refs = NULL; /* (element-type utf8 utf8) */
if (!ostree_repo_list_refs (self, NULL, &all_refs,
cancellable, error))
if (!ostree_repo_traverse_reachable_refs (self, depth, reachable, cancellable, error))
return FALSE;
GLNX_HASH_TABLE_FOREACH_V (all_refs, const char*, checksum)
{
g_debug ("Finding objects to keep for commit %s", checksum);
if (!ostree_repo_traverse_commit_union (self, checksum, depth, reachable,
cancellable, error))
return FALSE;
}
/* Using collections. */
g_autoptr(GHashTable) all_collection_refs = NULL; /* (element-type OstreeChecksumRef utf8) */
if (!ostree_repo_list_collection_refs (self, NULL, &all_collection_refs,
OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES, cancellable, error))
return FALSE;
GLNX_HASH_TABLE_FOREACH_V (all_collection_refs, const char*, checksum)
{
g_debug ("Finding objects to keep for commit %s", checksum);
if (!ostree_repo_traverse_commit_union (self, checksum, depth, reachable,
cancellable, error))
return FALSE;
}
}
if (!ostree_repo_list_objects (self, OSTREE_REPO_LIST_OBJECTS_ALL | OSTREE_REPO_LIST_OBJECTS_NO_PARENTS,
File diff suppressed because it is too large. Load diff
+3 -7
View File
@@ -470,7 +470,6 @@ ostree_repo_resolve_rev_ext (OstreeRepo *self,
return _ostree_repo_resolve_rev_internal (self, refspec, allow_noent, FALSE, out_rev, error);
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
/**
* ostree_repo_resolve_collection_ref:
* @self: an #OstreeRepo
@@ -494,7 +493,7 @@ ostree_repo_resolve_rev_ext (OstreeRepo *self,
* There are currently no @flags which affect the behaviour of this function.
*
* Returns: %TRUE on success, %FALSE on failure
* Since: 2017.12
* Since: 2018.6
*/
gboolean
ostree_repo_resolve_collection_ref (OstreeRepo *self,
@@ -531,7 +530,6 @@ ostree_repo_resolve_collection_ref (OstreeRepo *self,
*out_rev = g_strdup (ret_contents);
return TRUE;
}
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
static gboolean
enumerate_refs_recurse (OstreeRepo *repo,
@@ -876,7 +874,6 @@ ostree_repo_remote_list_refs (OstreeRepo *self,
return TRUE;
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
static gboolean
remote_list_collection_refs_process_refs (OstreeRepo *self,
const gchar *remote_name,
@@ -934,7 +931,7 @@ remote_list_collection_refs_process_refs (OstreeRepo *self,
* Any refs for other collections stored in the repository will also be returned.
* No filtering is performed.
*
* Since: 2017.10
* Since: 2018.6
*/
gboolean
ostree_repo_remote_list_collection_refs (OstreeRepo *self,
@@ -995,7 +992,6 @@ ostree_repo_remote_list_collection_refs (OstreeRepo *self,
ot_transfer_out_value (out_all_refs, &ret_all_refs);
return TRUE;
}
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
static char *
relative_symlink_to (const char *relpath,
@@ -1206,7 +1202,7 @@ _ostree_repo_update_collection_refs (OstreeRepo *self,
* %OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: 2017.8
* Since: 2018.6
*/
gboolean
ostree_repo_list_collection_refs (OstreeRepo *self,
+2 -2
View File
@@ -5703,7 +5703,7 @@ _ostree_repo_memory_cache_ref_destroy (OstreeRepoMemoryCacheRef *state)
* Get the collection ID of this repository. See [collection IDs][collection-ids].
*
* Returns: (nullable): collection ID for the repository
* Since: 2017.8
* Since: 2018.6
*/
const gchar *
ostree_repo_get_collection_id (OstreeRepo *self)
@@ -5724,7 +5724,7 @@ ostree_repo_get_collection_id (OstreeRepo *self)
* configuration on disk using ostree_repo_write_config().
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: 2017.8
* Since: 2018.6
*/
gboolean
ostree_repo_set_collection_id (OstreeRepo *self,
+9 -27
View File
@@ -28,10 +28,8 @@
#include "ostree-core.h"
#include "ostree-types.h"
#include "ostree-async-progress.h"
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
#include "ostree-ref.h"
#include "ostree-repo-finder.h"
#endif
#include "ostree-sepolicy.h"
#include "ostree-gpg-verify-result.h"
@@ -107,8 +105,6 @@ OstreeRepo * ostree_repo_create_at (int dfd,
GCancellable *cancellable,
GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
const gchar * ostree_repo_get_collection_id (OstreeRepo *self);
_OSTREE_PUBLIC
@@ -116,8 +112,6 @@ gboolean ostree_repo_set_collection_id (OstreeRepo *self,
const gchar *collection_id,
GError **error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
GFile * ostree_repo_get_path (OstreeRepo *self);
@@ -339,15 +333,11 @@ void ostree_repo_transaction_set_ref (OstreeRepo *self,
const char *ref,
const char *checksum);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
void ostree_repo_transaction_set_collection_ref (OstreeRepo *self,
const OstreeCollectionRef *ref,
const char *checksum);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
gboolean ostree_repo_set_ref_immediate (OstreeRepo *self,
const char *remote,
@@ -364,8 +354,6 @@ gboolean ostree_repo_set_alias_ref_immediate (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
gboolean ostree_repo_set_collection_ref_immediate (OstreeRepo *self,
const OstreeCollectionRef *ref,
@@ -373,8 +361,6 @@ gboolean ostree_repo_set_collection_ref_immediate (OstreeRepo
GCancellable *cancellable,
GError **error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
gboolean ostree_repo_has_object (OstreeRepo *self,
OstreeObjectType objtype,
@@ -479,7 +465,6 @@ gboolean ostree_repo_resolve_rev_ext (OstreeRepo *self,
char **out_rev,
GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
gboolean ostree_repo_resolve_collection_ref (OstreeRepo *self,
const OstreeCollectionRef *ref,
@@ -488,7 +473,6 @@ gboolean ostree_repo_resolve_collection_ref (OstreeRepo
char **out_rev,
GCancellable *cancellable,
GError **error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
gboolean ostree_repo_list_refs (OstreeRepo *self,
@@ -524,14 +508,12 @@ gboolean ostree_repo_remote_list_refs (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
gboolean ostree_repo_remote_list_collection_refs (OstreeRepo *self,
const char *remote_name,
GHashTable **out_all_refs,
GCancellable *cancellable,
GError **error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
gboolean ostree_repo_load_variant (OstreeRepo *self,
@@ -1202,6 +1184,14 @@ struct _OstreeRepoPruneOptions {
typedef struct _OstreeRepoPruneOptions OstreeRepoPruneOptions;
_OSTREE_PUBLIC
gboolean
ostree_repo_traverse_reachable_refs (OstreeRepo *self,
guint depth,
GHashTable *reachable,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_repo_prune_from_reachable (OstreeRepo *self,
OstreeRepoPruneOptions *options,
@@ -1257,8 +1247,6 @@ gboolean ostree_repo_pull_with_options (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
void ostree_repo_find_remotes_async (OstreeRepo *self,
const OstreeCollectionRef * const *refs,
@@ -1300,8 +1288,6 @@ gboolean ostree_repo_list_collection_refs (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
_OSTREE_PUBLIC
void ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress,
gpointer user_data);
@@ -1386,8 +1372,6 @@ gboolean ostree_repo_regenerate_summary (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
/**
* OSTREE_REPO_METADATA_REF:
*
@@ -1407,12 +1391,10 @@ gboolean ostree_repo_regenerate_summary (OstreeRepo *self,
* keys must be namespaced by product or developer. For example,
* `exampleos.end-of-life`. The `ostree.` prefix is reserved.
*
* Since: 2017.8
* Since: 2018.6
*/
#define OSTREE_REPO_METADATA_REF "ostree-metadata"
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
G_END_DECLS
+80 -15
View File
@@ -420,25 +420,76 @@ generate_deployment_refs (OstreeSysroot *self,
return TRUE;
}
static gboolean
prune_repo (OstreeRepo *repo,
GCancellable *cancellable,
GError **error)
/**
* ostree_sysroot_cleanup_prune_repo:
* @sysroot: Sysroot
* @options: Flags controlling pruning
* @out_objects_total: (out): Number of objects found
* @out_objects_pruned: (out): Number of objects deleted
* @out_pruned_object_size_total: (out): Storage size in bytes of objects deleted
* @cancellable: Cancellable
* @error: Error
*
* Prune the system repository. This is a thin wrapper
* around ostree_repo_prune_from_reachable(); the primary
* addition is that this function automatically gathers
* all deployed commits into the reachable set.
*
* You generally want to at least set the `OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY`
* flag in @options. A commit traversal depth of `0` is assumed.
*
* Locking: exclusive
* Since: 2018.6
*/
gboolean
ostree_sysroot_cleanup_prune_repo (OstreeSysroot *sysroot,
OstreeRepoPruneOptions *options,
gint *out_objects_total,
gint *out_objects_pruned,
guint64 *out_pruned_object_size_total,
GCancellable *cancellable,
GError **error)
{
gint n_objects_total;
gint n_objects_pruned;
guint64 freed_space;
if (!ostree_repo_prune (repo, OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY, 0,
&n_objects_total, &n_objects_pruned, &freed_space,
cancellable, error))
GLNX_AUTO_PREFIX_ERROR ("Pruning system repository", error);
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
const guint depth = 0; /* Historical default */
/* Hold an exclusive lock by default across gathering refs and doing
* the prune.
*/
g_autoptr(OstreeRepoAutoLock) lock =
_ostree_repo_auto_lock_push (repo, OSTREE_REPO_LOCK_EXCLUSIVE, cancellable, error);
if (!lock)
return FALSE;
if (freed_space > 0)
/* Ensure reachable has refs, but default to depth 0. This is
* what we've always done for the system repo, but perhaps down
* the line we could add a depth flag to the repo config or something?
*/
if (!ostree_repo_traverse_reachable_refs (repo, depth, options->reachable, cancellable, error))
return FALSE;
/* Since ostree was created we've been generating "deployment refs" in
* generate_deployment_refs() that look like ostree/0/1 etc. to ensure that
* anything doing a direct prune won't delete commits backing deployments.
* This bit might allow us to eventually drop that behavior, although we'd
* have to be very careful to ensure that all software is updated to use
* `ostree_sysroot_cleanup_prune_repo()`.
*/
for (guint i = 0; i < sysroot->deployments->len; i++)
{
g_autofree char *freed_space_str = g_format_size_full (freed_space, 0);
g_print ("Freed objects: %s\n", freed_space_str);
const char *checksum = ostree_deployment_get_csum (sysroot->deployments->pdata[i]);
if (!ostree_repo_traverse_commit_union (repo, checksum, depth, options->reachable,
cancellable, error))
return FALSE;
}
if (!ostree_repo_prune_from_reachable (repo, options,
out_objects_total, out_objects_pruned,
out_pruned_object_size_total,
cancellable, error))
return FALSE;
return TRUE;
}
@@ -501,8 +552,22 @@ _ostree_sysroot_cleanup_internal (OstreeSysroot *self,
if (do_prune_repo)
{
if (!prune_repo (repo, cancellable, error))
return glnx_prefix_error (error, "Pruning repo");
gint n_objects_total;
gint n_objects_pruned;
guint64 freed_space;
g_autoptr(GHashTable) reachable = ostree_repo_traverse_new_reachable ();
OstreeRepoPruneOptions opts = { OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY, reachable };
if (!ostree_sysroot_cleanup_prune_repo (self, &opts, &n_objects_total,
&n_objects_pruned, &freed_space,
cancellable, error))
return FALSE;
/* TODO remove printf in library */
if (freed_space > 0)
{
g_autofree char *freed_space_str = g_format_size_full (freed_space, 0);
g_print ("Freed objects: %s\n", freed_space_str);
}
}
return TRUE;
+10
View File
@@ -122,6 +122,16 @@ gboolean ostree_sysroot_prepare_cleanup (OstreeSysroot *self,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
gboolean
ostree_sysroot_cleanup_prune_repo (OstreeSysroot *sysroot,
OstreeRepoPruneOptions *options,
gint *out_objects_total,
gint *out_objects_pruned,
guint64 *out_pruned_object_size_total,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_sysroot_write_origin_file (OstreeSysroot *sysroot,
OstreeDeployment *deployment,
-3
View File
@@ -38,9 +38,6 @@ typedef struct OstreeSysroot OstreeSysroot;
typedef struct OstreeSysrootUpgrader OstreeSysrootUpgrader;
typedef struct OstreeMutableTree OstreeMutableTree;
typedef struct OstreeRepoFile OstreeRepoFile;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
typedef struct OstreeRemote OstreeRemote;
#endif
G_END_DECLS
+3 -3
View File
@@ -43,7 +43,7 @@
*
* Since: 2017.4
*/
#define OSTREE_RELEASE_VERSION (5)
#define OSTREE_RELEASE_VERSION (6)
/**
* OSTREE_VERSION
@@ -52,7 +52,7 @@
*
* Since: 2017.4
*/
#define OSTREE_VERSION (2018.5)
#define OSTREE_VERSION (2018.6)
/**
* OSTREE_VERSION_S:
@@ -62,7 +62,7 @@
*
* Since: 2017.4
*/
#define OSTREE_VERSION_S "2018.5"
#define OSTREE_VERSION_S "2018.6"
#define OSTREE_ENCODE_VERSION(year,release) \
((year) << 16 | (release))
-6
View File
@@ -25,9 +25,7 @@
#include <ostree-core.h>
#include <ostree-repo.h>
#include <ostree-mutable-tree.h>
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
#include <ostree-remote.h>
#endif
#include <ostree-repo-file.h>
#include <ostree-sysroot.h>
#include <ostree-sysroot-upgrader.h>
@@ -35,15 +33,11 @@
#include <ostree-bootconfig-parser.h>
#include <ostree-diff.h>
#include <ostree-gpg-verify-result.h>
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
#include <ostree-ref.h>
#include <ostree-repo-finder.h>
#include <ostree-repo-finder-avahi.h>
#include <ostree-repo-finder-config.h>
#include <ostree-repo-finder-mount.h>
#include <ostree-repo-finder-override.h>
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
#include <ostree-autocleanups.h>
#include <ostree-version.h>
-2
View File
@@ -63,14 +63,12 @@ static OstreeCommand commands[] = {
{ "export", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_export,
"Stream COMMIT to stdout in tar format" },
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
{ "find-remotes", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_find_remotes,
"Find remotes to serve the given refs" },
{ "create-usb", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_create_usb,
"Copy the refs to a USB stick" },
#endif
{ "fsck", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_fsck,
"Check the repository for consistency" },
+20
View File
@@ -45,11 +45,14 @@ static int opt_random_500s_percentage;
/* We have a strong upper bound for any unlikely
* cases involving repeated random 500s. */
static int opt_random_500s_max = 100;
static int opt_random_408s_percentage;
static int opt_random_408s_max = 100;
static gint opt_port = 0;
static gchar **opt_expected_cookies;
static gchar **opt_expected_headers;
static guint emitted_random_500s_count = 0;
static guint emitted_random_408s_count = 0;
typedef struct {
int root_dfd;
@@ -70,6 +73,8 @@ static GOptionEntry options[] = {
{ "force-range-requests", 0, 0, G_OPTION_ARG_NONE, &opt_force_ranges, "Force range requests by only serving half of files", NULL },
{ "random-500s", 0, 0, G_OPTION_ARG_INT, &opt_random_500s_percentage, "Generate random HTTP 500 errors approximately for PERCENTAGE requests", "PERCENTAGE" },
{ "random-500s-max", 0, 0, G_OPTION_ARG_INT, &opt_random_500s_max, "Limit HTTP 500 errors to MAX (default 100)", "MAX" },
{ "random-408s", 0, 0, G_OPTION_ARG_INT, &opt_random_408s_percentage, "Generate random HTTP 408 errors approximately for PERCENTAGE requests", "PERCENTAGE" },
{ "random-408s-max", 0, 0, G_OPTION_ARG_INT, &opt_random_408s_max, "Limit HTTP 408 errors to MAX (default 100)", "MAX" },
{ "log-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_log, "Put logs here (use - for stdout)", "PATH" },
{ "expected-cookies", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_expected_cookies, "Expect given cookies in the http request", "KEY=VALUE" },
{ "expected-header", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_expected_headers, "Expect given headers in the http request", "KEY=VALUE" },
@@ -291,6 +296,14 @@ do_get (OtTrivialHttpd *self,
soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
goto out;
}
else if (opt_random_408s_percentage > 0 &&
emitted_random_408s_count < opt_random_408s_max &&
g_random_int_range (0, 100) < opt_random_408s_percentage)
{
emitted_random_408s_count++;
soup_message_set_status (msg, SOUP_STATUS_REQUEST_TIMEOUT);
goto out;
}
while (path[0] == '/')
path++;
@@ -511,6 +524,13 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error)
goto out;
}
if (!(opt_random_408s_percentage >= 0 && opt_random_408s_percentage <= 99))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid --random-408s=%u", opt_random_408s_percentage);
goto out;
}
if (opt_log)
{
GOutputStream *stream = NULL;
-4
View File
@@ -331,7 +331,6 @@ parse_keyvalue_strings (GVariantBuilder *builder,
return TRUE;
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
static void
add_collection_binding (OstreeRepo *repo,
GVariantBuilder *metadata_builder)
@@ -344,7 +343,6 @@ add_collection_binding (OstreeRepo *repo,
g_variant_builder_add (metadata_builder, "{s@v}", OSTREE_COMMIT_META_KEY_COLLECTION_BINDING,
g_variant_new_variant (g_variant_new_string (collection_id)));
}
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
static int
compare_strings (gconstpointer a, gconstpointer b)
@@ -383,13 +381,11 @@ fill_bindings (OstreeRepo *repo,
add_ref_binding (metadata_builder);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
/* Allow the collection ID to be overridden using
* --add-metadata-string=ostree.collection-binding=blah */
if (metadata == NULL ||
!g_variant_lookup (metadata, OSTREE_COMMIT_META_KEY_COLLECTION_BINDING, "*", NULL))
add_collection_binding (repo, metadata_builder);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
*out_metadata = g_variant_ref_sink (g_variant_builder_end (metadata_builder));
}
+2 -1
View File
@@ -179,14 +179,15 @@ ostree_builtin_find_remotes (int argc,
g_autoptr(GPtrArray) finders = NULL; /* (element-type OstreeRepoFinder) */
g_autoptr(OstreeRepoFinder) finder_config = NULL;
g_autoptr(OstreeRepoFinder) finder_mount = NULL;
#ifdef HAVE_AVAHI
g_autoptr(OstreeRepoFinder) finder_avahi = NULL;
#endif /* HAVE_AVAHI */
g_autoptr(OstreeAsyncProgress) progress = NULL;
gsize i;
g_autoptr(GAsyncResult) find_result = NULL, pull_result = NULL;
g_auto(OstreeRepoFinderResultv) results = NULL;
g_auto(GLnxConsoleRef) console = { 0, };
g_autoptr(GHashTable) refs_found = NULL; /* set (element-type OstreeCollectionRef) */
g_auto(GStrv) finders_strings = NULL;
context = g_option_context_new ("COLLECTION-ID REF [COLLECTION-ID REF...]");
+25 -10
View File
@@ -31,6 +31,7 @@
static gboolean opt_quiet;
static gboolean opt_delete;
static gboolean opt_all;
static gboolean opt_add_tombstones;
static gboolean opt_verify_bindings;
static gboolean opt_verify_back_refs;
@@ -43,6 +44,7 @@ static gboolean opt_verify_back_refs;
static GOptionEntry options[] = {
{ "add-tombstones", 0, 0, G_OPTION_ARG_NONE, &opt_add_tombstones, "Add tombstones for missing commits", NULL },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &opt_quiet, "Only print error messages", NULL },
{ "all", 'a', 0, G_OPTION_ARG_NONE, &opt_all, "Don't stop on first error", NULL },
{ "delete", 0, 0, G_OPTION_ARG_NONE, &opt_delete, "Remove corrupted objects", NULL },
{ "verify-bindings", 0, 0, G_OPTION_ARG_NONE, &opt_verify_bindings, "Verify ref bindings", NULL },
{ "verify-back-refs", 0, 0, G_OPTION_ARG_NONE, &opt_verify_back_refs, "Verify back-references (implies --verify-bindings)", NULL },
@@ -63,22 +65,42 @@ fsck_one_object (OstreeRepo *repo,
if (!ostree_repo_fsck_object (repo, objtype, checksum, cancellable, &temp_error))
{
gboolean object_missing = FALSE;
g_auto(GStrv) parent_commits = NULL;
g_autofree char *parent_commits_str = NULL;
if (object_parents)
{
parent_commits = ostree_repo_traverse_parents_get_commits (object_parents, key);
parent_commits_str = g_strjoinv (", ", parent_commits);
}
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{
g_clear_error (&temp_error);
g_printerr ("Object missing: %s.%s\n", checksum,
ostree_object_type_to_string (objtype));
if (parent_commits_str)
g_printerr ("Object missing in commits %s: %s.%s\n", parent_commits_str, checksum,
ostree_object_type_to_string (objtype));
else
g_printerr ("Object missing: %s.%s\n", checksum,
ostree_object_type_to_string (objtype));
object_missing = TRUE;
}
else
{
if (parent_commits_str)
g_prefix_error (&temp_error, "In commits %s: ", parent_commits_str);
if (opt_delete)
{
g_printerr ("%s\n", temp_error->message);
(void) ostree_repo_delete_object (repo, objtype, checksum, cancellable, NULL);
object_missing = TRUE;
}
else if (opt_all)
{
*out_found_corruption = TRUE;
g_printerr ("%s\n", temp_error->message);
}
else
{
g_propagate_error (error, g_steal_pointer (&temp_error));
@@ -90,9 +112,8 @@ fsck_one_object (OstreeRepo *repo,
{
*out_found_corruption = TRUE;
if (object_parents != NULL && objtype != OSTREE_OBJECT_TYPE_COMMIT)
if (parent_commits != NULL && objtype != OSTREE_OBJECT_TYPE_COMMIT)
{
g_auto(GStrv) parent_commits = ostree_repo_traverse_parents_get_commits (object_parents, key);
int i;
/* The commit was missing or deleted, mark the commit partial */
@@ -243,7 +264,6 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
return FALSE;
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (!opt_quiet)
g_print ("Validating refs in collections...\n");
@@ -261,7 +281,6 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
&found_corruption, cancellable, error))
return FALSE;
}
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
if (!opt_quiet)
g_print ("Enumerating objects...\n");
@@ -306,13 +325,11 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
g_autoptr(GVariant) metadata = g_variant_get_child_value (commit, 0);
const char *collection_id = NULL;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (!g_variant_lookup (metadata,
OSTREE_COMMIT_META_KEY_COLLECTION_BINDING,
"&s",
&collection_id))
collection_id = NULL;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
g_autofree const char **refs = NULL;
if (g_variant_lookup (metadata,
@@ -324,7 +341,6 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
{
g_autofree char *checksum_for_ref = NULL;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (collection_id != NULL)
{
const OstreeCollectionRef collection_ref = { (char *) collection_id, (char *) *iter };
@@ -337,7 +353,6 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
return FALSE;
}
else
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
{
if (!ostree_repo_resolve_rev (repo, *iter, TRUE,
&checksum_for_ref, error))
-6
View File
@@ -28,9 +28,7 @@
#include "ostree.h"
static char *opt_mode = "bare";
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
static char *opt_collection_id = NULL;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
/* ATTENTION:
* Please remember to update the bash-completion script (bash/ostree) and
@@ -39,10 +37,8 @@ static char *opt_collection_id = NULL;
static GOptionEntry options[] = {
{ "mode", 0, 0, G_OPTION_ARG_STRING, &opt_mode, "Initialize repository in given mode (bare, bare-user, bare-user-only, archive)", NULL },
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
{ "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id,
"Globally unique ID for this repository as an collection of refs for redistribution to other repositories", "COLLECTION-ID" },
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
{ NULL }
};
@@ -61,10 +57,8 @@ ostree_builtin_init (int argc, char **argv,OstreeCommandInvocation *invocation,
if (!ostree_repo_mode_from_string (opt_mode, &mode, error))
goto out;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (!ostree_repo_set_collection_id (repo, opt_collection_id, error))
goto out;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
if (!ostree_repo_create (repo, mode, NULL, error))
goto out;
-4
View File
@@ -59,9 +59,7 @@ static gboolean
delete_commit (OstreeRepo *repo, const char *commit_to_delete, GCancellable *cancellable, GError **error)
{
g_autoptr(GHashTable) refs = NULL; /* (element-type utf8 utf8) */
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
g_autoptr(GHashTable) collection_refs = NULL; /* (element-type OstreeCollectionRef utf8) */
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
/* Check refs which are not in a collection. */
if (!ostree_repo_list_refs (repo, NULL, &refs, cancellable, error))
@@ -73,7 +71,6 @@ delete_commit (OstreeRepo *repo, const char *commit_to_delete, GCancellable *can
return glnx_throw (error, "Commit '%s' is referenced by '%s'", commit_to_delete, ref);
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
/* And check refs which *are* in a collection. */
if (!ostree_repo_list_collection_refs (repo, NULL, &collection_refs,
OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES,
@@ -87,7 +84,6 @@ delete_commit (OstreeRepo *repo, const char *commit_to_delete, GCancellable *can
return glnx_throw (error, "Commit '%s' is referenced by (%s, %s)",
commit_to_delete, ref->collection_id, ref->ref_name);
}
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
if (!ot_enable_tombstone_commits (repo, error))
return FALSE;
-8
View File
@@ -31,9 +31,7 @@ static gboolean opt_delete;
static gboolean opt_list;
static gboolean opt_alias;
static char *opt_create;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
static gboolean opt_collections;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
/* ATTENTION:
* Please remember to update the bash-completion script (bash/ostree) and
@@ -45,13 +43,10 @@ static GOptionEntry options[] = {
{ "list", 0, 0, G_OPTION_ARG_NONE, &opt_list, "Do not remove the prefix from the refs", NULL },
{ "alias", 'A', 0, G_OPTION_ARG_NONE, &opt_alias, "If used with --create, create an alias, otherwise just list aliases", NULL },
{ "create", 0, 0, G_OPTION_ARG_STRING, &opt_create, "Create a new ref for an existing commit", "NEWREF" },
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
{ "collections", 'c', 0, G_OPTION_ARG_NONE, &opt_collections, "Enable listing collection IDs for refs", NULL },
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
{ NULL }
};
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
static gboolean
do_ref_with_collections (OstreeRepo *repo,
const char *refspec_prefix,
@@ -136,7 +131,6 @@ do_ref_with_collections (OstreeRepo *repo,
out:
return ret;
}
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
static gboolean do_ref (OstreeRepo *repo, const char *refspec_prefix, GCancellable *cancellable, GError **error)
{
@@ -147,10 +141,8 @@ static gboolean do_ref (OstreeRepo *repo, const char *refspec_prefix, GCancellab
gboolean ret = FALSE;
gboolean is_list;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (opt_collections)
return do_ref_with_collections (repo, refspec_prefix, cancellable, error);
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
/* If we're doing aliasing, we need the full list of aliases mostly to allow
* replacing existing aliases.
-9
View File
@@ -108,16 +108,11 @@ ostree_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invocati
return FALSE;
}
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
const char *collection_id = ostree_repo_get_collection_id (repo);
#else /* if !OSTREE_ENABLE_EXPERIMENTAL_API */
const char *collection_id = NULL;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
/* Write out a new metadata commit for the repository. */
if (collection_id != NULL)
{
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
OstreeCollectionRef collection_ref = { (gchar *) collection_id, (gchar *) OSTREE_REPO_METADATA_REF };
g_autofree char *old_ostree_metadata_checksum = NULL;
g_autofree gchar *new_ostree_metadata_checksum = NULL;
@@ -192,10 +187,6 @@ ostree_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invocati
if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
return FALSE;
#else /* if !OSTREE_ENABLE_EXPERIMENTAL_API */
g_assert_not_reached ();
return FALSE;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
}
/* Regenerate and sign the conventional summary file. */
-2
View File
@@ -39,10 +39,8 @@ BUILTINPROTO(checksum);
BUILTINPROTO(commit);
BUILTINPROTO(diff);
BUILTINPROTO(export);
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
BUILTINPROTO(find_remotes);
BUILTINPROTO(create_usb);
#endif
BUILTINPROTO(gpg_sign);
BUILTINPROTO(init);
BUILTINPROTO(log);
-6
View File
@@ -32,9 +32,7 @@ static gboolean opt_no_gpg_verify;
static gboolean opt_if_not_exists;
static char *opt_gpg_import;
static char *opt_contenturl;
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
static char *opt_collection_id;
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
static char *opt_sysroot;
static char *opt_repo;
@@ -49,10 +47,8 @@ static GOptionEntry option_entries[] = {
{ "if-not-exists", 0, 0, G_OPTION_ARG_NONE, &opt_if_not_exists, "Do nothing if the provided remote exists", NULL },
{ "gpg-import", 0, 0, G_OPTION_ARG_FILENAME, &opt_gpg_import, "Import GPG key from FILE", "FILE" },
{ "contenturl", 0, 0, G_OPTION_ARG_STRING, &opt_contenturl, "Use URL when fetching content", "URL" },
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
{ "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id,
"Globally unique ID for this repository as an collection of refs for redistribution to other repositories", "COLLECTION-ID" },
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
{ "repo", 0, 0, G_OPTION_ARG_FILENAME, &opt_repo, "Path to OSTree repository (defaults to /sysroot/ostree/repo)", "PATH" },
{ "sysroot", 0, 0, G_OPTION_ARG_FILENAME, &opt_sysroot, "Use sysroot at PATH (overrides --repo)", "PATH" },
{ NULL }
@@ -133,11 +129,9 @@ ot_remote_builtin_add (int argc, char **argv, OstreeCommandInvocation *invocatio
"gpg-verify",
g_variant_new_variant (g_variant_new_boolean (FALSE)));
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (opt_collection_id != NULL)
g_variant_builder_add (optbuilder, "{s@v}", "collection-id",
g_variant_new_variant (g_variant_new_take_string (g_steal_pointer (&opt_collection_id))));
#endif /* OSTREE_ENABLE_EXPERIMENTAL_API */
options = g_variant_ref_sink (g_variant_builder_end (optbuilder));
+2
View File
@@ -31,6 +31,8 @@
#include <fcntl.h>
#include <string.h>
#define INITRAMFS_MOUNT_VAR "/run/ostree/initramfs-mount-var"
static inline int
path_is_on_readonly_fs (char *path)
{
+9 -4
View File
@@ -151,13 +151,18 @@ main(int argc, char *argv[])
if (chdir (deploy_path) < 0)
err (EXIT_FAILURE, "failed to chdir to deploy_path");
/* In the systemd case, this is handled by ostree-system-generator */
bool mount_var = true;
/* In the systemd case, this is handled by ostree-system-generator by default */
#ifndef HAVE_SYSTEMD_AND_LIBMOUNT
/* Link to the deployment's /var */
if (mount ("../../var", "var", NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
err (EXIT_FAILURE, "failed to bind mount ../../var to var");
/* file in /run can override that behaviour */
if (lstat (INITRAMFS_MOUNT_VAR, &stbuf) < 0)
mount_var = false;
#endif
/* Link to the deployment's /var */
if (mount_var && mount ("../../var", "var", NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
err (EXIT_FAILURE, "failed to bind mount ../../var to var");
char srcpath[PATH_MAX];
/* If /boot is on the same partition, use a bind mount to make it visible
* at /boot inside the deployment. */
+10
View File
@@ -49,6 +49,16 @@ main(int argc, char *argv[])
exit (EXIT_SUCCESS);
}
/* We conflict with the magic ostree-mount-deployment-var file for ostree-prepare-root */
{ struct stat stbuf;
if (fstatat (AT_FDCWD, INITRAMFS_MOUNT_VAR, &stbuf, 0) == 0)
{
if (unlinkat (AT_FDCWD, INITRAMFS_MOUNT_VAR, 0) < 0)
err (EXIT_FAILURE, "Can't unlink " INITRAMFS_MOUNT_VAR);
exit (EXIT_SUCCESS);
}
}
if (argc > 1 && argc != 4)
errx (EXIT_FAILURE, "This program takes three or no arguments");