Commit graph

51 commits

Author SHA1 Message Date
Frank Schreiner
0341caee98
fix flake8 error 'do not use bare except' 2017-11-06 09:52:36 +01:00
Frank Schreiner
67175bacdd
Reverting patch for setlocale as it breaks in containers 2017-11-06 09:32:37 +01:00
Adrian Schröter
b2bbe4efb4 workaround for python3 locale problems in factory 2017-10-30 16:57:46 +01:00
Adrian Schröter
3cd89e9bfa skip also sha256sums check for Arch 2017-10-12 18:22:35 +02:00
Thomas Bechtold
9e7f62b324 Simplify the pip version handling
Reduce code for version handling. Also align with other tools like
renderspec and obs-service-python-requires. Both use this schema for
pip versions.
2017-09-07 15:33:47 +02:00
Luca Boccassi
f8a5535417 Avoid half-converting Debian native pkgs to non-native pkgs
Newer versions of dpkg-buildpackages are more strict in checking that
the Debian package format is consistent.
Always appending a -0 to the version causes a native package, which
must not have a - in the version, to fail to build.
Append -0 conditionally on a simple check: if the original version
has a - character then it's non-native and it's safe to add -0.

In order to do this check a new version detection static method is
added, to parse the .dsc file for the Version tag.
2017-04-05 11:53:52 +01:00
Frank Schreiner
bf1d8d02ac
strip \n from version in obsinfo 2017-04-04 21:56:49 +02:00
Adrian Schröter
d2e983f302 Merge pull request #27 from jengelh/master
Add support for Collax build recipes
2017-03-02 09:46:00 +01:00
Adrian Schröter
a9da303a8e this is a pain without value... 2017-03-02 09:30:53 +01:00
Adrian Schröter
a42c3ebe3b read version from .obsinfo file if available 2017-03-02 08:59:40 +01:00
Adrian Schröter
259e7f6b61 add a error message when not being able to detect the version 2017-02-28 15:11:38 +01:00
Adrian Schröter
22a86c7d70 satisfy flake8 2017-01-13 14:17:58 +01:00
Adrian Schröter
a9f6aef3ba support obscpio archives 2017-01-13 14:04:50 +01:00
Adrian Schröter
c928f99931 do not strip release number in debian, but setting it back
to 0 like we do for rpm. otherwise dpg tools will just fail with unknown
format
2016-04-26 17:50:57 +02:00
Alberto Planas
fb01898ebc VersionDetector._autodetect: prioritize the directory name over the file name 2016-04-14 14:35:33 +02:00
Thomas Bechtold
3469568f58 Don't add unconverted_version unconditionally
If the unconverted_version and version are equal, don't
add unconverted_version define if not already there.
2016-04-07 17:52:30 +02:00
Bernhard M. Wiedemann
4e97022745 fix when switching from .dev to non-dev version
the setup call would still reference unconverted_version
which still had the old value
2015-12-04 11:49:02 +01:00
Jan Engelhardt
3c3eb59abd Add support for Collax build recipes 2015-11-17 17:13:56 +01:00
Thomas Bechtold
4be0cf30e7 Fix replacement of empty tags
I.e. a .spec file with an empty version like "Version:"
wasn't replaced with the found version.
Also added a testcase for that.
2015-09-16 10:07:36 +02:00
Thomas Bechtold
b6fb5456b8 Fix python3 compat
Use print_function from __future__ to be py2 and py3 compatible.
2015-08-30 11:19:34 +02:00
Thomas Bechtold
d75392f817 Set pkgver and pkgrel for PKGBUILD files (fixes #21)
With the python rewrite done in commit b5cadd8c1e,
the version for PKGBUILD files was no longer updated.
2015-08-30 11:11:08 +02:00
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
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
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
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
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
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
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
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
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
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
Jan Blunck
61c2dff8d6 Add support to automatically detect version based on Debian changelog file
Based on the original bash implementation created by Sven-Thorsten Dietrich <sven@brocade.com>.

Signed-off-by: Jan Blunck <jblunck@brocade.com>
2014-07-03 10:54:54 +02:00
Martin Koegler
c8de506152 Handle PKGBUILD files generated by services 2014-06-12 09:07:04 +02:00
Adrian Schröter
b898cee6d6 - fix PKGBUILD version setting 2014-03-17 10:49:27 +01:00
Adrian Schröter
f29ada8ad8 fix help text 2014-03-13 12:16:32 +01:00
Adrian Schröter
48ed90f863 support detection from tar ball content 2014-03-07 13:05:56 +01:00
Adam Spiers
92b25145b9 use warnings pragma
Running without warnings in Perl is a really bad idea for anything except one-liners.
2014-03-07 12:00:36 +00:00
Adrian Schröter
10d5bddcea - replace bash script with a more secure perl version 2014-03-06 12:00:23 +01:00
Adrian Schröter
dc6277f1d1 fix urgent quoting bugs 2014-03-06 11:01:34 +01:00
Sascha Peilicke
3bb76e859d Be more liberal in root-dir version detection
Don't choke on things like "v132".
2014-02-11 17:27:00 +01:00
Sascha Peilicke
82cd0ba8d3 Check tarball content's root-dir for version
If a tarball doesn't include a version number in it's filename, it is
worth checking it's contents. If the tarball has a root-directory, it is
usually named $BASENAME-$VERSION.
2014-02-06 09:44:39 +01:00
Sascha Peilicke
4a5eaecaba Use a for-loop for different endings 2014-02-05 13:32:28 +01:00