* pisi/operations/build.py (Builder.file_actions): Use python magic
module instead of spawning file process to improve performance.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
2009-09-16 Ozan Çağlayan <ozan@pardus.org.tr>
|
||||
* pisi/archive.py (ArchiveBzip2): Implement ArchiveBzip2 to support
|
||||
.bz2 archive files.
|
||||
.bz2 archive files,
|
||||
* pisi/operations/build.py (Builder.file_actions): Use python magic
|
||||
module instead of spawning file process to improve performance.
|
||||
|
||||
2009-09-08 Ozan Çağlayan <ozan@pardus.org.tr>
|
||||
* pisi/specfile.py (read_translations): Fix matching of translations
|
||||
|
||||
@@ -19,6 +19,7 @@ import glob
|
||||
import stat
|
||||
import pwd
|
||||
import grp
|
||||
import locale
|
||||
|
||||
import gettext
|
||||
__trans = gettext.translation('pisi', fallback=True)
|
||||
@@ -131,7 +132,6 @@ def strip_debug_action(filepath, fileinfo, install_dir, ag):
|
||||
for exclude in excludelist:
|
||||
if p.startswith(exclude):
|
||||
strip = False
|
||||
ctx.ui.debug("%s [%s]" %(p, "NoStrip"))
|
||||
|
||||
if strip:
|
||||
if pisi.util.strip_file(filepath, fileinfo, outputpath):
|
||||
@@ -838,13 +838,22 @@ class Builder:
|
||||
|
||||
def file_actions(self):
|
||||
install_dir = self.pkg_install_dir()
|
||||
|
||||
locale.setlocale(locale.LC_ALL, 'C')
|
||||
import magic
|
||||
ms = magic.open(magic.MAGIC_NONE)
|
||||
ms.load()
|
||||
|
||||
for root, dirs, files in os.walk(install_dir):
|
||||
for fn in files:
|
||||
filepath = pisi.util.join_path(root, fn)
|
||||
fileinfo = os.popen("file \"%s\"" % filepath).read()
|
||||
fileinfo = ms.file(filepath)
|
||||
strip_debug_action(filepath, fileinfo, install_dir, self.actionGlobals)
|
||||
exclude_special_files(filepath, fileinfo, install_dir, self.actionGlobals)
|
||||
|
||||
ms.close()
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
def build_packages(self):
|
||||
"""Build each package defined in PSPEC file. After this process there
|
||||
will be .pisi files hanging around, AS INTENDED ;)"""
|
||||
|
||||
Reference in New Issue
Block a user