diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-06-25 11:30:25 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-06-25 13:17:45 +0200 |
commit | e9d239bb02b0e7bea06c01fb3572330620658209 (patch) | |
tree | 010b3edcec81c515a29165a4ada47e4b5df86b71 /gbp/pkg | |
parent | 9430ee11c59c1662af388ba47c3d91def044a852 (diff) |
UpstreamSource: automatically detect package name and versions from directories
of the form packagename-<version>
Diffstat (limited to 'gbp/pkg')
-rw-r--r-- | gbp/pkg/__init__.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gbp/pkg/__init__.py b/gbp/pkg/__init__.py index 540c22c..36f7099 100644 --- a/gbp/pkg/__init__.py +++ b/gbp/pkg/__init__.py @@ -265,6 +265,9 @@ class UpstreamSource(object): Guess the package name and version from the filename of an upstream archive. + @param extra_regex: extra regular expression to check + @type extra_regex: raw C{string} + >>> UpstreamSource('foo-bar_0.2.orig.tar.gz').guess_version() ('foo-bar', '0.2') >>> UpstreamSource('foo-Bar_0.2.orig.tar.gz').guess_version() @@ -293,12 +296,16 @@ class UpstreamSource(object): @rtype: tuple """ version_chars = r'[a-zA-Z\d\.\~\-\:\+]' - extensions = r'\.tar\.(%s)' % "|".join(self.known_compressions()) + if self.is_dir(): + extensions = '' + else: + extensions = r'\.tar\.(%s)' % "|".join(self.known_compressions()) version_filters = map ( lambda x: x % (version_chars, extensions), - ( # Debian package_<version>.orig.tar.gz: + ( # Debian upstream tarball: package_'<version>.orig.tar.gz' r'^(?P<package>[a-z\d\.\+\-]+)_(?P<version>%s+)\.orig%s', - # Upstream package-<version>.tar.gz: + # Upstream 'package-<version>.tar.gz' + # or directory 'package-<version>': r'^(?P<package>[a-zA-Z\d\.\+\-]+)-(?P<version>[0-9]%s*)%s')) if extra_regex: version_filters = extra_regex + version_filters |