Commit graph

65 commits

Author SHA1 Message Date
Adrian Schröter
5856842761 - fix it ... it only worked with "disabledrun" mode by luck
Let osc or bs_service copy back the generated files and enforce a --outdir parameter
2015-08-17 17:12:36 +02:00
Adrian Schröter
c8e7ae6db4 Merge pull request #20 from toabctl/pyfixes
Fix %setup handling for python spec files
2015-07-28 08:12:12 +02:00
Thomas Bechtold
3aaf0d3de1 Fix %setup handling for python spec files
If no "-n" was given during %setup,the wrong version was used for
tarball extraction.
2015-07-28 06:21:55 +02:00
Adrian Schröter
5dd6c56d59 Merge pull request #19 from toabctl/pypackaging-optional
Make python-packaging runtime dep optional
2015-07-27 16:55:24 +02:00
Thomas Bechtold
62b4bf6e1b Make python-packaging runtime dep optional
set_version should work even if python-packaging is not installed.
2015-07-27 13:44:08 +02:00
Adrian Schröter
7ee0a9a99c Merge pull request #18 from toabctl/pysemversion
Pysemversion
2015-07-24 08:26:41 +02:00
Thomas Bechtold
ef4ef2d910 Use python binary from virtualenv
This should make travis happy when running a python script via a
subprocess from a virtualenv.
2015-07-19 21:26:53 +02:00
Thomas Bechtold
6bbe0e6604 Skip some tests if zypper or dpkg are unavailable
For the PEP440 version conversion tests, zypper and/or dpkg are
needed. Skip the tests if the needed binaries are unavailable.
2015-07-19 21:14:03 +02:00
Thomas Bechtold
1aa86c9b94 Finally use version conversion for python packages
Use the functionality for converting PEP440 compatible python versions
to rpm compatible versions. Given the following example .spec:

%define component heat
Version:        5.0.0.0b2.dev261
%setup -q -n %{component}-%{version}

Will be transformed to something like:

