def vcs_git_url(pkg): repos = {} out = apt_showsrc(pkg) vcs_re = re.compile(r'(x-)?vcs-git:\s*(?P<repo>[^ ]+)$', re.I) version_re = re.compile(r'Version:\s*(?P<version>.*)$', re.I) end_re = re.compile(r'\s*$') version = repo = None for line in out.split('\n'): m = vcs_re.match(line) if m: repo = m.group('repo') continue m = version_re.match(line) if m: version = m.group('version') continue m = end_re.match(line) if m: if version and repo: repos[version] = repo version = repo = None if not repos: gbp.log.err("Can't find any vcs-git URL for '%s'" % pkg) return None s = sorted(repos, key=cmp_to_key(DpkgCompareVersions())) return repos[s[-1]]
def __call__(self, dsc1, dsc2): return DpkgCompareVersions.__call__(self, dsc1.version, dsc2.version)
def __init__(self): DpkgCompareVersions.__init__(self)