euscan: Adding naive deb handler, TODO updated

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino
2012-09-14 16:56:52 +02:00
committed by Corentin Chary
parent d2433c1b3c
commit 056b00f709
3 changed files with 59 additions and 7 deletions

View File

@ -0,0 +1,46 @@
import urllib
import re
import portage
from euscan import mangling, helpers, output
HANDLER_NAME = "deb"
CONFIDENCE = 100
PRIORITY = 90
def can_handle(pkg, url=None):
return False
def scan_pkg(pkg, options):
cp, ver, rev = portage.pkgsplit(pkg.cpv)
packages_url, package_name = options['data'].strip().split(" ", 1)
output.einfo("Using Debian Packages: " + packages_url)
fp = urllib.urlopen(packages_url)
content = fp.read()
# TODO: Add support for .gz and .bz2 Packages file
content = content.split("\n\n")
result = []
for package_info in content:
for line in package_info.split("\n"):
res = re.search("^Version: (.*)$", line)
if res:
result.append(res.group(1))
ret = []
for up_pv in result:
url = "" # TODO: How to find the url?
pv = mangling.mangle_version(up_pv, options)
if helpers.version_filtered(cp, ver, pv):
continue
ret.append((url, pv, HANDLER_NAME, CONFIDENCE))
return ret

View File

@ -17,7 +17,7 @@ def can_handle(pkg, url=None):
def scan_pkg(pkg, options):
cp, ver, rev = portage.pkgsplit(pkg.cpv)
package = options['data']
package = options['data'].strip()
output.einfo("Using FreeCode handler: " + package)