- pisi-build'in tekrar çalışmasını sağla.

- size bilgisini files'dan çıkart
- files.xml ve metadata.xml için doğru yeri pkg_dir() olarak tanımla.
This commit is contained in:
Barış Metin
2005-06-21 13:41:14 +00:00
parent 0627617632
commit db456c3601
3 changed files with 11 additions and 18 deletions
+4 -5
View File
@@ -107,7 +107,7 @@ class PisiBuild:
metadata.architecture = "Any" # FIXME metadata.architecture = "Any" # FIXME
metadata.installSize = util.dir_size(d) metadata.installSize = util.dir_size(d)
print d, metadata.installSize print d, metadata.installSize
metadata.write(os.path.join(self.ctx.pkg_work_dir(),"metadata.xml")) metadata.write(os.path.join(self.ctx.pkg_dir(),"metadata.xml"))
def genFilesXml(self, package): def genFilesXml(self, package):
# the worst function in this project! # the worst function in this project!
@@ -119,15 +119,14 @@ class PisiBuild:
fpath = fpath[len(install_dir):] fpath = fpath[len(install_dir):]
depth = 0 depth = 0
ftype = "" ftype = ""
fsize = 0
for path in package.paths: for path in package.paths:
if fpath.startswith(path.pathname): if fpath.startswith(path.pathname):
if depth < len(path.pathname): if depth < len(path.pathname):
depth = len(path.pathname) depth = len(path.pathname)
ftype = path.fileType ftype = path.fileType
print fpath, ftype, fsize, fhash print fpath, ftype, fhash
files.append(FileInfo(fpath, ftype, fsize, fhash)) files.append(FileInfo(fpath, ftype, fhash))
files.write(os.path.join(self.ctx.pkg_work_dir(),"files.xml")) files.write(os.path.join(self.ctx.pkg_dir(),"files.xml"))
def buildPackages(self): def buildPackages(self):
for package in self.spec.packages: for package in self.spec.packages:
+6 -12
View File
@@ -6,10 +6,9 @@ from xmlfile import XmlFile
class FileInfo: class FileInfo:
def __init__(self, _path = "", _type = "", _size = 0, _hash = ""): def __init__(self, _path = "", _type = "", _hash = ""):
self.path = _path self.path = _path
self.type = _type self.type = _type
self.size = _size
self.hash = _hash self.hash = _hash
def readnew(node): def readnew(node):
@@ -20,7 +19,6 @@ class FileInfo:
def read(self, node): def read(self, node):
self.path = getNodeText(getNode(node, "Path")) self.path = getNodeText(getNode(node, "Path"))
self.type = getNodeText(getNode(node, "Type")) self.type = getNodeText(getNode(node, "Type"))
self.size = int(getNodeText(getNode(node, "Size")))
self.hash = getNodeText(getNode(node, "Hash")) self.hash = getNodeText(getNode(node, "Hash"))
def elt(self, dom): def elt(self, dom):
@@ -28,16 +26,13 @@ class FileInfo:
## could apparently use helper functions to do this shorter ## could apparently use helper functions to do this shorter
elt = dom.createElement("File") elt = dom.createElement("File")
pathElt = dom.createElement("Path") pathElt = dom.createElement("Path")
pathElt.appendChild(dom.createTextNode(path)) pathElt.appendChild(dom.createTextNode(self.path))
typeElt = dom.createElement("Type") typeElt = dom.createElement("Type")
typeElt.appendChild(dom.createTextNode(type)) typeElt.appendChild(dom.createTextNode(self.type))
sizeElt = dom.createElement("Size")
sizeElt.appendChild(dom.createTextNode(str(size)))
hashElt = dom.createElement("Hash") hashElt = dom.createElement("Hash")
hashElt.appendChild(dom.createTextNode(hash)) hashElt.appendChild(dom.createTextNode(self.hash))
elt.appendChild(pathElt) elt.appendChild(pathElt)
elt.appendChild(typeElt) elt.appendChild(typeElt)
elt.appendChild(sizeElt)
elt.appendChild(hashElt) elt.appendChild(hashElt)
return elt return elt
@@ -58,8 +53,7 @@ class Files(XmlFile):
def write(self, filename): def write(self, filename):
self.newDOM() self.newDOM()
print list for x in self.list:
for x in list: print x.elt(self.dom)
self.dom.appendChild(x.elt(self.dom))
+1 -1
View File
@@ -126,7 +126,7 @@ class XmlFile(object):
"""clear DOM""" """clear DOM"""
from xml.dom.minidom import getDOMImplementation from xml.dom.minidom import getDOMImplementation
impl = getDOMImplementation() impl = getDOMImplementation()
dom = impl.createDocument(None, self.rootTag, None) self.dom = impl.createDocument(None, self.rootTag, None)
def unlink(self): def unlink(self):
self.dom.unlink() self.dom.unlink()