543 Commits

Author SHA1 Message Date
Matt Prahl
f4af515dad Merge #1100 Fix handling of SRPMs in Content Generator builds when SRPM name and main package name are different. 2018-12-12 15:26:59 +00:00
Jan Kaluza
7e7f298381 Fix handling of SRPMs in Content Generator builds when SRPM name and main package name are different.
Current code presumes SRPM name always matches the RPM name built out of this SRPM
and only includes it together with the main package in this case. This is wrong
assumption, because usually there are multiple binary RPMs built from single SRPM.

This commit fixes that by including the SRPM NEVRA in `non_devel_source_rpms`
no matter what RPM name is.

The test RPMs are reworked in this commit to match the reality better - especially
the relations between SRPM and RPMs. The case with different SRPM name and RPM
name is also included in the reworked test - dhcp-libs binary RPM built from
dhcp SRPM.
2018-12-12 16:25:20 +01:00
mprahl
96f82443aa Remove the unused "owner" parameter from KojiModuleBuilder.get_session 2018-12-10 09:59:42 -05:00
Chenxiong Qi
cbb8156311 Add tests for use of anonymous koji session
This patch also clean and rewrite some tests that are relative to use
anonymous koji session.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-12-07 18:37:36 +08:00
mprahl
9604da1b22 Fix a flake8 error 2018-12-05 09:13:26 -05:00
Chenxiong Qi
5579a0e72b Init event handler handles module stream collision
Fixes: FACTORY-3616

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-12-05 18:25:14 +08:00
Matt Prahl
8d36d97a5d Merge #1085 Show expanded buildrequires in API output 2018-12-04 16:57:12 +00:00
Chenxiong Qi
0c642a0944 Fix deprecation warnings from log.warn and inspect.getargspec
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-12-04 18:35:56 +08:00
mprahl
25b6a93a07 Make the devel Koji CG build optional using a config option 2018-12-03 12:00:30 -05:00
Chenxiong Qi
41481afc75 Remove unuseful topurl from tests
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-27 11:06:34 +08:00
Chenxiong Qi
1cd64d336a Fix some minor issues
* Fix failure test after rebasing on master branch.
* Fix some grammar issues.
* Only check stream collision modules on new created module build.
* Logging message properly.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-27 11:06:34 +08:00
Chenxiong Qi
d517a72de9 Add _get_module in DBResolver and fix _record_ursine_rpms
_record_ursine_rpms needs to get each collision module's koji_tag and
then get built RPMs from that koji_tag eventually. _get_module on each
individual resolver is called to get module metadata accordingly. So,
when running a local build, module metadata is got from remote MBS, and
for a MBS instance, connected database is queried.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-27 11:06:34 +08:00
Chenxiong Qi
5d3ea762c6 Make external repo URL prefix configurable
Not both Fedora and internal Brew uses config topurl as the external
repo's URL prefix. Hence, make it configurable to fulfill this
difference.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-27 11:06:34 +08:00
Chenxiong Qi
917c06ad0c Resolve stream collision with modules added to ursine content
This resolve the stream collision by adding specific RPMs to
module-build-macros SRPM as Conflicts.

For more information about module stream collision, please refer to
docstring in utils/ursine.py

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-27 11:06:34 +08:00
Chenxiong Qi
04b5a9a2a7 Show expanded buildrequires in API output
ModuleBuild.json now includes xmd/mbs/buildrequires in the output JSON
data. As a result, these APIs will show buildrequires by default.

* /module-builds/
* /module-builds/?verbose=True
* /module-builds/$build_id

Buildrequires is accessible like this:

    br_module_names = response_json['buildrequires'].keys()
    br_module_dict = response_json['buildrequires'][module name]

Fixes: FACTORY-2201

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-23 17:40:23 +08:00
Luiz Carvalho
086ed4a3f3 Remove dangling -debug* RPMs from final MMD
If an RPM is not included, its correspnding -debug* RPMs should also not
be included.

