Commit graph

84 commits

Author SHA1 Message Date
Devan Goodwin
59b6b9c855 Merge pull request #122 from domcleal/scl-builder-arg
Add 'scl' builder option for software collection name
2014-05-09 11:11:37 -03:00
Devan Goodwin
071278cfc9 Fix pep8 issues. 2014-05-09 11:06:53 -03:00
Dominic Cleal
9ca849b7d9 Add 'scl' builder option for software collection name
With a general 'scl' builder option, a software collection name can be
specified irrespective of the releaser used.  RsyncReleaser's own 'scl'
option has been deprecated in favour of using 'builder.scl' in
releasers.conf.
2014-05-04 21:33:54 +01:00
alfen
66baaa4bd2 added rpmbuild output to an error raised by tito to easier the error's cause analysis 2014-04-20 18:55:26 +02:00
Paul Morgan
bc0abf1beb avoid TB in gitannex builder test on python3
Avoids...

Traceback (most recent call last):
  File "/home/sandbox/test/functional/build_gitannex_tests.py", line 87, in test_simple_build
    self.assertEquals(1, len(builder.sources))
nose.proxy.TypeError: TypeError: object of type 'map' has no len()
2014-03-12 19:37:39 +00:00
Paul Morgan
ff5fd1faf7 skip git-annex tests if distro or git-annex is too old 2014-03-12 19:17:38 +00:00
Paul Morgan
a398833e72 avoid TB on python3 due to git format string
Use RawConfigParser instead of ConfigParser to avoid...

Traceback (most recent call last):
  File "/home/sandbox/test/functional/multiproject_tests.py", line 68, in setUp
    self.create_project(TEST_PKG_1, os.path.join(self.repo_dir, 'pkg1'))
  File "/home/sandbox/test/functional/fixture.py", line 198, in create_project
    tito('tag --keep-version --debug --accept-auto-changelog')
  File "/home/sandbox/test/functional/fixture.py", line 103, in tito
    return CLI().main(argstring.split(' '))
  File "/home/sandbox/src/tito/cli.py", line 222, in main
    return module.main(argv)
  File "/home/sandbox/src/tito/cli.py", line 671, in main
    offline=self.options.offline)
  File "/home/sandbox/src/tito/tagger/main.py", line 51, in __init__
    ConfigObject.__init__(self, config=config)
  File "/home/sandbox/src/tito/config_object.py", line 38, in __init__
    config.get(section, options))
  File "/usr/lib64/python3.3/configparser.py", line 1184, in set
    super().set(section, option, value)
  File "/usr/lib64/python3.3/configparser.py", line 889, in set
    value)
  File "/usr/lib64/python3.3/configparser.py", line 399, in before_set
    "position %d" % (value, tmp_value.find('%')))
nose.proxy.ValueError: ValueError: invalid interpolation syntax in '%s (%ae)' at position 0
2014-03-11 14:38:03 +00:00
Devan Goodwin
ce7393ecaa Add test for GitAnnexBuilder. 2014-03-11 11:27:19 -03:00
Devan Goodwin
a80fc5b6b0 Use test util to write files. 2014-03-11 09:25:45 -03:00
Devan Goodwin
9091afd684 Functional test for the CoprReleaser. 2014-03-11 09:17:52 -03:00
Paul Morgan
3ae1596923 deprecate GitPython
GitPython is not compatible with python3 and may never be:
https://fedoraproject.org/wiki/User:Churchyard/python3
2014-03-09 13:56:17 +00:00
Paul Morgan
a0d0f859c7 resolve another use of commands module for python3 compat
03255001d6 moved commands module to src/tito/compat.py to handle
differences between python2 and python3, but missed a bit that
did not show up in unit or functional tests.

Fix those occurences and add unit test to detect the regression.
2014-03-09 13:12:32 +00:00
Devan Goodwin
167800f75f Remove deprecated support for build.py.props config filename. 2014-03-07 13:53:57 -04:00
Paul Morgan
2a58a9b8e7 allow empty dist tag in functional tests
before this commit: fetch_tests and release_yum_tests
allow *any* dist tag, but the tag must not be empty or
else the glob fails on double-dot in path name.

