- yeni bir deneme paketi (amarok) yap (ve güzel hatalar keşfet.)
- build.py:getFileType()'daki bir hatayı düzelt. - kırık linkler ile ilgili iki sorunu util.py:sha1_file() ve build.py:genFilesXml()'de düzelt. - dizin boyutunu hesaplarken linkleri hesaplatma - util.py:dir_size() - files.py:Files'da okuma ile ilgili sorunları düzelt. - build.py:buildPackages()'da pakete eklenecek dosyaları files.xml'den okuyarak ekle.
This commit is contained in:
+12
-8
@@ -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)
|
||||
|
||||
+3
-2
@@ -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):
|
||||
|
||||
+12
-6
@@ -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"""
|
||||
|
||||
@@ -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()
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
|
||||
<!DOCTYPE PSPEC SYSTEM
|
||||
"http://www.uludag.org.tr/projeler/pisi/pisi-spec.dtd">
|
||||
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>amarok</Name>
|
||||
<Homepage>http://amarok.kde.org/</Homepage>
|
||||
<Packager>
|
||||
<Name>Baris Metin</Name>
|
||||
<Email>baris@uludag.org.tr</Email>
|
||||
</Packager>
|
||||
<License>GPL</License>
|
||||
<IsA>applications:audio</IsA>
|
||||
<PartOf>desktop:kde</PartOf>
|
||||
<Summary>Amarok audio player</Summary>
|
||||
<Description>Feature-rich audio player for KDE system.</Description>
|
||||
<Archive archType="tarbz2" sha1sum="660b576bcf5df6644dde03ba88d604c52191d593">
|
||||
http://umn.dl.sourceforge.net/sourceforge/amarok/amarok-1.3-beta1.tar.bz2
|
||||
</Archive>
|
||||
<BuildDependencies>
|
||||
<Dependency versionFrom="3.4.0">kdelibs</Dependency>
|
||||
</BuildDependencies>
|
||||
<History>
|
||||
<Update>
|
||||
<Date>06/25/2005</Date>
|
||||
<Version>1.3-beta1</Version>
|
||||
<Release>1</Release>
|
||||
</Update>
|
||||
</History>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>amarok</Name>
|
||||
<Summary>Amarok audio player</Summary>
|
||||
<Description>Feature-rich audio player for KDE system.</Description>
|
||||
<RuntimeDependencies>
|
||||
<Dependency>kdebase</Dependency>
|
||||
</RuntimeDependencies>
|
||||
<Files>
|
||||
<Path fileType="sharedLib">/usr/lib</Path>
|
||||
<Path fileType="data">/usr/share</Path>
|
||||
<Path fileType="localedata">/usr/share/locale</Path>
|
||||
<Path fileType="executable">/usr/bin</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
<Package>
|
||||
<Name>amarok-docs</Name>
|
||||
<Summary>Documentation files for Amarok audio player</Summary>
|
||||
<Description>Feature-rich audio player for KDE system.
|
||||
This package provides documentation files for Amarok.
|
||||
</Description>
|
||||
<Files>
|
||||
<Path fileType="doc">/usr/share/doc</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
</PISI>
|
||||
Reference in New Issue
Block a user