pisi copies already existing local file to /tmp before reading
When "pisi info pkgname" is run, pisi finds the related metadata.xml file under /var/lib/pisi/package/pkgname/metadata.xml. But then it copies the file to /tmp before reading it. Fix this weirdness by figuring remote and local files and read the localfile from its location. BUG:FIXED:5417
This commit is contained in:
+10
-14
@@ -62,23 +62,19 @@ class XmlFile(object):
|
||||
except Exception, e:
|
||||
raise Error(_("String '%s' has invalid XML") % (xml))
|
||||
|
||||
def readxmlfile(self, f):
|
||||
raise Exception("not implemented")
|
||||
try:
|
||||
self.doc = iks.parse(f)
|
||||
return self.doc
|
||||
except Exception, e:
|
||||
raise Error(_("File '%s' has invalid XML") % (f) )
|
||||
|
||||
|
||||
def readxml(self, uri, tmpDir='/tmp', sha1sum=False,
|
||||
compress=None, sign=None, copylocal = False):
|
||||
|
||||
uri = pisi.file.File.make_uri(uri)
|
||||
#try:
|
||||
localpath = pisi.file.File.download(uri, tmpDir, sha1sum=sha1sum,
|
||||
compress=compress,sign=sign, copylocal=copylocal)
|
||||
#except IOError, e:
|
||||
# raise Error(_("Cannot read URI %s: %s") % (uri, unicode(e)) )
|
||||
|
||||
if uri.is_local_file():
|
||||
# this is a local file
|
||||
localpath = uri.path()
|
||||
else:
|
||||
# this is a remote file, first download it into tmpDir
|
||||
localpath = pisi.file.File.download(uri, tmpDir, sha1sum=sha1sum,
|
||||
compress=compress,sign=sign, copylocal=copylocal)
|
||||
|
||||
try:
|
||||
self.doc = iks.parse(localpath)
|
||||
return self.doc
|
||||
|
||||
Reference in New Issue
Block a user