after this commit: allow the tag to be any *or* empty.
2014-02-28 19:07:53 +00:00
Paul Morgan
9f2c259c85 python 2.4 (rhel 5) does not support 'with...as' syntax
resolves from a73c90cb...

    Using Python 2.4
    Using nose 0.1
    Running tito tests against: /home/sandbox/src
    EEEE.Warning: spacewalk.releng.* namespace in tito.props is obsolete. Use tito.* instead.
    Warning: spacewalk.releng.* namespace in tito.props is obsolete. Use tito.* instead.
    ..............................F...........
    ======================================================================
    ERROR: Failure: SyntaxError (invalid syntax (fixture.py, line 159))
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/nose/loader.py", line 381, in loadTestsFromName
        module = self.importer.importFromPath(
      File "/usr/lib/python2.4/site-packages/nose/importer.py", line 39, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.4/site-packages/nose/importer.py", line 86, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/home/sandbox/test/functional/fetch_tests.py", line 27, in ?
        from fixture import TitoGitTestFixture, tito
      File "/home/sandbox/test/functional/fixture.py", line 159
        with open(os.path.join(full_pkg_dir, 'tito.props'), 'w') \
                ^
    SyntaxError: invalid syntax
2014-02-28 15:38:25 +00:00
Paul Morgan
25c6f7f1e0 avoid ImportError in test suite on python 3
python3 does not allow relative imports.

test/unit/__init.py__ and test/functional/__init.py__ already exist,
which means we can use absolute import on all versions of python
without resorting to http://legacy.python.org/dev/peps/pep-0328/
2014-02-28 15:38:25 +00:00
Paul Morgan
22896be9ce add unit test and use print function for python3 compat
Python 3 does not have the print statement, so convert all
print statements to print functions and add an ugly duckling
unit test to detect regressions.
2014-02-28 15:38:25 +00:00
Paul Morgan
03255001d6 add unit test and module compatibility lib
Add modules compat lib to support both python 2 and 3, and
add unit test to detect regressions.

Tito uses two modules that have changed significantly between
python 2 and 3:

* commands module merged into subprocess module
* ConfigParser module renamed as configparser
2014-02-28 15:38:25 +00:00
Paul Morgan
1182b13713 add unit tests and fix exception clause compatibility
Exceptions are now compatible with both python 2.4 and 3.3,
and we have unit tests to detect regressions.

The syntax for capturing exceptions changed in python 3, but
we need to continue supporting python 2.4 syntax since many
people use tito on RHEL 5, which has python 2.4.

http://docs.python.org/dev/howto/pyporting.html#capturing-the-currently-raised-exception
2014-02-28 15:02:50 +00:00
Paul Morgan
1597d7956a add pep8 tests and fix lexical indentation for python3
These are the pep8 tests that break python3,
such as mixing tabs and spaces for indentation.

I ignored all the pep8 tests that seemed only stylistic,
such as "visual" indentation.

http://docs.python.org/3.3/reference/lexical_analysis.html
2014-02-28 01:34:34 +00:00
Paul Morgan
7846ee875d add pep8 tests and fix redundant backslashes between brackets 2014-02-28 01:34:34 +00:00
Paul Morgan
4fe4ed4de7 add pep8 tests and fix statement errors 2014-02-28 01:34:34 +00:00
Paul Morgan
1a8ac66e06 add pep8 tests for import errors 2014-02-28 01:34:34 +00:00
Paul Morgan
97b29d6c35 add pep8 tests and fix blank line errors and warnings 2014-02-28 01:34:34 +00:00
Paul Morgan
1a772c5995 add pep8 tests and fix whitespace errors and warnings 2014-02-28 01:34:34 +00:00
Paul Morgan
5d336d0ce3 add pep8 tests for deprecated python usage 2014-02-27 21:22:05 +00:00
Paul Morgan
c108f6022a add pep8 tests for syntax errors 2014-02-27 21:22:05 +00:00
Paul Morgan
53f9a02442 avoid TB in nose tests if there is no tty
GitPython's git.util.get_user_id() calls os.getlogin(), which
throws an OSError if there is no tty:

    Traceback (most recent call last):
      File "/home/sandbox/test/functional/multiproject_tests.py", line 65, in setUp
        TitoGitTestFixture.setUp(self)
      File "/home/sandbox/test/functional/fixture.py", line 129, in setUp
        index.commit('Setting offline.')
      File "/usr/lib/python2.7/site-packages/git/index/base.py", line 887, in commit
        return Commit.create_from_tree(self.repo, tree, message, parent_commits, head)
      File "/usr/lib/python2.7/site-packages/git/objects/commit.py", line 303, in create_from_tree
        committer = Actor.committer(cr)
      File "/usr/lib/python2.7/site-packages/git/util.py", line 354, in committer
        return cls._main_actor(cls.env_committer_name, cls.env_committer_email, config_reader)
      File "/usr/lib/python2.7/site-packages/git/util.py", line 327, in _main_actor
        default_email = get_user_id()
      File "/usr/lib/python2.7/site-packages/git/util.py", line 120, in get_user_id
        username = os.getlogin()
    OSError: [Errno 25] Inappropriate ioctl for device

But GitPython also allows to avoid the call by setting
environment variable "USER" to anything other than "UNKNOWN".

Therefore we preempt GitPython by calling os.getlogin() ourselves.
If we have to rescue the exception, export the environment var to
avoid traceback.
2014-02-27 21:22:05 +00:00
Devan Goodwin
8d64e56b4e Fix bug with fetch builder source replacement. 2014-02-27 15:44:42 -04:00
Devan Goodwin
8342529dd9 Fix releasers and respect offline flag. 2014-02-27 11:46:00 -04:00
Devan Goodwin
9474b0ab95 Support release with fetch builder. 2014-02-26 15:58:58 -04:00
Devan Goodwin
a6d71534bb Add support for passing builder args through a releaser. 2014-02-26 14:52:56 -04:00
Devan Goodwin
1535850328 More testing. 2014-02-03 15:59:26 -04:00
Devan Goodwin
922c0f2850 Rename --builder-arg to just --arg in build command. 2014-01-16 14:52:55 -04:00
Devan Goodwin
e1a0017144 Rename to FetchBuilder. 2014-01-15 16:17:02 -04:00
Devan Goodwin
35c51ba7a3 Refactor to just one config object.
Instead of passing package specific and global config around separately, parse
them as one config object where package specific can override global should the
same sections and properties exist.

If you maintain custom builders/releasers, they will need to have their
constructors updated.
2014-01-14 11:50:39 -04:00
Devan Goodwin
a73c90cbf5 Make external source builder fetch strategy configurable. 2014-01-13 16:29:38 -04:00
Devan Goodwin
a52a2458c4 Merge branch 'master' into sourcefetch
Conflicts:
	test/functional/singleproject_tests.py

Technically not a merge, did a bunch of work only to discover I was mid-merge when I did it.
2014-01-13 14:40:28 -04:00
Devan Goodwin
8fe640e0ed Fix buildroot using ~/rpmbuild/BUILDROOT.
This may have been a recent change in rpmbuild that caused this as the
_buildroot macro appears to be somewhat new. However it seems using topdir
accomplishes the same thing more thoroughly.
2014-01-10 16:12:16 -04:00
Devan Goodwin
6097b7da59 Restore building of specific tags. 2014-01-09 15:52:17 -04:00
Devan Goodwin
05e3b80205 Extract version/release in external source builder. 2014-01-09 15:20:04 -04:00
Devan Goodwin
381debd36b Replace external sources in spec file copy during build. 2014-01-03 14:28:26 -04:00
Devan Goodwin
199f332d4d Start building with external sources and no tag.
Currently uses the files in the directory where tito was initially run, hoping to make this smarter and more useful soon.
2014-01-02 15:20:52 -04:00
Devan Goodwin
a3363cb93f Merge the FiledVersionTagger into the base VersionTagger.
This allows the behaviour to be used in just about any tagger sub-class.

Behaviour will be triggered on the presence of the 'version_template'
section in tito.props.

Renamed config:
  version -> version_template (section)
  file -> destination_file

Separated the replacement of version and release, as caller may just
want one or the other. (it works fine if only one of the variables is
present in your template file) Release is more of an rpm concept so may
not always be wanted in this context.

Removed the notion of default template files, if you want to use this
you need to specify the configuration for it.

Added a functional test to make sure I keep it working.
2013-11-12 13:28:32 -04:00
Devan Goodwin
373139efd5 Add test for recent pull request. 2013-02-26 08:55:54 -04:00
James Bowes
e3a6111072 Add a Travis configuration
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
2012-11-10 10:49:28 -04:00
jesus m. rodriguez
be8494f351 Merge pull request #46 from mstead/master
Added ability to specify build targets for DistGitReleaser and FedoraReleaser.
2012-09-21 11:55:43 -07:00
Ivan Necas
e97f8539fc Handle stderr noise getting from remote server
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.
2012-09-07 14:16:05 +02:00
Michael Stead
61c996977b Can now specify a build target for fedora and distgit releasers
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).
2012-06-20 15:17:09 -03:00
jesus m. rodriguez
c1df0a1a81 PEP8 cleanup 2011-12-05 14:37:07 -05:00