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
parent 4b29c6db2b
commit 0203a465ee
3 changed files with 59 additions and 7 deletions

18
TODO
View File

@ -41,12 +41,18 @@ packages:
### handlers
- freecode: to scan freecode.com
- remote-id: type deb repository. Example I always scan:
http://dl.google.com/linux/musicmanager/deb/dists/stable/main/binary-i386/Packages
to see if google has release an update, same would help for all google
packages and some of the actual debian packages.
Something similar could be done for rpm repositories.
- remote-id type deb repository:
- Fix handler to support Packages.gz or Packages.bz2
- find out how to get download url
### remote-id
- Propose new remote-id: deb
e.g.: <remote-id type="deb">
http://mysite.com/deb/dists/stable/main/binary-i386/Packages
</remote-id>
- Propose new remote-id: freecode
e.g.: <remote-id type="freecode">projectname</remote-id>
euscanwww
---------

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)