aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2012-02-10 21:14:23 +0000
committerNicolas Vigier <boklm@mageia.org>2012-02-10 21:14:23 +0000
commit39f1a32d93adef18e47ac9cb432d655bda60bb96 (patch)
tree8b698d41093e53b3a42472aa5469411e66b8157d
parent5fbe91c7097ac79dd77df398a498f4824af9fae4 (diff)
downloadmgarepo-39f1a32d93adef18e47ac9cb432d655bda60bb96.tar
mgarepo-39f1a32d93adef18e47ac9cb432d655bda60bb96.tar.gz
mgarepo-39f1a32d93adef18e47ac9cb432d655bda60bb96.tar.bz2
mgarepo-39f1a32d93adef18e47ac9cb432d655bda60bb96.tar.xz
mgarepo-39f1a32d93adef18e47ac9cb432d655bda60bb96.zip
add sql file to create youridb
-rwxr-xr-xcreate-srpm8
-rw-r--r--youridb.sql1
2 files changed, 5 insertions, 4 deletions
diff --git a/create-srpm b/create-srpm
index b49972d..837c776 100755
--- a/create-srpm
+++ b/create-srpm
@@ -30,7 +30,7 @@ class youridb:
dbpasswd = config.get("youridb", "dbpasswd")
dbhost = config.get("youridb", "dbhost")
sslmode = 1
- self.db = psycopg2.connect(dbname=dbname, user=dbuser,
+ self.db = psycopg2.connect(database=dbname, user=dbuser,
password=dbpasswd, host=dbhost)
def add(self, srpm, url, revision, packager):
@@ -39,8 +39,8 @@ class youridb:
rpmEVR = rpmhdr[rpm.RPMTAG_EVR]
rpmsha1 = file_hash(srpm)
cur = self.db.cursor()
- cur.execute("INSERT INTO submits (sha1, rpmname, EVR, packager, url, revision, status) VALUES (%s, %s, %s, %s, %s, %s, %s);",
- (rpmsha1, rpmname, rpmEVR, packager, url, revision, 'create-srpm'))
+ cur.execute("INSERT INTO submits (sha1, rpmname, EVR, packager, url, revision, status, submit_ts) VALUES (%s, %s, %s, %s, %s, %s, %s, CURRENT_TIMESTAMP);",
+ (rpmsha1, rpmname, rpmEVR, packager, url, revision, '1'))
cur.close()
self.db.commit()
@@ -58,7 +58,7 @@ class CmdIface:
try:
db = youridb()
except Exception, e:
- print e.pgerror
+ print 'youridb error:', e
return 0
pw = pwd.getpwuid(os.getuid())
username = pw[0]
diff --git a/youridb.sql b/youridb.sql
new file mode 100644
index 0000000..bef94ce
--- /dev/null
+++ b/youridb.sql
@@ -0,0 +1 @@
+CREATE TABLE submits ( sha1 character(40), rpmname varchar(512), EVR varchar(100), packager varchar(100), url varchar(512), revision integer, status integer, submit_ts timestamp with time zone );