From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QKI6s-0001t1-Gt for garchives@archives.gentoo.org; Wed, 11 May 2011 22:42:26 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EA8AC1C043; Wed, 11 May 2011 22:42:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B74951C043 for ; Wed, 11 May 2011 22:42:18 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 27F541B4038 for ; Wed, 11 May 2011 22:42:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 9457F80504 for ; Wed, 11 May 2011 22:42:17 +0000 (UTC) From: "Vikraman Choudhury" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vikraman Choudhury" Message-ID: <7366313b044fddd519a845f555fc8b2d5bd780f5.vikraman@gentoo> Subject: [gentoo-commits] proj/gentoostats:master commit in: server/ X-VCS-Repository: proj/gentoostats X-VCS-Files: server/post.py X-VCS-Directories: server/ X-VCS-Committer: vikraman X-VCS-Committer-Name: Vikraman Choudhury X-VCS-Revision: 7366313b044fddd519a845f555fc8b2d5bd780f5 Date: Wed, 11 May 2011 22:42:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: c89969c1cae0b161a8f7ed27725dc588 commit: 7366313b044fddd519a845f555fc8b2d5bd780f5 Author: Vikraman Choudhury gmail com> AuthorDate: Wed May 11 22:41:43 2011 +0000 Commit: Vikraman Choudhury gmail com> CommitDate: Wed May 11 22:41:43 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoostats.g= it;a=3Dcommit;h=3D7366313b fix duplicate tuples in packages --- server/post.py | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/post.py b/server/post.py index 4cd0712..b9eb46c 100644 --- a/server/post.py +++ b/server/post.py @@ -48,9 +48,12 @@ def handler(uuid, data, db): pkg =3D data['PACKAGES'] for cpv in pkg.keys(): t =3D pkgsplit(cpv) - db.insert('packages', cat=3Dt['cat'], pkg=3Dt['pn'], ver=3Dt['ver']) - pkey =3D db.select('packages', vars=3D{'cat':t['cat'], 'pkg':t['pn']= , 'ver':t['ver']}, - where=3D'cat=3D$cat and pkg=3D$pkg and ver=3D$ver', what=3D'pkey')[0].p= key + s =3D db.select('packages', vars=3D{'cat':t['cat'], 'pkg':t['pn'], '= ver':t['ver']}, + where=3D'cat=3D$cat and pkg=3D$pkg and ver=3D$ver') + if len(s) =3D=3D 0: + pkey =3D db.insert('packages', cat=3Dt['cat'], pkg=3Dt['pn'], ver=3D= t['ver']) + else: + pkey =3D s[0].pkey for use in pkg[cpv]: db.insert('useflags', uuid=3Duuid, useflag=3Duse, pkey=3Dstr(pkey)= ) =20