core/scripts: Drop support for ignore-scripts
This was a transient hack that I don't think we need any longer. Since then we've now committed to e.g. ignoring `%pretrans` etc., and we also have the hardcoded blacklist. It never really worked in a complete sense since one would have to re-specify the ignore on every operation, which was not sustainable. Closes: #873 Approved by: jlebon
This commit is contained in:
parent
7a1dd234a3
commit
325ee354e9
@ -176,7 +176,6 @@ rpmostree_treespec_new_from_keyfile (GKeyFile *keyfile,
|
||||
add_canonicalized_string_array (&builder, "repos", NULL, keyfile);
|
||||
}
|
||||
add_canonicalized_string_array (&builder, "instlangs", "instlangs-all", keyfile);
|
||||
add_canonicalized_string_array (&builder, "ignore-scripts", NULL, keyfile);
|
||||
|
||||
{ gboolean documentation = TRUE;
|
||||
g_autofree char *value = g_key_file_get_value (keyfile, "tree", "documentation", NULL);
|
||||
@ -236,7 +235,6 @@ struct _RpmOstreeContext {
|
||||
RpmOstreeTreespec *spec;
|
||||
gboolean empty;
|
||||
DnfContext *hifctx;
|
||||
GHashTable *ignore_scripts;
|
||||
OstreeRepo *ostreerepo;
|
||||
OstreeRepo *pkgcache_repo;
|
||||
gboolean unprivileged;
|
||||
@ -264,8 +262,6 @@ rpmostree_context_finalize (GObject *object)
|
||||
g_clear_object (&rctx->spec);
|
||||
g_clear_object (&rctx->hifctx);
|
||||
|
||||
g_clear_pointer (&rctx->ignore_scripts, g_hash_table_unref);
|
||||
|
||||
g_clear_object (&rctx->pkgcache_repo);
|
||||
g_clear_object (&rctx->ostreerepo);
|
||||
|
||||
@ -478,15 +474,6 @@ rpmostree_context_set_passwd_dir (RpmOstreeContext *self,
|
||||
self->passwd_dir = g_strdup (passwd_dir);
|
||||
}
|
||||
|
||||
void
|
||||
rpmostree_context_set_ignore_scripts (RpmOstreeContext *self,
|
||||
GHashTable *ignore_scripts)
|
||||
{
|
||||
g_clear_pointer (&self->ignore_scripts, g_hash_table_unref);
|
||||
if (ignore_scripts)
|
||||
self->ignore_scripts = g_hash_table_ref (ignore_scripts);
|
||||
}
|
||||
|
||||
DnfContext *
|
||||
rpmostree_context_get_hif (RpmOstreeContext *self)
|
||||
{
|
||||
@ -629,16 +616,9 @@ rpmostree_context_setup (RpmOstreeContext *self,
|
||||
DNF_TRANSACTION_FLAG_NODOCS);
|
||||
}
|
||||
|
||||
{ const char *const *ignore_scripts = NULL;
|
||||
if (g_variant_dict_lookup (self->spec->dict, "ignore-scripts", "^a&s", &ignore_scripts))
|
||||
{
|
||||
g_autoptr(GHashTable) ignore_hash = NULL;
|
||||
|
||||
if (!rpmostree_script_ignore_hash_from_strv (ignore_scripts, &ignore_hash, error))
|
||||
return FALSE;
|
||||
rpmostree_context_set_ignore_scripts (self, ignore_hash);
|
||||
}
|
||||
}
|
||||
/* We could likely delete this, but I'm keeping a log message just in case */
|
||||
if (g_variant_dict_contains (self->spec->dict, "ignore-scripts"))
|
||||
sd_journal_print (LOG_INFO, "ignore-scripts is no longer supported");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -2409,7 +2389,6 @@ rpmts_add_install (RpmOstreeContext *self,
|
||||
DnfPackage *pkg,
|
||||
gboolean is_upgrade,
|
||||
gboolean noscripts,
|
||||
GHashTable *ignore_scripts,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@ -2421,7 +2400,7 @@ rpmts_add_install (RpmOstreeContext *self,
|
||||
|
||||
if (!noscripts)
|
||||
{
|
||||
if (!rpmostree_script_txn_validate (pkg, hdr, ignore_scripts, cancellable, error))
|
||||
if (!rpmostree_script_txn_validate (pkg, hdr, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2464,7 +2443,7 @@ run_posttrans_sync (RpmOstreeContext *self,
|
||||
if (!get_package_metainfo (self, path, &hdr, NULL, error))
|
||||
return FALSE;
|
||||
|
||||
if (!rpmostree_posttrans_run_sync (pkg, hdr, self->ignore_scripts, rootfs_dfd,
|
||||
if (!rpmostree_posttrans_run_sync (pkg, hdr, rootfs_dfd,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
@ -2484,8 +2463,7 @@ run_pre_sync (RpmOstreeContext *self,
|
||||
if (!get_package_metainfo (self, path, &hdr, NULL, error))
|
||||
return FALSE;
|
||||
|
||||
if (!rpmostree_pre_run_sync (pkg, hdr, self->ignore_scripts,
|
||||
rootfs_dfd, cancellable, error))
|
||||
if (!rpmostree_pre_run_sync (pkg, hdr, rootfs_dfd, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
@ -2700,7 +2678,7 @@ add_install (RpmOstreeContext *self,
|
||||
if (!checkout_pkg_metadata_by_dnfpkg (self, pkg, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!rpmts_add_install (self, ts, pkg, is_upgrade, noscripts, self->ignore_scripts,
|
||||
if (!rpmts_add_install (self, ts, pkg, is_upgrade, noscripts,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
@ -3040,7 +3018,7 @@ rpmostree_context_assemble_tmprootfs (RpmOstreeContext *self,
|
||||
DnfPackage *pkg = overlays->pdata[i];
|
||||
|
||||
/* Set noscripts since we already validated them above */
|
||||
if (!rpmts_add_install (self, rpmdb_ts, pkg, FALSE, TRUE, NULL, cancellable, error))
|
||||
if (!rpmts_add_install (self, rpmdb_ts, pkg, FALSE, TRUE, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -3049,7 +3027,7 @@ rpmostree_context_assemble_tmprootfs (RpmOstreeContext *self,
|
||||
DnfPackage *pkg = overrides_replace->pdata[i];
|
||||
|
||||
/* Set noscripts since we already validated them above */
|
||||
if (!rpmts_add_install (self, rpmdb_ts, pkg, TRUE, TRUE, NULL, cancellable, error))
|
||||
if (!rpmts_add_install (self, rpmdb_ts, pkg, TRUE, TRUE, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,6 @@ void rpmostree_context_set_sepolicy (RpmOstreeContext *self,
|
||||
OstreeSePolicy *sepolicy);
|
||||
void rpmostree_context_set_passwd_dir (RpmOstreeContext *self,
|
||||
const char *passwd_dir);
|
||||
void rpmostree_context_set_ignore_scripts (RpmOstreeContext *self,
|
||||
GHashTable *ignore_scripts);
|
||||
|
||||
void rpmostree_dnf_add_checksum_goal (GChecksum *checksum, HyGoal goal);
|
||||
char *rpmostree_context_get_state_sha512 (RpmOstreeContext *self);
|
||||
|
@ -84,13 +84,10 @@ static const KnownRpmScriptKind unsupported_scripts[] = {
|
||||
|
||||
static RpmOstreeScriptAction
|
||||
lookup_script_action (DnfPackage *package,
|
||||
GHashTable *ignored_scripts,
|
||||
const char *scriptdesc)
|
||||
{
|
||||
const char *pkg_script = glnx_strjoina (dnf_package_get_name (package), ".", scriptdesc+1);
|
||||
const struct RpmOstreePackageScriptHandler *handler = rpmostree_script_gperf_lookup (pkg_script, strlen (pkg_script));
|
||||
if (ignored_scripts && g_hash_table_contains (ignored_scripts, pkg_script))
|
||||
return RPMOSTREE_SCRIPT_ACTION_IGNORE;
|
||||
if (!handler)
|
||||
return RPMOSTREE_SCRIPT_ACTION_DEFAULT;
|
||||
return handler->action;
|
||||
@ -99,7 +96,6 @@ lookup_script_action (DnfPackage *package,
|
||||
gboolean
|
||||
rpmostree_script_txn_validate (DnfPackage *package,
|
||||
Header hdr,
|
||||
GHashTable *override_ignored_scripts,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@ -112,7 +108,7 @@ rpmostree_script_txn_validate (DnfPackage *package,
|
||||
if (!(headerIsEntry (hdr, tagval) || headerIsEntry (hdr, progtagval)))
|
||||
continue;
|
||||
|
||||
RpmOstreeScriptAction action = lookup_script_action (package, override_ignored_scripts, desc);
|
||||
RpmOstreeScriptAction action = lookup_script_action (package, desc);
|
||||
switch (action)
|
||||
{
|
||||
case RPMOSTREE_SCRIPT_ACTION_DEFAULT:
|
||||
@ -217,7 +213,6 @@ static gboolean
|
||||
run_known_rpm_script (const KnownRpmScriptKind *rpmscript,
|
||||
DnfPackage *pkg,
|
||||
Header hdr,
|
||||
GHashTable *ignore_scripts,
|
||||
int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@ -238,7 +233,7 @@ run_known_rpm_script (const KnownRpmScriptKind *rpmscript,
|
||||
args = td.data;
|
||||
|
||||
const char *desc = rpmscript->desc;
|
||||
RpmOstreeScriptAction action = lookup_script_action (pkg, ignore_scripts, desc);
|
||||
RpmOstreeScriptAction action = lookup_script_action (pkg, desc);
|
||||
switch (action)
|
||||
{
|
||||
case RPMOSTREE_SCRIPT_ACTION_DEFAULT:
|
||||
@ -291,14 +286,13 @@ run_known_rpm_script (const KnownRpmScriptKind *rpmscript,
|
||||
gboolean
|
||||
rpmostree_posttrans_run_sync (DnfPackage *pkg,
|
||||
Header hdr,
|
||||
GHashTable *ignore_scripts,
|
||||
int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS (posttrans_scripts); i++)
|
||||
{
|
||||
if (!run_known_rpm_script (&posttrans_scripts[i], pkg, hdr, ignore_scripts,
|
||||
if (!run_known_rpm_script (&posttrans_scripts[i], pkg, hdr,
|
||||
rootfs_fd, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
@ -309,35 +303,16 @@ rpmostree_posttrans_run_sync (DnfPackage *pkg,
|
||||
gboolean
|
||||
rpmostree_pre_run_sync (DnfPackage *pkg,
|
||||
Header hdr,
|
||||
GHashTable *ignore_scripts,
|
||||
int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS (pre_scripts); i++)
|
||||
{
|
||||
if (!run_known_rpm_script (&pre_scripts[i], pkg, hdr, ignore_scripts,
|
||||
if (!run_known_rpm_script (&pre_scripts[i], pkg, hdr,
|
||||
rootfs_fd, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
rpmostree_script_ignore_hash_from_strv (const char *const *strv,
|
||||
GHashTable **out_hash,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GHashTable) ignore_scripts = NULL;
|
||||
if (!strv)
|
||||
{
|
||||
*out_hash = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
ignore_scripts = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
for (const char *const* iter = strv; iter && *iter; iter++)
|
||||
g_hash_table_add (ignore_scripts, g_strdup (*iter));
|
||||
*out_hash = g_steal_pointer (&ignore_scripts);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -45,21 +45,15 @@ struct RpmOstreePackageScriptHandler {
|
||||
|
||||
const struct RpmOstreePackageScriptHandler* rpmostree_script_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
||||
|
||||
gboolean rpmostree_script_ignore_hash_from_strv (const char *const *strv,
|
||||
GHashTable **out_hash,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
rpmostree_script_txn_validate (DnfPackage *package,
|
||||
Header hdr,
|
||||
GHashTable *ignore_scripts,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
rpmostree_posttrans_run_sync (DnfPackage *pkg,
|
||||
Header hdr,
|
||||
GHashTable *ignore_scripts,
|
||||
int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
@ -67,7 +61,6 @@ rpmostree_posttrans_run_sync (DnfPackage *pkg,
|
||||
gboolean
|
||||
rpmostree_pre_run_sync (DnfPackage *pkg,
|
||||
Header hdr,
|
||||
GHashTable *ignore_scripts,
|
||||
int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
Loading…
Reference in New Issue
Block a user