Commit Graph

23 Commits

Author SHA1 Message Date
Chenxiong Qi
e6aa47e02a Use set literal to create a set
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-15 21:14:02 +08:00
Chenxiong Qi
b242b12136 Remove handling of negative deps in _deps2reqs
Fixes #1338

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-22 15:24:07 +08:00
mprahl
0466ac394b Call _get_base_module_stream_overrides when the module is not the input module
This just simplifies the code. It doesn't change the functionality
at all. The tests had to be changed because it assumed that the
xmd.mbs.buildrequires section would be filled out for the input
module which isn't true.
2019-07-15 13:17:36 -04:00
Jan Kaluza
2778c39765 Allow buildrequiring modules built against all platform streams.
This commit fixes issue with following situation:

Module `foo` has been built with `buildrequires: platform: [f28]`
and `requires: platform: []`. It can therefore be used as a buildrequirement
on any platform stream. But if you want to build module `app` which
buildrequires `foo` on `platform:f30`, the MBS won't pull-in the `foo`
module build, because MBS currently limits the modules by the platform
they have been built for.

This commit adds new config option to allow including modules built
against any platform stream.
2019-06-17 07:25:50 +02:00
mprahl
14098cea08 Migrate to libmodulemd v2
This also moves the methods load_mmd and load_mmd_file to
module_build_service.utils.general.

This also removes some MSE unit tests with a mix of positive and
negative streams since this is not supported in libmodulemd v2. The
user will be presented with a syntax error if they try to submit
such a modulemd file.
2019-05-13 13:40:37 -04:00
mprahl
66c3f82160 Format the coding style across the codebase using "black" and manual tweaks
The main benefit of this commit is that the use of double quotes
is now consistent.
2019-04-26 00:32:13 -04:00
Chenxiong Qi
7c993f9165 Handle streams in base module stream
A base module's stream (the platform for RHEL) could have Z-stream suffix, e.g.
el8.0.0.z, this patch handles this Z-stream suffix and other potential streams
by returning the stream version as a float with configured suffix value. For
example, el8.1.0.z would be parsed as 080100.1. Note that, the 0.1 is totally
configured in config and it actually could be any value according to concrete
cases in practice.

Config STREAM_SUFFIXES is enabled in TestConfiguration so that tests depending
on the return value from ModuleBuild.get_stream_version are covered.

Part fixture of test TestMMDResolver.test_solve_virtual_streams is updated by
adding Z-stream suffix to platform:el8.2.0 in order to ensure this patch does
not break the MMD resolver.

Addresses FACTORY-4307

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-04-23 11:21:46 +08:00
Jan Kaluza
d1f6631f3b Fix traceback in MMDResolver when transitive dependency cannot be satisfied.
This fixes problems from #1184 when new platform stream is added and the
input module depends on another module which is not built against this
new platform, but in the same time the input module wants to be built
against this new platform stream. See the unit-test for more info.

The problem is that `MMDResolver.solve()` method sets the `alternative`
to an empty list and stores the data there only if the alternative
is found valid. If the alternative is not found valid, then it stays
set to an empty list, but the code using `alternative` later expects
it to only contains valid alternatives.

This commit fixes this by setting the `alternative` only in a case
we found it is valid alternative.
2019-03-27 06:36:43 +01:00
Chenxiong Qi
879d0daca0 Detect transitive stream collision
For an explanation of transitive stream collision, please refer to the
source code docstring.

When such collision is detected, error is raised with proper error
message.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-06 20:27:43 +08:00
Jan Kaluza
6b496dfde4 Add tests for "Conflicts: module(name)" in MMDResolver.
The test tests installation of multiple streams of single module.
For example:
 - "app:1" requires "foo:1" and "gtk:1".
 - "foo:1" requires "bar:1".
 - "gtk:1" requires "bar:2".
"bar:1" and "bar:2" cannot be installed in the same time and therefore
there need to be conflict defined between them.
2018-10-25 16:01:36 +02:00
Jan Kaluza
192eaae012 Support Virtual Streams in MMDResolver.
Modularity team needs to be able to define multiple streams for single "platform"
module. They need it to express that "platform:el8.1.0" also provides "platform:el8".

This needs changes in a way how MMDResolver resolves dependencies between modules.

For example, if we are building module against platform:el8.1.0, the MMDResolver must
not return buildrequired module built against platform > el8.1.0, but it can for example
return (cherry-pick) buildrequired module from platform:el8.0.0 if there is no such
module built for platform:el8.1.0.

The way how it is implemented is following:

  - MMDResolver reads list of virtual streams from xmd["mbs"]["virtual_streams"] when
    creating Solvable from MMD and adds additional Provides for these virtual streams.
    We expect these to be set mainly on base modules. The versions of such provides
    are based on "stream version" number, so we can compare them.
  - The base module ("platform") buildrequires of MMDs added to MMDResolver are overriden
    to mark particular platform "stream version". For example, if module "foo" buildrequires
    "platform:el8" in MMD file, but was in fact built against platform:el8.1.0, it will
    be treated as if it would really buildrequire "platform:el8.1.0". This is needed
    to not include buildrequired modules built against newer platform than what we want.
  - MMDResolver resolves all the valid combinations of buildrequires, but we are only
    interested in the one with latest versions of buildrequired module. Therefore the
    solve() method is changed to find out combinations which have the latest versions
    for each alternative name:stream buildrequires.
2018-10-18 15:06:04 +02:00
Jan Kaluza
e5e9a24fce Allow adding bool to XMD. Fix flake8 issues. 2018-04-03 09:58:57 -04:00
Igor Gnatenko
90f292c7f5 tests/mmd_resolver: add test for multiple runtime requires
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
32d053dd98 tests/mmd_resolver: simplify testing
And try to use some real names.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
d38d55451d tests/mmd_resolver: test empty inclusion/exclusion dependency
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
85af781920 mmd_resolver: add support for streams exclusion
Also fix support for dependencies with empty streams list.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
e3490d129a mmd_resolver: generate combinations only for top-level dependencies
Reported-by: Petr Šabata <contyk@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Jan Kaluža
c925ebbd34 tests/mmd_resolver: add tests for multi-dependency modules
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
0f26e1af62 tests/mmd_resolver: deduplicate code for generation test modules
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
8174b933b0 tests/mmd_resolver: add support for multi-dependency modules
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
7cbd0a0301 mmd_resolver: rework solvables generation
Now we have good separation between runtime and buildtime dependencies:
If mmd has context, it is built artefact which supposed to have only one
dependency entry, we create solvable with real arch for it. Otherwise we
create multiple solvables with "src" arch.

In "src" solvables, "context" is a number which represents index in
dependencies array.

Stream is not included anymore in "evr" because it's incomparable.
Version is not included anymore in "name" because it's there just for
comparison, nothing more (it's not different module-stream).

As a side, add_requires/add_conflicts/add_provides were replaced with
non-deprecated add_deparray method.

With all this, we are ready to handle MMDs which have multiple elements
in dependencies (modulemd v2).

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Igor Gnatenko
9ce5dffb14 mmd_resolver: rewrite function for finding alternatives
Previous version was assuming that number of alternatives is static
which is wrong, they can be appearing depending on solvables.

Also it was checking even impossible combinations (due to using
itertools.product).

Now we check only real possibilities.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Jan Kaluža
e7587cb77b add MMDResolver to find possible combinations between modules
Using libsolv for solving part and libmodulemd for getting the data.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00