Add in a check to confirm we get the original root commit has in case there are multiple. This can occur when two separate repositories are merged in to one new one. Without this addition the count will always return 0.
Following the principals of https://nedbatchelder.com/text/unipain.html
our goal is to decode bytes in to unicode as soon as we read them and
encode unicode date to bytes at the last second.
The specific problem we were seeing was caused by calling "encode" on a
byte string rather than a unicode string. Python attempts to be
"helpful" and tries to decode the bytes as ASCII in order to provide a
unicode string to the encode function. Since the bytes aren't ASCII,
the decode fails and we get the UnicodeDecodeError despite the fact that
we never explicitly asked for a decode at all.
Also, calculate checksums correctly for tarballs that have files with
UTF8 characters in the file name.
A number of build systems support using <pkg>.rpmlintrc for
rpmlintrc files that are used and associated with a specific
package build. These should be committed and pushed when
releasing with tito.
Since we support the case with a SUSE-style detached changelog,
we need to ensure that the changes file is going to be committed
when tito makes a release and pushes it.
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.
The existing implementation of `run_command_print` uses `shlex.split`
to split command line arguments into an array, but it doesn't handle
wildcards like `run_command`. This breaks Mock build because of failure
of copying generated RPMs.
This PR also adds `print_on_success` argument and unify the behavior of
error handling.
Reproduction:
``` bash
$ tito build --test --rpm --output=artifacts/el6 --builder=tito.builder.MockBuilder --arg=mock=eng-rhel-6-candidate-x86_64
...
INFO: Results and/or logs in: /var/lib/mock/ERROR: Error running command: cp -v /home/fedora/jenkins/workspace/rcm-pulp-rpm-package/artifacts/el6/rpmbuild-pulp-rpm4f6rzL/mockoutput/*.rpm /home/fedora/jenkins/workspace/rcm-pulp-rpm-package/artifacts/el6
```
--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.