public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Vikraman Choudhury" <vikraman.choudhury@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoostats:master commit in: server/
Date: Wed, 11 May 2011 22:42:17 +0000 (UTC)	[thread overview]
Message-ID: <7366313b044fddd519a845f555fc8b2d5bd780f5.vikraman@gentoo> (raw)

commit:     7366313b044fddd519a845f555fc8b2d5bd780f5
Author:     Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
AuthorDate: Wed May 11 22:41:43 2011 +0000
Commit:     Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
CommitDate: Wed May 11 22:41:43 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoostats.git;a=commit;h=7366313b

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 = data['PACKAGES']
   for cpv in pkg.keys():
     t = pkgsplit(cpv)
-    db.insert('packages', cat=t['cat'], pkg=t['pn'], ver=t['ver'])
-    pkey = db.select('packages', vars={'cat':t['cat'], 'pkg':t['pn'], 'ver':t['ver']},
-	where='cat=$cat and pkg=$pkg and ver=$ver', what='pkey')[0].pkey
+    s = db.select('packages', vars={'cat':t['cat'], 'pkg':t['pn'], 'ver':t['ver']},
+	where='cat=$cat and pkg=$pkg and ver=$ver')
+    if len(s) == 0:
+      pkey = db.insert('packages', cat=t['cat'], pkg=t['pn'], ver=t['ver'])
+    else:
+      pkey = s[0].pkey
     for use in pkg[cpv]:
       db.insert('useflags', uuid=uuid, useflag=use, pkey=str(pkey))
   



             reply	other threads:[~2011-05-11 22:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11 22:42 Vikraman Choudhury [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-11 23:52 [gentoo-commits] proj/gentoostats:master commit in: server/ Vikraman Choudhury
2011-06-15 20:55 Vikraman Choudhury
2011-06-30 10:28 Vikraman Choudhury
2011-07-11  8:26 Vikraman Choudhury
2011-07-25 12:35 Vikraman Choudhury
2011-08-01 23:04 Vikraman Choudhury
2011-08-01 23:15 Vikraman Choudhury
2011-08-01 23:40 Vikraman Choudhury
2011-08-06 20:04 Vikraman Choudhury

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7366313b044fddd519a845f555fc8b2d5bd780f5.vikraman@gentoo \
    --to=vikraman.choudhury@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox