Add support for deploy <version>
in rojig://
mode
This fleshes out an important piece of the story, showing that we can support history versioning the same way that we did with ostree. Also it's very useful for testing; I'm going to extend the suite after this to deploy the previous version, clean everything up, then upgrade and verify we only download changed RPMs. Closes: #1232 Approved by: jlebon
This commit is contained in:
parent
c5939b7ca7
commit
799a809c2d
@ -439,7 +439,8 @@ rpmostree_sysroot_upgrader_pull_base (RpmOstreeSysrootUpgrader *self,
|
||||
case RPMOSTREE_REFSPEC_TYPE_ROJIG:
|
||||
{
|
||||
// Not implemented yet, though we could do a query for the provides
|
||||
g_assert (!override_commit);
|
||||
if (override_commit)
|
||||
return glnx_throw (error, "Specifying commit overrides for rojig:// is not implemented yet");
|
||||
|
||||
g_autoptr(GKeyFile) tsk = g_key_file_new ();
|
||||
g_key_file_set_string (tsk, "tree", "jigdo", refspec);
|
||||
|
@ -122,6 +122,8 @@ change_origin_refspec (OstreeSysroot *sysroot,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Handle `deploy` semantics of pinning to a version or checksum. See
|
||||
* rpmostreed_parse_revision() for available syntax for @revision */
|
||||
static gboolean
|
||||
apply_revision_override (RpmostreedTransaction *transaction,
|
||||
OstreeRepo *repo,
|
||||
@ -131,41 +133,63 @@ apply_revision_override (RpmostreedTransaction *transaction,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
RpmOstreeRefspecType refspectype;
|
||||
rpmostree_origin_classify_refspec (origin, &refspectype, NULL);
|
||||
|
||||
g_autofree char *checksum = NULL;
|
||||
g_autofree char *version = NULL;
|
||||
|
||||
if (!rpmostreed_parse_revision (revision,
|
||||
&checksum,
|
||||
&version,
|
||||
error))
|
||||
if (!rpmostreed_parse_revision (revision, &checksum, &version, error))
|
||||
return FALSE;
|
||||
|
||||
if (version != NULL)
|
||||
{
|
||||
rpmostreed_transaction_emit_message_printf (transaction,
|
||||
"Resolving version '%s'",
|
||||
version);
|
||||
switch (refspectype)
|
||||
{
|
||||
case RPMOSTREE_REFSPEC_TYPE_OSTREE:
|
||||
{
|
||||
/* Perhaps down the line we'll drive history traversal into libostree */
|
||||
rpmostreed_transaction_emit_message_printf (transaction,
|
||||
"Resolving version '%s'",
|
||||
version);
|
||||
|
||||
if (!rpmostreed_repo_lookup_version (repo, rpmostree_origin_get_refspec (origin),
|
||||
version, progress,
|
||||
cancellable, &checksum, error))
|
||||
return FALSE;
|
||||
if (!rpmostreed_repo_lookup_version (repo, rpmostree_origin_get_refspec (origin),
|
||||
version, progress,
|
||||
cancellable, &checksum, error))
|
||||
return FALSE;
|
||||
|
||||
rpmostree_origin_set_override_commit (origin, checksum, version);
|
||||
}
|
||||
break;
|
||||
case RPMOSTREE_REFSPEC_TYPE_ROJIG:
|
||||
/* This case we'll look up later */
|
||||
rpmostree_origin_set_jigdo_version (origin, version);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (checksum != NULL);
|
||||
|
||||
rpmostreed_transaction_emit_message_printf (transaction,
|
||||
"Validating checksum '%s'",
|
||||
checksum);
|
||||
switch (refspectype)
|
||||
{
|
||||
case RPMOSTREE_REFSPEC_TYPE_OSTREE:
|
||||
rpmostreed_transaction_emit_message_printf (transaction,
|
||||
"Validating checksum '%s'",
|
||||
checksum);
|
||||
if (!rpmostreed_repo_lookup_checksum (repo, rpmostree_origin_get_refspec (origin),
|
||||
checksum, progress, cancellable, error))
|
||||
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;
|
||||
}
|
||||
|
||||
if (!rpmostreed_repo_lookup_checksum (repo, rpmostree_origin_get_refspec (origin),
|
||||
checksum, progress, cancellable, error))
|
||||
return FALSE;
|
||||
rpmostree_origin_set_override_commit (origin, checksum, version);
|
||||
}
|
||||
|
||||
rpmostree_origin_set_override_commit (origin, checksum, version);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,9 @@ rpmostree_treespec_new_from_keyfile (GKeyFile *keyfile,
|
||||
}
|
||||
|
||||
BIND_STRING("jigdo");
|
||||
BIND_STRING("jigdo-version");
|
||||
BIND_STRING("releasever");
|
||||
#undef BIND_STRING
|
||||
|
||||
add_canonicalized_string_array (&builder, "packages", NULL, keyfile);
|
||||
add_canonicalized_string_array (&builder, "cached-packages", NULL, keyfile);
|
||||
|
@ -388,6 +388,18 @@ rpmostree_origin_set_override_commit (RpmOstreeOrigin *origin,
|
||||
origin->cached_override_commit = g_strdup (checksum);
|
||||
}
|
||||
|
||||
void
|
||||
rpmostree_origin_set_jigdo_version (RpmOstreeOrigin *origin,
|
||||
const char *version)
|
||||
{
|
||||
if (version)
|
||||
g_key_file_set_string (origin->kf, "origin", "jigdo-version", version);
|
||||
else
|
||||
g_key_file_remove_key (origin->kf, "origin", "jigdo-version", NULL);
|
||||
g_free (origin->cached_jigdo_version);
|
||||
origin->cached_jigdo_version = g_strdup (version);
|
||||
}
|
||||
|
||||
gboolean
|
||||
rpmostree_origin_set_rebase (RpmOstreeOrigin *origin,
|
||||
const char *new_refspec,
|
||||
|
@ -117,6 +117,10 @@ rpmostree_origin_set_override_commit (RpmOstreeOrigin *origin,
|
||||
const char *checksum,
|
||||
const char *version);
|
||||
|
||||
void
|
||||
rpmostree_origin_set_jigdo_version (RpmOstreeOrigin *origin,
|
||||
const char *version);
|
||||
|
||||
gboolean
|
||||
rpmostree_origin_set_rebase (RpmOstreeOrigin *origin,
|
||||
const char *new_refspec,
|
||||
|
@ -41,4 +41,15 @@ vm_rpmostree rebase --experimental rojig://fahc:fedora-atomic-host
|
||||
vm_assert_status_jq '.deployments[0].origin|startswith("rojig://fahc:fedora-atomic-host")'
|
||||
vm_cmd ostree refs > refs.txt
|
||||
assert_file_has_content refs.txt '^rpmostree/jigdo/kernel-core/'
|
||||
echo "ok jigdo client"
|
||||
echo "ok jigdo client rebase "
|
||||
|
||||
version=$(vm_get_deployment_info 0 version)
|
||||
version_major=$(echo ${version} | cut -f 1 -d '.')
|
||||
version_minor=$(echo ${version} | cut -f 2 -d '.')
|
||||
prev_version=${version_major}.$((${version_minor} - 1))
|
||||
assert_not_streq "${version}" "${prev_version}"
|
||||
vm_rpmostree deploy ${prev_version}
|
||||
vm_assert_status_jq '.deployments[0].origin|startswith("rojig://fahc:fedora-atomic-host")' \
|
||||
'.deployments[0].version == "'${prev_version}'"'
|
||||
|
||||
echo "ok jigdo client deploy"
|
||||
|
Loading…
Reference in New Issue
Block a user