aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2012-12-04 13:18:57 +0000
committerNicolas Vigier <boklm@mageia.org>2012-12-04 13:18:57 +0000
commit7b66b55903f09fef8bd1a9a3a3b0941890e2ac4f (patch)
tree3272eccc4276d9577ab336c01e9299602437dea4
parentfa6e28fa34acb6167d5a70c138c5041d1b19d03d (diff)
downloadmgarepo-7b66b55903f09fef8bd1a9a3a3b0941890e2ac4f.tar
mgarepo-7b66b55903f09fef8bd1a9a3a3b0941890e2ac4f.tar.gz
mgarepo-7b66b55903f09fef8bd1a9a3a3b0941890e2ac4f.tar.bz2
mgarepo-7b66b55903f09fef8bd1a9a3a3b0941890e2ac4f.tar.xz
mgarepo-7b66b55903f09fef8bd1a9a3a3b0941890e2ac4f.zip
create-srpm: don't use youridb if no db defined
-rw-r--r--CHANGES1
-rwxr-xr-xcreate-srpm10
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 7a7ffea..bbbbfc3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,5 @@
+- in create-srpm, don't try to use youri db if not defined in config
- allow keeping the old rpm log in the package directory if the oldurl
config value is set to '.' or starts with './'
- add putsrpm command in man page (#4055)
diff --git a/create-srpm b/create-srpm
index 837c776..9b654a3 100755
--- a/create-srpm
+++ b/create-srpm
@@ -13,7 +13,6 @@ import optparse
import subprocess
import urlparse
import urllib
-import psycopg2
import rpm
def get_rpm_hdr(filename):
@@ -26,6 +25,11 @@ def get_rpm_hdr(filename):
class youridb:
def __init__(self):
dbname = config.get("youridb", "dbname")
+ if not dbname:
+ self.usedb = False
+ return
+ import psycopg2
+ self.usedb = True
dbuser = config.get("youridb", "dbuser")
dbpasswd = config.get("youridb", "dbpasswd")
dbhost = config.get("youridb", "dbhost")
@@ -34,6 +38,8 @@ class youridb:
password=dbpasswd, host=dbhost)
def add(self, srpm, url, revision, packager):
+ if not self.usedb:
+ return
rpmhdr = get_rpm_hdr(srpm)
rpmname = rpmhdr[rpm.RPMTAG_NAME]
rpmEVR = rpmhdr[rpm.RPMTAG_EVR]
@@ -45,6 +51,8 @@ class youridb:
self.db.commit()
def close(self):
+ if not self.usedb:
+ return
self.db.close()
class CmdError(Error): pass