Commit Graph

126 Commits

Author SHA1 Message Date
Lubomír Sedlář c9f34b6684 gather: Only parse pungi log once
No need to read the file three times, we can just get all the data in
one go.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-08-09 11:04:14 +02:00
Lubomír Sedlář cef8650c3e gather: Report missing comps packages
When a package mentioned in comps is not available in the package set,
print a warning about this. Additionally there is a config option that
allows to turn this warning into a fatal error.

Fixes: https://pagure.io/pungi/issue/50
Fixes: https://pagure.io/pungi/issue/683
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-08-09 11:04:14 +02:00
Lubomír Sedlář 1d7617f783 gather: Avoid reading whole log into memory
There's no reason for reading the whole log of depsolving into memory
just to split it into lines and process one line at a time.

We can just as well read it in chunks.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-08-09 11:04:14 +02:00
Qixiang Wan 0a3e5b27bf remove the dependency of rpmUtils
The rpmUtils module is provided yum-utils package, which is only
available for Python 2. There is no replacement for the functionality in
DNF.

There is a proposal to add this functionality to rpm itself, but it's
not really moving forward very much:
https://bugzilla.redhat.com/show_bug.cgi?id=1072972

As a short term solution let's copy the needed parts of rpmUtils.arch
module directly to pungi code base.

Fixes: https://pagure.io/pungi/issue/533
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-07-26 11:23:16 +02:00
Lubomír Sedlář 8c48dfb93a gather: nodeps should take packages from comps groups
When gather_method is set to nodeps, we should not ignore the comps
group that the method received. Instead it should find out which
packages are in those groups and take them into the compose.

In order for this to be of any reasonable use, the comps file needs to
include all dependencies for the packages.

Fixes: #653
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-07-11 10:21:13 +02:00
Lubomír Sedlář ecbb43ab86 variants-wrapper: Remove main() function
Nothing is calling this code, and it's only really useful for manual
testing of parsing.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-06-27 09:36:48 +02:00
Lubomír Sedlář 81b71b9ed3 koji-wrapper: Handle failed subtasks
If a subtask fails, we can't ask about it's results as that would raise
an exception. We can safely assume that since the parent succeeded, any
failed child is actually allowed to fail.

Fixes: #641
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-06-12 18:15:29 +02:00
Lubomír Sedlář 1db1abbb82 koji-wrapper: Stop mangling env variables
When koji is authenticated with a keytab, by setting the private
directory we erased rest of existing environment. In non-keytab path,
the environment variables got removed as well.

This patch makes sure that the environment will not be modified more
than necessary (by setting KRB5CCNAME if needed).

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-06-05 12:46:45 +02:00
Lubomír Sedlář 8c237b78c2 comps-wrapper: Report unknown package types
When there is a typo in the comps file, instead of crashing with a
non-descript KeyError we should raise a nice error with details about
the problem.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-06-01 09:59:41 +02:00
Lubomír Sedlář 63c0bbc5c9 iso-wrapper: Capture debug information for mounting
Occasionally we have seen the mount command fail. The default error
message says to set some environment variables and try again. We can
just always set the environment and only print the output on failure.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-05-29 13:18:07 +02:00
Lubomír Sedlář 77ee882c21 comps-wrapper: Fix crash on conditional packages
A `requires` attribute is taken from a wrong package (because of a wrong
variable used: `pkg` vs. `package`). On RHEL 6 this actually leads to a
crash. Let's use only one name to avoid such problems.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-05-29 13:11:49 +02:00
Lubomír Sedlář f27f3ce4ba koji-wrapper: Run all blocking commands with fresh ccache
If keytab is used for authentication, other commands than runroot can
possibly fail due to the credentials cache being overwritten.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-05-29 12:53:29 +02:00
Jan Kaluza 68351fa5a8 Add @retry decorator and use it to retry connection on PDC on IOError and in SCM's retry_run.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2017-05-29 11:33:23 +02:00
Jan Kaluza d037d61521 Store RPM artifacts in resulting repository in modulemd metadata.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2017-05-04 21:12:30 +02:00
Lubomír Sedlář 6ce88630ec variants: Remove redundant check
This situation is handled by schema validation already, so this
condition can never really fire.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-05-03 14:51:39 +02:00
Lubomír Sedlář 55058f1590 scm-wrapper: Remove unused arguments
There are a couple arguments that are never used. We can just remove
them. This also fixes a bug where temporary files would be left
undeleted in tests.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-27 15:59:26 +02:00
Lubomír Sedlář 059449e140 koji-wrapper: Run koji runroot with fresh credentials cache
If the koji profile we are using is configured to use keytab, we should
run koji executable with a fresh credentials cache. Otherwise we risk a
race condition as multiple processes will trample over the same
directory in /tmp/krbcc_0.

This is currently only implemented for calling `koji runroot`. We might
need to do it for other commands as well (currently there is a sleep to
avoid the race condition for other commands).

Fixes: https://pagure.io/releng/issue/6715
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-25 15:45:00 +02:00
Lubomír Sedlář 7028399403 util: Move get_buildroot_rpms to koji wrapper
This way the util module does not import the particular wrapper.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-25 15:22:41 +02:00
Lubomír Sedlář 180a5b94a9 comps-wrapper: Reduce duplication in code
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 11:45:23 +02:00
Lubomír Sedlář 3861be3e08 comps-wrapper: Port to libcomps
Instead of replacing yum.comps with an something from DNF, we can go
directly to libcomps. DNF does not have the equivalent functionality
(particularly it's impossible to load comps from file directly).

We would have depended on libcomps anyway transitively, so this is not a
big deal.

Fixes: #587
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 11:45:23 +02:00
Lubomír Sedlář 39c3f42f77 comps-wrapper: Sort langpacks by name
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 11:45:23 +02:00
Lubomír Sedlář e5dc69cd41 comps-wrapper: Minor code cleanup
Use context manager for opening file, reduce duplication in creating
nodes with boolean values.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 11:45:23 +02:00
Lubomír Sedlář daf3628594 comps-wrapper: Fix uservisible not being modifiable
The group uservisible attribute can now be modified in variants XML.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 10:28:26 +02:00
Lubomír Sedlář 20005adb98 comps-wrapper: Return IDs instead of yum.comps.Group
We never need anything more than the ID, so passing around a big
complicated object is not necessary.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 10:28:26 +02:00
Lubomír Sedlář c5fcab2aa5 comps-wrapper: Remove unused code
There are a couple methods that are never used in the codebase. We don't
support using this module as a library from other programs either, so we
can just drop this.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-13 10:28:26 +02:00
Lubomír Sedlář b5efb67ff1 init: Warn when variants mentions non-existing comps group
When variants XML lists a group that does not match any known group in
input comps, report a warning. This is not necessarily a problem in
itself, but having this information in the log can help debug problems.

Relates: #585
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-04-11 15:46:34 +02:00
Lubomír Sedlář 4f4fd845d9 Fix PEP8 complaints
* Remove dead imports
* Remove dead code
* Fix extra empty lines
* Fix formatting
* Break too long lines

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-03-24 09:24:48 +01:00
Daniel Mach 43d8d02cb1 Integrate DNF gathering code with Pungi.
Set 'dnf_gather = True' (temporary option) in config file to enable DNF
gathering.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-03-24 09:12:23 +01:00
Jan Kaluza 9fcd71f831 Add support for modular composes
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2017-03-22 15:55:52 +01:00
Lubomír Sedlář ae5ee3d856 iso-wrapper: Refactor functions
Split the function for getting implant MD5 into two functions, so that
we can have access to other information retrieved by checkisomd5
command. A test case is added for both functions.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-03-21 07:55:19 +01:00
Lubomír Sedlář 306f7e69b0 iso-wrapper: Add utility for mounting images
This patch refactors logic for creating a temporary mount point,
mounting an image, running arbitrary code on it, unmounting the image
and removing the mount point. It immediately uses it in the buildinstall
phase.

Similar mounting is present in product_img phase as well, but due to
different usage pattern it's not changed yet.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-03-21 07:55:19 +01:00
Lubomír Sedlář cd805a1e6d iso-wrapper: Handle wrong implant md5
If the checkisomd5 command exits successfully but returns a wrong value,
we should catch and log that. In theory this should be impossible, but
we have seen it in production.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-03-07 09:58:14 +01:00
Lubomír Sedlář 857aee05c1 util: Add a utility for managing temporary files
In multiple situations we need to create temporary files or directories
that should not be preserved after compose is finished. Let's add
context managers that ensure these get cleaned up.

This fixes tests leaving garbage around in /tmp.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-02-20 09:14:25 +01:00
Lubomír Sedlář 9533fca96c koji_wrapper: Always use --profile option with koji
This patch adds this option to all invoked koji commands.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-30 13:00:25 +01:00
Dennis Gilmore 5a498f80b6 use koji --profile when calling koji for livemedia
take the profile from the koji config and apply it to the koji cli
when building livemedia

Signed-off-by: Dennis Gilmore <dennis@ausil.us>
2017-01-30 04:44:31 -06:00
Dennis Gilmore c650f04d0b Revert "live-media: Call correct koji alias"
This was accidently merged and is not correct
This reverts commit 02beb35e67.

Signed-off-by: Dennis Gilmore <dennis@ausil.us>
2017-01-30 04:44:17 -06:00
Lubomír Sedlář dc7d3b36ab repoclosure: Don't run build deps check
Fixes: #521
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-30 10:16:03 +01:00
Dennis Gilmore 7feadb14ba Merge #518 `Migrate test phase to dnf repoclosure` 2017-01-28 16:49:10 +00:00
Lubomír Sedlář 02beb35e67 live-media: Call correct koji alias
We need call whatever command is configured in koji_profile. It's not
always `koji`.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-26 15:32:21 +01:00
Lubomír Sedlář e3fe67be53 repoclosure: add option to use dnf backend
This adds a new option repoclosure_backend that changes what tool is
used for repoclosure.

Checking build dependencies is currently not supported, as `dnf` does
not have the corresponding option.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-26 13:39:12 +01:00
Lubomír Sedlář 56932f9067 repoclosure: Remove duplicated code
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-26 10:55:23 +01:00
Lubomír Sedlář 7a8fa87172 repoclosure: Remove useless wrapper class
We already get namespacing from being in a separate module.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-26 10:55:23 +01:00
Lubomír Sedlář 5693bf9925 repoclosure: Remove unused code
There are a lot of options that are not used by any code path in Pungi.
There is not reason to provide access to them.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-01-26 10:55:23 +01:00
Dennis Gilmore 46f77403df Merge #475 `Allow failure for some arches` 2017-01-04 14:43:22 +00:00
Patrick Uiterwijk c0c3e2e79d Make KojiWrapper support krb_login with keytab
Using getattr so we also work with versions of koji that do not
read principal and keytab from the config file.

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2016-12-14 12:58:23 +00:00
Patrick Uiterwijk c41c46403a Make KojiWrapper parse krb_rdns
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2016-12-14 12:58:23 +00:00
Lubomír Sedlář 356b78d440 image-build: Allow failure only on some arches
This uses the --can-fail option in koji. Failing an optional image will
not abort whole task. If the whole task fails (or there is a problem on
the compose side), we abort unless all arches are optional.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2016-12-14 10:14:30 +01:00
Lubomír Sedlář 7f56b978ce live-media: Allow some arches to fail
This patch uses the `--can-fail` option of koji command line. If only
optional arches fail, the task will report as success. Failures on
compose box side are ignored if and only if all architectures are
optional.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2016-12-14 10:14:30 +01:00
Colin Walters 7bcbe30fd2 Expose lorax's --rootfs-size argument
This is going to be necessary for reworking the Atomic Host ISO,
see: https://pagure.io/fedora-lorax-templates/pull-request/6

Signed-off-by: Colin Walters <walters@verbum.org>
2016-11-17 10:17:39 -05:00
Dennis Gilmore 5dc8132fa4 Merge #456 `Add tests for dependency solving` 2016-11-15 20:58:40 +00:00