2012-08-03 21:50:54 +02:00
|
|
|
from euscan.handlers import generic
|
2011-12-30 11:34:39 +01:00
|
|
|
|
2012-07-24 15:02:36 +02:00
|
|
|
PRIORITY = 90
|
2012-06-28 11:08:05 +02:00
|
|
|
|
2012-05-23 16:30:43 +02:00
|
|
|
HANDLER_NAME = "kde"
|
|
|
|
|
2012-04-28 18:16:05 +02:00
|
|
|
|
2012-07-24 08:56:00 +02:00
|
|
|
def can_handle(pkg, url):
|
2012-08-03 21:50:54 +02:00
|
|
|
return url and url.startswith('mirror://kde/')
|
2012-04-28 18:16:05 +02:00
|
|
|
|
2011-12-30 11:34:39 +01:00
|
|
|
def clean_results(results):
|
|
|
|
ret = []
|
|
|
|
|
2012-07-24 15:02:36 +02:00
|
|
|
for path, version, _, confidence in results:
|
2011-12-30 11:34:39 +01:00
|
|
|
if version == '5SUMS':
|
|
|
|
continue
|
2012-05-23 16:44:44 +02:00
|
|
|
ret.append((path, version, HANDLER_NAME, confidence))
|
2011-12-30 11:34:39 +01:00
|
|
|
|
|
|
|
return ret
|
|
|
|
|
2012-04-28 18:16:05 +02:00
|
|
|
|
2012-08-03 21:50:54 +02:00
|
|
|
def scan_url(pkg, url):
|
2012-07-24 08:56:00 +02:00
|
|
|
results = generic.scan(pkg.cpv, url)
|
2011-12-30 11:34:39 +01:00
|
|
|
|
2012-08-03 21:50:54 +02:00
|
|
|
if generic.startswith('mirror://kde/unstable/'):
|
|
|
|
url = generic.replace('mirror://kde/unstable/', 'mirror://kde/stable/')
|
2012-07-24 08:56:00 +02:00
|
|
|
results += generic.scan(pkg.cpv, url)
|
2011-12-30 11:34:39 +01:00
|
|
|
|
2012-07-26 10:44:10 +02:00
|
|
|
if not results: # if nothing was found go brute forcing
|
|
|
|
results = generic.brute_force(pkg.cpv, url)
|
2011-12-30 11:34:39 +01:00
|
|
|
|
2012-08-03 21:50:54 +02:00
|
|
|
if generic.startswith('mirror://kde/unstable/'):
|
|
|
|
url = generic.replace('mirror://kde/unstable/', 'mirror://kde/stable/')
|
2012-07-26 10:44:10 +02:00
|
|
|
results += generic.brute_force(pkg.cpv, url)
|
2011-12-30 11:34:39 +01:00
|
|
|
|
|
|
|
return clean_results(results)
|