From 3bc44963280758f9e057943081e0b7a2f5541aff Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 14 Jun 2015 11:51:50 +0200 Subject: git-update: Fix parsing of versioned optdepends Fixes FS#43649. Signed-off-by: Lukas Fleischer --- git-interface/git-update.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'git-interface') diff --git a/git-interface/git-update.py b/git-interface/git-update.py index d87fac7..ebed491 100755 --- a/git-interface/git-update.py +++ b/git-interface/git-update.py @@ -36,6 +36,16 @@ def extract_arch_fields(pkginfo, field): return values +def parse_dep(depstring): + dep, _, desc = depstring.partition(': ') + depname = re.sub(r'(<|=|>).*', '', dep) + depcond = dep[len(depname):] + + if (desc): + return (depname + ': ' + desc, depcond) + else: + return (depname, depcond) + def save_srcinfo(srcinfo, db, cur, user): # Obtain package base ID and previous maintainer. pkgbase = srcinfo._pkgbase['pkgname'] @@ -89,8 +99,7 @@ def save_srcinfo(srcinfo, db, cur, user): [deptype]) deptypeid = cur.fetchone()[0] for dep_info in extract_arch_fields(pkginfo, deptype): - depname = re.sub(r'(<|=|>).*', '', dep_info['value']) - depcond = dep_info['value'][len(depname):] + depname, depcond = parse_dep(dep_info['value']) deparch = dep_info['arch'] cur.execute("INSERT INTO PackageDepends (PackageID, " + "DepTypeID, DepName, DepCondition, DepArch) " + @@ -103,8 +112,7 @@ def save_srcinfo(srcinfo, db, cur, user): [reltype]) reltypeid = cur.fetchone()[0] for rel_info in extract_arch_fields(pkginfo, reltype): - relname = re.sub(r'(<|=|>).*', '', rel_info['value']) - relcond = rel_info['value'][len(relname):] + relname, relcond = parse_dep(rel_info['value']) relarch = rel_info['arch'] cur.execute("INSERT INTO PackageRelations (PackageID, " + "RelTypeID, RelName, RelCondition, RelArch) " + -- cgit v1.2.3-70-g09d2