Skip to content

Commit

Permalink
tree-wide: Remove (almost) all remaining rojig bits
Browse files Browse the repository at this point in the history
The only part left that we will need to keep ~forever is
the treefile parsing `rojig:` because it's used by coreos-assembler.
But all we need is to propagate it into the JSON treefile.
  • Loading branch information
cgwalters committed May 19, 2021
1 parent 5a89dce commit 7082822
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 143 deletions.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions rust/src/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ 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";

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub(crate) enum RefspecType {
Checksum,
Ostree,
Rojig,
}

#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -224,11 +222,7 @@ impl Origin {
}

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<String> {
Expand Down
4 changes: 1 addition & 3 deletions src/app/rpmostree-builtin-rebase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 0 additions & 2 deletions src/app/rpmostree-builtin-status.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions src/app/rpmostree-compose-builtin-tree.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<rust::Box<rpmostreecxx::Treefile>> treefile_rs;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 1 addition & 16 deletions src/daemon/rpmostree-sysroot-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -183,7 +182,7 @@ 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);
}

Expand Down Expand Up @@ -211,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;
}
Expand Down
6 changes: 1 addition & 5 deletions src/daemon/rpmostree-sysroot-upgrader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 0 additions & 14 deletions src/daemon/rpmostreed-deployment-utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,6 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot,
}
}
break;
case RPMOSTREE_REFSPEC_TYPE_ROJIG:
g_assert_not_reached ();
break;
}

if (refspec)
Expand Down Expand Up @@ -807,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;
}
Expand Down
39 changes: 0 additions & 39 deletions src/daemon/rpmostreed-transaction-types.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,6 @@ change_origin_refspec (GVariantDict *options,
const char *current_refspecdata;
rpmostree_origin_classify_refspec (origin, &current_refspectype, &current_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;

Expand Down Expand Up @@ -211,9 +184,6 @@ apply_revision_override (RpmostreedTransaction *transaction,
rpmostree_origin_set_override_commit (origin, checksum, version);
}
break;
case RPMOSTREE_REFSPEC_TYPE_ROJIG:
g_assert_not_reached ();
break;
case RPMOSTREE_REFSPEC_TYPE_CHECKSUM:
g_assert_not_reached (); /* Handled above */
}
Expand All @@ -233,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 */
}
Expand Down Expand Up @@ -1073,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)
Expand Down Expand Up @@ -1436,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)
{
Expand Down
20 changes: 0 additions & 20 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,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);
Expand Down Expand Up @@ -2158,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)
Expand Down
12 changes: 1 addition & 11 deletions src/libpriv/rpmostree-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -165,12 +161,6 @@ gboolean rpmostree_context_prepare (RpmOstreeContext *self,

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
Expand Down
20 changes: 1 addition & 19 deletions src/libpriv/rpmostree-origin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +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;
return g_strdup (origin->cached_refspec);
}

void
Expand Down Expand Up @@ -530,9 +520,6 @@ rpmostree_origin_set_rebase_custom (RpmOstreeOrigin *origin,
}
}
break;
case RPMOSTREE_REFSPEC_TYPE_ROJIG:
g_assert_not_reached ();
break;
}

return TRUE;
Expand Down Expand Up @@ -589,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;
}
}
}
Expand Down

0 comments on commit 7082822

Please sign in to comment.