Skip to content

Commit

Permalink
Remove modularity support entrypoints
Browse files Browse the repository at this point in the history
This should hopefully fix libdnf warnings.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters authored and jlebon committed May 3, 2024
1 parent 586473b commit 1ba3a7b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 121 deletions.
33 changes: 0 additions & 33 deletions docs/administrator-handbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,39 +105,6 @@ The install --force-replacefiles option allows this.
# rpm-ostree install --force-replacefiles <pkg>
```

### Modularity

rpm-ostree provides experimental support for modules, a way for the distribution
to ship multiple versions (or "streams") of the same software.

A module can have multiple streams, and each stream can have multiple profiles.
A profile is a set of packages for common use cases (e.g. you can have a
"client" and "server" profile, each installing different packages).

`rpm-ostree ex module enable` enables a module stream and allow you to
individually pick packages to `rpm-ostree install` from that stream.
`rpm-ostree ex module install` installs module stream profiles directly.

For example, to enable the `cri-o:1.20` module stream, use:

```
# rpm-ostree ex module enable cri-o:1.20
```

You can then `rpm-ostree install` individual packages from the enabled module.

Or to install a predefined profile, use e.g.:

```
# rpm-ostree ex module install cri-o:1.20/default
```

For more information about modularity, see
[the Fedora documentation](https://docs.fedoraproject.org/en-US/modularity). In
particular,
[this page](https://docs.fedoraproject.org/en-US/modularity/installing-modules/#_installing_packages)
provides sample syntax invocations.

### Rebasing

```
Expand Down
4 changes: 0 additions & 4 deletions src/app/rpmostree-builtin-ex.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ static RpmOstreeCommand ex_subcommands[]
(RpmOstreeBuiltinFlags)(RPM_OSTREE_BUILTIN_FLAG_HIDDEN
| RPM_OSTREE_BUILTIN_FLAG_CONTAINER_CAPABLE),
"Rebuild system based on configuration", rpmostree_ex_builtin_rebuild },
/* To graduate out of experimental, simply revert:
* https://github.com/coreos/rpm-ostree/pull/3078 */
{ "module", static_cast<RpmOstreeBuiltinFlags> (0), "Commands to install/uninstall modules",
rpmostree_ex_builtin_module },
{ NULL, (RpmOstreeBuiltinFlags)0, NULL, NULL } };

/*
Expand Down
42 changes: 1 addition & 41 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,6 @@ rpmostree_context_new_compose (int userroot_dfd, OstreeRepo *repo,

rpmostree_context_set_cache_root (ret, userroot_dfd);

auto platform_module = treefile_rs.get_platform_module ();
if (!platform_module.empty ())
{
dnf_context_set_platform_module (ret->dnfctx, platform_module.c_str ());
}

// The ref needs special handling as it gets variable-substituted.
auto ref = ret->treefile_rs->get_ref ();
if (ref.length () > 0)
Expand Down Expand Up @@ -1856,12 +1850,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, GCancellable *cancellable, GE
return FALSE;
}

/* All modules are opt-in, so start off with everything disabled. We'll enable/install
* user-provided ones down below. We need to do this before `find_locked_packages` so that it can
* find non-modular versions of a package. */
if (!dnf_context_module_disable_all (dnfctx, error))
return FALSE;

/* Now that we're done adding stuff to the sack, we can actually mark pkgs for install and
* uninstall. We don't want to mix those two steps, otherwise we might confuse libdnf,
* see: https://github.com/rpm-software-management/libdnf/issues/700 */
Expand Down Expand Up @@ -2039,36 +2027,8 @@ rpmostree_context_prepare (RpmOstreeContext *self, GCancellable *cancellable, GE
}
}

gboolean we_got_modules = FALSE;
if (!modules_enable.empty ())
{
g_auto (GStrv) modules = rpmostree_cxx_string_vec_to_strv (modules_enable);
if (!dnf_context_module_enable (dnfctx, (const char **)modules, error))
return FALSE;
we_got_modules = TRUE;
}

if (!modules_install.empty ())
{
g_auto (GStrv) modules = rpmostree_cxx_string_vec_to_strv (modules_install);
if (!dnf_context_module_install (dnfctx, (const char **)modules, error))
return glnx_prefix_error (error, "Installing modules");
we_got_modules = TRUE;
}

