Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile-decls.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ gsettings_SCHEMAS =
# git.mk
GITIGNOREFILES =

# This initializes some more variables
include $(top_srcdir)/buildutil/glib-tap.mk

# This is a special facility to chain together hooks easily
INSTALL_DATA_HOOKS =
install-data-hook: $(INSTALL_DATA_HOOKS)
2 changes: 0 additions & 2 deletions Makefile-tests.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include $(top_srcdir)/buildutil/glib-tap.mk

BASE_TESTS_ENVIRONMENT = \
builddir=$(abs_builddir) \
topsrcdir=$(abs_top_srcdir) \
Expand Down
2 changes: 1 addition & 1 deletion libglnx
Submodule libglnx updated from abd37a to 602fdd
70 changes: 17 additions & 53 deletions src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,6 @@ enable_one_repo (GPtrArray *sources,
const char *reponame,
GError **error)
{
gboolean ret = FALSE;
gboolean found = FALSE;

for (guint i = 0; i < sources->len; i++)
{
DnfRepo *src = sources->pdata[i];
Expand All @@ -540,48 +537,31 @@ enable_one_repo (GPtrArray *sources,
continue;

dnf_repo_set_enabled (src, DNF_REPO_ENABLED_PACKAGES);
found = TRUE;
break;
}

if (!found)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Unknown rpm-md repository: %s", reponame);
goto out;
return TRUE;
}

ret = TRUE;
out:
return ret;
return glnx_throw (error, "Unknown rpm-md repository: %s", reponame);
}

static gboolean
context_repos_enable_only (RpmOstreeContext *context,
const char *const *enabled_repos,
GError **error)
{
gboolean ret = FALSE;
guint i;
const char *const *iter;
GPtrArray *sources;

sources = dnf_context_get_repos (context->hifctx);
for (i = 0; i < sources->len; i++)
GPtrArray *sources = dnf_context_get_repos (context->hifctx);
for (guint i = 0; i < sources->len; i++)
{
DnfRepo *src = sources->pdata[i];
dnf_repo_set_enabled (src, DNF_REPO_ENABLED_NONE);
}

for (iter = enabled_repos; iter && *iter; iter++)
for (const char *const *iter = enabled_repos; iter && *iter; iter++)
{
if (!enable_one_repo (sources, *iter, error))
goto out;
return FALSE;
}

ret = TRUE;
out:
return ret;
return TRUE;
}

gboolean
Expand All @@ -592,7 +572,6 @@ rpmostree_context_setup (RpmOstreeContext *self,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
GPtrArray *repos = NULL;
g_autofree char **enabled_repos = NULL;
g_autofree char **instlangs = NULL;
Expand All @@ -607,7 +586,7 @@ rpmostree_context_setup (RpmOstreeContext *self,
if (!rpmostree_mkdtemp ("/tmp/rpmostree-dummy-instroot-XXXXXX",
&self->dummy_instroot_path,
&dfd, error))
goto out;
return FALSE;
dnf_context_set_install_root (self->hifctx, self->dummy_instroot_path);
}

Expand Down Expand Up @@ -635,30 +614,26 @@ rpmostree_context_setup (RpmOstreeContext *self,
}

if (!dnf_context_setup (self->hifctx, cancellable, error))
goto out;
return FALSE;

/* This is what we use as default. */
set_rpm_macro_define ("_dbpath", "/usr/share/rpm");

/* NB: missing repo --> let hif figure it out for itself */
if (g_variant_dict_lookup (self->spec->dict, "repos", "^a&s", &enabled_repos))
if (!context_repos_enable_only (self, (const char *const*)enabled_repos, error))
goto out;
return FALSE;

repos = dnf_context_get_repos (self->hifctx);
if (repos->len == 0)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"No enabled repositories");
goto out;
}
return glnx_throw (error, "No enabled repositories");

require_enabled_repos (repos);

{ gboolean docs;

g_variant_dict_lookup (self->spec->dict, "documentation", "b", &docs);

if (!docs)
dnf_transaction_set_flags (dnf_context_get_transaction (self->hifctx),
DNF_TRANSACTION_FLAG_NODOCS);
Expand All @@ -670,14 +645,12 @@ rpmostree_context_setup (RpmOstreeContext *self,
g_autoptr(GHashTable) ignore_hash = NULL;

if (!rpmostree_script_ignore_hash_from_strv (ignore_scripts, &ignore_hash, error))
goto out;
return FALSE;
rpmostree_context_set_ignore_scripts (self, ignore_hash);
}
}

ret = TRUE;
out:
return ret;
return TRUE;
}


Expand Down Expand Up @@ -756,10 +729,7 @@ checkout_pkg_metadata (RpmOstreeContext *self,
return TRUE;

if (errno != ENOENT)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return glnx_throw_errno (error);

return glnx_file_replace_contents_at (self->metadata_dir_fd, path,
g_variant_get_data (header),
Expand Down Expand Up @@ -873,11 +843,7 @@ rpmostree_pkgcache_find_pkg_header (OstreeRepo *pkgcache,
return FALSE;

if (!g_str_equal (expected_sha256, actual_sha256))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Checksum mismatch for package %s", nevra);
return FALSE;
}
return glnx_throw (error, "Checksum mismatch for package %s", nevra);
}

if (!get_header_variant (pkgcache, ref, &header, cancellable, error))
Expand All @@ -887,9 +853,7 @@ rpmostree_pkgcache_find_pkg_header (OstreeRepo *pkgcache,
return TRUE;
}

g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to find cached pkg for %s", nevra);
return FALSE;
return glnx_throw (error, "Failed to find cached pkg for %s", nevra);
}

static gboolean
Expand Down