1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 12:29:55 +00:00

sstate: Add extra intercept functions

In some cases we do either need to add extra sstate manipulation
functions, or change the existing modification functions. This patch
parametrises them to SSTATECREATEFUNCS and SSTATEPOSTUNPACKFUNCS and
abstracts the "hardcoded path" functions into separate functions using
these new variables.

We may use this new functionality to improve binary relocating using
patchelf for example, this at least lets us have the hooks to be able to
experiment.

(From OE-Core rev: 9d659c6f20fa4a141b491c62a3ef0dfb1f896d9c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2014-08-27 15:48:09 +01:00
parent bbf1040f8c
commit 347f9c6bc3
+30 -24
View File
@@ -32,8 +32,10 @@ BB_HASHFILENAME = "${SSTATE_EXTRAPATH} ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}"
SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
SSTATEPREINSTFUNCS ?= "" SSTATECREATEFUNCS = "sstate_hardcode_path"
SSTATEPOSTINSTFUNCS ?= "" SSTATEPREINSTFUNCS = ""
SSTATEPOSTUNPACKFUNCS = "sstate_hardcode_path_unpack"
SSTATEPOSTINSTFUNCS = ""
EXTRA_STAGING_FIXMES ?= "" EXTRA_STAGING_FIXMES ?= ""
# Specify dirs in which the shell function is executed and don't use ${B} # Specify dirs in which the shell function is executed and don't use ${B}
@@ -239,16 +241,32 @@ def sstate_installpkg(ss, d):
d.setVar('SSTATE_INSTDIR', sstateinst) d.setVar('SSTATE_INSTDIR', sstateinst)
d.setVar('SSTATE_PKG', sstatepkg) d.setVar('SSTATE_PKG', sstatepkg)
for preinst in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split(): for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split():
bb.build.exec_func(preinst, d) bb.build.exec_func(f, d)
bb.build.exec_func('sstate_unpack_package', d) for state in ss['dirs']:
prepdir(state[1])
os.rename(sstateinst + state[0], state[1])
sstate_install(ss, d)
for plain in ss['plaindirs']:
workdir = d.getVar('WORKDIR', True)
src = sstateinst + "/" + plain.replace(workdir, '')
dest = plain
bb.utils.mkdirhier(src)
prepdir(dest)
os.rename(src, dest)
return True
python sstate_hardcode_path_unpack () {
# Fixup hardcoded paths # Fixup hardcoded paths
# #
# Note: The logic below must match the reverse logic in # Note: The logic below must match the reverse logic in
# sstate_hardcode_path(d) # sstate_hardcode_path(d)
import subprocess
sstateinst = d.getVar('SSTATE_INSTDIR', True)
fixmefn = sstateinst + "fixmepath" fixmefn = sstateinst + "fixmepath"
if os.path.isfile(fixmefn): if os.path.isfile(fixmefn):
staging = d.getVar('STAGING_DIR', True) staging = d.getVar('STAGING_DIR', True)
@@ -276,21 +294,7 @@ def sstate_installpkg(ss, d):
# Need to remove this or we'd copy it into the target directory and may # Need to remove this or we'd copy it into the target directory and may
# conflict with another writer # conflict with another writer
os.remove(fixmefn) os.remove(fixmefn)
}
for state in ss['dirs']:
prepdir(state[1])
os.rename(sstateinst + state[0], state[1])
sstate_install(ss, d)
for plain in ss['plaindirs']:
workdir = d.getVar('WORKDIR', True)
src = sstateinst + "/" + plain.replace(workdir, '')
dest = plain
bb.utils.mkdirhier(src)
prepdir(dest)
os.rename(src, dest)
return True
def sstate_clean_cachefile(ss, d): def sstate_clean_cachefile(ss, d):
import oe.path import oe.path
@@ -395,7 +399,7 @@ python sstate_cleanall() {
sstate_clean(shared_state, ld) sstate_clean(shared_state, ld)
} }
def sstate_hardcode_path(d): python sstate_hardcode_path () {
import subprocess, platform import subprocess, platform
# Need to remove hardcoded paths and fix these when we install the # Need to remove hardcoded paths and fix these when we install the
@@ -449,6 +453,7 @@ def sstate_hardcode_path(d):
else: else:
bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
subprocess.call(sstate_filelist_relative_cmd, shell=True) subprocess.call(sstate_filelist_relative_cmd, shell=True)
}
def sstate_package(ss, d): def sstate_package(ss, d):
import oe.path import oe.path
@@ -506,9 +511,10 @@ def sstate_package(ss, d):
d.setVar('SSTATE_BUILDDIR', sstatebuild) d.setVar('SSTATE_BUILDDIR', sstatebuild)
d.setVar('SSTATE_PKG', sstatepkg) d.setVar('SSTATE_PKG', sstatepkg)
sstate_hardcode_path(d)
bb.build.exec_func('sstate_create_package', d) for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package']:
bb.build.exec_func(f, d)
bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
return return