When using `tito build --install` on a system without `sudo`, such as
inside of a Linux container build, the current implementation fails.
Furthermore, if the user is running `tito build --install` with the
correct level of privilege, it is not necessary to escalate privileges
further for the installation step.
This patch adds the `--dont-escalate-privileges` flag to `tito build`
and defaults it to `True`, which keeps the behavior backwards compat-
ible. Users will want to use this flag when building RPMs inside of a
container or when running `tito build` with the requisite permissions
for installing in the first place.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
When a custom implementation of a tito Tagger is used, the mapping
function that is used to generate a tag from a version in the custom
Tagger must also be used in whichever tito Builder is used on that
repository. This commit factors out the mapping of version to tag so
that custom implementations of a Builder can inject custom logic here
with minimal effort, as is possible on the tito.VersionTagger by
overriding the _get_new_tag() function.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
In 26b02a7, the utility of the `ForceVersionTagger` was merged with the
base `VersionTagger`, so it is no longer necessary to ever explicitly
invoke the `ForceVersionTagger` class. Furthermore, the `elif` and
`else` branches of the decision tree for the tagger class were identical
in the previous implementation, so they were collapsed as well. The
remaining tagger class assignment is a simple query of the `tito.props`
file.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
From the looks of it, the `globalconfig` section is deprecated and
adding anything to that section of `tito.props` results in an error:
WARNING: Please rename [globalconfig] to [buildconfig] in tito.props
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
When tests fail, artifacts from that tests are necessary to properly
debug the failure and determine how to fix the test. This is impossible
when artifacts are immediately removed after the test is finished.
Instead, the tests should remove old artifacts before the test run
begins.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
The logic that previously existed for updating the version and/or the
release in the specfile contained a lot of repetition and enough boolean
logic that it was becoming hard to read. By simplifying that stanza, the
hope is that the resulting code is easier to understand.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
When multiple tags exist for one version of a project, or when a version
is passed to `tito tag --use-version` that does not exactly correspond
with a tag in the repository's git history, the auto-generated release
is not guaranteed to monotonically increase. In order for users to
overcome this issue without building complicated logic into `tito`, it
is simpler to allow users to provide a literal release string to use.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
To allow the tests to run from a host with SELinux enabled, the data
needs to be relabeled to the correct SELinux contexts. Adding the `Z`
label to the volume mount allows for this to occur.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
Instead of special-casing the case where a user has supplied
the specific version to use, we can instead use the same version
tagger for both cases and detect inside of that tagger whether
or not the user has supplied the tag.
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>