/* By default, when enabling a module, trying to install a package "foo" will
* always prioritize the "foo" in the module. This is what we want, but in the
* case of pinned repo packages, we want to be able to override that. So we
* need to fiddle with the modular excludes. */
if (we_got_modules && pinned_pkgs && dnf_packageset_count (pinned_pkgs) > 0)
{
g_autoptr (DnfPackageSet) excludes = dnf_sack_get_module_excludes (sack);
g_autoptr (DnfPackageSet) cloned_pkgs = dnf_packageset_clone (pinned_pkgs);
Map *m = dnf_packageset_get_map (cloned_pkgs);
map_invertall (m);
map_and (dnf_packageset_get_map (excludes), m);
dnf_sack_set_module_excludes (sack, excludes);
}
return glnx_throw (error, "Modularity is no longer supported");

/* And finally, handle packages to install from all enabled repos */
g_autoptr (GPtrArray) missing_pkgs = NULL;
Expand Down
43 changes: 0 additions & 43 deletions tests/compose/test-basic-unified.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ treefile_append "repos" '["test-repo"]'
build_rpm foobar recommends foobar-rec post "test -f /run/ostree-booted"
build_rpm foobar-rec

# check that even a modular version of a pinned pkg is ignored, even if it's
# higher version
build_rpm foobar version 99.9
build_module foo \
stream foo \
rpm foobar-0:99.9-1.x86_64

uinfo_cmd add TEST-SEC-LOW security low
build_rpm vuln-pkg uinfo TEST-SEC-LOW
uinfo_cmd add-ref TEST-SEC-LOW 1 http://example.com/vuln1 "CVE-12-34 vuln1"
Expand All @@ -33,11 +26,6 @@ tf['repo-packages'] = [{
}]
"

treefile_pyedit "tf['modules'] = {
'enable': [],
'install': [],
}"

# also test repovar substitution
treefile_pyedit "tf['repovars'] = {
'foobar': 'yumrepo',
Expand All @@ -46,28 +34,6 @@ treefile_pyedit "tf['repovars'] = {
sed -i -e 's,baseurl=\(.*\)/yumrepo,baseurl=\1/$foobar,' yumrepo.repo
assert_file_has_content_literal yumrepo.repo '$foobar'

build_rpm foomodular requires foomodular-ext
build_rpm foomodular-ext
build_rpm foomodular-optional
build_module foomodular \
stream mystream \
profile myprof:foomodular \
rpm foomodular-0:1.0-1.x86_64 \
rpm foomodular-ext-0:1.0-1.x86_64 \
rpm foomodular-optional-0:1.0-1.x86_64
treefile_pyedit "tf['modules']['install'] += ['foomodular:mystream/myprof']"

build_rpm barmodular requires barmodular-ext
build_rpm barmodular-ext
build_rpm barmodular-optional
build_module barmodular \
stream latest \
rpm barmodular-0:1.0-1.x86_64 \
rpm barmodular-ext-0:1.0-1.x86_64 \
rpm barmodular-optional-0:1.0-1.x86_64
treefile_pyedit "tf['modules']['enable'] += ['barmodular:latest']"
treefile_append "packages" '["barmodular"]'

# Test --print-only. We also
# just in this test (for now) use ${basearch} to test substitution.
# shellcheck disable=SC2016
Expand Down Expand Up @@ -164,15 +130,6 @@ assert_not_file_has_content_literal db-diff-adv.txt TEST-SEC-LOW
assert_file_has_content_literal db-diff-adv.txt TEST-SEC-CRIT
echo "ok db diff --advisories"

rpm-ostree db list --repo="${repo}" "${treeref}" > db-list.txt
assert_file_has_content_literal db-list.txt foomodular-1.0-1.x86_64
assert_file_has_content_literal db-list.txt foomodular-ext-1.0-1.x86_64
assert_not_file_has_content_literal db-list.txt foomodular-optional
assert_file_has_content_literal db-list.txt barmodular-1.0-1.x86_64
assert_file_has_content_literal db-list.txt barmodular-ext-1.0-1.x86_64
assert_not_file_has_content_literal db-list.txt barmodular-optional
echo "ok modules"

build_rpm dodo-base
build_rpm dodo requires dodo-base
build_rpm solitaire
Expand Down

0 comments on commit 1ba3a7b

Please sign in to comment.