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