Add tag blacklisting
This commit is contained in:
parent
42d607ba5d
commit
5c800652d8
|
@ -4,7 +4,7 @@
|
|||
import urllib.request
|
||||
import pkgcrap.parse as parse
|
||||
import json
|
||||
from pkgcrap.util import maintained_packages_get
|
||||
from pkgcrap.util import blacklisted_tags_get, maintained_packages_get
|
||||
from functools import cmp_to_key
|
||||
from libversion import version_compare
|
||||
|
||||
|
@ -58,6 +58,7 @@ def repos_from_pkg(pkg):
|
|||
return [repo for repo in repos if repo != None]
|
||||
|
||||
def repo_get_latest_git(uri, pkg, verbose):
|
||||
global blacklisted_tags
|
||||
try:
|
||||
r = urllib.request.urlopen(uri+'/info/refs?service=git-upload-pack')
|
||||
except urllib.error.HTTPError:
|
||||
|
@ -66,9 +67,13 @@ def repo_get_latest_git(uri, pkg, verbose):
|
|||
return None
|
||||
tags = []
|
||||
for line in reversed(r.read().decode('utf-8').split("\n")):
|
||||
if line[4:44] in blacklisted_tags:
|
||||
continue
|
||||
line = line.split(' ')[-1].split("\t")[-1]
|
||||
if line[:10] == 'refs/tags/' and line[-3:] != '^{}':
|
||||
tag = line[10:]
|
||||
if tag in blacklisted_tags:
|
||||
continue
|
||||
if tag.startswith(pkg.name):
|
||||
tag = tag[len(pkg.name):]
|
||||
if tag.startswith('version'):
|
||||
|
@ -130,6 +135,8 @@ def main(args):
|
|||
else:
|
||||
packages = [parse.package.from_path('.')]
|
||||
verbose = True
|
||||
global blacklisted_tags
|
||||
blacklisted_tags = blacklisted_tags_get()
|
||||
for pkg in packages:
|
||||
pkg.load()
|
||||
outdated_check(pkg, verbose=verbose)
|
||||
|
|
|
@ -34,3 +34,12 @@ def maintained_packages_get():
|
|||
cat.load()
|
||||
packages.append(cat.packages[pkg_info[1]])
|
||||
return packages
|
||||
|
||||
def blacklisted_tags_get():
|
||||
blacklisted_tags = []
|
||||
with open(conf_file_path('eviltags.txt'), 'r') as fp:
|
||||
for line in fp.read().split('\n'):
|
||||
if len(line) > 0 and line[0] == '#':
|
||||
continue
|
||||
blacklisted_tags.append(line.split(' ',1)[0])
|
||||
return blacklisted_tags
|
||||
|
|
Loading…
Reference in New Issue