fix exception when AUR package disappears

This commit is contained in:
lilydjwg 2013-11-03 18:50:19 +08:00
parent dbc35aa901
commit 16ef913b88
2 changed files with 13 additions and 0 deletions

View File

@ -46,6 +46,10 @@ def write_verfile():
util.write_verfile(args.newver, g_curver)
def print_version_update(name, version):
if version is None:
task_dec()
return
oldver = g_oldver.get(name, None)
if not oldver or parse_version(oldver) < parse_version(version):
logger.info('%s: updated version %s', name, version)

View File

@ -1,10 +1,13 @@
from functools import partial
import json
import logging
from tornado.httpclient import AsyncHTTPClient
AUR_URL = 'https://aur.archlinux.org/rpc.php?type=info&arg='
logger = logging.getLogger(__name__)
def get_version(name, conf, callback):
aurname = conf.get('aur') or name
url = AUR_URL + aurname
@ -12,5 +15,11 @@ def get_version(name, conf, callback):
def _aur_done(name, callback, res):
data = json.loads(res.body.decode('utf-8'))
if not data['results']:
logger.error('AUR upstream not found for %s', name)
callback(name, None)
return
version = data['results']['Version']
callback(name, version)