mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 10:16:14 +01:00
do not crash on reading rpms (missuse of filname as file object)
This commit is contained in:
parent
c48cc43d1a
commit
c18adb7edf
@ -62,7 +62,7 @@ class RpmQuery(packagequery.PackageQuery):
|
|||||||
|
|
||||||
def __init__(self, fh):
|
def __init__(self, fh):
|
||||||
self.__file = fh
|
self.__file = fh
|
||||||
self.__file = os.path.abspath(fh.name)
|
self.__filename = os.path.abspath(fh.name)
|
||||||
self.filename_suffix = 'rpm'
|
self.filename_suffix = 'rpm'
|
||||||
self.header = None
|
self.header = None
|
||||||
|
|
||||||
@ -224,7 +224,11 @@ class RpmQuery(packagequery.PackageQuery):
|
|||||||
def query(filename):
|
def query(filename):
|
||||||
f = open(filename, 'rb')
|
f = open(filename, 'rb')
|
||||||
rpmq = RpmQuery(f)
|
rpmq = RpmQuery(f)
|
||||||
rpmq.read()
|
if rpmq:
|
||||||
|
rpmq.read()
|
||||||
|
else:
|
||||||
|
print "Failed to read", filename, "as rpm"
|
||||||
|
sys.exit(2)
|
||||||
f.close()
|
f.close()
|
||||||
return rpmq
|
return rpmq
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user