SUSE-style RPM packaging generally prefers having the RPM changelog
detached from the main RPM spec file as a changes file. This file is
typically named <pkg>.changes (corresponding to <pkg>.spec).
At package build time in the Open Build Service, the content of the
changes file is reformatted to the RPM changelog structure and
appended to the spec file by the build system before rpmbuild
processes it.
This change adds support for this particular workflow, which is
common in communities using an instance of the Open Build Service,
such as (open)SUSE.
This was originally authored by Michael Calmer. The code was ported
to work on Python 3 and adapted for the current tito codebase
by Neal Gompa.
Co-authored-by: Michael Calmer <mc@suse.de>
Co-authored-by: Neal Gompa <ngompa13@gmail.com>
According to mock man page the default behavior without a command flag is to run --rebuild.
This change avoids what is essentially doing --rebuild twice.
--follow-tags pushes both new commits and their tags in one transaction.
It is functional equivalent of git push && git push --tags, but with
less typing. It is available since git 1.8.3 released in April 2013.
Currently when building RPMs or SRPMs with MockBuilder, tito will not print the
output from mock. This makes diagnosis harder especially in CI
environments.
This PR will do the following changes:
1. If `--quiet` option is not specified, `run_command_print` will be used to
run the `mock` or `rpmbuild` command. Otherwise we will continue to use
`run_command`.
2. `run_command_print` will print error message when an error happens, like what `run_command`
does.
When doing concurrent build, if `/tmp/tito` doesn't exist, even if different output
directories for different builds are specified,
tito will fail because tito processes are trying to create
`/tmp/tito` at the time that directory doesn't exist.
Here is the stack trace when this issue occurs:
06:42:15 [el7] + tito build --test --rpm --output=artifacts/el7 --builder=tito.builder.MockBuilder --arg=mock=eng-rhel-7-candidate-x86_64
06:42:16 [el7] ERROR: Error running command: mkdir /tmp/tito
06:42:16 [el7]
06:42:16 [el7] Status code: 256
06:42:16 [el7]
06:42:16 [el7] Command output: mkdir: cannot create directory '/tmp/tito': File exists
06:42:16 [el7]
06:42:16 [el7] Creating output directory: /tmp/tito
06:42:16 [el7] Traceback (most recent call last):
06:42:16 [el7] File "/usr/bin/tito", line 23, in <module>
06:42:16 [el7] CLI().main(sys.argv[1:])
06:42:16 [el7] File "/usr/lib/python2.7/site-packages/tito/cli.py", line 201, in main
06:42:16 [el7] module = module_class()
06:42:16 [el7] File "/usr/lib/python2.7/site-packages/tito/cli.py", line 298, in __init__
06:42:16 [el7] BaseCliModule.__init__(self, "usage: %prog build [options]")
06:42:16 [el7] File "/usr/lib/python2.7/site-packages/tito/cli.py", line 223, in __init__
06:42:16 [el7] self._add_common_options()
06:42:16 [el7] File "/usr/lib/python2.7/site-packages/tito/cli.py", line 242, in _add_common_options
06:42:16 [el7] run_command("mkdir %s" % default_output_dir)
06:42:16 [el7] File "/usr/lib/python2.7/site-packages/tito/common.py", line 426, in run_command
06:42:16 [el7] raise RunCommandException(command, status, output)
06:42:16 [el7] tito.exception.RunCommandException: Error running
command: mkdir /tmp/tito
This change will make sure that the user defined output directory will
be created if the default output directory, `/tmp/tito`, is overridden by the '--output' option.
addressing:
Python runtime initialized with LC_CTYPE=C (a locale with default ASCII encoding), which may cause Unicode compatibility problems. Using C.UTF-8, C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is recommended.
When building a large number of packages, the current output from tito
will place all of them on one very long line, which makes it hard to
read. Instead, we should place them on separate lines to format them
more like a list.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
createrepo_c is a faster and more correct implementation of
generating rpm repositories, used by Fedora, openSUSE, and Mageia
for creating official distro repositories. It is also used by COPR
for creating repositories for packages built through its system.
The test suite tests both Python 2 and Python 3, but the spec file
doesn't install both sets of dependencies, so we need to declare
the Python 2 dependencies to be installed in the Dockerfiles.
In addition, there's no reason to drag in yum-utils, since
"dnf builddep" exists and serves the same purpose.