Artık files.xml içerisinde her bir "File" için "Size" bilgisi de var..
This commit is contained in:
+5
-4
@@ -185,21 +185,22 @@ class PisiBuild:
|
||||
install_dir = self.ctx.pkg_install_dir()
|
||||
for fpath, fhash in util.get_file_hashes(install_dir):
|
||||
# get the relative path
|
||||
fpath = fpath[len(install_dir):]
|
||||
frpath = fpath[len(install_dir):]
|
||||
ftype = ""
|
||||
# The usage of depth is somewhat confusing. It is used for
|
||||
# finding the best match to package.paths. For an example,
|
||||
# if package.paths contains
|
||||
# ['/usr/share','/usr/share/doc'] and fpath is
|
||||
# ['/usr/share','/usr/share/doc'] and frpath is
|
||||
# /usr/share/doc/filename our iteration over package.paths
|
||||
# should match the second item.
|
||||
depth = 0
|
||||
for path in package.paths:
|
||||
if fpath.startswith(path.pathname):
|
||||
if frpath.startswith(path.pathname):
|
||||
if depth < len(path.pathname):
|
||||
depth = len(path.pathname)
|
||||
ftype = path.fileType
|
||||
files.append(FileInfo(fpath, ftype, fhash))
|
||||
fsize = str(os.path.getsize(fpath))
|
||||
files.append(FileInfo(frpath, ftype, fsize, fhash))
|
||||
files.write(os.path.join(self.ctx.pkg_dir(), self.ctx.const.files_xml))
|
||||
|
||||
def buildPackages(self):
|
||||
|
||||
+6
-1
@@ -6,9 +6,10 @@ from xmlfile import XmlFile
|
||||
|
||||
class FileInfo:
|
||||
|
||||
def __init__(self, _path = "", _type = "", _hash = ""):
|
||||
def __init__(self, _path = "", _type = "", _size="", _hash = ""):
|
||||
self.path = _path
|
||||
self.type = _type
|
||||
self.size = _size
|
||||
self.hash = _hash
|
||||
|
||||
def readnew(node):
|
||||
@@ -19,6 +20,7 @@ class FileInfo:
|
||||
def read(self, node):
|
||||
self.path = getNodeText(getNode(node, "Path"))
|
||||
self.type = getNodeText(getNode(node, "Type"))
|
||||
self.size = getNodeText(getNode(node, "Size"))
|
||||
self.hash = getNodeText(getNode(node, "SHA1Sum"))
|
||||
|
||||
def elt(self, dom):
|
||||
@@ -29,10 +31,13 @@ class FileInfo:
|
||||
pathElt.appendChild(dom.createTextNode(self.path))
|
||||
typeElt = dom.createElement("Type")
|
||||
typeElt.appendChild(dom.createTextNode(self.type))
|
||||
sizeElt = dom.createElement("Size")
|
||||
sizeElt.appendChild(dom.createTextNode(self.size))
|
||||
hashElt = dom.createElement("SHA1Sum")
|
||||
hashElt.appendChild(dom.createTextNode(self.hash))
|
||||
elt.appendChild(pathElt)
|
||||
elt.appendChild(typeElt)
|
||||
elt.appendChild(sizeElt)
|
||||
elt.appendChild(hashElt)
|
||||
return elt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user