Commit 965f908e authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

git-update.py: Cast epoch to an integer



Convert epoch values before doing integer comparisons. Also, add a
sanity check for the epoch variable.

Reported-by: default avatarIdo Rosen <ido@kernel.org>
Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent 3d12d388
......@@ -42,8 +42,8 @@ def save_srcinfo(srcinfo, db, cur, user):
for pkgname in srcinfo.GetPackageNames():
pkginfo = srcinfo.GetMergedPackage(pkgname)
if 'epoch' in pkginfo and pkginfo['epoch'] > 0:
ver = '%d:%s-%s' % (pkginfo['epoch'], pkginfo['pkgver'],
if 'epoch' in pkginfo and int(pkginfo['epoch']) > 0:
ver = '%d:%s-%s' % (int(pkginfo['epoch']), pkginfo['pkgver'],
pkginfo['pkgrel'])
else:
ver = '%s-%s' % (pkginfo['pkgver'], pkginfo['pkgrel'])
......@@ -189,6 +189,9 @@ for commit in walker:
for pkgname in srcinfo.GetPackageNames():
pkginfo = srcinfo.GetMergedPackage(pkgname)
if 'epoch' in pkginfo and not pkginfo['epoch'].isdigit():
die_commit('invalid epoch: %s' % (pkginfo['epoch']), commit.id)
if not re.match(r'[a-z0-9][a-z0-9\.+_-]*$', pkginfo['pkgname']):
die_commit('invalid package name: %s' % (pkginfo['pkgname']),
commit.id)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment