Commit Graph

63 Commits

Author SHA1 Message Date
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
mprahl
83bc780a23 Add backwards-compatibility for cloning local repos with the artifact name and not the full path
This addresses #1211
2019-04-11 10:23:12 -04:00
Owen W. Taylor
da57146bf2 GenericBuilder: Add a boolean 'succeeded' parameter to finalize
Previously MockModuleBuilder was checking the module state to see if
it should run a final createrepo, but since eafa93037f, finalize() is
called before changing the module state; add an explicit boolean to
GenericBuilder.finalize() to avoid worrying about ordering.
2019-04-03 18:12:57 +00:00
Jan Kaluza
4bc6e7ed65 Set the $releasever variable in Mock config. 2019-04-02 14:04:16 +00:00
Jan Kaluza
1c535fa755 Set the module_platform_id in the yum.conf 2019-04-01 13:13:08 +00:00
Jan Kaluza
360a8f3b84 Add support for local component repository using file://.
This is needed for offline local builds to build a component which is
stored on local git repository.

This PR also adds OfflineLocalBuildConfiguration configuration class
for offline local builds to set the RESOLVER.
2019-04-01 13:13:08 +00:00
Jan Kaluza
67a5a9d1b0 Allow building module in --offline module with dependencies from local repositories.
There are following changes introduced in this commit:

- The `koji_tag` of module builds imported from the local repositories
  is now in `repofile:///etc/yum.repos.d/some.repo` format to store the
  repository from which the module was imported to local MBS DB.
- The `koji_tag` of fake base module is set to empty `repofile://`
  and in `MockModuleBuilder` the `conf.base_module_repofiles` list
  is used as source for the repositories defining platform. We can't
  simply use single repository, because there might be fedora.repo
  and fedora-update.repo and so on.
- The list of default .repo files for platform are passed using the
  `-r` switch in `build_module_locally` `mbs-manager` command.
- The LocalResolver (subclass of DBResolver) is added which is used
  to resolve the build dependencies when building modules offline
  locally.
- The `MockModuleBuilder` enables the buildrequired modules and
  repositories from which they come in the mock config.

With this commit, it is possible to build testmodule locally
without any external infra.
2019-04-01 13:13:08 +00:00
Merlin Mathesius
152419f376 Module scratch build fixups per PR review feedback:
- Keep scratch module builds in the 'done' state.
- Make koji tagging for scratch modules unique so the same
  commit can be resubmitted.
- Use alternate prefix for scratch module build components so they can
  be identified later.
- Prevent scratch build components from being reused.
- Assorted code and comment cleanup.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-01 10:27:04 -06:00
Merlin Mathesius
dd950857ec Update koji tagging for scratch modules.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-01 10:27:04 -06:00
mprahl
96f82443aa Remove the unused "owner" parameter from KojiModuleBuilder.get_session 2018-12-10 09:59:42 -05:00
Chenxiong Qi
55add5cfc0 Use anonymous Koji session properly
MBS calls some read-only Koji APIs which does not require to log into a
session. This patch makes it optional to choose whether to login a
session and use anonymous session properly to call those read-only APIs.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-12-06 16:31:12 +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
Owen W. Taylor
b31fb65cef MockModuleBuilder: Don't run the final createrepo if the module build failed
The build steps assume that the the repository for the build is non-modular,
so after the final createrepo is run with include_module_yaml=True, it's
impossible to repeat a build steps. Running mock -c <failed_config> build is
quite useful for debugging a failed build (even though it's hard to find the
right config) - skipping the final createrepo step for failed module builds
makes it work as expected.
2018-10-06 10:33:37 -04:00
Ralph Bean
cfe32afcd0 Rename LocalBuilder to SRPMBuilder and change type detection.
First, rename LocalBuilder to SRPMBuilder.  Reading the manpage for mock tells
me that the `--rebuild` option is specifically for rebuilding a given srpm.
The class was just named poorly (imo).

Second, change the type detection.  The bug I'm trying to fix is if you try to
pass a string for the `repository:` in your modulemd like
`file:///home/user/repos/libfoo/`.  The old logic here would assume that it is
an srpm since it didn't start with "git" or "http", but that's not correct.  We
have people who want to experiment with building modules with components that
are not publicly accessible over the network - which are only local.  This
change allows that.
2018-09-07 09:23:11 -04:00
mprahl
36a9026ca8 Remove references to COPR 2018-06-28 10:00:06 -04:00
Ralph Bean
6981449853 Fix local builds.
I discovered that local builds have been broken by recent (good) changes in
dnf.  At the end of every batch, we regenerate the local repo with createrepo
and we also call modifyrepo to include the modulemd file as we progress.  This
was added in #467.

What we really want, is for the modulemd file to be present at the *end* of the
build.

Recently, dnf started respecting the modulemd file natively, such that builds
we built in batch0 would not show up in batch1.  They would be present in the
repo, but they would be marked as belonging to a module which was not enabled,
and so could not be pulled in.  Every module build would fail because
module-srpm-macros was in a disabled module (the module being built at the
time).

This change makes it so that the module metadata is only added to the repo at
the very end of the build.  I moved it into a `finalize` method on the builder
which the copr builder was using, and for symmetry's sake I moved the koji
content generator code to the same method on that builder.

There was a circular import issue to solve between the koji module builder and
the koji content generator modules that generated a larger diff, but is mostly
cosmetic and mock changes.
2018-06-25 17:05:22 -04:00
Owen W. Taylor
ddee4f840b MockModuleBuilder: add artifacts to artifacts not components
The built RPM artifacts were being added to the components list (the
RPMs to build) instead of the proper artifacts section. Also, they
need to be in NEVRA format, so use 'rpm -qf' to query the epochs from
the built artifacts.
2018-05-30 15:47:14 -04:00
Jan Kaluza
e5e9a24fce Allow adding bool to XMD. Fix flake8 issues. 2018-04-03 09:58:57 -04:00
mprahl
f0852d9009 Port to libmodulemd and support v2 modulemd without module stream expansion 2018-04-03 09:58:57 -04:00
Yash Nanavati
ed25afd9ec Code changes for Python 3 support 2018-03-04 03:22:38 -05:00
Yash Nanavati
1d3fd2af64 Minor changes towards Python 3 Compatability 2018-02-28 09:01:51 -05:00
mprahl
2651d53603 Use external repos tied to the Koji tags on local builds 2018-01-29 14:34:04 -05:00
mprahl
2a018a649f Add consistency to the type of quotes used in "buildroot_add_repos" 2018-01-29 14:33:35 -05:00
mprahl
55d07aa8f5 Use Koji repos if possible during local builds 2018-01-18 17:02:03 -05:00
Martin Curlej
1eb3c653dd Changed the filters so they execute when everything is build
Signed-off-by: Martin Curlej <mcurlej@redhat.com>
2017-10-31 16:04:31 -04:00
Martin Curlej
60b3d97c97 flake8 cleanup
Signed-off-by: Martin Curlej <mcurlej@redhat.com>

removed some noqa tags
2017-10-25 12:13:59 +02:00
mprahl
f5de140521 Schedule components based on build time 2017-10-23 15:33:57 -04:00
Ralph Bean
d5344b0c63 Fix a typo.
Definitely a typo.  It would be a `NameError`.  There is no `name` here.
2017-10-02 16:22:14 -04:00
Filip Valder
be7c8d7aff Fix #661: mbs hard-codes x86_64 as the local architecture 2017-09-15 15:18:02 +02:00
Filip Valder
f86654c655 Fix #641 - mock configuration is hardcoded 2017-09-13 15:09:56 +02:00
Jan Kaluza
8c3ca6986e Filter out packages in Mock backend based on the mmd filter 2017-08-31 10:47:16 -04:00
Jan Kaluža
77ac0db625 Merge #644 Add 'mbs-build local [[--add-local-build n:s:v], ...]' to use local builds as dependency. 2017-08-17 08:07:43 +00:00
Jan Kaluza
aac4227eb8 Add 'mbs-build local [[--add-local-build n:s:v], ...]' to use local builds as dependency. 2017-08-17 10:00:19 +02:00
Filip Valder
6a2e9aeddd Fix #576: Remove empty/useless log files 2017-08-16 13:39:59 +02:00
Filip Valder
7ef2975984 PEP8 fixes 2017-07-17 18:29:10 +02:00
Ralph Bean
a755104bd4 Fix the test suite.
We had some circular imports that caused the tests (and more?) to fail.

I ran into this when looking at the tests for #583 and #595.
2017-07-06 21:02:32 -04:00
Owen W. Taylor
40ececa5a0 MockModuleBuilder: Fix thread safety problem with distgit-clone-wrapper
Multiple build threads would try to write to the same distgit-clone-wrapper
location, which could result in ETXTBSY when one thread tried to execute
a script that another was writing to or vice-versa.

Instead of using a wrapper script, use a sh -c invocation for distgit_get.

https://pagure.io/fm-orchestrator/issue/592
2017-06-16 06:14:07 -04:00
Owen W. Taylor
786dd2f301 MockModuleBuilder: move generated artifacts to the final directory, instead of copying them
There's no good reason to have artifacts in both the thread-specific results directory
and in the main results directory, so just move them across instead of copying them.

https://pagure.io/fm-orchestrator/issue/591
2017-06-15 16:30:04 -04:00
Owen W. Taylor
280facdbe0 MockModuleBuilder: Pass an explicit pkglist to createrepo_c
createrepo_c recursively looks for RPMs in the target directory and
subdirectories, meaning that it was finding RPMs in the thread-specific
directories. Pass in an explicit list of RPMs at the toplevel.

https://pagure.io/fm-orchestrator/issue/591
2017-06-15 16:25:04 -04:00
Jan Kaluza
4b16cf9a64 Fix various bugs in 'mbs-build local' 2017-06-07 13:16:26 +02:00
Jakub Kadlčík
c7e8ba2f1d MockModuleBuilder does not use build_from_scm function anymore 2017-05-30 14:50:09 +02:00
Petr Šabata
84df0b4ef1 Use modulemd.dump_all to create local repodata
Both pungi and dnf use the new multidocument format, with the
old one not really being supported by anything at this point.
Let's be compatible.

This change requires modulemd-1.2.0+.

Signed-off-by: Petr Šabata <contyk@redhat.com>
2017-05-26 09:40:37 +02:00
Jakub Kadlčík
99ba03b52d Move also distgit_src_get command to config 2017-05-17 16:23:16 +02:00
Jakub Kadlčík
8c8ea65b2e Don't hardcode dist-git clone command 2017-05-16 16:26:24 +02:00
Jakub Kadlčík
9e4c43a315 Use commit hash from source as branch 2017-05-16 15:20:28 +02:00
Jakub Kadlčík
8a258c3ad7 Use master branch 2017-05-16 14:51:40 +02:00
Jakub Kadlčík
1af400de02 Obtain SRPM from distgit via mock SCM 2017-05-16 14:51:40 +02:00
Jakub Kadlčík
14757ec3ad Implement classes for building srpms via mock 2017-05-16 14:51:40 +02:00
Jan Kaluza
e9e7f44d70 Mock: Set user_bootstrap_container to False to fix module builds with latest Mock 2017-05-09 14:22:44 +02:00