New upstream version 2019.1
This commit is contained in:
commit
72f5087561
73 files changed
+3173
-1997
No files matched your search
@@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The builtin grub.cfg generator.
|
||||
# The builtin grub.cfg generator. This script is called by
|
||||
# ostree/src/libostree/ostree-bootloader-grub2.c whenever boot loader
|
||||
# configuration file needs to be updated on systems which do not use
|
||||
# grub2-mkconfig (and thus, the `ostree admin instutil grub2-generate` path).
|
||||
#
|
||||
# This script is called by ostree/src/libostree/ostree-bootloader-grub2.c whenever
|
||||
# boot loader configuration file needs to be updated. It can be used as a template
|
||||
# for a custom grub.cfg generator. What to consider when writing a custom grub.cfg
|
||||
# generator:
|
||||
# It can be used as a template for a custom grub.cfg generator. What to consider
|
||||
# when writing a custom grub.cfg generator:
|
||||
#
|
||||
# - The populate_menu() function converts boot loader entries as defined by
|
||||
# https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ into GRUB2
|
||||
@@ -32,6 +33,7 @@ read_config()
|
||||
initrd=""
|
||||
options=""
|
||||
linux=""
|
||||
devicetree=""
|
||||
|
||||
while read -r line
|
||||
do
|
||||
@@ -47,6 +49,9 @@ read_config()
|
||||
"linux")
|
||||
linux=${value}
|
||||
;;
|
||||
"devicetree")
|
||||
devicetree=${value}
|
||||
;;
|
||||
"options")
|
||||
options=${value}
|
||||
;;
|
||||
@@ -73,6 +78,9 @@ populate_menu()
|
||||
if [ -n "${initrd}" ] ; then
|
||||
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
||||
fi
|
||||
if [ -n "${devicetree}" ] ; then
|
||||
menu="${menu}\t devicetree ${boot_prefix}${devicetree}\n"
|
||||
fi
|
||||
menu="${menu}}\n\n"
|
||||
done
|
||||
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
***/
|
||||
|
||||
/* Add new symbols here. Release commits should copy this section into -released.sym. */
|
||||
LIBOSTREE_2018.10 {
|
||||
} LIBOSTREE_2018.9;
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -191,6 +191,7 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
|
||||
const char *options;
|
||||
const char *kernel;
|
||||
const char *initrd;
|
||||
const char *devicetree;
|
||||
char *quoted_title = NULL;
|
||||
char *uuid = NULL;
|
||||
char *quoted_uuid = NULL;
|
||||
@@ -246,6 +247,15 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
|
||||
g_string_append_c (output, '\n');
|
||||
}
|
||||
|
||||
devicetree = ostree_bootconfig_parser_get (config, "devicetree");
|
||||
if (devicetree)
|
||||
{
|
||||
g_string_append (output, "devicetree");
|
||||
g_string_append_c (output, ' ');
|
||||
g_string_append (output, devicetree);
|
||||
g_string_append_c (output, '\n');
|
||||
}
|
||||
|
||||
g_string_append (output, "}\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -626,9 +626,9 @@ ostree_content_stream_parse (gboolean compressed,
|
||||
cancellable, error))
|
||||
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);
|
||||
g_variant_ref_sink(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;
|
||||
|
||||
@@ -777,7 +777,6 @@ initiate_next_curl_request (FetcherRequest *req,
|
||||
* there are numerous HTTP/2 fixes since the original version in
|
||||
* libcurl 7.43.0.
|
||||
*/
|
||||
#ifdef BUILDOPT_HTTP2
|
||||
if (!(self->config_flags & OSTREE_FETCHER_FLAGS_DISABLE_HTTP2))
|
||||
{
|
||||
#if CURL_AT_LEAST_VERSION(7, 51, 0)
|
||||
@@ -789,7 +788,7 @@ initiate_next_curl_request (FetcherRequest *req,
|
||||
curl_easy_setopt (req->easy, CURLOPT_PIPEWAIT, 1L);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
curl_easy_setopt (req->easy, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
if (g_getenv ("OSTREE_DEBUG_HTTP"))
|
||||
curl_easy_setopt (req->easy, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
@@ -304,12 +304,82 @@ _ostree_gpg_verifier_add_key_ascii_file (OstreeGpgVerifier *self,
|
||||
g_ptr_array_add (self->key_ascii_files, g_strdup (path));
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_gpg_verifier_add_keyfile_path (OstreeGpgVerifier *self,
|
||||
const char *path,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GError) temp_error = NULL;
|
||||
if (!_ostree_gpg_verifier_add_keyfile_dir_at (self, AT_FDCWD, path,
|
||||
cancellable, &temp_error))
|
||||
{
|
||||
g_assert (temp_error);
|
||||
|
||||
/* If failed due to not being a directory, add the file as an ascii key. */
|
||||
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY))
|
||||
{
|
||||
g_clear_error (&temp_error);
|
||||
|
||||
_ostree_gpg_verifier_add_key_ascii_file (self, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_propagate_error (error, g_steal_pointer (&temp_error));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Add files that exist one level below the directory at @path as ascii
|
||||
* key files. If @path cannot be opened as a directory,
|
||||
* an error is returned.
|
||||
*/
|
||||
gboolean
|
||||
_ostree_gpg_verifier_add_keyfile_dir_at (OstreeGpgVerifier *self,
|
||||
int dfd,
|
||||
const char *path,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
|
||||
if (!glnx_dirfd_iterator_init_at (dfd, path, FALSE,
|
||||
&dfd_iter, error))
|
||||
return FALSE;
|
||||
|
||||
g_debug ("Adding GPG keyfile dir %s to verifier", path);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
struct dirent *dent;
|
||||
|
||||
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dfd_iter, &dent,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (dent == NULL)
|
||||
break;
|
||||
|
||||
if (dent->d_type != DT_REG)
|
||||
continue;
|
||||
|
||||
/* TODO: Potentially open the files here and have the GPG verifier iterate
|
||||
over the fds. See https://github.com/ostreedev/ostree/pull/1773#discussion_r235421900. */
|
||||
g_autofree char *iter_path = g_build_filename (path, dent->d_name, NULL);
|
||||
|
||||
_ostree_gpg_verifier_add_key_ascii_file (self, iter_path);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_gpg_verifier_add_keyring_dir (OstreeGpgVerifier *self,
|
||||
GFile *path,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
|
||||
{
|
||||
return _ostree_gpg_verifier_add_keyring_dir_at (self, AT_FDCWD,
|
||||
gs_file_get_path_cached (path),
|
||||
@@ -322,7 +392,6 @@ _ostree_gpg_verifier_add_keyring_dir_at (OstreeGpgVerifier *self,
|
||||
const char *path,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
|
||||
{
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
if (!glnx_dirfd_iterator_init_at (dfd, path, FALSE,
|
||||
|
||||
@@ -75,4 +75,17 @@ void _ostree_gpg_verifier_add_keyring_file (OstreeGpgVerifier *self,
|
||||
void _ostree_gpg_verifier_add_key_ascii_file (OstreeGpgVerifier *self,
|
||||
const char *path);
|
||||
|
||||
gboolean
|
||||
_ostree_gpg_verifier_add_keyfile_path (OstreeGpgVerifier *self,
|
||||
const char *path,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
_ostree_gpg_verifier_add_keyfile_dir_at (OstreeGpgVerifier *self,
|
||||
int dfd,
|
||||
const char *path,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -33,23 +33,14 @@ static char *
|
||||
split_keyeq (char *arg)
|
||||
{
|
||||
char *eq;
|
||||
|
||||
|
||||
eq = strchr (arg, '=');
|
||||
if (eq)
|
||||
{
|
||||
/* Note key/val are in one malloc block,
|
||||
* so we don't free val...
|
||||
*/
|
||||
*eq = '\0';
|
||||
return eq+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ...and this allows us to insert a constant
|
||||
* string.
|
||||
*/
|
||||
return "";
|
||||
}
|
||||
if (eq == NULL)
|
||||
return NULL;
|
||||
|
||||
// Note: key/val are in a single allocation block, so we don't free val.
|
||||
*eq = '\0';
|
||||
return eq+1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -264,8 +255,10 @@ _ostree_kernel_args_to_strv (OstreeKernelArgs *kargs)
|
||||
for (j = 0; j < values->len; j++)
|
||||
{
|
||||
const char *value = values->pdata[j];
|
||||
|
||||
g_ptr_array_add (strv, g_strconcat (key, "=", value, NULL));
|
||||
if (value == NULL)
|
||||
g_ptr_array_add (strv, g_strconcat (key, NULL));
|
||||
else
|
||||
g_ptr_array_add (strv, g_strconcat (key, "=", value, NULL));
|
||||
}
|
||||
}
|
||||
g_ptr_array_add (strv, NULL);
|
||||
@@ -297,14 +290,12 @@ _ostree_kernel_args_to_string (OstreeKernelArgs *kargs)
|
||||
else
|
||||
g_string_append_c (buf, ' ');
|
||||
|
||||
if (value && *value)
|
||||
g_string_append (buf, key);
|
||||
if (value != NULL)
|
||||
{
|
||||
g_string_append (buf, key);
|
||||
g_string_append_c (buf, '=');
|
||||
g_string_append (buf, value);
|
||||
}
|
||||
else
|
||||
g_string_append (buf, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "ostree-repo-private.h"
|
||||
|
||||
#define WHITEOUT_PREFIX ".wh."
|
||||
#define OPAQUE_WHITEOUT_NAME ".wh..wh..opq"
|
||||
|
||||
/* Per-checkout call state/caching */
|
||||
typedef struct {
|
||||
@@ -879,6 +880,7 @@ checkout_tree_at_recurse (OstreeRepo *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean did_exist = FALSE;
|
||||
gboolean is_opaque_whiteout = FALSE;
|
||||
const gboolean sepolicy_enabled = options->sepolicy && !self->disable_xattrs;
|
||||
g_autoptr(GVariant) dirtree = NULL;
|
||||
g_autoptr(GVariant) dirmeta = NULL;
|
||||
@@ -912,6 +914,22 @@ checkout_tree_at_recurse (OstreeRepo *self,
|
||||
return TRUE; /* Note early return */
|
||||
}
|
||||
|
||||
if (options->process_whiteouts)
|
||||
{
|
||||
g_autoptr(GVariant) dir_file_contents = g_variant_get_child_value (dirtree, 0);
|
||||
GVariantIter viter;
|
||||
const char *fname;
|
||||
g_autoptr(GVariant) contents_csum_v = NULL;
|
||||
g_variant_iter_init (&viter, dir_file_contents);
|
||||
while (g_variant_iter_loop (&viter, "(&s@ay)", &fname, &contents_csum_v))
|
||||
{
|
||||
is_opaque_whiteout = (g_str_equal (fname, OPAQUE_WHITEOUT_NAME));
|
||||
if (is_opaque_whiteout)
|
||||
break;
|
||||
}
|
||||
contents_csum_v = NULL; /* iter_loop freed it */
|
||||
}
|
||||
|
||||
/* First, make the directory. Push a new scope in case we end up using
|
||||
* setfscreatecon().
|
||||
*/
|
||||
@@ -931,6 +949,13 @@ checkout_tree_at_recurse (OstreeRepo *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If it is an opaque whiteout, ensure the destination is empty first. */
|
||||
if (is_opaque_whiteout)
|
||||
{
|
||||
if (!glnx_shutil_rm_rf_at (destination_parent_fd, destination_name, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Create initially with mode 0700, then chown/chmod only when we're
|
||||
* done. This avoids anyone else being able to operate on partially
|
||||
* constructed dirs.
|
||||
|
||||
@@ -1624,9 +1624,18 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
|
||||
self->txn.max_blocks = bfree - self->reserved_blocks;
|
||||
else
|
||||
{
|
||||
self->cleanup_stagedir = TRUE;
|
||||
g_mutex_unlock (&self->txn_lock);
|
||||
return throw_min_free_space_error (self, 0, error);
|
||||
self->txn.max_blocks = 0;
|
||||
/* Don't throw_min_free_space_error here; reason being that
|
||||
* this transaction could be just committing metadata objects
|
||||
* which are relatively small in size and we do not really
|
||||
* want to block them via min-free-space-* value. Metadata
|
||||
* objects helps in housekeeping and hence should be kept
|
||||
* out of the strict min-free-space values.
|
||||
*
|
||||
* The main drivers for writing content objects will always honor
|
||||
* the min-free-space value and throw_min_free_space_error in
|
||||
* case of overstepping the number of reserved blocks.
|
||||
*/
|
||||
}
|
||||
g_mutex_unlock (&self->txn_lock);
|
||||
|
||||
@@ -3338,6 +3347,9 @@ write_content_to_mtree_internal (OstreeRepo *self,
|
||||
if (!glnx_shutil_rm_rf_at (dfd_iter->fd, name, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
g_mutex_lock (&self->txn_lock);
|
||||
self->txn.stats.devino_cache_hits++;
|
||||
g_mutex_unlock (&self->txn_lock);
|
||||
return TRUE; /* Early return */
|
||||
}
|
||||
}
|
||||
@@ -3469,6 +3481,10 @@ write_content_to_mtree_internal (OstreeRepo *self,
|
||||
if (!ostree_mutable_tree_replace_file (mtree, name, loose_checksum,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
g_mutex_lock (&self->txn_lock);
|
||||
self->txn.stats.devino_cache_hits++;
|
||||
g_mutex_unlock (&self->txn_lock);
|
||||
}
|
||||
/* Next fast path - we can "adopt" the file */
|
||||
else if (can_adopt)
|
||||
@@ -4094,12 +4110,18 @@ import_is_bareuser_only_conversion (OstreeRepo *src_repo,
|
||||
&& objtype == OSTREE_OBJECT_TYPE_FILE;
|
||||
}
|
||||
|
||||
/* Returns TRUE if we can potentially just call link() to copy an object. */
|
||||
/* Returns TRUE if we can potentially just call link() to copy an object;
|
||||
* if untrusted the repos must be owned by the same uid.
|
||||
*/
|
||||
static gboolean
|
||||
import_via_reflink_is_possible (OstreeRepo *src_repo,
|
||||
OstreeRepo *dest_repo,
|
||||
OstreeObjectType objtype)
|
||||
OstreeObjectType objtype,
|
||||
gboolean trusted)
|
||||
{
|
||||
/* Untrusted pulls require matching ownership */
|
||||
if (!trusted && (src_repo->owner_uid != dest_repo->owner_uid))
|
||||
return FALSE;
|
||||
/* Equal modes are always compatible, and metadata
|
||||
* is identical between all modes.
|
||||
*/
|
||||
@@ -4160,13 +4182,6 @@ import_one_object_direct (OstreeRepo *dest_repo,
|
||||
char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
|
||||
_ostree_loose_path (loose_path_buf, checksum, objtype, dest_repo->mode);
|
||||
|
||||
if (!import_via_reflink_is_possible (src_repo, dest_repo, objtype))
|
||||
{
|
||||
/* If we can't reflink, nothing to do here */
|
||||
*out_was_supported = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* hardlinks require the owner to match and to be on the same device */
|
||||
const gboolean can_hardlink =
|
||||
src_repo->owner_uid == dest_repo->owner_uid &&
|
||||
@@ -4254,15 +4269,29 @@ import_one_object_direct (OstreeRepo *dest_repo,
|
||||
G_IN_SET (src_repo->mode, OSTREE_REPO_MODE_BARE, OSTREE_REPO_MODE_BARE_USER);
|
||||
if (src_is_bare_or_bare_user && !OSTREE_OBJECT_TYPE_IS_META(objtype))
|
||||
{
|
||||
g_autoptr(GVariant) xattrs = NULL;
|
||||
if (src_repo == OSTREE_REPO_MODE_BARE)
|
||||
{
|
||||
g_autoptr(GVariant) xattrs = NULL;
|
||||
if (!glnx_fd_get_all_xattrs (src_fd, &xattrs,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (!glnx_fd_set_all_xattrs (tmp_dest.fd, xattrs,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* bare-user; we just want ostree.usermeta */
|
||||
g_autoptr(GBytes) bytes =
|
||||
glnx_fgetxattr_bytes (src_fd, "user.ostreemeta", error);
|
||||
if (bytes == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!glnx_fd_get_all_xattrs (src_fd, &xattrs,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!glnx_fd_set_all_xattrs (tmp_dest.fd, xattrs,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (TEMP_FAILURE_RETRY (fsetxattr (src_fd, "user.ostreemeta",
|
||||
(char*)g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes), 0)) != 0)
|
||||
return glnx_throw_errno_prefix (error, "fsetxattr");
|
||||
}
|
||||
}
|
||||
|
||||
if (fchmod (tmp_dest.fd, stbuf.st_mode & ~S_IFMT) != 0)
|
||||
@@ -4318,7 +4347,7 @@ _ostree_repo_import_object (OstreeRepo *self,
|
||||
*/
|
||||
const gboolean is_bareuseronly_conversion =
|
||||
import_is_bareuser_only_conversion (source, self, objtype);
|
||||
gboolean try_direct = trusted;
|
||||
gboolean try_direct = TRUE;
|
||||
|
||||
/* If we need to do bareuseronly verification, or we're potentially doing a
|
||||
* bareuseronly conversion, let's verify those first so we don't complicate
|
||||
@@ -4358,11 +4387,20 @@ _ostree_repo_import_object (OstreeRepo *self,
|
||||
}
|
||||
}
|
||||
|
||||
/* We try to import via reflink/hardlink. If the remote is explicitly not trusted
|
||||
* (i.e.) their checksums may be incorrect, we skip that.
|
||||
*/
|
||||
if (try_direct)
|
||||
/* First, let's see if we can import via reflink/hardlink. */
|
||||
if (try_direct && import_via_reflink_is_possible (source, self, objtype, trusted))
|
||||
{
|
||||
/* For local repositories, if the untrusted flag is set, we verify the
|
||||
* checksum first. This assumes then that the files are immutable - the
|
||||
* above check verified that the owner uids match.
|
||||
*/
|
||||
if (!trusted)
|
||||
{
|
||||
if (!ostree_repo_fsck_object (source, objtype, checksum,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean direct_was_supported = FALSE;
|
||||
if (!import_one_object_direct (self, source, checksum, objtype,
|
||||
&direct_was_supported,
|
||||
|
||||
@@ -2948,9 +2948,14 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
|
||||
if (gzip)
|
||||
fetcher_flags |= OSTREE_FETCHER_FLAGS_TRANSFER_GZIP;
|
||||
|
||||
{ gboolean http2 = TRUE;
|
||||
{ gboolean http2_default = TRUE;
|
||||
#ifndef BUILDOPT_HTTP2
|
||||
http2_default = FALSE;
|
||||
#endif
|
||||
gboolean http2;
|
||||
|
||||
if (!ostree_repo_get_remote_boolean_option (self, remote_name,
|
||||
"http2", TRUE,
|
||||
"http2", http2_default,
|
||||
&http2, error))
|
||||
goto out;
|
||||
if (!http2)
|
||||
@@ -4643,6 +4648,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
g_clear_object (&pull_data->cancellable);
|
||||
g_clear_pointer (&pull_data->localcache_repos, (GDestroyNotify)g_ptr_array_unref);
|
||||
g_clear_object (&pull_data->remote_repo_local);
|
||||
g_free (pull_data->remote_refspec_name);
|
||||
g_free (pull_data->remote_name);
|
||||
g_free (pull_data->append_user_agent);
|
||||
g_clear_pointer (&pull_data->meta_mirrorlist, (GDestroyNotify) g_ptr_array_unref);
|
||||
|
||||
@@ -1002,7 +1002,7 @@ ostree_repo_remote_list_collection_refs (OstreeRepo *self,
|
||||
summary_collection_map = NULL;
|
||||
|
||||
while (summary_collection_map != NULL &&
|
||||
g_variant_iter_loop (summary_collection_map, "{s@a(s(taya{sv}))}", &summary_collection_id, &summary_refs))
|
||||
g_variant_iter_loop (summary_collection_map, "{&s@a(s(taya{sv}))}", &summary_collection_id, &summary_refs))
|
||||
{
|
||||
if (!remote_list_collection_refs_process_refs (self, remote_name,
|
||||
summary_collection_id, summary_refs,
|
||||
|
||||
@@ -4214,9 +4214,9 @@ ostree_repo_import_object_from (OstreeRepo *self,
|
||||
* @error: Error
|
||||
*
|
||||
* Copy object named by @objtype and @checksum into @self from the
|
||||
* source repository @source. If both repositories are of the same
|
||||
* type and on the same filesystem, this will simply be a fast Unix
|
||||
* hard link operation.
|
||||
* source repository @source. If @trusted is %TRUE and both
|
||||
* repositories are of the same type and on the same filesystem,
|
||||
* this will simply be a fast Unix hard link operation.
|
||||
*
|
||||
* Otherwise, a copy will be performed.
|
||||
*/
|
||||
@@ -5081,7 +5081,6 @@ _ostree_repo_gpg_verify_data_internal (OstreeRepo *self,
|
||||
}
|
||||
else if (remote_name != NULL)
|
||||
{
|
||||
g_autofree char *gpgkeypath = NULL;
|
||||
/* Add the remote's keyring file if it exists. */
|
||||
|
||||
g_autoptr(OstreeRemote) remote = NULL;
|
||||
@@ -5100,12 +5099,19 @@ _ostree_repo_gpg_verify_data_internal (OstreeRepo *self,
|
||||
add_global_keyring_dir = FALSE;
|
||||
}
|
||||
|
||||
if (!ot_keyfile_get_value_with_default (remote->options, remote->group, "gpgkeypath", NULL,
|
||||
&gpgkeypath, error))
|
||||
g_auto(GStrv) gpgkeypath_list = NULL;
|
||||
|
||||
if (!ot_keyfile_get_string_as_list (remote->options, remote->group, "gpgkeypath",
|
||||
";,", &gpgkeypath_list, error))
|
||||
return NULL;
|
||||
|
||||
if (gpgkeypath)
|
||||
_ostree_gpg_verifier_add_key_ascii_file (verifier, gpgkeypath);
|
||||
if (gpgkeypath_list)
|
||||
{
|
||||
for (char **iter = gpgkeypath_list; *iter != NULL; ++iter)
|
||||
if (!_ostree_gpg_verifier_add_keyfile_path (verifier, *iter,
|
||||
cancellable, error))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (add_global_keyring_dir)
|
||||
|
||||
@@ -291,8 +291,9 @@ struct _OstreeRepoTransactionStats {
|
||||
guint content_objects_total;
|
||||
guint content_objects_written;
|
||||
guint64 content_bytes_written;
|
||||
guint devino_cache_hits;
|
||||
|
||||
guint64 padding1;
|
||||
guint padding1;
|
||||
guint64 padding2;
|
||||
guint64 padding3;
|
||||
guint64 padding4;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_YEAR_VERSION (2018)
|
||||
#define OSTREE_YEAR_VERSION (2019)
|
||||
|
||||
/**
|
||||
* OSTREE_RELEASE_VERSION:
|
||||
@@ -43,7 +43,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_RELEASE_VERSION (9)
|
||||
#define OSTREE_RELEASE_VERSION (1)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION
|
||||
@@ -52,7 +52,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION (2018.9)
|
||||
#define OSTREE_VERSION (2019.1)
|
||||
|
||||
/**
|
||||
* OSTREE_VERSION_S:
|
||||
@@ -62,7 +62,7 @@
|
||||
*
|
||||
* Since: 2017.4
|
||||
*/
|
||||
#define OSTREE_VERSION_S "2018.9"
|
||||
#define OSTREE_VERSION_S "2019.1"
|
||||
|
||||
#define OSTREE_ENCODE_VERSION(year,release) \
|
||||
((year) << 16 | (release))
|
||||
|
||||
@@ -101,6 +101,107 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read the value of key as a string. If the value string contains
|
||||
* one of the separators and none of the others, read the
|
||||
* string as a NULL-terminated array out_value. If the value string contains
|
||||
* none of the separators, read the string as a single entry into a
|
||||
* NULL-terminated array out_value. If the value string contains multiple of
|
||||
* the separators, an error is given.
|
||||
* Returns TRUE on success, FALSE on error. */
|
||||
gboolean
|
||||
ot_keyfile_get_string_as_list (GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
const char *separators,
|
||||
char ***out_value,
|
||||
GError **error)
|
||||
{
|
||||
guint sep_count = 0;
|
||||
gchar sep = '\0';
|
||||
g_autofree char *value_str = NULL;
|
||||
g_autofree char **value_list = NULL;
|
||||
|
||||
g_return_val_if_fail (keyfile != NULL, FALSE);
|
||||
g_return_val_if_fail (section != NULL, FALSE);
|
||||
g_return_val_if_fail (key != NULL, FALSE);
|
||||
g_return_val_if_fail (separators != NULL, FALSE);
|
||||
|
||||
if (!ot_keyfile_get_value_with_default (keyfile, section, key, NULL,
|
||||
&value_str, error))
|
||||
return FALSE;
|
||||
|
||||
if (value_str)
|
||||
{
|
||||
for (size_t i = 0; i < strlen (separators) && sep_count <= 1; i++)
|
||||
{
|
||||
if (strchr (value_str, separators[i]))
|
||||
{
|
||||
sep_count++;
|
||||
sep = separators[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (sep_count == 0)
|
||||
{
|
||||
value_list = g_new (gchar *, 2);
|
||||
value_list[0] = g_steal_pointer (&value_str);
|
||||
value_list[1] = NULL;
|
||||
}
|
||||
else if (sep_count == 1)
|
||||
{
|
||||
if (!ot_keyfile_get_string_list_with_default (keyfile, section, key,
|
||||
sep, NULL, &value_list, error))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return glnx_throw (error, "key value list contains more than one separator");
|
||||
}
|
||||
}
|
||||
|
||||
ot_transfer_out_value (out_value, &value_list);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ot_keyfile_get_string_list_with_default (GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
char separator,
|
||||
char **default_value,
|
||||
char ***out_value,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GError) temp_error = NULL;
|
||||
|
||||
g_return_val_if_fail (keyfile != NULL, FALSE);
|
||||
g_return_val_if_fail (section != NULL, FALSE);
|
||||
g_return_val_if_fail (key != NULL, FALSE);
|
||||
|
||||
g_key_file_set_list_separator (keyfile, separator);
|
||||
|
||||
g_autofree char **ret_value = g_key_file_get_string_list (keyfile, section,
|
||||
key, NULL, &temp_error);
|
||||
|
||||
if (temp_error)
|
||||
{
|
||||
if (g_error_matches (temp_error, G_KEY_FILE_ERROR,
|
||||
G_KEY_FILE_ERROR_KEY_NOT_FOUND))
|
||||
{
|
||||
g_clear_error (&temp_error);
|
||||
ret_value = default_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_propagate_error (error, g_steal_pointer (&temp_error));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ot_transfer_out_value (out_value, &ret_value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ot_keyfile_copy_group (GKeyFile *source_keyfile,
|
||||
GKeyFile *target_keyfile,
|
||||
|
||||
@@ -44,6 +44,23 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile,
|
||||
char **out_value,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
ot_keyfile_get_string_as_list (GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
const char *separators,
|
||||
char ***out_value_list,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
ot_keyfile_get_string_list_with_default (GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
char separator,
|
||||
char **default_value,
|
||||
char ***out_value,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
ot_keyfile_copy_group (GKeyFile *source_keyfile,
|
||||
GKeyFile *target_keyfile,
|
||||
|
||||
@@ -141,10 +141,11 @@ deployment_print_status (OstreeSysroot *sysroot,
|
||||
g_autoptr(GString) output_buffer = g_string_sized_new (256);
|
||||
/* Print any digital signatures on this commit. */
|
||||
|
||||
const char *osname = ostree_deployment_get_osname (deployment);
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
g_autoptr(OstreeGpgVerifyResult) result =
|
||||
ostree_repo_verify_commit_ext (repo, ref, NULL, NULL,
|
||||
cancellable, &local_error);
|
||||
ostree_repo_verify_commit_for_remote (repo, ref, osname,
|
||||
cancellable, &local_error);
|
||||
|
||||
/* G_IO_ERROR_NOT_FOUND just means the commit is not signed. */
|
||||
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
|
||||
@@ -835,6 +835,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
|
||||
g_print ("Metadata Written: %u\n", stats.metadata_objects_written);
|
||||
g_print ("Content Total: %u\n", stats.content_objects_total);
|
||||
g_print ("Content Written: %u\n", stats.content_objects_written);
|
||||
g_print ("Content Cache Hits: %u\n", stats.devino_cache_hits);
|
||||
g_print ("Content Bytes Written: %" G_GUINT64_FORMAT "\n", stats.content_bytes_written);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "otutil.h"
|
||||
|
||||
static char *opt_remote;
|
||||
static gboolean opt_commit_only;
|
||||
static gboolean opt_disable_fsync;
|
||||
static gboolean opt_untrusted;
|
||||
static gboolean opt_bareuseronly_files;
|
||||
@@ -46,6 +47,7 @@ static int opt_depth = 0;
|
||||
*/
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ "commit-metadata-only", 0, 0, G_OPTION_ARG_NONE, &opt_commit_only, "Fetch only the commit metadata", NULL },
|
||||
{ "remote", 0, 0, G_OPTION_ARG_STRING, &opt_remote, "Add REMOTE to refspec", "REMOTE" },
|
||||
{ "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
|
||||
{ "untrusted", 0, 0, G_OPTION_ARG_NONE, &opt_untrusted, "Verify checksums of local sources (always enabled for HTTP pulls)", NULL },
|
||||
@@ -110,6 +112,8 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc
|
||||
pullflags |= OSTREE_REPO_PULL_FLAGS_UNTRUSTED;
|
||||
if (opt_bareuseronly_files)
|
||||
pullflags |= OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES;
|
||||
if (opt_commit_only)
|
||||
pullflags |= OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY;
|
||||
|
||||
if (opt_disable_fsync)
|
||||
ostree_repo_set_disable_fsync (repo, TRUE);
|
||||
|
||||
@@ -66,7 +66,7 @@ static GOptionEntry options[] = {
|
||||
{ "bareuseronly-files", 0, 0, G_OPTION_ARG_NONE, &opt_bareuseronly_files, "Reject regular files with mode outside of 0775 (world writable, suid, etc.)", NULL },
|
||||
{ "dry-run", 0, 0, G_OPTION_ARG_NONE, &opt_dry_run, "Only print information on what will be downloaded (requires static deltas)", NULL },
|
||||
{ "depth", 0, 0, G_OPTION_ARG_INT, &opt_depth, "Traverse DEPTH parents (-1=infinite) (default: 0)", "DEPTH" },
|
||||
{ "url", 0, 0, G_OPTION_ARG_STRING, &opt_url, "Pull objects from this URL instead of the one from the remote config", NULL },
|
||||
{ "url", 0, 0, G_OPTION_ARG_STRING, &opt_url, "Pull objects from this URL instead of the one from the remote config", "URL" },
|
||||
{ "http-header", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_http_headers, "Add NAME=VALUE as HTTP header to all requests", "NAME=VALUE" },
|
||||
{ "update-frequency", 0, 0, G_OPTION_ARG_INT, &opt_frequency, "Sets the update frequency, in milliseconds (0=1000ms) (default: 0)", "FREQUENCY" },
|
||||
{ "network-retries", 0, 0, G_OPTION_ARG_INT, &opt_network_retries, "Specifies how many times each download should be retried upon error (default: 5)", "N"},
|
||||
|
||||
@@ -221,6 +221,9 @@ static gboolean do_ref (OstreeRepo *repo, const char *refspec_prefix, GCancellab
|
||||
{
|
||||
if (remote)
|
||||
return glnx_throw (error, "Cannot create alias to remote ref: %s", remote);
|
||||
if (!g_hash_table_contains (refs, refspec_prefix))
|
||||
return glnx_throw (error, "Cannot create alias to non-existent ref: %s",
|
||||
refspec_prefix);
|
||||
if (!ostree_repo_set_alias_ref_immediate (repo, remote, ref, refspec_prefix,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
@@ -354,7 +354,7 @@ ostree_option_context_parse (GOptionContext *context,
|
||||
* possible to parse */
|
||||
g_auto(GStrv) features = g_strsplit (OSTREE_FEATURES, " ", -1);
|
||||
g_print ("%s:\n", PACKAGE_NAME);
|
||||
g_print (" Version: %s\n", PACKAGE_VERSION);
|
||||
g_print (" Version: '%s'\n", PACKAGE_VERSION);
|
||||
if (strlen (OSTREE_GITREV) > 0)
|
||||
g_print (" Git: %s\n", OSTREE_GITREV);
|
||||
#ifdef BUILDOPT_IS_DEVEL_BUILD
|
||||
|
||||
Reference in new issue
Block a user