New upstream version 2018.8
This commit is contained in:
commit
119b14e21d
26 files changed
+538
-133
No files matched your search
@@ -31,6 +31,7 @@ Before=systemd-tmpfiles-setup.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/lib/ostree/ostree-remount
|
||||
StandardInput=null
|
||||
StandardOutput=syslog
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
***/
|
||||
|
||||
/* Add new symbols here. Release commits should copy this section into -released.sym. */
|
||||
LIBOSTREE_2018.9 {
|
||||
} LIBOSTREE_2018.7;
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -534,6 +534,8 @@ global:
|
||||
ostree_mutable_tree_check_error;
|
||||
} LIBOSTREE_2018.6;
|
||||
|
||||
/* No new symbols in 2018.8 */
|
||||
|
||||
/* NOTE: Only add more content here in release commits! See the
|
||||
* comments at the top of this file.
|
||||
*/
|
||||
@@ -445,10 +445,10 @@ throw_min_free_space_error (OstreeRepo *self,
|
||||
else
|
||||
err_msg = "would be exceeded";
|
||||
|
||||
if (self->min_free_space_percent > 0)
|
||||
return glnx_throw (error, "min-free-space-percent '%u%%' %s", self->min_free_space_percent, err_msg);
|
||||
else
|
||||
if (self->min_free_space_mb > 0)
|
||||
return glnx_throw (error, "min-free-space-size %" G_GUINT64_FORMAT "MB %s", self->min_free_space_mb, err_msg);
|
||||
else
|
||||
return glnx_throw (error, "min-free-space-percent '%u%%' %s", self->min_free_space_percent, err_msg);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -1295,6 +1295,7 @@ write_metadata_object (OstreeRepo *self,
|
||||
char actual_checksum[OSTREE_SHA256_STRING_LEN+1];
|
||||
if (is_tombstone)
|
||||
{
|
||||
g_assert (expected_checksum != NULL);
|
||||
memcpy (actual_checksum, expected_checksum, sizeof (actual_checksum));
|
||||
}
|
||||
else
|
||||
@@ -2194,11 +2195,19 @@ ostree_repo_commit_transaction (OstreeRepo *self,
|
||||
if (self->txn.refs)
|
||||
if (!_ostree_repo_update_refs (self, self->txn.refs, cancellable, error))
|
||||
return FALSE;
|
||||
g_clear_pointer (&self->txn.refs, g_hash_table_destroy);
|
||||
|
||||
if (self->txn.collection_refs)
|
||||
if (!_ostree_repo_update_collection_refs (self, self->txn.collection_refs, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
/* Update the summary if auto-update-summary is set, because doing so was
|
||||
* delayed for each ref change during the transaction.
|
||||
*/
|
||||
if ((self->txn.refs || self->txn.collection_refs) &&
|
||||
!_ostree_repo_maybe_regenerate_summary (self, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
g_clear_pointer (&self->txn.refs, g_hash_table_destroy);
|
||||
g_clear_pointer (&self->txn.collection_refs, g_hash_table_destroy);
|
||||
|
||||
self->in_transaction = FALSE;
|
||||
@@ -3309,6 +3318,7 @@ write_dir_entry_to_mtree_internal (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (dfd_iter != NULL);
|
||||
g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, };
|
||||
|
||||
if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, name, FALSE, &child_dfd_iter, error))
|
||||
|
||||
@@ -61,7 +61,8 @@ G_BEGIN_DECLS
|
||||
#define OSTREE_COMMIT_TIMESTAMP "ostree.commit.timestamp"
|
||||
|
||||
typedef enum {
|
||||
OSTREE_REPO_TEST_ERROR_PRE_COMMIT = (1 << 0)
|
||||
OSTREE_REPO_TEST_ERROR_PRE_COMMIT = (1 << 0),
|
||||
OSTREE_REPO_TEST_ERROR_INVALID_CACHE = (1 << 1),
|
||||
} OstreeRepoTestErrorFlags;
|
||||
|
||||
struct OstreeRepoCommitModifier {
|
||||
@@ -437,6 +438,11 @@ _ostree_repo_get_remote_inherited (OstreeRepo *self,
|
||||
const char *name,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
_ostree_repo_maybe_regenerate_summary (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
/* Locking APIs are currently private.
|
||||
* See https://github.com/ostreedev/ostree/pull/1555
|
||||
*/
|
||||
|
||||
@@ -2486,7 +2486,10 @@ process_one_static_delta (OtPullData *pull_data,
|
||||
OSTREE_STATIC_DELTA_OPEN_FLAGS_SKIP_CHECKSUM,
|
||||
NULL, &inline_delta_part,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
{
|
||||
fetch_static_delta_data_free (fetch_data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_ostree_static_delta_part_execute_async (pull_data->repo,
|
||||
fetch_data->objects,
|
||||
@@ -3345,6 +3348,19 @@ initiate_request (OtPullData *pull_data,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* If doing a delta from a ref, look up the from-revision, since we need it
|
||||
* on most paths below. */
|
||||
if (ref != NULL)
|
||||
{
|
||||
g_autofree char *refspec = NULL;
|
||||
if (pull_data->remote_name != NULL)
|
||||
refspec = g_strdup_printf ("%s:%s", pull_data->remote_name, ref->ref_name);
|
||||
if (!ostree_repo_resolve_rev (pull_data->repo,
|
||||
refspec ?: ref->ref_name, TRUE,
|
||||
&delta_from_revision, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If we have a summary, we can use the newer logic */
|
||||
if (pull_data->summary)
|
||||
{
|
||||
@@ -3372,7 +3388,16 @@ initiate_request (OtPullData *pull_data,
|
||||
enqueue_one_static_delta_superblock_request (pull_data, deltares.from_revision, to_revision, ref);
|
||||
break;
|
||||
case DELTA_SEARCH_RESULT_SCRATCH:
|
||||
enqueue_one_static_delta_superblock_request (pull_data, NULL, to_revision, ref);
|
||||
{
|
||||
/* If a from-scratch delta is available, we don’t want to use it if
|
||||
* the ref already exists locally, since we are likely only a few
|
||||
* commits out of date; so doing an object pull is likely more
|
||||
* bandwidth efficient. */
|
||||
if (delta_from_revision != NULL)
|
||||
queue_scan_one_metadata_object (pull_data, to_revision, OSTREE_OBJECT_TYPE_COMMIT, NULL, 0, ref);
|
||||
else
|
||||
enqueue_one_static_delta_superblock_request (pull_data, NULL, to_revision, ref);
|
||||
}
|
||||
break;
|
||||
case DELTA_SEARCH_RESULT_UNCHANGED:
|
||||
{
|
||||
@@ -3392,13 +3417,6 @@ initiate_request (OtPullData *pull_data,
|
||||
{
|
||||
/* Are we doing a delta via a ref? In that case we can fall back to the older
|
||||
* logic of just using the current tip of the ref as a delta FROM source. */
|
||||
g_autofree char *refspec = NULL;
|
||||
if (pull_data->remote_name != NULL)
|
||||
refspec = g_strdup_printf ("%s:%s", pull_data->remote_name, ref->ref_name);
|
||||
if (!ostree_repo_resolve_rev (pull_data->repo,
|
||||
refspec ?: ref->ref_name, TRUE,
|
||||
&delta_from_revision, error))
|
||||
return FALSE;
|
||||
|
||||
/* Determine whether the from revision we have is partial; this
|
||||
* can happen if e.g. one uses `ostree pull --commit-metadata-only`.
|
||||
@@ -3983,7 +4001,10 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
goto out;
|
||||
|
||||
if (bytes_summary)
|
||||
summary_from_cache = TRUE;
|
||||
{
|
||||
g_debug ("Loaded %s summary from cache", remote_name_or_baseurl);
|
||||
summary_from_cache = TRUE;
|
||||
}
|
||||
|
||||
if (!pull_data->summary && !bytes_summary)
|
||||
{
|
||||
@@ -4021,12 +4042,53 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
if (pull_data->gpg_verify_summary && bytes_summary && bytes_sig)
|
||||
{
|
||||
g_autoptr(OstreeGpgVerifyResult) result = NULL;
|
||||
g_autoptr(GError) temp_error = NULL;
|
||||
|
||||
result = ostree_repo_verify_summary (self, pull_data->remote_name,
|
||||
bytes_summary, bytes_sig,
|
||||
cancellable, error);
|
||||
if (!ostree_gpg_verify_result_require_valid_signature (result, error))
|
||||
goto out;
|
||||
cancellable, &temp_error);
|
||||
if (!ostree_gpg_verify_result_require_valid_signature (result, &temp_error))
|
||||
{
|
||||
if (summary_from_cache)
|
||||
{
|
||||
/* The cached summary doesn't match, fetch a new one and verify again */
|
||||
if ((self->test_error_flags & OSTREE_REPO_TEST_ERROR_INVALID_CACHE) > 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Remote %s cached summary invalid and "
|
||||
"OSTREE_REPO_TEST_ERROR_INVALID_CACHE specified",
|
||||
pull_data->remote_name);
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
g_debug ("Remote %s cached summary invalid, pulling new version",
|
||||
pull_data->remote_name);
|
||||
|
||||
summary_from_cache = FALSE;
|
||||
g_clear_pointer (&bytes_summary, (GDestroyNotify)g_bytes_unref);
|
||||
if (!_ostree_fetcher_mirrored_request_to_membuf (pull_data->fetcher,
|
||||
pull_data->meta_mirrorlist,
|
||||
"summary",
|
||||
OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT,
|
||||
pull_data->n_network_retries,
|
||||
&bytes_summary,
|
||||
OSTREE_MAX_METADATA_SIZE,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
g_autoptr(OstreeGpgVerifyResult) retry =
|
||||
ostree_repo_verify_summary (self, pull_data->remote_name,
|
||||
bytes_summary, bytes_sig,
|
||||
cancellable, error);
|
||||
if (!ostree_gpg_verify_result_require_valid_signature (retry, error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_propagate_error (error, g_steal_pointer (&temp_error));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bytes_summary)
|
||||
@@ -4131,7 +4193,6 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
{
|
||||
const char *delta;
|
||||
g_autoptr(GVariant) csum_v = NULL;
|
||||
guchar *csum_data = g_malloc (OSTREE_SHA256_DIGEST_LEN);
|
||||
g_autoptr(GVariant) ref = g_variant_get_child_value (deltas, i);
|
||||
|
||||
g_variant_get_child (ref, 0, "&s", &delta);
|
||||
@@ -4140,6 +4201,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
if (!validate_variant_is_csum (csum_v, error))
|
||||
goto out;
|
||||
|
||||
guchar *csum_data = g_malloc (OSTREE_SHA256_DIGEST_LEN);
|
||||
memcpy (csum_data, ostree_checksum_bytes_peek (csum_v), 32);
|
||||
g_hash_table_insert (pull_data->summary_deltas_checksums,
|
||||
g_strdup (delta),
|
||||
@@ -5255,8 +5317,9 @@ find_remotes_cb (GObject *obj,
|
||||
summary_bytes, FALSE);
|
||||
|
||||
/* Check the summary’s additional metadata and set up @commit_metadata
|
||||
* and @refs_and_remotes_table with all the refs listed in the summary
|
||||
* file which intersect with @refs. */
|
||||
* and @refs_and_remotes_table with the refs listed in the summary file,
|
||||
* filtered by the keyring associated with this result and the
|
||||
* intersection with @refs. */
|
||||
additional_metadata_v = g_variant_get_child_value (summary_v, 1);
|
||||
|
||||
if (g_variant_lookup (additional_metadata_v, OSTREE_SUMMARY_COLLECTION_ID, "s", &summary_collection_id))
|
||||
@@ -5277,6 +5340,13 @@ find_remotes_cb (GObject *obj,
|
||||
while (summary_collection_map != NULL &&
|
||||
g_variant_iter_loop (summary_collection_map, "{s@a(s(taya{sv}))}", &summary_collection_id, &summary_refs))
|
||||
{
|
||||
/* Exclude refs that don't use the associated keyring if this is a
|
||||
* dynamic remote, by comparing against the collection ID of the
|
||||
* remote this one inherits from */
|
||||
if (result->remote->refspec_name != NULL &&
|
||||
!check_remote_matches_collection_id (self, result->remote->refspec_name, summary_collection_id))
|
||||
continue;
|
||||
|
||||
if (!find_remotes_process_refs (self, refs, result, i, summary_collection_id, summary_refs,
|
||||
commit_metadatas, refs_and_remotes_table))
|
||||
{
|
||||
@@ -5656,7 +5726,7 @@ copy_option (GVariantDict *master_options,
|
||||
{
|
||||
g_autoptr(GVariant) option_v = g_variant_dict_lookup_value (master_options, key, expected_type);
|
||||
if (option_v != NULL)
|
||||
g_variant_dict_insert_value (slave_options, key, g_steal_pointer (&option_v));
|
||||
g_variant_dict_insert_value (slave_options, key, option_v);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1144,6 +1144,11 @@ _ostree_repo_write_ref (OstreeRepo *self,
|
||||
if (!_ostree_repo_update_mtime (self, error))
|
||||
return FALSE;
|
||||
|
||||
/* Update the summary after updating the mtime so the summary doesn't look
|
||||
* out of date */
|
||||
if (!self->in_transaction && !_ostree_repo_maybe_regenerate_summary (self, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1153,17 +1158,10 @@ _ostree_repo_update_refs (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, refs);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (refs, const char*, refspec, const char*, rev)
|
||||
{
|
||||
const char *refspec = key;
|
||||
const char *rev = value;
|
||||
g_autofree char *remote = NULL;
|
||||
g_autofree char *ref_name = NULL;
|
||||
|
||||
if (!ostree_parse_refspec (refspec, &remote, &ref_name, error))
|
||||
return FALSE;
|
||||
|
||||
@@ -1253,7 +1251,6 @@ ostree_repo_list_collection_refs (OstreeRepo *self,
|
||||
(GDestroyNotify) ostree_collection_ref_free,
|
||||
g_free);
|
||||
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
g_autoptr(GString) base_path = g_string_new ("");
|
||||
|
||||
const gchar *main_collection_id = ostree_repo_get_collection_id (self);
|
||||
@@ -1279,6 +1276,8 @@ ostree_repo_list_collection_refs (OstreeRepo *self,
|
||||
{
|
||||
const char *refs_dir = *iter;
|
||||
gboolean refs_dir_exists = FALSE;
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
|
||||
if (!ot_dfd_iter_init_allow_noent (self->repo_dir_fd, refs_dir,
|
||||
&dfd_iter, &refs_dir_exists, error))
|
||||
return FALSE;
|
||||
|
||||
@@ -313,14 +313,13 @@ finish_part (OstreeStaticDeltaBuilder *builder, GError **error)
|
||||
static OstreeStaticDeltaPartBuilder *
|
||||
allocate_part (OstreeStaticDeltaBuilder *builder, GError **error)
|
||||
{
|
||||
OstreeStaticDeltaPartBuilder *part = g_new0 (OstreeStaticDeltaPartBuilder, 1);
|
||||
|
||||
if (builder->parts->len > 0)
|
||||
{
|
||||
if (!finish_part (builder, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OstreeStaticDeltaPartBuilder *part = g_new0 (OstreeStaticDeltaPartBuilder, 1);
|
||||
part->objects = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
|
||||
part->payload = g_string_new (NULL);
|
||||
part->operations = g_string_new (NULL);
|
||||
@@ -1522,7 +1521,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_variant_builder_add_value (part_headers, g_variant_ref (part_builder->header));
|
||||
g_variant_builder_add_value (part_headers, part_builder->header);
|
||||
|
||||
total_compressed_size += part_builder->compressed_size;
|
||||
total_uncompressed_size += part_builder->uncompressed_size;
|
||||
|
||||
@@ -1187,6 +1187,7 @@ ostree_repo_init (OstreeRepo *self)
|
||||
static gsize gpgme_initialized;
|
||||
const GDebugKey test_error_keys[] = {
|
||||
{ "pre-commit", OSTREE_REPO_TEST_ERROR_PRE_COMMIT },
|
||||
{ "invalid-cache", OSTREE_REPO_TEST_ERROR_INVALID_CACHE },
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&gpgme_initialized))
|
||||
@@ -1440,12 +1441,10 @@ ostree_repo_copy_config (OstreeRepo *self)
|
||||
/**
|
||||
* ostree_repo_write_config:
|
||||
* @self: Repo
|
||||
* @new_config: Overwrite the config file with this data. Do not change later!
|
||||
* @new_config: Overwrite the config file with this data
|
||||
* @error: a #GError
|
||||
*
|
||||
* Save @new_config in place of this repository's config file. Note
|
||||
* that @new_config should not be modified after - this function
|
||||
* simply adds a reference.
|
||||
* Save @new_config in place of this repository's config file.
|
||||
*/
|
||||
gboolean
|
||||
ostree_repo_write_config (OstreeRepo *self,
|
||||
@@ -4611,8 +4610,9 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
|
||||
|
||||
if (bytes_sec > 0)
|
||||
{
|
||||
/* MAX(0, value) here just to be defensive */
|
||||
guint64 est_time_remaining = MAX(0, (total_delta_part_size - fetched_delta_part_size)) / bytes_sec;
|
||||
guint64 est_time_remaining = 0;
|
||||
if (total_delta_part_size > fetched_delta_part_size)
|
||||
est_time_remaining = (total_delta_part_size - fetched_delta_part_size) / bytes_sec;
|
||||
g_autofree char *formatted_est_time_remaining = _formatted_time_remaining_from_seconds (est_time_remaining);
|
||||
/* No space between %s and remaining, since formatted_est_time_remaining has a trailing space */
|
||||
g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/%s %s/s %sremaining",
|
||||
@@ -4891,7 +4891,7 @@ ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
|
||||
g_autoptr(GVariant) metadata = NULL;
|
||||
if (!ot_openat_ignore_enoent (self->repo_dir_fd, "summary.sig", &fd, error))
|
||||
return FALSE;
|
||||
if (fd != -1)
|
||||
if (fd >= 0)
|
||||
{
|
||||
if (!ot_variant_read_fd (fd, 0, G_VARIANT_TYPE (OSTREE_SUMMARY_SIG_GVARIANT_STRING),
|
||||
FALSE, &metadata, error))
|
||||
@@ -5384,8 +5384,8 @@ summary_add_ref_entry (OstreeRepo *self,
|
||||
* regular, setting the `ostree.summary.expires` key in @additional_metadata
|
||||
* will aid clients in working out when to check for updates.
|
||||
*
|
||||
* It is regenerated automatically after a commit if
|
||||
* `core/commit-update-summary` is set.
|
||||
* It is regenerated automatically after any ref is
|
||||
* added, removed, or updated if `core/auto-update-summary` is set.
|
||||
*
|
||||
* If the `core/collection-id` key is set in the configuration, it will be
|
||||
* included as %OSTREE_SUMMARY_COLLECTION_ID in the summary file. Refs that
|
||||
@@ -5393,6 +5393,8 @@ summary_add_ref_entry (OstreeRepo *self,
|
||||
* file, listed under the %OSTREE_SUMMARY_COLLECTION_MAP key. Collection IDs
|
||||
* and refs in %OSTREE_SUMMARY_COLLECTION_MAP are guaranteed to be in
|
||||
* lexicographic order.
|
||||
*
|
||||
* Locking: exclusive
|
||||
*/
|
||||
gboolean
|
||||
ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||
@@ -5400,6 +5402,18 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
/* Take an exclusive lock. This makes sure the commits and deltas don't get
|
||||
* deleted while generating the summary. It also means we can be sure refs
|
||||
* won't be created/updated/deleted during the operation, without having to
|
||||
* add exclusive locks to those operations which would prevent concurrent
|
||||
* commits from working.
|
||||
*/
|
||||
g_autoptr(OstreeRepoAutoLock) lock = NULL;
|
||||
lock = _ostree_repo_auto_lock_push (self, OSTREE_REPO_LOCK_EXCLUSIVE,
|
||||
cancellable, error);
|
||||
if (!lock)
|
||||
return FALSE;
|
||||
|
||||
g_auto(GVariantDict) additional_metadata_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
g_variant_dict_init (&additional_metadata_builder, additional_metadata);
|
||||
g_autoptr(GVariantBuilder) refs_builder = g_variant_builder_new (G_VARIANT_TYPE ("a(s(taya{sv}))"));
|
||||
@@ -5577,6 +5591,37 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Regenerate the summary if `core/auto-update-summary` is set. We default to FALSE for
|
||||
* this setting because OSTree supports multiple processes committing to the same repo (but
|
||||
* different refs) concurrently, and in fact gnome-continuous actually does this. In that
|
||||
* context it's best to update the summary explicitly once at the end of multiple
|
||||
* transactions instead of automatically here. `auto-update-summary` only updates
|
||||
* atomically within a transaction. */
|
||||
gboolean
|
||||
_ostree_repo_maybe_regenerate_summary (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean auto_update_summary;
|
||||
if (!ot_keyfile_get_boolean_with_default (self->config, "core",
|
||||
"auto-update-summary", FALSE,
|
||||
&auto_update_summary, error))
|
||||
return FALSE;
|
||||
|
||||
/* Deprecated alias for `auto-update-summary`. */
|
||||
gboolean commit_update_summary;
|
||||
if (!ot_keyfile_get_boolean_with_default (self->config, "core",
|
||||
"commit-update-summary", FALSE,
|
||||
&commit_update_summary, error))
|
||||
return FALSE;
|
||||
|
||||
if ((auto_update_summary || commit_update_summary) &&
|
||||
!ostree_repo_regenerate_summary (self, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_repo_is_locked_tmpdir (const char *filename)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_RELEASE_VERSION (7)
|
||||
#define OSTREE_RELEASE_VERSION (8)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION
|
||||
@@ -52,7 +52,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION (2018.7)
|
||||
#define OSTREE_VERSION (2018.8)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION_S:
|
||||
@@ -62,7 +62,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION_S "2018.7"
|
||||
#define OSTREE_VERSION_S "2018.8"
|
||||
|
||||
#define OSTREE_ENCODE_VERSION(year,release) \
|
||||
((year) << 16 | (release))
|
||||
|
||||
@@ -262,10 +262,8 @@ data_read_cb (void *handle, void *buffer, size_t size)
|
||||
|
||||
g_return_val_if_fail (G_IS_INPUT_STREAM (input_stream), -1);
|
||||
|
||||
g_input_stream_read_all (input_stream, buffer, size,
|
||||
&bytes_read, NULL, &local_error);
|
||||
|
||||
if (local_error != NULL)
|
||||
if (!g_input_stream_read_all (input_stream, buffer, size,
|
||||
&bytes_read, NULL, &local_error))
|
||||
{
|
||||
set_errno_from_gio_error (local_error);
|
||||
g_clear_error (&local_error);
|
||||
@@ -287,7 +285,7 @@ data_write_cb (void *handle, const void *buffer, size_t size)
|
||||
if (g_output_stream_write_all (output_stream, buffer, size,
|
||||
&bytes_written, NULL, &local_error))
|
||||
{
|
||||
g_output_stream_flush (output_stream, NULL, &local_error);
|
||||
(void)g_output_stream_flush (output_stream, NULL, &local_error);
|
||||
}
|
||||
|
||||
if (local_error != NULL)
|
||||
|
||||
@@ -752,7 +752,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||
|
||||
if (!skip_commit)
|
||||
{
|
||||
gboolean update_summary;
|
||||
guint64 timestamp;
|
||||
|
||||
if (!opt_no_bindings)
|
||||
@@ -823,22 +822,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||
|
||||
if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
|
||||
goto out;
|
||||
|
||||
/* The default for this option is FALSE, even for archive repos,
|
||||
* because ostree supports multiple processes committing to the same
|
||||
* repo (but different refs) concurrently, and in fact gnome-continuous
|
||||
* actually does this. In that context it's best to update the summary
|
||||
* explicitly instead of automatically here. */
|
||||
if (!ot_keyfile_get_boolean_with_default (ostree_repo_get_config (repo), "core",
|
||||
"commit-update-summary", FALSE,
|
||||
&update_summary, error))
|
||||
goto out;
|
||||
|
||||
if (update_summary && !ostree_repo_regenerate_summary (repo,
|
||||
NULL,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,12 +28,15 @@
|
||||
#include "ostree.h"
|
||||
#include "otutil.h"
|
||||
|
||||
static char* opt_group;
|
||||
|
||||
/* ATTENTION:
|
||||
* Please remember to update the bash-completion script (bash/ostree) and
|
||||
* man page (man/ostree-config.xml) when changing the option list.
|
||||
*/
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ "group", 0, 0, G_OPTION_ARG_STRING, &opt_group , "Group name", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -44,7 +47,7 @@ split_key_string (const char *k,
|
||||
GError **error)
|
||||
{
|
||||
const char *dot = strchr (k, '.');
|
||||
|
||||
|
||||
if (!dot)
|
||||
{
|
||||
return glnx_throw (error,
|
||||
@@ -85,18 +88,31 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||
|
||||
if (!strcmp (op, "set"))
|
||||
{
|
||||
if (argc < 4)
|
||||
if (opt_group)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"KEY and VALUE must be specified");
|
||||
goto out;
|
||||
if (argc < 4)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"GROUP name, KEY and VALUE must be specified");
|
||||
goto out;
|
||||
}
|
||||
section = g_strdup(opt_group);
|
||||
key = g_strdup(argv[2]);
|
||||
value = argv[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argc < 4)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"KEY and VALUE must be specified");
|
||||
goto out;
|
||||
}
|
||||
section_key = argv[2];
|
||||
value = argv[3];
|
||||
if(!split_key_string (section_key, §ion, &key, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
section_key = argv[2];
|
||||
value = argv[3];
|
||||
|
||||
if (!split_key_string (section_key, §ion, &key, error))
|
||||
goto out;
|
||||
|
||||
config = ostree_repo_copy_config (repo);
|
||||
g_key_file_set_string (config, section, key, value);
|
||||
@@ -108,17 +124,29 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||
{
|
||||
GKeyFile *readonly_config = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
if (argc < 3)
|
||||
if (opt_group)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"KEY must be specified");
|
||||
goto out;
|
||||
if (argc < 3)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Group name and key must be specified");
|
||||
goto out;
|
||||
}
|
||||
section = g_strdup(opt_group);
|
||||
key = g_strdup(argv[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(argc < 3)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"KEY must be specified");
|
||||
goto out;
|
||||
}
|
||||
section_key = argv[2];
|
||||
if (!split_key_string (section_key, §ion, &key, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
section_key = argv[2];
|
||||
|
||||
if (!split_key_string (section_key, §ion, &key, error))
|
||||
goto out;
|
||||
|
||||
readonly_config = ostree_repo_get_config (repo);
|
||||
value = g_key_file_get_string (readonly_config, section, key, error);
|
||||
@@ -133,7 +161,7 @@ ostree_builtin_config (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||
"Unknown operation %s", op);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (config)
|
||||
|
||||
@@ -293,7 +293,7 @@ ostree_builtin_refs (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||
else if (opt_create)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"You must specify an existing ref when creating a new ref");
|
||||
"You must specify a revision when creating a new ref");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user