diff --git a/pisi/build.py b/pisi/build.py index 0f0ae3b4..79e41bda 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -31,6 +31,7 @@ def getFileType(path, pinfoList): # should match the second item. depth = 0 ftype = "" + path = "/"+path # we need a real path. for pinfo in pinfoList: if path.startswith(pinfo.pathname): length = len(pinfo.pathname) @@ -194,7 +195,10 @@ class PisiBuild: for fpath, fhash in util.get_file_hashes(path): frpath = util.removepathprefix(install_dir, fpath) # relative path ftype = getFileType(frpath, package.paths) - fsize = str(os.path.getsize(fpath)) + try: # broken links can cause problem + fsize = str(os.path.getsize(fpath)) + except OSError: + fsize = "0" files.append(FileInfo(frpath, ftype, fsize, fhash)) files.write(os.path.join(self.ctx.pkg_dir(), const.files_xml)) @@ -226,13 +230,13 @@ class PisiBuild: pkg.add_to_package(const.metadata_xml) pkg.add_to_package(const.files_xml) - # Now it is time to add files to the packages. We should - # only add the files listed in the Files section of the - # Package. - for pinfo in package.paths: - p = os.path.join("install" + pinfo.pathname) - if os.path.exists(p): - pkg.add_to_package(p) + # Now it is time to add files to the packages using newly + # created files.xml + files = Files() + files.read(const.files_xml) + for finfo in files.list: + p = "install/" + finfo.path + pkg.add_to_package(p) pkg.close() os.chdir(c) diff --git a/pisi/files.py b/pisi/files.py index e8a46c7c..b70cc046 100644 --- a/pisi/files.py +++ b/pisi/files.py @@ -1,7 +1,7 @@ # Files module provides access to files.xml. files.xml is genarated # during the build process of a package and used in installation. -import xmlfile +from xmlext import * from xmlfile import XmlFile @@ -17,6 +17,7 @@ class FileInfo: f = FileInfo() f.read(node) return f + readnew = staticmethod(readnew) def read(self, node): self.path = getNodeText(getNode(node, "Path")) @@ -54,7 +55,7 @@ class Files(XmlFile): def read(self, filename): self.readxml(filename) - fileElts = getAllNodes(node, "File") + fileElts = self.getAllNodes("File") self.list = [FileInfo.readnew(x) for x in fileElts] def write(self, filename): diff --git a/pisi/util.py b/pisi/util.py index f31e7218..1fb53c3a 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -128,9 +128,10 @@ def dir_size(dir): # better solution :(. getsize = os.path.getsize join = os.path.join + islink = os.path.islink def sizes(): for root, dirs, files in os.walk(dir): - yield sum([getsize(join(root, name)) for name in files]) + yield sum([getsize(join(root, name)) for name in files if not islink(join(root,name))]) return sum( sizes() ) def copy_file(src,dest): @@ -156,11 +157,16 @@ def copy_dir(src, dest): def sha1_file(filename): """calculate sha1 hash of filename""" - m = sha.new() - f = file(filename, 'rb') - for l in f: - m.update(l) - return m.hexdigest() + # Broken links can cause problem! + try: + m = sha.new() + f = file(filename, 'rb') + for l in f: + m.update(l) + return m.hexdigest() + except IOError: + return "0" + def run_batch(cmd): """run command non-interactively and report return value and output""" diff --git a/samples/amarok/actions.py b/samples/amarok/actions.py new file mode 100644 index 00000000..a1c85a8f --- /dev/null +++ b/samples/amarok/actions.py @@ -0,0 +1,16 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from pisi.actionsapi import gnuconfig +from pisi.actionsapi import autotools + +def setup(): + gnuconfig.gnuconfig_update() +# libtoolize.libtoolize() + autotools.configure() + +def build(): + autotools.make() + +def install(): + autotools.install() diff --git a/samples/amarok/amarok-1.3-beta1.pspec b/samples/amarok/amarok-1.3-beta1.pspec new file mode 100644 index 00000000..6215e859 --- /dev/null +++ b/samples/amarok/amarok-1.3-beta1.pspec @@ -0,0 +1,60 @@ + + + + + + + amarok + http://amarok.kde.org/ + + Baris Metin + baris@uludag.org.tr + + GPL + applications:audio + desktop:kde + Amarok audio player + Feature-rich audio player for KDE system. + + http://umn.dl.sourceforge.net/sourceforge/amarok/amarok-1.3-beta1.tar.bz2 + + + kdelibs + + + + 06/25/2005 + 1.3-beta1 + 1 + + + + + + amarok + Amarok audio player + Feature-rich audio player for KDE system. + + kdebase + + + /usr/lib + /usr/share + /usr/share/locale + /usr/bin + + + + + amarok-docs + Documentation files for Amarok audio player + Feature-rich audio player for KDE system. +This package provides documentation files for Amarok. + + + /usr/share/doc + + + +