Gerekli olmadığına inandığımız *.a dosyalarını paketlerin içine almayıp otomatik yaratılan ayrı bir pakete koyalım dedik..
--create-static diye bir parametre ekledim. Şimdilik özellikle istenmediği sürece *-static paketleri oluşturulmuyor. Fakat depo'daki eksikleri düzelttikten sonra bunu öntanımlı seçenek haline getirip getirmemeyi tartışabiliriz. ------------------------------------------------------------------------- meren@wunjo bzip2 $ sudo pisi build pspec.xml (...) * Paket bzip2 inşa ediliyor meren@wunjo bzip2 $ ls -l *.pisi -rw-r--r-- 1 root root 434256 Mar 22 13:51 bzip2-1.0.3-3-1.pisi meren@wunjo bzip2 $ rm -rf *.pisi meren@wunjo bzip2 $ sudo pisi build pspec.xml --create-static PİSİ kaynak paketi bzip2 inşa ediliyor (...) * Paket bzip2 inşa ediliyor * Paket bzip2-static inşa ediliyor meren@wunjo bzip2 $ ls -l *.pisi -rw-r--r-- 1 root root 406859 Mar 22 13:51 bzip2-1.0.3-3-1.pisi -rw-r--r-- 1 root root 28280 Mar 22 13:51 bzip2-static-1.0.3-3-1.pisi --------------------------------------------------------------------------
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
|
from copy import deepcopy
|
||||||
from os.path import basename, dirname
|
from os.path import basename, dirname
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
@@ -74,6 +75,10 @@ def check_path_collision(package, pkgList):
|
|||||||
# collide. Exp:
|
# collide. Exp:
|
||||||
# pinfo.path: /usr/share
|
# pinfo.path: /usr/share
|
||||||
# path.path: /usr/share/doc
|
# path.path: /usr/share/doc
|
||||||
|
if path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static'):
|
||||||
|
# don't throw collision error for ar files.
|
||||||
|
# we'll handle this in gen_files_xml..
|
||||||
|
continue
|
||||||
if util.subpath(pinfo.path, path.path):
|
if util.subpath(pinfo.path, path.path):
|
||||||
collisions.append(path.path)
|
collisions.append(path.path)
|
||||||
ctx.ui.error(_('Path %s belongs in multiple packages') %
|
ctx.ui.error(_('Path %s belongs in multiple packages') %
|
||||||
@@ -461,6 +466,28 @@ class Builder:
|
|||||||
ctx.ui.action(_("* Applying patch: %s") % patch.filename)
|
ctx.ui.action(_("* Applying patch: %s") % patch.filename)
|
||||||
util.do_patch(self.srcDir, patchFile, level=patch.level, target=patch.target)
|
util.do_patch(self.srcDir, patchFile, level=patch.level, target=patch.target)
|
||||||
|
|
||||||
|
def generate_static_package_object(self):
|
||||||
|
ar_files = []
|
||||||
|
for root, dirs, files in os.walk(self.pkg_install_dir()):
|
||||||
|
for f in files:
|
||||||
|
if f.endswith(ctx.const.ar_file_suffix) and util.is_ar_file(util.join_path(root, f)):
|
||||||
|
ar_files.append(util.join_path(root, f))
|
||||||
|
|
||||||
|
if not len(ar_files):
|
||||||
|
return None
|
||||||
|
|
||||||
|
static_package_obj = pisi.specfile.Package()
|
||||||
|
static_package_obj.name = self.spec.source.name + ctx.const.static_name_suffix
|
||||||
|
# FIXME: find a better way to deal with the summary and description constants.
|
||||||
|
static_package_obj.summary['en'] = u'Ar files for %s' % (self.spec.source.name)
|
||||||
|
static_package_obj.description['en'] = u'Ar files for %s' % (self.spec.source.name)
|
||||||
|
static_package_obj.partOf = 'library:static'
|
||||||
|
for f in ar_files:
|
||||||
|
static_package_obj.files.append(pisi.specfile.Path(path = f[len(self.pkg_install_dir()):], fileType = "library"))
|
||||||
|
static_package_obj.packageDependencies.append(pisi.dependency.Dependency(package = self.spec.source.name))
|
||||||
|
|
||||||
|
return static_package_obj
|
||||||
|
|
||||||
def strip_install_dir(self):
|
def strip_install_dir(self):
|
||||||
"""strip install directory"""
|
"""strip install directory"""
|
||||||
ctx.ui.action(_("Stripping files.."))
|
ctx.ui.action(_("Stripping files.."))
|
||||||
@@ -529,6 +556,13 @@ class Builder:
|
|||||||
def add_path(path):
|
def add_path(path):
|
||||||
# add the files under material path
|
# add the files under material path
|
||||||
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
|
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
|
||||||
|
if ctx.get_option('create_static') \
|
||||||
|
and fpath.endswith(ctx.const.ar_file_suffix) \
|
||||||
|
and not package.name.endswith(ctx.const.static_name_suffix) \
|
||||||
|
and util.is_ar_file(fpath):
|
||||||
|
# if this is an ar file, and this package is not a -static package,
|
||||||
|
# don't include this file into the package.
|
||||||
|
continue
|
||||||
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
||||||
ftype, permanent = get_file_type(frpath, package.files, install_dir)
|
ftype, permanent = get_file_type(frpath, package.files, install_dir)
|
||||||
fsize = util.dir_size(fpath)
|
fsize = util.dir_size(fpath)
|
||||||
@@ -641,6 +675,11 @@ class Builder:
|
|||||||
# Strip install directory before building .pisi packages.
|
# Strip install directory before building .pisi packages.
|
||||||
self.strip_install_dir()
|
self.strip_install_dir()
|
||||||
|
|
||||||
|
if ctx.get_option('create_static'):
|
||||||
|
obj = self.generate_static_package_object()
|
||||||
|
if obj:
|
||||||
|
self.spec.packages.append(obj)
|
||||||
|
|
||||||
package_names = []
|
package_names = []
|
||||||
old_package_names = []
|
old_package_names = []
|
||||||
|
|
||||||
|
|||||||
@@ -352,6 +352,8 @@ to be downloaded from a repository containing sources.
|
|||||||
help=_("bypass errors from ActionsAPI"))
|
help=_("bypass errors from ActionsAPI"))
|
||||||
self.parser.add_option("-B", "--ignore-comar", action="store_true",
|
self.parser.add_option("-B", "--ignore-comar", action="store_true",
|
||||||
default=False, help=_("bypass comar configuration agent"))
|
default=False, help=_("bypass comar configuration agent"))
|
||||||
|
self.parser.add_option("-S", "--create-static", action="store_true",
|
||||||
|
default=False, help=_("automatically create a *-static package with ar files"))
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|||||||
+5
-1
@@ -45,10 +45,14 @@ class Constants:
|
|||||||
__c = _constant()
|
__c = _constant()
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# prefix for package names
|
# suffix for package names
|
||||||
self.__c.package_suffix = ".pisi"
|
self.__c.package_suffix = ".pisi"
|
||||||
self.__c.xdelta_suffix = ".xdelta"
|
self.__c.xdelta_suffix = ".xdelta"
|
||||||
|
|
||||||
|
# suffix for auto generated ar packages
|
||||||
|
self.__c.static_name_suffix = "-static"
|
||||||
|
self.__c.ar_file_suffix = ".a"
|
||||||
|
|
||||||
# directory suffixes for build
|
# directory suffixes for build
|
||||||
self.__c.work_dir_suffix = "/work"
|
self.__c.work_dir_suffix = "/work"
|
||||||
self.__c.install_dir_suffix = "/install"
|
self.__c.install_dir_suffix = "/install"
|
||||||
|
|||||||
+5
-2
@@ -312,11 +312,14 @@ def copy_file(src,dest):
|
|||||||
check_dir(os.path.dirname(dest))
|
check_dir(os.path.dirname(dest))
|
||||||
shutil.copyfile(src, dest)
|
shutil.copyfile(src, dest)
|
||||||
|
|
||||||
|
def is_ar_file(file_path):
|
||||||
|
return open(file_path).readline().strip() == '!<arch>'
|
||||||
|
|
||||||
def clean_ar_timestamps(ar_file):
|
def clean_ar_timestamps(ar_file):
|
||||||
"""clean the timestamps of the ar files"""
|
"""clean the timestamps of the ar files"""
|
||||||
content = open(ar_file).readlines()
|
if not is_ar_file(ar_file):
|
||||||
if not content[0].strip() == '!<arch>':
|
|
||||||
return
|
return
|
||||||
|
content = open(ar_file).readlines()
|
||||||
fp = open(ar_file, 'w')
|
fp = open(ar_file, 'w')
|
||||||
for line in content:
|
for line in content:
|
||||||
pos = line.rfind(chr(32) + chr(96))
|
pos = line.rfind(chr(32) + chr(96))
|
||||||
|
|||||||
Reference in New Issue
Block a user