- 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:
+10
-6
@@ -31,6 +31,7 @@ def getFileType(path, pinfoList):
|
|||||||
# should match the second item.
|
# should match the second item.
|
||||||
depth = 0
|
depth = 0
|
||||||
ftype = ""
|
ftype = ""
|
||||||
|
path = "/"+path # we need a real path.
|
||||||
for pinfo in pinfoList:
|
for pinfo in pinfoList:
|
||||||
if path.startswith(pinfo.pathname):
|
if path.startswith(pinfo.pathname):
|
||||||
length = len(pinfo.pathname)
|
length = len(pinfo.pathname)
|
||||||
@@ -194,7 +195,10 @@ class PisiBuild:
|
|||||||
for fpath, fhash in util.get_file_hashes(path):
|
for fpath, fhash in util.get_file_hashes(path):
|
||||||
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
||||||
ftype = getFileType(frpath, package.paths)
|
ftype = getFileType(frpath, package.paths)
|
||||||
|
try: # broken links can cause problem
|
||||||
fsize = str(os.path.getsize(fpath))
|
fsize = str(os.path.getsize(fpath))
|
||||||
|
except OSError:
|
||||||
|
fsize = "0"
|
||||||
files.append(FileInfo(frpath, ftype, fsize, fhash))
|
files.append(FileInfo(frpath, ftype, fsize, fhash))
|
||||||
|
|
||||||
files.write(os.path.join(self.ctx.pkg_dir(), const.files_xml))
|
files.write(os.path.join(self.ctx.pkg_dir(), const.files_xml))
|
||||||
@@ -226,12 +230,12 @@ class PisiBuild:
|
|||||||
pkg.add_to_package(const.metadata_xml)
|
pkg.add_to_package(const.metadata_xml)
|
||||||
pkg.add_to_package(const.files_xml)
|
pkg.add_to_package(const.files_xml)
|
||||||
|
|
||||||
# Now it is time to add files to the packages. We should
|
# Now it is time to add files to the packages using newly
|
||||||
# only add the files listed in the Files section of the
|
# created files.xml
|
||||||
# Package.
|
files = Files()
|
||||||
for pinfo in package.paths:
|
files.read(const.files_xml)
|
||||||
p = os.path.join("install" + pinfo.pathname)
|
for finfo in files.list:
|
||||||
if os.path.exists(p):
|
p = "install/" + finfo.path
|
||||||
pkg.add_to_package(p)
|
pkg.add_to_package(p)
|
||||||
|
|
||||||
pkg.close()
|
pkg.close()
|
||||||
|
|||||||
+3
-2
@@ -1,7 +1,7 @@
|
|||||||
# Files module provides access to files.xml. files.xml is genarated
|
# Files module provides access to files.xml. files.xml is genarated
|
||||||
# during the build process of a package and used in installation.
|
# during the build process of a package and used in installation.
|
||||||
|
|
||||||
import xmlfile
|
from xmlext import *
|
||||||
from xmlfile import XmlFile
|
from xmlfile import XmlFile
|
||||||
|
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ class FileInfo:
|
|||||||
f = FileInfo()
|
f = FileInfo()
|
||||||
f.read(node)
|
f.read(node)
|
||||||
return f
|
return f
|
||||||
|
readnew = staticmethod(readnew)
|
||||||
|
|
||||||
def read(self, node):
|
def read(self, node):
|
||||||
self.path = getNodeText(getNode(node, "Path"))
|
self.path = getNodeText(getNode(node, "Path"))
|
||||||
@@ -54,7 +55,7 @@ class Files(XmlFile):
|
|||||||
def read(self, filename):
|
def read(self, filename):
|
||||||
self.readxml(filename)
|
self.readxml(filename)
|
||||||
|
|
||||||
fileElts = getAllNodes(node, "File")
|
fileElts = self.getAllNodes("File")
|
||||||
self.list = [FileInfo.readnew(x) for x in fileElts]
|
self.list = [FileInfo.readnew(x) for x in fileElts]
|
||||||
|
|
||||||
def write(self, filename):
|
def write(self, filename):
|
||||||
|
|||||||
+7
-1
@@ -128,9 +128,10 @@ def dir_size(dir):
|
|||||||
# better solution :(.
|
# better solution :(.
|
||||||
getsize = os.path.getsize
|
getsize = os.path.getsize
|
||||||
join = os.path.join
|
join = os.path.join
|
||||||
|
islink = os.path.islink
|
||||||
def sizes():
|
def sizes():
|
||||||
for root, dirs, files in os.walk(dir):
|
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() )
|
return sum( sizes() )
|
||||||
|
|
||||||
def copy_file(src,dest):
|
def copy_file(src,dest):
|
||||||
@@ -156,11 +157,16 @@ def copy_dir(src, dest):
|
|||||||
|
|
||||||
def sha1_file(filename):
|
def sha1_file(filename):
|
||||||
"""calculate sha1 hash of filename"""
|
"""calculate sha1 hash of filename"""
|
||||||
|
# Broken links can cause problem!
|
||||||
|
try:
|
||||||
m = sha.new()
|
m = sha.new()
|
||||||
f = file(filename, 'rb')
|
f = file(filename, 'rb')
|
||||||
for l in f:
|
for l in f:
|
||||||
m.update(l)
|
m.update(l)
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
|
except IOError:
|
||||||
|
return "0"
|
||||||
|
|
||||||
|
|
||||||
def run_batch(cmd):
|
def run_batch(cmd):
|
||||||
"""run command non-interactively and report return value and output"""
|
"""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