Travis[1] runs continuous integration for Open Source projects. With
github, it will run the configured tests and tag pull requests as passing
or failing. This commit adds a Travis configuration.
Since Travis hosts run debian/ubuntu, and execute tests in virtualenv,
getting access to `rpm` and `python-rpm` is impossible, or nontrivial,
at least. For now, ignore the functional tests. To support running the
BuildTargetParser tests, pull that class out into its own module, and
away from release.py, which imports `rpm`.
To configure travis, go to the website, log in with your github account,
then sync your repos under the account tab below your name. Then just
switch the repo to 'on' and it should be all set up.
[1]: http://travis-ci.org
The refactoring of YumRepoReleaser into RsyncReleaser and
YumRepoReleaser caused a regression that didn't allow multiple rsync
locations to be defined and sync'd properly.
Moved a bunch of code around and adding of method variables to
allow multiple rsync and tempdirs to be used.
Use regular expression to extract the SHA1 from the `git ls-remote` call
response. The reason is that there might be some messages in the
response going to stderr, that are captured when using run_command,
e.g.:
```
Could not chdir to home directory /home/johndoe: No such file or directory
fe87e2b75ed1850718d99c797cc171b88bfad5ca refs/tags/my-awesome-lib-1.0.1-1
```
I used 30 and more characters for the regular expression because I was
not sure the SHA1 is always shown as 40 characters. However we can be
quite certain that the word of 30 and more [0-9a-f] characters is a
SHA1.
RsyncReleaser takes an optional argument "filetypes" from releasers.conf
which specifies what type of packages should be rsynced
[rsync_test-example]
releaser = tito.release.RsyncReleaser
builder = tito.builder.MockBuilder
builder.mock = fedora-16-x86_64
filetypes = tgz rpm srpm
rsync = /tmp/rsync_repo/
in case of YumRepoReleaser default filetypes is of course only rpm.
Tito only supported the default build target when releasing,
however, in some cases it was necessisary to change it (building
for zstream for example).
By default, the build target is the same as the branch. With this
change, you can specify a build target on a per branch basis by
adding a 'build_targets' property in the releasers.conf file.
This property takes on the following format:
build_targets = <branch>:<build_target> <branch>:<build_target> ...
An example configuration could be:
[project-x.y.z]
releaser = tito.release.DistGitReleaser
branches = project-x.y
build_targets = project-x.y:project-x.y.z-candidate
Running:
tito release project-x.y.z
would instruct the build system to build with the target
'project-x.y.z-candidate' when building from the project-x.y
branch (i.e rhpkg build --no-wait --target project-x.y.z-candidate).
For releasers copying into a build system SCM, we now extract the
SourceX filenames from the spec file, and anything we see in the
relative directory matching those exactly will be copied. (i.e. if you
store additional sources for your package at the same level as your spec
file, these will now be copied)
MockBuilder was assuming your package would build fine with the normal
builder, anything using NoTgzBuilder (or others likely) would break.
Now we will instantiate a builder internally, whatever the package would
use by default, and use this to build just the srpm before handing it
off to mock.
Because we treat this directory as a per-user directory (tito doesn't
work well on a multi-user system, users have to configure their own
output dirs with RPMBUILD_BASEDIR=~/tito/ in ~/.titorc), it seems best
to do this internally to tito rather than try to handle the permissions
in a spec file that won't know who should actually own it.
Adding "builder.test = 1" to a target in releasers.conf will allow you
to submit test builds out to a yum repository. This can be useful for
automated nightly builds. This is done as a builder arg rather than a
CLI argument to prevent anyone from accidentally doing a --test release
for something important. Instead it is a feature you configure once for
your targets.
Instead using a kwargs solution for optional things to be passed
through. Will allow for easier use of builders in other components which
do not have a set of CLI args to pass in. (i.e. releasers)
We keep getting permission denied with trying to set time on directories.
According to the rsync man page:
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
Hrm so what do those mean?
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-g, --group preserve group
-o, --owner preserve owner (super-user only)
-D same as --devices --specials
-p, --perms preserve permissions
-t, --times preserve modification times
So by having -a, that means -t automatically gets added which is not
what we want. And in some cases we were adding -no-p and -no-g
again added because -a includes them.
So by switching to -rlvz we avoid all these problems.