diff --git a/configure.ac b/configure.ac index 6102befaa9..f9c253a08a 100644 --- a/configure.ac +++ b/configure.ac @@ -137,7 +137,6 @@ echo " $PACKAGE $VERSION introspection: $found_introspection - rojig: ${enable_rojig:-no} ASAN + UBSAN: ${enable_sanitizers:-no} gtk-doc: $enable_gtk_doc rust: $rust_debug_release diff --git a/rust/src/lib.rs b/rust/src/lib.rs index ae858223ad..611baec614 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -276,8 +276,6 @@ pub mod ffi { fn format_install_langs_macro(&self) -> String; fn get_lockfile_repos(&self) -> Vec; fn get_ref(&self) -> &str; - fn get_rojig_spec_path(&self) -> String; - fn get_rojig_name(&self) -> String; fn get_cliwrap(&self) -> bool; fn get_readonly_executables(&self) -> bool; fn get_documentation(&self) -> bool; diff --git a/rust/src/origin.rs b/rust/src/origin.rs index bd592b0713..9fe7eb0b33 100644 --- a/rust/src/origin.rs +++ b/rust/src/origin.rs @@ -15,7 +15,6 @@ use std::result::Result as StdResult; use std::collections::{BTreeMap, BTreeSet}; -const ROJIG_PREFIX: &str = "rojig://"; const ORIGIN: &str = "origin"; const OVERRIDE_COMMIT: &str = "override-commit"; @@ -23,7 +22,6 @@ const OVERRIDE_COMMIT: &str = "override-commit"; pub(crate) enum RefspecType { Checksum, Ostree, - Rojig, } #[derive(Clone, Debug, PartialEq, Eq)] @@ -37,9 +35,6 @@ struct Cache { override_commit: Option, #[allow(dead_code)] unconfigured_state: Option, - rojig_override_version: Option, - #[allow(dead_code)] - rojig_description: Option, packages: BTreeSet, packages_local: BTreeMap, @@ -135,14 +130,13 @@ impl Origin { fn new_parse(kf: &KeyFile) -> Result> { let kf = keyfile_dup(kf); - let rojig = keyfile_get_optional_string(&kf, "origin", "rojig")?; let refspec_str = if let Some(r) = keyfile_get_optional_string(&kf, "origin", "refspec")? { Some(r) } else { keyfile_get_optional_string(&kf, "origin", "baserefspec")? }; - let refspec = match (refspec_str, rojig) { - (Some(refspec), None) => { + let refspec = match refspec_str { + Some(refspec) => { if ostree::validate_checksum_string(&refspec).is_ok() { Refspec { kind: RefspecType::Checksum, @@ -155,12 +149,7 @@ impl Origin { } } }, - (None, Some(rojig)) => Refspec { - kind: RefspecType::Rojig, - value: rojig - }, - (None, None) => bail!("No origin/refspec, origin/rojig, or origin/baserefspec in current deployment origin; cannot handle via rpm-ostree"), - (Some(_), Some(_)) => bail!("Duplicate origin/refspec and origin/rojig in deployment origin"), + None => bail!("No origin/refspec, or origin/baserefspec in current deployment origin; cannot handle via rpm-ostree"), }; let override_commit = keyfile_get_optional_string(&kf, "origin", "override-commit")?; let unconfigured_state = keyfile_get_optional_string(&kf, "origin", "unconfigured-state")?; @@ -176,17 +165,12 @@ impl Origin { r }) .unwrap_or_default(); - let rojig_override_version = - keyfile_get_optional_string(&kf, ORIGIN, "rojig-override-version")?; - let rojig_description = keyfile_get_optional_string(&kf, ORIGIN, "rojig-description")?; Ok(Box::new(Self { kf, cache: Cache { refspec: refspec, override_commit, unconfigured_state, - rojig_override_version, - rojig_description, packages, packages_local, override_remove, @@ -233,30 +217,12 @@ impl Origin { } } - pub(crate) fn set_rojig_version(&mut self, version: Option<&str>) { - match version { - Some(version) => { - self.kf - .set_string(ORIGIN, "rojig-override-version", version); - self.cache.rojig_override_version = Some(version.to_string()); - } - None => { - let _ = self.kf.remove_key(ORIGIN, "rojig-override-version"); - self.cache.rojig_override_version = None; - } - } - } - pub(crate) fn get_refspec_type(&self) -> RefspecType { self.cache.refspec.kind } pub(crate) fn get_prefixed_refspec(&self) -> String { - let val = self.cache.refspec.value.as_str(); - match self.cache.refspec.kind { - RefspecType::Rojig => format!("{}{}", ROJIG_PREFIX, val), - _ => val.to_string(), - } + self.cache.refspec.value.as_str().to_string() } pub(crate) fn get_custom_url(&self) -> Result { @@ -275,15 +241,6 @@ impl Origin { ) } - pub(crate) fn get_rojig_description(&self) -> String { - // FIXME(cxx-rs) propagate Option once supported - self.cache - .rojig_description - .as_ref() - .map(String::from) - .unwrap_or_default() - } - pub(crate) fn get_regenerate_initramfs(&self) -> bool { match map_keyfile_optional(self.kf.get_boolean("rpmostree", "regenerate-initramfs")) { Ok(Some(v)) => v, @@ -309,10 +266,6 @@ impl Origin { || !self.cache.override_remove.is_empty() } - pub(crate) fn is_rojig(&self) -> bool { - self.cache.refspec.kind == RefspecType::Rojig - } - // Binding for cxx pub(crate) fn get_override_local_pkgs(&self) -> Vec { let mut r = Vec::new(); @@ -344,8 +297,6 @@ refspec=foo:bar/x86_64/baz assert!(!o.may_require_local_assembly()); assert!(!o.get_regenerate_initramfs()); assert!(o.get_initramfs_etc_files().is_empty()); - assert!(!o.is_rojig()); - assert_eq!(o.get_rojig_description(), ""); assert_eq!(o.get_custom_url()?, ""); assert_eq!(o.get_custom_description()?, ""); assert!(o.get_override_local_pkgs().is_empty()); @@ -354,7 +305,6 @@ refspec=foo:bar/x86_64/baz let mut o = o.duplicate(); assert_eq!(o.get_refspec_type(), RefspecType::Ostree); o.remove_transient_state(); - o.set_rojig_version(Some("42")); let mut o = Origin::new_from_str(indoc! {" [origin] diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index 386ec46081..06af5db4ef 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -66,9 +66,6 @@ pub struct Treefile { primary_dfd: openat::Dir, #[allow(dead_code)] // Not used in tests pub(crate) parsed: TreeComposeConfig, - // This is a copy of rojig.name to avoid needing to convert to CStr when reading - rojig_name: Option, - rojig_spec: Option, serialized: CUtf8Buf, pub(crate) externals: TreefileExternals, } @@ -484,20 +481,11 @@ impl Treefile { parsed.config = parsed.config.substitute_vars()?; Treefile::validate_config(&parsed.config)?; let dfd = openat::Dir::open(utils::parent_dir(filename).unwrap())?; - let (rojig_name, rojig_spec) = match (workdir.as_ref(), parsed.config.rojig.as_ref()) { - (Some(workdir), Some(rojig)) => ( - Some(rojig.name.clone()), - Some(Treefile::write_rojig_spec(workdir, rojig)?), - ), - _ => (None, None), - }; let serialized = Treefile::serialize_json_string(&parsed.config)?; Ok(Box::new(Treefile { primary_dfd: dfd, parsed: parsed.config, _workdir: workdir, - rojig_name, - rojig_spec, serialized, externals: parsed.externals, })) @@ -590,14 +578,6 @@ impl Treefile { self.parsed.treeref.as_deref().unwrap_or_default() } - pub(crate) fn get_rojig_spec_path(&self) -> String { - self.rojig_spec.clone().unwrap_or_default() - } - - pub(crate) fn get_rojig_name(&self) -> String { - self.rojig_name.clone().unwrap_or_default() - } - pub(crate) fn get_cliwrap(&self) -> bool { self.parsed.cliwrap.unwrap_or(false) } @@ -752,59 +732,6 @@ impl Treefile { Ok(hasher.get_string().expect("hash")) } - /// Generate a rojig spec file. - fn write_rojig_spec(workdir: &openat::Dir, r: &Rojig) -> CxxResult { - let description = r - .description - .as_ref() - .and_then(|v| { - if !v.is_empty() { - Some(v.as_str()) - } else { - None - } - }) - .unwrap_or_else(|| r.summary.as_str()); - let name: String = format!("{}.spec", r.name); - { - let mut f = workdir.write_file(name.as_str(), 0o644)?; - write!( - f, - r###" -# The canonical version of this is maintained by rpm-ostree. -# Suppress most build root processing we are just carrying -# binary data. -%global __os_install_post /usr/lib/rpm/brp-compress %{{nil}} -Name: {rpmostree_rojig_name} -Version: %{{ostree_version}} -Release: 1%{{?dist}} -Summary: {rpmostree_rojig_summary} -License: {rpmostree_rojig_license} -#@@@rpmostree_rojig_meta@@@ - -%description -{rpmostree_rojig_description} - -%prep - -%build - -%install -mkdir -p %{{buildroot}}%{{_prefix}}/lib/ostree-jigdo/%{{name}} -for x in *; do mv ${{x}} %{{buildroot}}%{{_prefix}}/lib/ostree-jigdo/%{{name}}; done - -%files -%{{_prefix}}/lib/ostree-jigdo/%{{name}} -"###, - rpmostree_rojig_name = r.name, - rpmostree_rojig_summary = r.summary, - rpmostree_rojig_license = r.license, - rpmostree_rojig_description = description, - )?; - } - Ok(name) - } - /// Perform sanity checks on externally provided input, such /// as the executability of `postprocess-script`. pub(crate) fn sanitycheck_externals(&self) -> Result<()> { @@ -1568,7 +1495,6 @@ pub(crate) mod tests { let workdir = tempfile::tempdir().unwrap(); let tf = new_test_treefile(workdir.path(), VALID_PRELUDE, None).unwrap(); assert!(tf.parsed.rojig.is_none()); - assert!(tf.rojig_spec.is_none()); assert!(tf.parsed.machineid_compat.is_none()); } @@ -1579,6 +1505,7 @@ pub(crate) mod tests { summary: "ExampleOS rojig base image" "#}; + // We need to support rojig: for a long time because it's used by fedora-coreos-config/coreos-assembler at least. #[test] fn test_treefile_new_rojig() { let workdir = tempfile::tempdir().unwrap(); @@ -1587,9 +1514,6 @@ pub(crate) mod tests { let tf = new_test_treefile(workdir.path(), buf.as_str(), None).unwrap(); let rojig = tf.parsed.rojig.as_ref().unwrap(); assert!(rojig.name == "exampleos"); - let rojig_spec_str = tf.rojig_spec.as_ref().unwrap().as_str(); - let rojig_spec = Path::new(rojig_spec_str); - assert!(rojig_spec.file_name().unwrap() == "exampleos.spec"); } #[test] diff --git a/src/app/rpmostree-builtin-rebase.cxx b/src/app/rpmostree-builtin-rebase.cxx index cf475b9bd7..dec46c64cd 100644 --- a/src/app/rpmostree-builtin-rebase.cxx +++ b/src/app/rpmostree-builtin-rebase.cxx @@ -142,10 +142,8 @@ rpmostree_builtin_rebase (int argc, RpmOstreeRefspecType refspectype; if (!rpmostree_refspec_classify (new_provided_refspec, &refspectype, &remainder, error)) return FALSE; - if (!opt_experimental && refspectype == RPMOSTREE_REFSPEC_TYPE_ROJIG) - return glnx_throw (error, "rojig:// refspec requires --experimental"); - /* catch "ostree://" or "rojig://"; we'd error out much later in the daemon otherwise */ + /* catch "ostree://"; we'd error out much later in the daemon otherwise */ if (strlen (remainder) == 0) return glnx_throw (error, "Refspec is empty"); diff --git a/src/app/rpmostree-builtin-status.cxx b/src/app/rpmostree-builtin-status.cxx index 9a6b0e7658..5c057a35f1 100644 --- a/src/app/rpmostree-builtin-status.cxx +++ b/src/app/rpmostree-builtin-status.cxx @@ -652,8 +652,6 @@ print_one_deployment (RPMOSTreeSysroot *sysroot_proxy, g_print ("%s", canonrefspec); } break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - g_assert_not_reached (); } } else diff --git a/src/app/rpmostree-compose-builtin-tree.cxx b/src/app/rpmostree-compose-builtin-tree.cxx index 2a075214da..7fec88089a 100644 --- a/src/app/rpmostree-compose-builtin-tree.cxx +++ b/src/app/rpmostree-compose-builtin-tree.cxx @@ -147,7 +147,6 @@ typedef struct { OstreeRepo *pkgcache_repo; /* unified mode: pkgcache repo where we import pkgs */ OstreeRepoDevInoCache *devino_cache; const char *ref; - char *rojig_spec; char *previous_checksum; std::optional> treefile_rs; @@ -295,8 +294,7 @@ install_packages (RpmOstreeTreeComposeContext *self, } /* By default, retain packages in addition to metadata with --cachedir, unless - * we're doing unified core, in which case the pkgcache repo is the cache. But - * the rojigSet build still requires the original RPMs too. + * we're doing unified core, in which case the pkgcache repo is the cache. */ if (opt_cachedir && !opt_unified_core) dnf_context_set_keep_cache (dnfctx, TRUE); @@ -448,9 +446,7 @@ install_packages (RpmOstreeTreeComposeContext *self, return FALSE; /* Now reload the policy from the tmproot, and relabel the pkgcache - this - * is the same thing done in rpmostree_context_commit(). But here we want - * to ensure our pkgcache labels are accurate, since that will - * be important for the ostree-rojig work. + * is the same thing done in rpmostree_context_commit(). */ g_autoptr(OstreeSePolicy) sepolicy = ostree_sepolicy_new_at (rootfs_dfd, cancellable, error); if (sepolicy == NULL) diff --git a/src/daemon/rpmostree-sysroot-core.cxx b/src/daemon/rpmostree-sysroot-core.cxx index 94bcfe1f49..cb514dd2cb 100644 --- a/src/daemon/rpmostree-sysroot-core.cxx +++ b/src/daemon/rpmostree-sysroot-core.cxx @@ -109,7 +109,6 @@ generate_baselayer_refs (OstreeSysroot *sysroot, */ static gboolean add_package_refs_to_set (RpmOstreeRefSack *rsack, - gboolean is_rojig, GHashTable *referenced_pkgs, GCancellable *cancellable, GError **error) @@ -128,8 +127,7 @@ add_package_refs_to_set (RpmOstreeRefSack *rsack, for (guint i = 0; i < pkglist->len; i++) { auto pkg = static_cast(pkglist->pdata[i]); - g_autofree char *pkgref = - is_rojig ? rpmostree_get_rojig_branch_pkg (pkg) : rpmostree_get_cache_branch_pkg (pkg); + g_autofree char *pkgref = rpmostree_get_cache_branch_pkg (pkg); g_hash_table_add (referenced_pkgs, util::move_nullify (pkgref)); } } @@ -156,7 +154,6 @@ generate_pkgcache_refs (OstreeSysroot *sysroot, for (guint i = 0; i < deployments->len; i++) { auto deployment = static_cast(deployments->pdata[i]); - const char *current_checksum = ostree_deployment_get_csum (deployment); g_autofree char *base_commit = NULL; if (!rpmostree_deployment_get_base_layer (repo, deployment, &base_commit, error)) @@ -185,23 +182,9 @@ generate_pkgcache_refs (OstreeSysroot *sysroot, if (rsack == NULL) return FALSE; - if (!add_package_refs_to_set (rsack, FALSE, referenced_pkgs, cancellable, error)) + if (!add_package_refs_to_set (rsack, referenced_pkgs, cancellable, error)) return glnx_prefix_error (error, "Deployment index=%d", i); } - /* In rojig mode, we need to also reference packages from the base; this - * is a different refspec format. - */ - if (rpmostree_origin_is_rojig (origin)) - { - const char *actual_base_commit = base_commit ?: current_checksum; - g_autoptr(RpmOstreeRefSack) base_rsack = - rpmostree_get_base_refsack_for_commit (repo, actual_base_commit, cancellable, error); - if (base_rsack == NULL) - return FALSE; - - if (!add_package_refs_to_set (base_rsack, TRUE, referenced_pkgs, cancellable, error)) - return FALSE; - } /* also add any inactive local replacements */ GHashTable *local_replace = rpmostree_origin_get_overrides_local_replace (origin); @@ -227,20 +210,6 @@ generate_pkgcache_refs (OstreeSysroot *sysroot, n_freed++; } - /* Loop over rojig refs */ - g_autoptr(GHashTable) rojig_refs = NULL; - if (!ostree_repo_list_refs_ext (repo, "rpmostree/rojig", &rojig_refs, - OSTREE_REPO_LIST_REFS_EXT_NONE, cancellable, error)) - return FALSE; - GLNX_HASH_TABLE_FOREACH (rojig_refs, const char*, ref) - { - if (g_hash_table_contains (referenced_pkgs, ref)) - continue; - - ostree_repo_transaction_set_ref (repo, NULL, ref, NULL); - n_freed++; - } - *out_n_freed = n_freed; return TRUE; } diff --git a/src/daemon/rpmostree-sysroot-upgrader.cxx b/src/daemon/rpmostree-sysroot-upgrader.cxx index 7f7c16b0c4..0803b92b34 100644 --- a/src/daemon/rpmostree-sysroot-upgrader.cxx +++ b/src/daemon/rpmostree-sysroot-upgrader.cxx @@ -52,7 +52,7 @@ * The #RpmOstreeSysrootUpgrader class models a `baserefspec` OSTree branch * in an origin file, along with a set of layered RPM packages. * - * It also supports the plain-ostree "refspec" model, as well as rojig://. + * It also supports the plain-ostree "refspec" model. */ typedef struct { GObjectClass parent_class; @@ -480,10 +480,6 @@ rpmostree_sysroot_upgrader_pull_base (RpmOstreeSysrootUpgrader *self, } } break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - { - return glnx_throw (error, "rojig is not supported in this build of rpm-ostree"); - } } gboolean changed = !g_str_equal (new_base_rev, self->base_revision); @@ -947,16 +943,6 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, cancellable, error)) return FALSE; - if (rpmostree_origin_is_rojig (self->origin)) - { - /* We don't want to re-check the metadata, we already did that for the - * base. In the future we should try to re-use the DnfContext. - */ - g_autoptr(DnfState) hifstate = dnf_state_new (); - if (!dnf_context_setup_sack (rpmostree_context_get_dnf (self->ctx), hifstate, error)) - return FALSE; - } - const gboolean have_packages = (self->overlay_packages->len > 0 || g_hash_table_size (local_pkgs) > 0 || self->override_remove_packages->len > 0 || diff --git a/src/daemon/rpmostreed-deployment-utils.cxx b/src/daemon/rpmostreed-deployment-utils.cxx index 1d4fa5dae6..8d86794e80 100644 --- a/src/daemon/rpmostreed-deployment-utils.cxx +++ b/src/daemon/rpmostreed-deployment-utils.cxx @@ -337,12 +337,6 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, } } break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - { - g_variant_dict_insert (dict, "rojig-description", "@a{sv}", - rpmostree_origin_get_rojig_description (origin)); - } - break; } if (refspec) @@ -810,17 +804,6 @@ rpmostreed_update_generate_variant (OstreeDeployment *booted_deployment, if (!rpmostree_refspec_classify (refspec, &refspectype, &refspec_data, error)) return FALSE; - /* we don't support rojig-based origins yet */ - switch (refspectype) - { - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - *out_update = NULL; - return TRUE; /* NB: early return */ - case RPMOSTREE_REFSPEC_TYPE_OSTREE: - case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: - break; - } - /* just skip over "ostree://" so we can talk with libostree without thinking about it */ refspec = refspec_data; } diff --git a/src/daemon/rpmostreed-transaction-types.cxx b/src/daemon/rpmostreed-transaction-types.cxx index ae67a56ae9..12dde5234b 100644 --- a/src/daemon/rpmostreed-transaction-types.cxx +++ b/src/daemon/rpmostreed-transaction-types.cxx @@ -68,33 +68,6 @@ change_origin_refspec (GVariantDict *options, const char *current_refspecdata; rpmostree_origin_classify_refspec (origin, ¤t_refspectype, ¤t_refspecdata); - /* This function ideally would be split into ostree/rojig handling - * and we'd also do "partial" support for rojig so one could do e.g. - * `rpm-ostree rebase fedora-atomic-workstation` instead of - * `rpm-ostree rebase updates:fedora-atomic-workstation` etc. - */ - switch (refspectype) - { - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - { - if (!rpmostree_origin_set_rebase (origin, src_refspec, error)) - return FALSE; - - if (current_refspectype == RPMOSTREE_REFSPEC_TYPE_ROJIG - && strcmp (current_refspecdata, refspecdata) == 0) - return glnx_throw (error, "Old and new refs are equal: %s", src_refspec); - - if (out_old_refspec != NULL) - *out_old_refspec = g_strdup (current_refspecdata); - if (out_new_refspec != NULL) - *out_new_refspec = g_strdup (src_refspec); - return TRUE; - } - case RPMOSTREE_REFSPEC_TYPE_OSTREE: - case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: - break; - } - /* Now here we "peel" it since the rest of the code assumes libostree */ const char *refspec = refspecdata; @@ -211,10 +184,6 @@ apply_revision_override (RpmostreedTransaction *transaction, rpmostree_origin_set_override_commit (origin, checksum, version); } break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - /* This case we'll look up later */ - rpmostree_origin_set_rojig_version (origin, version); - break; case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: g_assert_not_reached (); /* Handled above */ } @@ -234,11 +203,6 @@ apply_revision_override (RpmostreedTransaction *transaction, return FALSE; } break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - /* For now we skip validation here, if there's an error we'll see it later - * on. - */ - break; case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: g_assert_not_reached (); /* Handled above */ } @@ -1074,9 +1038,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, if (!rpmostree_refspec_classify (self->refspec, &refspectype, &ref, error)) return FALSE; - if (refspectype == RPMOSTREE_REFSPEC_TYPE_ROJIG) - return glnx_throw (error, "Local repo remotes not supported for rojig://"); - g_autoptr(OstreeRepo) local_repo_remote = ostree_repo_open_at (self->local_repo_remote_dfd, ".", cancellable, error); if (!local_repo_remote) @@ -1437,7 +1398,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, return glnx_throw (error, "Refusing to download rpm-md for offline OS '%s'", self->osname); - /* XXX: in rojig mode we'll want to do this unconditionally */ g_autoptr(DnfSack) sack = NULL; if (g_hash_table_size (rpmostree_origin_get_packages (origin)) > 0) { diff --git a/src/libpriv/rpmostree-core-private.h b/src/libpriv/rpmostree-core-private.h index 4e83791019..a38f9af1e2 100644 --- a/src/libpriv/rpmostree-core-private.h +++ b/src/libpriv/rpmostree-core-private.h @@ -40,15 +40,6 @@ struct _RpmOstreeContext { gboolean disable_selinux; char *ref; - /* rojig-mode data */ - const char *rojig_spec; /* The rojig spec like: repoid:package */ - const char *rojig_version; /* Optional */ - gboolean rojig_pure; /* There is only rojig */ - gboolean rojig_allow_not_found; /* Don't error if package not found */ - DnfPackage *rojig_pkg; - char *rojig_checksum; - char *rojig_inputhash; - gboolean pkgcache_only; DnfContext *dnfctx; RpmOstreeContextDnfCachePolicy dnf_cache_policy; @@ -59,9 +50,6 @@ struct _RpmOstreeContext { gboolean unprivileged; OstreeSePolicy *sepolicy; char *passwd_dir; - /* Used in async imports, not owned */ - GVariant *rojig_xattr_table; - GHashTable *rojig_pkg_to_xattrs; guint async_index; /* Offset into array if applicable */ guint n_async_running; diff --git a/src/libpriv/rpmostree-core.cxx b/src/libpriv/rpmostree-core.cxx index b34391831b..0938cd3555 100644 --- a/src/libpriv/rpmostree-core.cxx +++ b/src/libpriv/rpmostree-core.cxx @@ -50,7 +50,7 @@ static OstreeRepo * get_pkgcache_repo (RpmOstreeContext *self); -/* Given a string, look for ostree:// or rojig:// prefix and +/* Given a string, look for ostree:// prefix and * return its type and the remainder of the string. Note * that ostree:// can be either a refspec (TYPE_OSTREE) or * a bare commit (TYPE_COMMIT). @@ -61,13 +61,6 @@ rpmostree_refspec_classify (const char *refspec, const char **out_remainder, GError **error) { - if (g_str_has_prefix (refspec, RPMOSTREE_REFSPEC_ROJIG_PREFIX)) - { - *out_type = RPMOSTREE_REFSPEC_TYPE_ROJIG; - if (out_remainder) - *out_remainder = refspec + strlen (RPMOSTREE_REFSPEC_ROJIG_PREFIX); - return TRUE; - } /* Add any other prefixes here */ /* For compatibility, fall back to ostree:// when we have no prefix. */ @@ -97,9 +90,6 @@ rpmostree_refspec_to_string (RpmOstreeRefspecType reftype, case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: prefix = RPMOSTREE_REFSPEC_OSTREE_PREFIX; break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - prefix = RPMOSTREE_REFSPEC_ROJIG_PREFIX; - break; } g_assert (prefix); return g_strconcat (prefix, data, NULL); @@ -225,16 +215,6 @@ rpmostree_treespec_new_from_keyfile (GKeyFile *keyfile, g_variant_builder_init (&builder, (GVariantType*)"a{sv}"); -#define BIND_STRING(k) \ - { g_autofree char *v = g_key_file_get_string (keyfile, "tree", k, NULL); \ - if (v) \ - g_variant_builder_add (&builder, "{sv}", k, g_variant_new_string (v)); \ - } - - BIND_STRING("rojig"); - BIND_STRING("rojig-version"); -#undef BIND_STRING - add_canonicalized_string_array (&builder, "packages", NULL, keyfile); add_canonicalized_string_array (&builder, "exclude-packages", NULL, keyfile); add_canonicalized_string_array (&builder, "cached-packages", NULL, keyfile); @@ -303,10 +283,6 @@ rpmostree_context_finalize (GObject *object) g_clear_pointer (&rctx->ref, g_free); - g_clear_object (&rctx->rojig_pkg); - g_free (rctx->rojig_checksum); - g_free (rctx->rojig_inputhash); - g_clear_object (&rctx->pkgcache_repo); g_clear_object (&rctx->ostreerepo); g_clear_pointer (&rctx->devino_cache, (GDestroyNotify)ostree_repo_devino_cache_unref); @@ -801,11 +777,6 @@ rpmostree_context_setup (RpmOstreeContext *self, return glnx_throw (error, "No enabled repositories"); } - /* Keep a handy pointer to the rojig source if specified, since it influences - * a lot of things here. - */ - g_variant_dict_lookup (self->spec->dict, "rojig", "&s", &self->rojig_spec); - /* Ensure that each repo that's enabled is marked as required; this should be * the default, but we make sure. This is a bit of a messy topic, but for * rpm-ostree we're being more strict about requiring repos. @@ -1062,8 +1033,6 @@ rpmostree_context_download_metadata (RpmOstreeContext *self, /* https://github.com/rpm-software-management/libdnf/pull/416 * https://github.com/projectatomic/rpm-ostree/issues/1127 */ - if (self->rojig_pure) - flags = static_cast(static_cast(flags) | DNF_CONTEXT_SETUP_SACK_FLAG_SKIP_FILELISTS); if (flags & DNF_CONTEXT_SETUP_SACK_FLAG_SKIP_FILELISTS) dnf_context_set_enable_filelists (self->dnfctx, FALSE); @@ -1348,8 +1317,7 @@ find_pkg_in_ostree (RpmOstreeContext *self, if (repo == NULL) return TRUE; /* Note early return */ - g_autofree char *cachebranch = self->rojig_spec ? - rpmostree_get_rojig_branch_pkg (pkg) : rpmostree_get_cache_branch_pkg (pkg); + g_autofree char *cachebranch = rpmostree_get_cache_branch_pkg (pkg); g_autofree char *cached_rev = NULL; if (!ostree_repo_resolve_rev (repo, cachebranch, TRUE, &cached_rev, error)) @@ -1925,18 +1893,10 @@ rpmostree_context_prepare (RpmOstreeContext *self, dnf_sack_set_installonly (sack, NULL); dnf_sack_set_installonly_limit (sack, 0); - if (self->rojig_pure) - { - g_assert_cmpint (g_strv_length (pkgnames), ==, 0); - g_assert_cmpint (g_strv_length (cached_pkgnames), ==, 0); - g_assert_cmpint (g_strv_length (cached_replace_pkgs), ==, 0); - g_assert_cmpint (g_strv_length (removed_base_pkgnames), ==, 0); - } if (self->lockfile) { /* we only support pure installs for now (compose case) */ - g_assert (!self->rojig_pure); g_assert_cmpint (g_strv_length (cached_pkgnames), ==, 0); g_assert_cmpint (g_strv_length (cached_replace_pkgs), ==, 0); g_assert_cmpint (g_strv_length (removed_base_pkgnames), ==, 0); @@ -1956,8 +1916,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, if (!rpmostree_decompose_sha256_nevra (&nevra, &sha256, error)) return FALSE; - g_assert (!self->rojig_pure); - g_autoptr(DnfPackage) pkg = NULL; if (!add_pkg_from_cache (self, nevra, sha256, &pkg, cancellable, error)) return FALSE; @@ -1980,8 +1938,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, if (!rpmostree_decompose_sha256_nevra (&nevra, &sha256, error)) return FALSE; - g_assert (!self->rojig_pure); - g_autoptr(DnfPackage) pkg = NULL; if (!add_pkg_from_cache (self, nevra, sha256, &pkg, cancellable, error)) return FALSE; @@ -2090,7 +2046,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, for (char **it = removed_base_pkgnames; it && *it; it++) { const char *pkgname = *it; - g_assert (!self->rojig_pure); if (!dnf_context_remove (dnfctx, pkgname, error)) return FALSE; @@ -2135,7 +2090,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, for (char **it = pkgnames; it && *it; it++) { const char *pkgname = *it; - g_assert (!self->rojig_pure); g_autoptr(GError) local_error = NULL; if (!dnf_context_install (dnfctx, pkgname, &local_error)) { @@ -2173,53 +2127,25 @@ rpmostree_context_prepare (RpmOstreeContext *self, } } - g_assert (!self->rojig_spec); - - if (!self->rojig_pure) - { - auto actions = static_cast(DNF_INSTALL | DNF_ALLOW_UNINSTALL); - - if (self->treefile_rs && !self->treefile_rs->get_recommends()) - actions = static_cast(static_cast(actions) | DNF_IGNORE_WEAK_DEPS); - - auto task = rpmostreecxx::progress_begin_task("Resolving dependencies"); - - /* XXX: consider a --allow-uninstall switch? */ - if (!dnf_goal_depsolve (goal, actions, error) || - !check_goal_solution (self, removed_pkgnames, replaced_nevras, error)) - return FALSE; - g_clear_pointer (&self->pkgs, (GDestroyNotify)g_ptr_array_unref); - self->pkgs = dnf_goal_get_packages (goal, - DNF_PACKAGE_INFO_INSTALL, - DNF_PACKAGE_INFO_UPDATE, - DNF_PACKAGE_INFO_DOWNGRADE, -1); - if (!sort_packages (self, self->pkgs, cancellable, error)) - return glnx_prefix_error (error, "Sorting packages"); - } + auto actions = static_cast(DNF_INSTALL | DNF_ALLOW_UNINSTALL); + if (self->treefile_rs && !self->treefile_rs->get_recommends()) + actions = static_cast(static_cast(actions) | DNF_IGNORE_WEAK_DEPS); + auto task = rpmostreecxx::progress_begin_task("Resolving dependencies"); + /* XXX: consider a --allow-uninstall switch? */ + if (!dnf_goal_depsolve (goal, actions, error) || + !check_goal_solution (self, removed_pkgnames, replaced_nevras, error)) + return FALSE; + g_clear_pointer (&self->pkgs, (GDestroyNotify)g_ptr_array_unref); + self->pkgs = dnf_goal_get_packages (goal, + DNF_PACKAGE_INFO_INSTALL, + DNF_PACKAGE_INFO_UPDATE, + DNF_PACKAGE_INFO_DOWNGRADE, -1); + if (!sort_packages (self, self->pkgs, cancellable, error)) + return glnx_prefix_error (error, "Sorting packages"); return TRUE; } -/* Call this to ensure we don't do any "package stuff" like - * depsolving - we're in "pure rojig" mode. If specified - * this obviously means there are no layered packages for - * example. - */ -gboolean -rpmostree_context_prepare_rojig (RpmOstreeContext *self, - gboolean allow_not_found, - GCancellable *cancellable, - GError **error) -{ - self->rojig_pure = TRUE; - /* Override the default policy load; rojig handles xattrs - * internally. - */ - rpmostree_context_set_sepolicy (self, NULL); - self->rojig_allow_not_found = allow_not_found; - return rpmostree_context_prepare (self, cancellable, error); -} - /* Must have invoked rpmostree_context_prepare(). * Returns: (transfer container): All packages in the depsolved list. */ @@ -2229,23 +2155,6 @@ rpmostree_context_get_packages (RpmOstreeContext *self) return g_ptr_array_ref (self->pkgs); } -/* Rather than doing a depsolve, directly set which packages - * are required. Will be used by rojig. - */ -gboolean -rpmostree_context_set_packages (RpmOstreeContext *self, - GPtrArray *packages, - GCancellable *cancellable, - GError **error) -{ - g_clear_pointer (&self->pkgs_to_download, (GDestroyNotify)g_ptr_array_unref); - g_clear_pointer (&self->pkgs_to_import, (GDestroyNotify)g_ptr_array_unref); - self->n_async_pkgs_imported = 0; - g_clear_pointer (&self->pkgs_to_relabel, (GDestroyNotify)g_ptr_array_unref); - self->n_async_pkgs_relabeled = 0; - return sort_packages (self, packages, cancellable, error); -} - /* Returns a reference to the set of packages that will be imported */ GPtrArray * rpmostree_context_get_packages_to_import (RpmOstreeContext *self) @@ -2455,30 +2364,6 @@ rpmostree_context_download (RpmOstreeContext *self, return rpmostree_download_packages (self->pkgs_to_download, cancellable, error); } -/* Returns: (transfer none): The rojig package */ -DnfPackage * -rpmostree_context_get_rojig_pkg (RpmOstreeContext *self) -{ - g_assert (self->rojig_spec); - return self->rojig_pkg; -} - -/* Returns: (transfer none): The rojig checksum */ -const char * -rpmostree_context_get_rojig_checksum (RpmOstreeContext *self) -{ - g_assert (self->rojig_spec); - return self->rojig_checksum; -} - -/* Returns: (transfer none): The rojig inputhash (checksum of build-time inputs) */ -const char * -rpmostree_context_get_rojig_inputhash (RpmOstreeContext *self) -{ - g_assert (self->rojig_spec); - return self->rojig_inputhash; -} - static gboolean async_imports_mainctx_iter (gpointer user_data); @@ -2514,14 +2399,6 @@ start_async_import_one_package (RpmOstreeContext *self, DnfPackage *pkg, GCancellable *cancellable, GError **error) { - GVariant *rojig_xattrs = NULL; - if (self->rojig_pkg_to_xattrs) - { - rojig_xattrs = static_cast(g_hash_table_lookup (self->rojig_pkg_to_xattrs, pkg)); - if (!rojig_xattrs) - g_error ("Failed to find rojig xattrs for %s", dnf_package_get_nevra (pkg)); - } - glnx_fd_close int fd = -1; if (!rpmostree_context_consume_package (self, pkg, &fd, error)) return FALSE; @@ -2551,12 +2428,6 @@ start_async_import_one_package (RpmOstreeContext *self, DnfPackage *pkg, if (!unpacker) return glnx_prefix_error (error, "creating importer"); - if (rojig_xattrs) - { - g_assert (!self->sepolicy); - rpmostree_importer_set_rojig_mode (unpacker, self->rojig_xattr_table, rojig_xattrs); - } - rpmostree_importer_run_async (unpacker, cancellable, on_async_import_done, self); return TRUE; @@ -2595,11 +2466,9 @@ async_imports_mainctx_iter (gpointer user_data) } gboolean -rpmostree_context_import_rojig (RpmOstreeContext *self, - GVariant *rojig_xattr_table, - GHashTable *rojig_pkg_to_xattrs, - GCancellable *cancellable, - GError **error) +rpmostree_context_import (RpmOstreeContext *self, + GCancellable *cancellable, + GError **error) { DnfContext *dnfctx = self->dnfctx; const int n = self->pkgs_to_import->len; @@ -2617,8 +2486,6 @@ rpmostree_context_import_rojig (RpmOstreeContext *self, if (!rpmostree_repo_auto_transaction_start (&txn, repo, TRUE, cancellable, error)) return FALSE; - self->rojig_xattr_table = rojig_xattr_table; - self->rojig_pkg_to_xattrs = rojig_pkg_to_xattrs; self->async_running = TRUE; self->async_index = 0; self->n_async_running = 0; @@ -2660,14 +2527,6 @@ rpmostree_context_import_rojig (RpmOstreeContext *self, return TRUE; } -gboolean -rpmostree_context_import (RpmOstreeContext *self, - GCancellable *cancellable, - GError **error) -{ - return rpmostree_context_import_rojig (self, NULL, NULL, cancellable, error); -} - /* Given a single package, verify its GPG signature (if enabled), open a file * descriptor for it, and delete the on-disk downloaded copy. */ @@ -3839,8 +3698,6 @@ run_all_transfiletriggers (RpmOstreeContext *self, GCancellable *cancellable, GError **error) { - g_assert (!self->rojig_pure); - /* Triggers from base packages, but only if we already have an rpmdb, * otherwise librpm will whine on our stderr. */ diff --git a/src/libpriv/rpmostree-core.h b/src/libpriv/rpmostree-core.h index 5f611048c7..1db1014cd8 100644 --- a/src/libpriv/rpmostree-core.h +++ b/src/libpriv/rpmostree-core.h @@ -59,17 +59,13 @@ G_DECLARE_FINAL_TYPE (RpmOstreeContext, rpmostree_context, RPMOSTREE, CONTEXT, G #define RPMOSTREE_TYPE_TREESPEC (rpmostree_treespec_get_type ()) G_DECLARE_FINAL_TYPE (RpmOstreeTreespec, rpmostree_treespec, RPMOSTREE, TREESPEC, GObject) -/* Now in the code we handle "refspec" types of rojig (rpm-ostree jigdo), - * in addition to ostree. - */ + typedef enum { RPMOSTREE_REFSPEC_TYPE_OSTREE, - RPMOSTREE_REFSPEC_TYPE_ROJIG, RPMOSTREE_REFSPEC_TYPE_CHECKSUM, } RpmOstreeRefspecType; #define RPMOSTREE_REFSPEC_OSTREE_PREFIX "ostree://" -#define RPMOSTREE_REFSPEC_ROJIG_PREFIX "rojig://" gboolean rpmostree_refspec_classify (const char *refspec, RpmOstreeRefspecType *out_type, @@ -162,20 +158,9 @@ gboolean rpmostree_context_download_metadata (RpmOstreeContext *context, gboolean rpmostree_context_prepare (RpmOstreeContext *self, GCancellable *cancellable, GError **error); -/* Like above, but used for "pure rojig" cases */ -gboolean rpmostree_context_prepare_rojig (RpmOstreeContext *self, - gboolean allow_not_found, - GCancellable *cancellable, - GError **error); GPtrArray *rpmostree_context_get_packages (RpmOstreeContext *self); -/* Alternative to _prepare() for non-depsolve cases like rojig */ -gboolean rpmostree_context_set_packages (RpmOstreeContext *self, - GPtrArray *packages, - GCancellable *cancellable, - GError **error); - GPtrArray *rpmostree_context_get_packages_to_import (RpmOstreeContext *self); void @@ -194,31 +179,16 @@ gboolean rpmostree_context_download (RpmOstreeContext *self, void rpmostree_set_repos_on_packages (DnfContext *dnfctx, GPtrArray *packages); -gboolean rpmostree_context_execute_rojig (RpmOstreeContext *self, - gboolean *out_changed, - GCancellable *cancellable, - GError **error); - gboolean rpmostree_context_consume_package (RpmOstreeContext *self, DnfPackage *package, int *out_fd, GError **error); -DnfPackage *rpmostree_context_get_rojig_pkg (RpmOstreeContext *self); -const char *rpmostree_context_get_rojig_checksum (RpmOstreeContext *self); -const char *rpmostree_context_get_rojig_inputhash (RpmOstreeContext *self); - gboolean rpmostree_context_import (RpmOstreeContext *self, GCancellable *cancellable, GError **error); -gboolean rpmostree_context_import_rojig (RpmOstreeContext *self, - GVariant *xattr_table, - GHashTable *pkg_to_xattrs, - GCancellable *cancellable, - GError **error); - gboolean rpmostree_context_force_relabel (RpmOstreeContext *self, GCancellable *cancellable, GError **error); diff --git a/src/libpriv/rpmostree-importer.cxx b/src/libpriv/rpmostree-importer.cxx index 9f21ff6d75..934bc6f208 100644 --- a/src/libpriv/rpmostree-importer.cxx +++ b/src/libpriv/rpmostree-importer.cxx @@ -69,15 +69,7 @@ struct RpmOstreeImporter DnfPackage *pkg; char *hdr_sha256; - guint n_rojig_skipped; - guint n_rojig_total; char *ostree_branch; - - gboolean rojig_mode; - char *rojig_cacheid; - GVariant *rojig_xattr_table; - GVariant *rojig_xattrs; - GVariant *rojig_next_xattrs; /* passed from filter to xattr cb */ }; G_DEFINE_TYPE(RpmOstreeImporter, rpmostree_importer, G_TYPE_OBJECT) @@ -104,11 +96,6 @@ rpmostree_importer_finalize (GObject *object) g_free (self->hdr_sha256); - g_free (self->rojig_cacheid); - g_clear_pointer (&self->rojig_xattr_table, (GDestroyNotify)g_variant_unref); - g_clear_pointer (&self->rojig_xattrs, (GDestroyNotify)g_variant_unref); - g_clear_pointer (&self->rojig_next_xattrs, (GDestroyNotify)g_variant_unref); - G_OBJECT_CLASS (rpmostree_importer_parent_class)->finalize (object); } @@ -293,18 +280,6 @@ rpmostree_importer_new_take_fd (int *fd, return ret; } -void -rpmostree_importer_set_rojig_mode (RpmOstreeImporter *self, - GVariant *xattr_table, - GVariant *xattrs) -{ - self->rojig_mode = TRUE; - self->rojig_xattr_table = g_variant_ref (xattr_table); - g_variant_get (xattrs, "(s@a(su))", - &self->rojig_cacheid, - &self->rojig_xattrs); -} - static void get_rpmfi_override (RpmOstreeImporter *self, const char *path, @@ -334,10 +309,7 @@ rpmostree_importer_get_ostree_branch (RpmOstreeImporter *self) { if (!self->ostree_branch) { - if (self->rojig_mode) - self->ostree_branch = rpmostree_get_rojig_branch_header (self->hdr); - else - self->ostree_branch = rpmostree_get_cache_branch_header (self->hdr); + self->ostree_branch = rpmostree_get_cache_branch_header (self->hdr); } return self->ostree_branch; @@ -483,23 +455,6 @@ build_metadata_variant (RpmOstreeImporter *self, g_variant_new_string (chksum_repr.c_str())); } - if (self->rojig_mode) - { - g_variant_builder_add (&metadata_builder, "{sv}", - "rpmostree.rojig", - g_variant_new_boolean (TRUE)); - g_variant_builder_add (&metadata_builder, "{sv}", - "rpmostree.rojig_cacheid", - g_variant_new_string (self->rojig_cacheid)); - g_variant_builder_add (&metadata_builder, "{sv}", - "rpmostree.rojig_n_skipped", - g_variant_new_uint32 (self->n_rojig_skipped)); - g_variant_builder_add (&metadata_builder, "{sv}", - "rpmostree.rojig_total", - g_variant_new_uint32 (self->n_rojig_total)); - - } - if (self->doc_files) { g_variant_builder_add (&metadata_builder, "{sv}", @@ -805,11 +760,7 @@ import_rpm_to_repo (RpmOstreeImporter *self, * is unprivileged, anything else is a compose. */ const gboolean unprivileged = ostree_repo_get_mode (repo) == OSTREE_REPO_MODE_BARE_USER_ONLY; - if (self->rojig_mode) - { - g_assert_not_reached (); - } - else if (unprivileged) + if (unprivileged) filter = unprivileged_filter_cb; else filter = compose_filter_cb; @@ -821,15 +772,8 @@ import_rpm_to_repo (RpmOstreeImporter *self, modifier_flags |= OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS; g_autoptr(OstreeRepoCommitModifier) modifier = ostree_repo_commit_modifier_new (static_cast(modifier_flags), filter, &fdata, NULL); - if (self->rojig_mode) - { - g_assert_not_reached (); - } - else - { - ostree_repo_commit_modifier_set_xattr_callback (modifier, xattr_cb, NULL, self); - ostree_repo_commit_modifier_set_sepolicy (modifier, self->sepolicy); - } + ostree_repo_commit_modifier_set_xattr_callback (modifier, xattr_cb, NULL, self); + ostree_repo_commit_modifier_set_sepolicy (modifier, self->sepolicy); OstreeRepoImportArchiveOptions opts = { 0 }; opts.ignore_unsupported_content = TRUE; diff --git a/src/libpriv/rpmostree-importer.h b/src/libpriv/rpmostree-importer.h index 534ff22d7f..6b52d1ef6f 100644 --- a/src/libpriv/rpmostree-importer.h +++ b/src/libpriv/rpmostree-importer.h @@ -58,10 +58,6 @@ rpmostree_importer_new_take_fd (int *fd, OstreeSePolicy *sepolicy, GError **error); -void rpmostree_importer_set_rojig_mode (RpmOstreeImporter *self, - GVariant *xattr_table, - GVariant *xattrs); - gboolean rpmostree_importer_read_metainfo (int fd, Header *out_header, diff --git a/src/libpriv/rpmostree-origin.cxx b/src/libpriv/rpmostree-origin.cxx index 7e565d4191..53ba5a2ddc 100644 --- a/src/libpriv/rpmostree-origin.cxx +++ b/src/libpriv/rpmostree-origin.cxx @@ -34,15 +34,12 @@ struct RpmOstreeOrigin { /* this is the single source of truth */ GKeyFile *kf; - /* An origin can have either a refspec or a rojigspec */ + /* Branch name or pinned to commit*/ RpmOstreeRefspecType refspec_type; char *cached_refspec; /* Version data that goes along with the refspec */ char *cached_override_commit; - char *cached_rojig_version; - /* The NEVRA of the rojigRPM */ - char *cached_rojig_description; char *cached_unconfigured_state; char **cached_initramfs_args; @@ -118,36 +115,23 @@ rpmostree_origin_parse_keyfile (GKeyFile *origin, ret->cached_unconfigured_state = g_key_file_get_string (ret->kf, "origin", "unconfigured-state", NULL); g_autofree char *refspec = g_key_file_get_string (ret->kf, "origin", "refspec", NULL); - g_autofree char *rojig_spec = g_key_file_get_string (ret->kf, "origin", "rojig", NULL); if (!refspec) { refspec = g_key_file_get_string (ret->kf, "origin", "baserefspec", NULL); - if (!refspec && !rojig_spec) - return (RpmOstreeOrigin *)glnx_null_throw (error, "No origin/refspec, origin/rojig, or origin/baserefspec in current deployment origin; cannot handle via rpm-ostree"); - } - if (refspec && rojig_spec) - return (RpmOstreeOrigin *)glnx_null_throw (error, "Duplicate origin/refspec and origin/rojig in deployment origin"); - else if (refspec) - { - if (!rpmostree_refspec_classify (refspec, &ret->refspec_type, NULL, error)) - return FALSE; - /* Note the lack of a prefix here so that code that just calls - * rpmostree_origin_get_refspec() in the ostree:// case - * sees it without the prefix for compatibility. - */ - ret->cached_refspec = util::move_nullify (refspec); - ret->cached_override_commit = - g_key_file_get_string (ret->kf, "origin", "override-commit", NULL); - } - else - { - g_assert (rojig_spec); - ret->refspec_type = RPMOSTREE_REFSPEC_TYPE_ROJIG; - ret->cached_refspec = util::move_nullify (rojig_spec); - ret->cached_rojig_version = g_key_file_get_string (ret->kf, "origin", "rojig-override-version", NULL); - ret->cached_rojig_description = g_key_file_get_string (ret->kf, "origin", "rojig-description", NULL); + if (!refspec) + return (RpmOstreeOrigin *)glnx_null_throw (error, "No origin/refspec, or origin/baserefspec in current deployment origin; cannot handle via rpm-ostree"); } + if (!rpmostree_refspec_classify (refspec, &ret->refspec_type, NULL, error)) + return FALSE; + /* Note the lack of a prefix here so that code that just calls + * rpmostree_origin_get_refspec() in the ostree:// case + * sees it without the prefix for compatibility. + */ + ret->cached_refspec = util::move_nullify (refspec); + ret->cached_override_commit = + g_key_file_get_string (ret->kf, "origin", "override-commit", NULL); + if (!parse_packages_strv (ret->kf, "packages", "requested", FALSE, ret->cached_packages, error)) return FALSE; @@ -203,30 +187,13 @@ rpmostree_origin_get_refspec (RpmOstreeOrigin *origin) return origin->cached_refspec; } -/* For rojig:// refspecs, includes the prefix. */ char * rpmostree_origin_get_full_refspec (RpmOstreeOrigin *origin, RpmOstreeRefspecType *out_refspectype) { if (out_refspectype) *out_refspectype = origin->refspec_type; - switch (origin->refspec_type) - { - case RPMOSTREE_REFSPEC_TYPE_OSTREE: - case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: - return g_strdup (origin->cached_refspec); - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - return g_strconcat (RPMOSTREE_REFSPEC_ROJIG_PREFIX, origin->cached_refspec, NULL); - } - g_assert_not_reached (); - return NULL; -} - -/* Returns: TRUE iff the origin type is rpm-ostree rojig */ -gboolean -rpmostree_origin_is_rojig (RpmOstreeOrigin *origin) -{ - return origin->refspec_type == RPMOSTREE_REFSPEC_TYPE_ROJIG; + return g_strdup (origin->cached_refspec); } void @@ -239,37 +206,6 @@ rpmostree_origin_classify_refspec (RpmOstreeOrigin *origin, *out_refspecdata = origin->cached_refspec; } -const char * -rpmostree_origin_get_rojig_version (RpmOstreeOrigin *origin) -{ - return origin->cached_rojig_version; -} - -/* Returns a new (floating) variant of type a{sv} with fields: - * - s: repo - * - s: name - * - s: evr - * - s: arch - * Note this type is exposed as DBus API. - */ -GVariant * -rpmostree_origin_get_rojig_description (RpmOstreeOrigin *origin) -{ - const char *colon = strchr (origin->cached_refspec, ':'); - g_assert (colon); - const char *repo = strndupa (origin->cached_refspec, colon - origin->cached_refspec); - g_autofree char *rojig_evr = g_key_file_get_string (origin->kf, "origin", "rojig-imported-evr", NULL); - g_autofree char *rojig_arch = g_key_file_get_string (origin->kf, "origin", "rojig-imported-arch", NULL); - g_autoptr(GVariantBuilder) builder = g_variant_builder_new (G_VARIANT_TYPE_VARDICT); - g_variant_builder_add (builder, "{sv}", "repo", g_variant_new_string (repo)); - g_variant_builder_add (builder, "{sv}", "name", g_variant_new_string (colon + 1)); - if (rojig_evr) - g_variant_builder_add (builder, "{sv}", "evr", g_variant_new_string (rojig_evr)); - if (rojig_arch) - g_variant_builder_add (builder, "{sv}", "arch", g_variant_new_string (rojig_arch)); - return g_variant_builder_end (builder); -} - static char * keyfile_get_nonempty_string (GKeyFile *kf, const char *section, const char *key) { @@ -394,7 +330,6 @@ rpmostree_origin_unref (RpmOstreeOrigin *origin) return; g_key_file_unref (origin->kf); g_free (origin->cached_refspec); - g_free (origin->cached_rojig_version); g_free (origin->cached_unconfigured_state); g_strfreev (origin->cached_initramfs_args); g_clear_pointer (&origin->cached_packages, g_hash_table_unref); @@ -519,18 +454,6 @@ rpmostree_origin_set_override_commit (RpmOstreeOrigin *origin, origin->cached_override_commit = g_strdup (checksum); } -void -rpmostree_origin_set_rojig_version (RpmOstreeOrigin *origin, - const char *version) -{ - if (version) - g_key_file_set_string (origin->kf, "origin", "rojig-override-version", version); - else - g_key_file_remove_key (origin->kf, "origin", "rojig-override-version", NULL); - g_free (origin->cached_rojig_version); - origin->cached_rojig_version = g_strdup (version); -} - gboolean rpmostree_origin_get_cliwrap (RpmOstreeOrigin *origin) { @@ -548,24 +471,6 @@ rpmostree_origin_set_cliwrap (RpmOstreeOrigin *origin, gboolean cliwrap) g_key_file_remove_key (origin->kf, k, v, NULL); } -/* The rojigRPM is highly special; it doesn't live in the rpmdb for example, as - * that would be fully circular. Yet, it's of critical importance to the whole - * system; we want to render it on the client. For now, what we do is stick the - * EVR+A in the origin. That's the only data we really care about. - * - * Perhaps down the line, what we really want to do is store the whole Header at - * least somewhere hooked off the deployment (or perhaps imported itself into - * the pkgcache)? - */ -void -rpmostree_origin_set_rojig_description (RpmOstreeOrigin *origin, - DnfPackage *package) -{ - g_assert_cmpint (origin->refspec_type, ==, RPMOSTREE_REFSPEC_TYPE_ROJIG); - g_key_file_set_string (origin->kf, "origin", "rojig-imported-evr", dnf_package_get_evr (package)); - g_key_file_set_string (origin->kf, "origin", "rojig-imported-arch", dnf_package_get_arch (package)); -} - gboolean rpmostree_origin_set_rebase_custom (RpmOstreeOrigin *origin, const char *new_refspec, @@ -584,7 +489,6 @@ rpmostree_origin_set_rebase_custom (RpmOstreeOrigin *origin, * rebase by default. */ rpmostree_origin_set_override_commit (origin, NULL, NULL); - g_key_file_remove_key (origin->kf, "origin", "rojig-override-version", NULL); /* See related code in rpmostree_origin_parse_keyfile() */ const char *refspecdata; @@ -597,9 +501,6 @@ rpmostree_origin_set_rebase_custom (RpmOstreeOrigin *origin, case RPMOSTREE_REFSPEC_TYPE_CHECKSUM: case RPMOSTREE_REFSPEC_TYPE_OSTREE: { - g_key_file_remove_key (origin->kf, "origin", "rojig", NULL); - g_key_file_remove_key (origin->kf, "origin", "rojig-imported-evr", NULL); - g_key_file_remove_key (origin->kf, "origin", "rojig-imported-arch", NULL); const char *refspec_key = g_key_file_has_key (origin->kf, "origin", "baserefspec", NULL) ? "baserefspec" : "refspec"; @@ -619,18 +520,6 @@ rpmostree_origin_set_rebase_custom (RpmOstreeOrigin *origin, } } break; - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - { - g_assert (!custom_origin_url); - origin->cached_refspec = g_strdup (refspecdata); - g_key_file_remove_key (origin->kf, "origin", "refspec", NULL); - g_key_file_remove_key (origin->kf, "origin", "baserefspec", NULL); - g_key_file_remove_key (origin->kf, "origin", "custom-url", NULL); - g_key_file_remove_key (origin->kf, "origin", "custom-description", NULL); - /* Peeled */ - g_key_file_set_string (origin->kf, "origin", "rojig", origin->cached_refspec); - } - break; } return TRUE; @@ -687,11 +576,6 @@ update_keyfile_pkgs_from_cache (RpmOstreeOrigin *origin, g_key_file_remove_key (origin->kf, "origin", "refspec", NULL); break; } - case RPMOSTREE_REFSPEC_TYPE_ROJIG: - /* Nothing to switch, since libostree already doesn't know how to - * handle rojig. - */ - break; } } } diff --git a/src/libpriv/rpmostree-origin.h b/src/libpriv/rpmostree-origin.h index d90bdd367c..fd4b516eed 100644 --- a/src/libpriv/rpmostree-origin.h +++ b/src/libpriv/rpmostree-origin.h @@ -69,14 +69,6 @@ char * rpmostree_origin_get_full_refspec (RpmOstreeOrigin *origin, RpmOstreeRefspecType *out_refspectype); -gboolean rpmostree_origin_is_rojig (RpmOstreeOrigin *origin); - -const char * -rpmostree_origin_get_rojig_version (RpmOstreeOrigin *origin); - -GVariant * -rpmostree_origin_get_rojig_description (RpmOstreeOrigin *origin); - void rpmostree_origin_get_custom_description (RpmOstreeOrigin *origin, char **custom_type, @@ -143,13 +135,6 @@ void rpmostree_origin_set_override_commit (RpmOstreeOrigin *origin, const char *checksum, const char *version); -void -rpmostree_origin_set_rojig_description (RpmOstreeOrigin *origin, - DnfPackage *package); - -void -rpmostree_origin_set_rojig_version (RpmOstreeOrigin *origin, - const char *version); gboolean rpmostree_origin_get_cliwrap (RpmOstreeOrigin *origin); diff --git a/src/libpriv/rpmostree-rpm-util.cxx b/src/libpriv/rpmostree-rpm-util.cxx index d44dd53a98..57bdda4ed9 100644 --- a/src/libpriv/rpmostree-rpm-util.cxx +++ b/src/libpriv/rpmostree-rpm-util.cxx @@ -1418,15 +1418,6 @@ rpmostree_get_cache_branch_header (Header hdr) return rpmostree_get_cache_branch_for_n_evr_a (name, evr, arch); } -char * -rpmostree_get_rojig_branch_header (Header hdr) -{ - g_autofree char *name = headerGetAsString (hdr, RPMTAG_NAME); - g_autofree char *evr = headerGetAsString (hdr, RPMTAG_EVR); - g_autofree char *arch = headerGetAsString (hdr, RPMTAG_ARCH); - return get_branch_for_n_evr_a ("rojig", name, evr, arch); -} - /* Return the ostree cache branch from a libdnf Package */ char * rpmostree_get_cache_branch_pkg (DnfPackage *pkg) @@ -1436,14 +1427,6 @@ rpmostree_get_cache_branch_pkg (DnfPackage *pkg) dnf_package_get_arch (pkg)); } -char * -rpmostree_get_rojig_branch_pkg (DnfPackage *pkg) -{ - return get_branch_for_n_evr_a ("rojig", dnf_package_get_name (pkg), - dnf_package_get_evr (pkg), - dnf_package_get_arch (pkg)); -} - GPtrArray* rpmostree_get_enabled_rpmmd_repos (DnfContext *dnfctx, DnfRepoEnabled enablement) diff --git a/src/libpriv/rpmostree-rpm-util.h b/src/libpriv/rpmostree-rpm-util.h index 86de549bdb..cdc39367ee 100644 --- a/src/libpriv/rpmostree-rpm-util.h +++ b/src/libpriv/rpmostree-rpm-util.h @@ -219,9 +219,7 @@ rpmostree_create_rpmdb_pkglist_variant (int dfd, char * rpmostree_get_cache_branch_for_n_evr_a (const char *name, const char *evr, const char *arch); char *rpmostree_get_cache_branch_header (Header hdr); -char *rpmostree_get_rojig_branch_header (Header hdr); char *rpmostree_get_cache_branch_pkg (DnfPackage *pkg); -char *rpmostree_get_rojig_branch_pkg (DnfPackage *pkg); gboolean rpmostree_decompose_nevra (const char *nevra,