From db456c3601786dcaa2f321563568558719c9531a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Tue, 21 Jun 2005 13:41:14 +0000 Subject: [PATCH] =?UTF-8?q?-=20pisi-build'in=20tekrar=20=C3=A7al=C4=B1?= =?UTF-8?q?=C5=9Fmas=C4=B1n=C4=B1=20sa=C4=9Fla.=20-=20size=20bilgisini=20f?= =?UTF-8?q?iles'dan=20=C3=A7=C4=B1kart=20-=20files.xml=20ve=20metadata.xml?= =?UTF-8?q?=20i=C3=A7in=20do=C4=9Fru=20yeri=20pkg=5Fdir()=20olarak=20tan?= =?UTF-8?q?=C4=B1mla.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/build.py | 9 ++++----- pisi/files.py | 18 ++++++------------ pisi/xmlfile.py | 2 +- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/pisi/build.py b/pisi/build.py index 08cd9104..20ab02fe 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -107,7 +107,7 @@ class PisiBuild: metadata.architecture = "Any" # FIXME metadata.installSize = util.dir_size(d) 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): # the worst function in this project! @@ -119,15 +119,14 @@ class PisiBuild: fpath = fpath[len(install_dir):] depth = 0 ftype = "" - fsize = 0 for path in package.paths: if fpath.startswith(path.pathname): if depth < len(path.pathname): depth = len(path.pathname) ftype = path.fileType - print fpath, ftype, fsize, fhash - files.append(FileInfo(fpath, ftype, fsize, fhash)) - files.write(os.path.join(self.ctx.pkg_work_dir(),"files.xml")) + print fpath, ftype, fhash + files.append(FileInfo(fpath, ftype, fhash)) + files.write(os.path.join(self.ctx.pkg_dir(),"files.xml")) def buildPackages(self): for package in self.spec.packages: diff --git a/pisi/files.py b/pisi/files.py index e9dc9ed8..f3a881fc 100644 --- a/pisi/files.py +++ b/pisi/files.py @@ -6,10 +6,9 @@ from xmlfile import XmlFile class FileInfo: - def __init__(self, _path = "", _type = "", _size = 0, _hash = ""): + def __init__(self, _path = "", _type = "", _hash = ""): self.path = _path self.type = _type - self.size = _size self.hash = _hash def readnew(node): @@ -20,7 +19,6 @@ class FileInfo: def read(self, node): self.path = getNodeText(getNode(node, "Path")) self.type = getNodeText(getNode(node, "Type")) - self.size = int(getNodeText(getNode(node, "Size"))) self.hash = getNodeText(getNode(node, "Hash")) def elt(self, dom): @@ -28,16 +26,13 @@ class FileInfo: ## could apparently use helper functions to do this shorter elt = dom.createElement("File") pathElt = dom.createElement("Path") - pathElt.appendChild(dom.createTextNode(path)) + pathElt.appendChild(dom.createTextNode(self.path)) typeElt = dom.createElement("Type") - typeElt.appendChild(dom.createTextNode(type)) - sizeElt = dom.createElement("Size") - sizeElt.appendChild(dom.createTextNode(str(size))) + typeElt.appendChild(dom.createTextNode(self.type)) hashElt = dom.createElement("Hash") - hashElt.appendChild(dom.createTextNode(hash)) + hashElt.appendChild(dom.createTextNode(self.hash)) elt.appendChild(pathElt) elt.appendChild(typeElt) - elt.appendChild(sizeElt) elt.appendChild(hashElt) return elt @@ -58,8 +53,7 @@ class Files(XmlFile): def write(self, filename): self.newDOM() - print list - for x in list: - self.dom.appendChild(x.elt(self.dom)) + for x in self.list: + print x.elt(self.dom) diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index 65dd4746..80c3e36f 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -126,7 +126,7 @@ class XmlFile(object): """clear DOM""" from xml.dom.minidom import getDOMImplementation impl = getDOMImplementation() - dom = impl.createDocument(None, self.rootTag, None) + self.dom = impl.createDocument(None, self.rootTag, None) def unlink(self): self.dom.unlink()