diff options
author | Jun Wang <junbill.wang@samsung.com> | 2016-01-28 22:50:55 +0800 |
---|---|---|
committer | Jun Wang <junbill.wang@samsung.com> | 2016-01-28 22:50:55 +0800 |
commit | 27761b16936562b0d6d9ce71de948091b1cf229d (patch) | |
tree | 1c5569e5228cee837d8d0f2b59be9f9e106b9ad8 /gbp/pkg | |
parent | 0eae33b7dff9b06aade2ac401416cb67a368250d (diff) | |
download | git-buildpackage-27761b16936562b0d6d9ce71de948091b1cf229d.tar.gz git-buildpackage-27761b16936562b0d6d9ce71de948091b1cf229d.tar.bz2 git-buildpackage-27761b16936562b0d6d9ce71de948091b1cf229d.zip |
fix merge errors
Change-Id: I4419bb8322f341f92db7e9e19f60ffaa93af2171
Diffstat (limited to 'gbp/pkg')
-rw-r--r-- | gbp/pkg/__init__.py | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/gbp/pkg/__init__.py b/gbp/pkg/__init__.py index 79067982..941b0f63 100644 --- a/gbp/pkg/__init__.py +++ b/gbp/pkg/__init__.py @@ -142,67 +142,6 @@ class PkgPolicy(object): return True return False - @classmethod - def guess_upstream_src_version(cls, filename, extra_regex=r''): - """ - Guess the package name and version from the filename of an upstream - archive. - - @param filename: filename (archive or directory) from which to guess - @type filename: C{string} - @param extra_regex: additional regex to apply, needs a 'package' and a - 'version' group - @return: (package name, version) or ('', '') - @rtype: tuple - - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.orig.tar.gz') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-Bar_0.2.orig.tar.gz') - ('foo-Bar', '0.2.orig') - >>> PkgPolicy.guess_upstream_src_version('git-bar-0.2.tar.gz') - ('git-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('git-bar-0.2-rc1.tar.gz') - ('git-bar', '0.2-rc1') - >>> PkgPolicy.guess_upstream_src_version('git-bar-0.2:~-rc1.tar.gz') - ('git-bar', '0.2:~-rc1') - >>> PkgPolicy.guess_upstream_src_version('git-Bar-0A2d:rc1.tar.bz2') - ('git-Bar', '0A2d:rc1') - >>> PkgPolicy.guess_upstream_src_version('git-1.tar.bz2') - ('git', '1') - >>> PkgPolicy.guess_upstream_src_version('kvm_87+dfsg.orig.tar.gz') - ('kvm', '87+dfsg') - >>> PkgPolicy.guess_upstream_src_version('foo-Bar-a.b.tar.gz') - ('', '') - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.orig.tar.xz') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.tar.gz') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.orig.tar.lzma') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar-0.2.zip') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar-0.2.tlz') - ('foo-bar', '0.2') - """ - version_chars = r'[a-zA-Z\d\.\~\-\:\+]' - basename = parse_archive_filename(os.path.basename(filename))[0] - - version_filters = map ( lambda x: x % version_chars, - ( # Debian upstream tarball: package_'<version>.orig.tar.gz' - r'^(?P<package>[a-z\d\.\+\-]+)_(?P<version>%s+)\.orig', - # Upstream 'package-<version>.tar.gz' - # or Debian native 'package_<version>.tar.gz' - # or directory 'package-<version>': - r'^(?P<package>[a-zA-Z\d\.\+\-]+)(-|_)(?P<version>[0-9]%s*)')) - if extra_regex: - version_filters = extra_regex + version_filters - - for filter in version_filters: - m = re.match(filter, basename) - if m: - return (m.group('package'), m.group('version')) - return ('', '') - @staticmethod def guess_upstream_src_version(filename, extra_regex=r''): """ |