Skip to content

Commit

Permalink
jigdo: Add Provides: rpmostree-jigdo(v1), require it on client
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Dec 7, 2017
1 parent 44b938a commit c3b152f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/rpmostree-ex-builtin-commit2jigdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 21 additions & 1 deletion src/app/rpmostree-ex-builtin-jigdo2commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions src/libpriv/rpmostree-jigdo-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
1 change: 1 addition & 0 deletions tests/composedata/fedora-atomic-host-oirpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit c3b152f

Please sign in to comment.