diff options
-rw-r--r-- | CHANGES | 1 | ||||
-rwxr-xr-x | create-srpm | 10 |
2 files changed, 10 insertions, 1 deletions
@@ -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 |