diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-12-30 12:28:25 +0100 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-12-30 12:38:12 +0100 |
commit | 965f908e15c072bb09a9f206bbfe50c843ac3d21 (patch) | |
tree | ec6cdd89b1e8d835d19c60bab46e172dc25152c3 /scripts/git-integration | |
parent | 3d12d3888a625523fc7fe89278a85c54fb94beec (diff) | |
download | aurweb-965f908e15c072bb09a9f206bbfe50c843ac3d21.tar.xz |
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: Ido Rosen <ido@kernel.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'scripts/git-integration')
-rwxr-xr-x | scripts/git-integration/git-update.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/git-integration/git-update.py b/scripts/git-integration/git-update.py index 94da12e..6888ad0 100755 --- a/scripts/git-integration/git-update.py +++ b/scripts/git-integration/git-update.py @@ -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) |