Also ensure that source RPMs are only ever added to -devel modules if
a binary RPM has been completely excluded from non-devel module.

Internal ref: FACTORY-3263

Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
2018-11-21 13:56:20 -05:00
Jan Kaluza
fe88cffa21 Require non-devel module in -devel module. Clear API list and profiles for -devel. 2018-11-21 15:16:36 +01:00
Jan Kaluza
f5e3c81b0c Import original source modulemd file as stored in dist-git to CG build.
There is a need to ship the unchanged source file which was used to build
a module build from legal reasons. The KojiContentGenerator is extended
in this commit to fetch it from SCM URL using the `scm` module and later
attach it as `modulemd.src.txt` to Koji CG build.
2018-11-21 14:22:58 +01:00
Jan Kaluža
98aa2ea19f Merge #1080 Do not retreive rpm info if there is an empty rpm list 2018-11-21 10:10:25 +00:00
Chenxiong Qi
b5860fa039 Make it optional to tag build for CG import
Fixes FACTORY-3467

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-21 09:28:03 +08:00
Valerij Maljulin
f3c86541b6 Do not retreive rpm info if there is an empty rpm list.
Fixes #1078

Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2018-11-20 10:45:17 +01:00
Jan Kaluza
343d145180 Do not leak internal data into final MMD files attached to CG build.
This commit introduces KojiContentGenerator._sanitize_mmd method to:
- remove `repository` and `cache` from ComponentRPM in Modulemd.
- remove `mbs` section from `xmd`.

This is done to not leak internal build-only information to final
modulemd files.
2018-11-19 09:51:27 +01:00
Valerij Maljulin
8adce7593b set module build state to 'failed' imediately
Fixes #1009

Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2018-11-15 17:13:34 +01:00
Chenxiong Qi
b577b0f9e1 Refactor SCM.get_latest
git-ls-remote accepts paramter refs to just return refs for specific
ones. This refactor uses this parameter to avoid handling full list of
refs from remote repository.

In original code, option --exit-code is passed to git-ls-remote, which
would cause command return exit code 2 when no ref is found from remote
repository. SCM._run raises an error if that happens, but the raised
error is not handled. This refactor catches this error to ensure the
original behavior happens, that is if a ref is not found, treat it as a
commit hash and call SCM.get_full_commit_hash.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-07 11:02:40 +08: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
Matt Prahl
1c104d0401 Merge #1062 Import -devel CG build with RPMs which are filtered out of the current real CG build. 2018-10-30 15:35:33 +00:00
Jan Kaluza
13ab18425a Import -devel CG build with RPMs which are filtered out of the current real CG build.
For some modules, modularity-wg wants to be able to ship the "-devel" modules containing
the RPMs which are normally filtered out from the module.

This PR generates second Koji CG module with -devel suffix in a name with final modulemd
files containing the filtered out RPMs.
2018-10-30 13:49:12 +01:00
mprahl
f7e7765686 Add the ability to override buildrequires and requires when submitting a module build
This will allow for tooling to automatically override certain buildrequires and requires
based on the branch name the modulemd is built form.

Addresses FACTORY-3414
2018-10-29 17:08:27 -04:00
Matt Prahl
7a0360728a Merge #1059 Remove duplicate modulemds returned in utils.mse._get_base_module_mmds 2018-10-29 13:00:19 +00:00
mprahl
85401c2e1e Surface an error to the user when no base module could be found in the module's buildrequires 2018-10-26 14:47:01 -04:00
mprahl
1633e55917 Remove duplicate modulemds returned in utils.mse._get_base_module_mmds 2018-10-26 14:39:54 -04:00
Jan Kaluza
f2a236bc74 Pass buildrequired modules built against all compatible base module streams to MMDResolver.
Imagine we have "platform:f29.0.0" and "platform:f29.1.0" base modules.
We also have "DBI" module we want to build agaisnt "platform:f29.1.0".
This "DBI" module depends on "perl" module which is only build against
"platform:f29.0.0".

Currently, DBI build would fail to resolve the dependencies, because
it wouldn't find "perl" module, because it is built against different
platform stream.

This PR changes the MSE code to include buildrequired module builds built
against all the compatible platform streams.

It does so by introducing following changes:

- MSE code uses new get_base_module_mmds() method to find out all the
  compatible platform modules. This needed new methods in DBResolver
  and MBSResolver.
- For each buildrequired module defined by name:stream, the MSE code then
  finds particular NSVC built against each compatible platform module.

Side effect of these code changes is that every module now must buildrequire
some base module.
2018-10-26 14:02:36 +02: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
ff758a48f1 Include also 'src' RPMs in the final RPMs list.
This fixes regression introduced in previous bcb104a16 commit.
2018-10-25 09:08:52 +02:00
Chenxiong Qi
db4dbe3b25 Remove unused parameter session
_get_mmds_from_requires does not do anything against db.session. Hence,
remove parameter session from it and
get_mmds_required_by_module_recursively.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-10-22 11:48:04 +08:00
Chenxiong Qi
20de3d2e94 Make _make_module reusable
TestUtilsModuleStreamExpansion._make_module is moved to
tests/__init__.py so that other tests could reuse this to create a
module build.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-10-19 15:58:47 +08: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
mprahl
599c881714 Add the ability to query by the base modules a module build buildrequires
Future use cases will require the ability to find compatible module builds
to buildrequire based on the base module the module used to build. This
commit adds an association table that will contain module build IDs
and the base module they buildrequire.

Addresses FACTORY-3353
2018-10-17 07:47:31 -04:00
mprahl
4f9fffff3b Move some of the logic in get_prefixed_version to a ModuleBuild static method
The logic used to parse the stream version will need to be reused elsewhere
to support the filtering and ordering of a base module stream version.
2018-10-16 10:26:39 -04:00
Valerij Maljulin
8ee7168017 get_reusable_component now checks the architecture
Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2018-10-16 13:44:18 +02:00
Jan Kaluža
2c29d9095e Merge #1040 Fix wrong inclusion of non-multilib packages in final MMD. 2018-10-16 07:10:33 +00:00
Jan Kaluza
bcb104a16a Fix wrong inclusion of non-multilib packages in final MMD.
The original Pungi code, on which MBS code is based on, always passed only RPMs
with valid architectures to further decide if their subset should end up in a
final modulemd file.

In MBS, we pass RPMs with all architecture and there was no code to actually filter
out the RPMs which are from architectures which should never end up in a final MMD.

This commit checks that RPMs for completely different architectures will never
be considered to be included in a final MMD.
2018-10-16 09:08:14 +02:00
Valerij Maljulin
7f60db545a renaming koji_arches to arches
Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2018-10-15 15:29:50 +02:00
Valerij Maljulin
924a0951fb add architectures support for format_mmd 2018-10-15 15:29:50 +02:00
mprahl
117791ee16 Prefix the component disttag with the platform stream 2018-10-04 07:19:07 -04:00
mprahl
cfb75b4d0f Prefix the module version based on the platform it buildrequires 2018-10-04 07:19:07 -04:00
Matt Prahl
456ab29c8e Merge #1031 Fix filtering noarch RPMs 2018-10-02 16:58:54 +00:00
Jan Kaluza
4d0d0cb0df Add test for filtering noarch RPMs with excludearch and multilib. 2018-10-02 07:38:55 +02:00
Jan Kaluža
d5747b19eb Merge #1026 Add singleton system_resolver 2018-10-01 14:11:33 +00:00
Chenxiong Qi
0a15989f88 Add koji_tag into resolved buildrequires
This is useful for an issue I'm working on, for which I need to get
platform module's koji_tag.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-09-28 12:09:07 +08:00