Merge pull request #1 from safaariman/master

sync with safaariman
This commit is contained in:
Ertuğrul Erata
2019-08-06 09:31:14 +03:00
committed by GitHub
6 changed files with 218 additions and 11 deletions
+124 -3
View File
@@ -1,6 +1,127 @@
*~
*.mo
*.py[co]
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# PyCharm
.idea/
+35 -4
View File
@@ -26,6 +26,11 @@ from pisi.actionsapi.shelltools import system
from pisi.actionsapi.shelltools import can_access_file
from pisi.actionsapi.shelltools import unlink
from pisi.actionsapi.libtools import gnuconfig_update
from pisi.actionsapi.shelltools import isDirectory
from pisi.actionsapi.shelltools import ls
from pisi.actionsapi.pisitools import dosed
from pisi.actionsapi.pisitools import removeDir
class ConfigureError(pisi.actionsapi.Error):
def __init__(self, value=''):
@@ -59,6 +64,8 @@ def configure(parameters = ''):
if can_access_file('configure'):
gnuconfig_update()
prefix = get.emul32prefixDIR() if get.buildTYPE() == "emul32" else get.defaultprefixDIR()
args = './configure \
--prefix=/%s \
--build=%s \
@@ -68,10 +75,15 @@ def configure(parameters = ''):
--sysconfdir=/%s \
--localstatedir=/%s \
--libexecdir=/%s \
%s' % (get.defaultprefixDIR(), \
get.HOST(), get.manDIR(), \
get.infoDIR(), get.dataDIR(), \
get.confDIR(), get.localstateDIR(), get.libexecDIR(), parameters)
%s%s' % (prefix, \
get.HOST(), get.manDIR(), \
get.infoDIR(), get.dataDIR(), \
get.confDIR(), get.localstateDIR(), get.libexecDIR(),
"--libdir=/usr/lib32 " if get.buildTYPE() == "emul32" else "",
parameters)
if get.buildTYPE() == "emul32":
args += " --libdir=/usr/lib32"
if system(args):
raise ConfigureError(_('Configure failed.'))
@@ -101,6 +113,15 @@ def fixInfoDir():
if can_access_file(infoDir):
unlink(infoDir)
def fixpc():
''' fix .pc files in installDIR()/usr/lib32/pkgconfig'''
path = "%s/usr/lib32/pkgconfig" % get.installDIR()
if isDirectory(path):
for f in ls("%s/*.pc" % path):
dosed(f, get.emul32prefixDIR(), get.defaultprefixDIR())
def install(parameters = '', argument = 'install'):
'''install source into install directory with given parameters'''
args = 'make prefix=%(prefix)s/%(defaultprefix)s \
@@ -127,6 +148,11 @@ def install(parameters = '', argument = 'install'):
else:
fixInfoDir()
if get.buildTYPE() == "emul32":
fixpc()
if isDirectory("%s/emul32" % get.installDIR()):
removeDir("/emul32")
def rawInstall(parameters = '', argument = 'install'):
'''install source into install directory with given parameters = PREFIX=%s % get.installDIR()'''
@@ -135,6 +161,11 @@ def rawInstall(parameters = '', argument = 'install'):
else:
fixInfoDir()
if get.buildTYPE() == "emul32":
fixpc()
if isDirectory("%s/emul32" % get.installDIR()):
removeDir("/emul32")
def aclocal(parameters = ''):
'''generates an aclocal.m4 based on the contents of configure.in.'''
if system('aclocal %s' % parameters):
+3
View File
@@ -157,6 +157,9 @@ def libexecDIR():
def defaultprefixDIR():
return dirs.defaultprefix
def emul32prefixDIR():
return dirs.emul32prefix
def kdeDIR():
return dirs.kde
+1
View File
@@ -84,6 +84,7 @@ class Dirs:
localstate = 'var'
libexec = 'usr/libexec'
defaultprefix = 'usr'
emul32prefix = 'emul32'
# These should be owned by object not the class. Or else Python
# will bug us with NoneType errors because of uninitialized
+13 -1
View File
@@ -403,6 +403,13 @@ class Builder:
"SRC_NAME": self.spec.source.name,
"SRC_VERSION": self.spec.getSourceVersion(),
"SRC_RELEASE": self.spec.getSourceRelease()}
if self.build_type == "emul32":
env["CC"] = "%s -m32" % os.getenv("CC")
env["CXX"] = "%s -m32" % os.getenv("CXX")
env["CFLAGS"] = os.getenv("CFLAGS").replace("-fPIC", "")
env["CXXFLAGS"] = os.getenv("CXXFLAGS").replace("-fPIC", "")
env["PKG_CONFIG_PATH"] = "/usr/lib32/pkgconfig"
os.environ.update(env)
# First check icecream, if not found use ccache
@@ -676,6 +683,10 @@ class Builder:
src_dir, ext = os.path.splitext(src_dir)
if not ext:
break
if not os.path.exists(src_dir):
src_dir = util.join_path(self.pkg_work_dir(), [d for d in os.walk(self.pkg_work_dir()).next()[1] if not d.startswith(".")][0])
if self.get_state() == "unpack":
ctx.ui.debug("Using %s as WorkDir" % src_dir)
return src_dir
@@ -700,7 +711,8 @@ class Builder:
if func in self.actionLocals:
if ctx.get_option('ignore_sandbox') or \
not ctx.config.values.build.enablesandbox:
not ctx.config.values.build.enablesandbox or \
"emul32" in self.build_type:
self.actionLocals[func]()
else:
import catbox
+42 -3
View File
@@ -516,6 +516,17 @@ def uncompress(patchFile, compressType="gz", targetDir=""):
return filePath.split(".%s" % extension)[0]
def check_patch_level(workdir, path):
level = 0
while path:
if os.path.isfile("%s/%s" % (workdir, path)):
return level
if path.find("/") == -1:
return None
level += 1
path = path[path.find("/")+1:]
def do_patch(sourceDir, patchFile, level=0, name=None, reverse=False):
"""Apply given patch to the sourceDir."""
cwd = os.getcwd()
@@ -524,14 +535,42 @@ def do_patch(sourceDir, patchFile, level=0, name=None, reverse=False):
else:
raise Error(_("ERROR: WorkDir (%s) does not exist\n") % (sourceDir))
if level == None:
check_file(patchFile)
if level is None:
with open(patchFile, "r") as patchfile:
lines = patchfile.readlines()
try:
paths_m = [l.strip().split()[1] for l in lines if l.startswith("---") and "/" in l]
try:
paths_p = [l.strip().split()[1] for l in lines if l.startswith("+++")]
except IndexError:
paths_p = []
except IndexError:
pass
else:
if not paths_p:
paths_p = paths_m[:]
try:
paths_m = [l.strip().split()[1] for l in lines if l.startswith("***") and "/" in l]
except IndexError:
pass
for path_p, path_m in zip(paths_p, paths_m):
if "/dev/null" in path_m and not len(paths_p) -1 == paths_p.index(path_p): continue
level = check_patch_level(sourceDir, path_p)
if level is None and len(paths_m) - 1 == paths_m.index(path_m):
level = check_patch_level(sourceDir, path_m)
if level is not None:
ctx.ui.debug("Detected patch level=%s for %s" % (level, os.path.basename(patchFile)))
break
if level is None:
level = 0
if name is None:
name = os.path.basename(patchFile)
check_file(patchFile)
if ctx.get_option('use_quilt'):
patchesDir = join_path(sourceDir, ctx.const.quilt_dir_suffix)
# Make sure sourceDir/patches directory exists and if not create one!