%define component heat
%define version_unconverted 5.0.0.0b2.dev261
Version:        5.0.0.0~b2~dev261
%setup -q -n %{component}-%{version_unconverted}
2015-07-19 20:53:14 +02:00
Thomas Bechtold
1224e1d4e5 Add custom line support for _write_specfile func
To be able to define more specific .spec files in unittests, add the
possibility to add custom lines (i.e. '%define foo bar') to a test .spec
file.
2015-07-19 20:53:14 +02:00
Thomas Bechtold
f4b37ebc56 Add function to replace %{version} in %setup
This is the next needed addition to handle python package versions which
are PEP440 compatible. While using the converted (PEP440 compatible)
version in the 'Version' tag, for the '%setup' section, the unconverted
version needs to be used. The new function can be used to replace the
'%{version}' in the '%setup' section.
2015-07-19 20:53:14 +02:00
Thomas Bechtold
e1f1b409ac Fix problem with replacing tags in spec files
While replacing tags in .spec files, the whole content starting from the
selected tag was replaced. Now just replace the line containing the tag.
2015-07-19 20:53:14 +02:00
Thomas Bechtold
aa37a76361 Add function to add or replace a %define
This function will be used to set the tarball version in a .spec
file. This is needed for PEP440 compatible versions for python
packages. Imagine the detected python version by 'set_version' is
'5.0.0.0a1.dev13'. The converted version will be '5.0.0.0~a1~dev13' (so
5.0.0.0 > 5.0.0.0~a1~dev13 is valid).
In the .spec file, the 'Version' tag will be set to '5.0.0.0~a1~dev13'
but we still need the unconverted version '5.0.0.0a1.dev13' because this
is the version which will be use in the '%setup' section to enter the
correct directory during the setup step. So the setup section should
then look like '%setup -q -n %{component}-%{unconverted_version}'
2015-07-19 20:53:14 +02:00
Thomas Bechtold
9636bf5f79 Run python version converter tests with dpkg
In addition to the current tests running with zypper, also test that the
generated versions are compatible with dpkg.
Also improve the assertion output in case of a test failure.
2015-07-19 20:53:03 +02:00
Thomas Bechtold
380cc67d9e Add version converter for python packages
Python's PEP440 compatible versions can look like "1.1alpha" which means
in the pip world (pip is python's package manager), that "1.1 >
1.1alpha". Comparing the same version with rpm, the result is
"1.1alpha > 1.1". This commit adds code to convert PEP440 versions to
rpm versions without loosing the correct version compare semantics.
2015-07-19 20:52:12 +02:00
Thomas Bechtold
e17e863faf Add package type detection for python
Look for ".egg-info/PKG-INFO" in tarballs/zipfiles and if available,
assume the package is a python package.
2015-07-19 20:49:20 +02:00
Thomas Bechtold
b90707ff72 Allow files in test tarballs
Currently only test tarballs with empty directories can be created. This
commit also allows to add empty files to the test tarball. This is
needed for package type detection tests.
2015-07-19 20:49:20 +02:00
Thomas Bechtold
ce00d6c1e8 Restructure version detection code
To get a better overview about the code which does the version
detection, bundle the used functions in a new class called
VersionDetector.
2015-07-19 20:49:20 +02:00
Dirk Mueller
08a5a93c34 Merge pull request #17 from toabctl/pyrewrite
Pyrewrite
2015-07-13 09:06:50 +02:00
Thomas Bechtold
2e8f7d6599 Install devscripts in travis-ci test env
Needed to run the debian changelog tests.
2015-07-03 21:25:44 +02:00
Thomas Bechtold
b5cadd8c1e Rewrite set_version in python
For the following reasons:

- integration of https://github.com/openSUSE/\
   obs-service-set_version_pysemver simpler
- testsuite is in python
- try "import this" to get more reasons :)
2015-07-03 21:08:40 +02:00
Thomas Bechtold
5013040029 Reuse test data for debian changelog tests
Add more tests for debian.changelog based on the data and tests for rpmspec.
2015-07-03 20:24:19 +02:00
Thomas Bechtold
ae1c4aceb9 Remove python 2.6 compat import
We only care about python >= 2.7
2015-07-03 20:06:28 +02:00
Thomas Bechtold
e728d3204e Move _write_tarfile() to base test class
The function is not only useful for RPM spec tests.
2015-07-03 19:48:13 +02:00
Thomas Bechtold
6a89333bf1 Move testdata to .json files
The testdata can be reused from different test classes now. Start doing
this for 'test_from_commandline' for the debian/changelog and rpm .spec tests.
2015-07-03 19:41:55 +02:00
Thomas Bechtold
0b62448052 Also do negative test for debian/changelog
Be sure that the old version is no longer available.
2015-07-03 18:50:38 +02:00
Thomas Bechtold
6cdddf3d2a Add travis build status image to README 2015-07-03 14:12:46 +02:00
Dirk Mueller
cbebe46ee7 Merge pull request #16 from toabctl/basic-dch-tests
Add basic test for debian changelogs
2015-07-03 13:39:57 +02:00
Dirk Mueller
5bd332b134 Merge pull request #15 from toabctl/pyversions-for-tests
Disable py26, enable py{33,34} for tests
2015-07-03 13:38:21 +02:00
Adrian Schröter
daa5d443da Merge pull request #11 from hiberis/hiberis
Fix tar file detection for PKGBUILD
2015-07-03 13:12:25 +02:00
Thomas Bechtold
3b909331b8 Add basic test for debian changelogs 2015-07-03 11:49:34 +02:00
Thomas Bechtold
d904d6384c Disable py26, enable py{33,34} for tests 2015-07-02 17:40:42 +02:00
Adrian Schröter
62266d30ab - empty dummy commit to test travis hook 2015-07-02 13:21:10 +02:00
Adrian Schröter
81f1eda7fa Merge pull request #12 from toabctl/basic-testsuite
Add Testsuite and README.md
2015-07-02 10:00:16 +02:00
Thomas Bechtold
2b27c904d3 Add Testsuite and README.md
- add basic testsuite for RPM spec files
- add .travis.yml to execute tests and stylechecks
- add README.md with basic project information
2015-07-01 19:31:21 +02:00
Hib Eris
50486bd41b Fix tar file detection for PKGBUILD
The version string can contain regular expression special characters like '+'.
To escape the version string, use \Q and \E.
2015-06-25 08:44:58 +02:00
Adrian Schröter
f40253b5ad Merge pull request #10 from hiberis/master
Fix package for debian 8.0
2015-06-22 13:11:40 +02:00
Hib Eris
e077e0b449 Change debian source format to 'native' 2015-06-14 20:26:03 +02:00
Hib Eris
3eef8bc32c Add Makefile with install target 2015-06-14 13:53:30 +02:00
Adrian Schröter
310b9a0efc Merge pull request #8 from jblunck/master
Release 0.4.2 - Update Debian changelog
2014-09-11 14:20:07 +02:00
Jan Blunck
b4a0fb14b4 Release 0.4.2 - Update Debian changelog
Signed-off-by: Jan Blunck <jblunck@infradead.org>
2014-09-10 18:21:49 +02:00
Adrian Schröter
b9f374a66b Merge pull request #7 from jblunck/master
Some general fixes plus support for setting the version in debian.changelog files
2014-09-10 17:18:00 +02:00
Jan Blunck
28935286c0 Sort local file list based on modification time (newest first)
When we are searching for the version number we want to visit the least
recently modified file first. Therefore we shall sort the readdir result
based on the modification timestamp.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2014-09-10 11:22:44 +02:00
Jan Blunck
0d441373ac Add support for setting the version in debian.changelog
For Debian builds the primary location of the package version number is the
changelog file. In some cases where set_version is used in combination with
tar_scm's versionformat parameter it might be required to amend the
Debian changelog as well. Later during the build debtransform will assemble
the correct format of the sources.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2014-09-10 11:22:44 +02:00
Jan Blunck
cbd398f081 Fix processing of --file parameter
We need to check for an empty @files array before we start filtering. We
shall not reset the @files array when filtering the list.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2014-09-10 11:22:44 +02:00
Jan Blunck
415de1070e test with defined() at ./set_version line 118.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
2014-09-10 11:22:44 +02:00
Stephan Kulow
4b5fb5666b the extension needs to be \. 2014-08-25 17:22:24 +02:00
Adrian Schröter
eab34cf8af Merge pull request #4 from e9925248/master
Handle PKGBUILD files generated by services
2014-07-07 11:05:21 +02:00
Adrian Schröter
74c8212c96 Merge pull request #6 from jblunck/master
Add support to automatically detect version based on Debian changelog fi...
2014-07-07 11:02:04 +02:00
Adrian Schröter
4d58c8fa87 Merge pull request #5 from gollub/debianization
Initial debianization
2014-07-07 11:01:53 +02:00