jigdo: Add Provides: rpmostree-jigdo(v1), require it on client

We are going to want versioning on the jigdo RPMs, since it's
highly likely things change.

This is done via new magic '-D rpmostree_jigdo_meta` macro, which we can also
use for other things down the line.

Closes: #1135
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-12-05 15:41:40 -05:00 committed by Atomic Bot
parent 44b938a6ac
commit c3b152f3ee
4 changed files with 28 additions and 1 deletions

View File

@ -926,6 +926,10 @@ write_commit2jigdo (RpmOstreeCommit2JigdoContext *self,
g_ptr_array_add (rpmbuild_argv, g_strdup ("-D"));
g_ptr_array_add (rpmbuild_argv, g_strconcat ("ostree_version ", commit_version, NULL));
}
g_ptr_array_add (rpmbuild_argv, g_strdup ("-D"));
g_ptr_array_add (rpmbuild_argv, g_strconcat ("rpmostree_jigdo_meta ", "Provides: " RPMOSTREE_JIGDO_PROVIDE_V1 "\n", NULL));
g_ptr_array_add (rpmbuild_argv, g_strdup (oirpm_spec));
g_ptr_array_add (rpmbuild_argv, NULL);
int estatus;

View File

@ -201,9 +201,29 @@ impl_jigdo2commit (RpmOstreeJigdo2CommitContext *self,
g_print ("%u oirpm matches\n", pkglist->len);
}
g_ptr_array_set_size (pkglist, 1);
oirpm_pkg = g_object_ref (pkglist->pdata[0]);
/* Iterate over provides directly to provide a nicer error on mismatch */
gboolean found_v1_provide = FALSE;
g_autoptr(DnfReldepList) provides = dnf_package_get_provides (oirpm_pkg);
const gint n_provides = dnf_reldep_list_count (provides);
for (int i = 0; i < n_provides; i++)
{
DnfReldep *provide = dnf_reldep_list_index (provides, i);
if (g_str_equal (dnf_reldep_to_string (provide), RPMOSTREE_JIGDO_PROVIDE_V1))
{
found_v1_provide = TRUE;
break;
}
}
if (!found_v1_provide)
return glnx_throw (error, "Package '%s' does not have Provides: %s",
dnf_package_get_nevra (oirpm_pkg), RPMOSTREE_JIGDO_PROVIDE_V1);
if (!rpmostree_context_set_packages (self->ctx, pkglist, cancellable, error))
return FALSE;
oirpm_pkg = g_object_ref (pkglist->pdata[0]);
}
g_print ("oirpm: %s (%s)\n", dnf_package_get_nevra (oirpm_pkg),

View File

@ -75,3 +75,5 @@
#define RPMOSTREE_JIGDO_XATTRS_TABLE_VARIANT_FORMAT (G_VARIANT_TYPE ("aa(ayay)"))
/* NEVRA + xattr table */
#define RPMOSTREE_JIGDO_XATTRS_PKG_VARIANT_FORMAT (G_VARIANT_TYPE ("a(su)"))
#define RPMOSTREE_JIGDO_PROVIDE_V1 "rpmostree-jigdo(v1)"

View File

@ -7,6 +7,7 @@ Version: %{ostree_version}
Release: 1%{?dist}
Summary: Image (rpm-ostree jigdo) for Fedora Atomic Host
License: MIT
%{rpmostree_jigdo_meta}
%description
%{summary}