mirror of
https://git.yoctoproject.org/poky
synced 2026-02-03 23:38:44 +01:00
Compare commits
44 Commits
2.6_M2
...
uninative-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d854f1b6dc | ||
|
|
1b7eccff64 | ||
|
|
ce76b71666 | ||
|
|
ce5cd33a8a | ||
|
|
a6a865ba93 | ||
|
|
2dda838683 | ||
|
|
b84b073396 | ||
|
|
e3dcd61337 | ||
|
|
d8762a1ea7 | ||
|
|
dafacf0453 | ||
|
|
5aef7cd919 | ||
|
|
34c2bd84ee | ||
|
|
adea90740d | ||
|
|
1d8924f172 | ||
|
|
9928614e94 | ||
|
|
e1ba46109e | ||
|
|
069a1c4a15 | ||
|
|
e0ea2c7378 | ||
|
|
bc6b668e60 | ||
|
|
0e6a662ba2 | ||
|
|
29482de968 | ||
|
|
3fa835d9bc | ||
|
|
2245a94bb8 | ||
|
|
6d66b57409 | ||
|
|
4c67ffef2e | ||
|
|
6cdfd77806 | ||
|
|
bf5b43495a | ||
|
|
2019f78260 | ||
|
|
9c20b0df5f | ||
|
|
b4317d0ead | ||
|
|
44bc1ba5f5 | ||
|
|
79f916d92c | ||
|
|
8056a3dcd2 | ||
|
|
ad79b00257 | ||
|
|
fde3ca8b73 | ||
|
|
6494ab4ab3 | ||
|
|
437a5ace77 | ||
|
|
2f4009dd57 | ||
|
|
a42ec88902 | ||
|
|
1d1d96e75f | ||
|
|
c441b34e42 | ||
|
|
b865fb4fcb | ||
|
|
e3af86e98d | ||
|
|
1d8c7fa369 |
@@ -377,11 +377,12 @@ class BitBakeServer(object):
|
||||
if os.path.exists(sockname):
|
||||
os.unlink(sockname)
|
||||
|
||||
# Place the log in the builddirectory alongside the lock file
|
||||
logfile = os.path.join(os.path.dirname(self.bitbake_lock.name), "bitbake-cookerdaemon.log")
|
||||
|
||||
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
# AF_UNIX has path length issues so chdir here to workaround
|
||||
cwd = os.getcwd()
|
||||
logfile = os.path.join(cwd, "bitbake-cookerdaemon.log")
|
||||
|
||||
try:
|
||||
os.chdir(os.path.dirname(sockname))
|
||||
self.sock.bind(os.path.basename(sockname))
|
||||
|
||||
@@ -141,7 +141,6 @@ python () {
|
||||
deps += " %s:%s" % (dep, task)
|
||||
return deps
|
||||
|
||||
d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_lic'))
|
||||
d.appendVarFlag('do_image_complete', 'depends', extraimage_getdepends('do_populate_sysroot'))
|
||||
|
||||
deps = " " + imagetypes_getdepends(d)
|
||||
|
||||
@@ -16,284 +16,6 @@ addtask populate_lic after do_patch before do_build
|
||||
do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
|
||||
do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
|
||||
|
||||
python write_package_manifest() {
|
||||
# Get list of installed packages
|
||||
license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}')
|
||||
bb.utils.mkdirhier(license_image_dir)
|
||||
from oe.rootfs import image_list_installed_packages
|
||||
from oe.utils import format_pkg_list
|
||||
|
||||
pkgs = image_list_installed_packages(d)
|
||||
output = format_pkg_list(pkgs)
|
||||
open(os.path.join(license_image_dir, 'package.manifest'),
|
||||
'w+').write(output)
|
||||
}
|
||||
|
||||
python write_deploy_manifest() {
|
||||
license_deployed_manifest(d)
|
||||
}
|
||||
|
||||
python license_create_manifest() {
|
||||
import oe.packagedata
|
||||
from oe.rootfs import image_list_installed_packages
|
||||
|
||||
build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS')
|
||||
if build_images_from_feeds == "1":
|
||||
return 0
|
||||
|
||||
pkg_dic = {}
|
||||
for pkg in sorted(image_list_installed_packages(d)):
|
||||
pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
|
||||
'runtime-reverse', pkg)
|
||||
pkg_name = os.path.basename(os.readlink(pkg_info))
|
||||
|
||||
pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info)
|
||||
if not "LICENSE" in pkg_dic[pkg_name].keys():
|
||||
pkg_lic_name = "LICENSE_" + pkg_name
|
||||
pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
|
||||
|
||||
rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
d.getVar('IMAGE_NAME'), 'license.manifest')
|
||||
write_license_files(d, rootfs_license_manifest, pkg_dic)
|
||||
}
|
||||
|
||||
def write_license_files(d, license_manifest, pkg_dic):
|
||||
import re
|
||||
|
||||
bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
|
||||
bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
|
||||
bad_licenses = expand_wildcard_licenses(d, bad_licenses)
|
||||
|
||||
with open(license_manifest, "w") as license_file:
|
||||
for pkg in sorted(pkg_dic):
|
||||
if bad_licenses:
|
||||
try:
|
||||
(pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \
|
||||
oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],
|
||||
bad_licenses, canonical_license, d)
|
||||
except oe.license.LicenseError as exc:
|
||||
bb.fatal('%s: %s' % (d.getVar('P'), exc))
|
||||
else:
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"])
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
|
||||
pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
|
||||
|
||||
if not "IMAGE_MANIFEST" in pkg_dic[pkg]:
|
||||
# Rootfs manifest
|
||||
license_file.write("PACKAGE NAME: %s\n" % pkg)
|
||||
license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
|
||||
license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
|
||||
license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
|
||||
|
||||
# If the package doesn't contain any file, that is, its size is 0, the license
|
||||
# isn't relevant as far as the final image is concerned. So doing license check
|
||||
# doesn't make much sense, skip it.
|
||||
if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
|
||||
continue
|
||||
else:
|
||||
# Image manifest
|
||||
license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
|
||||
license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
|
||||
license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
|
||||
license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
|
||||
|
||||
for lic in pkg_dic[pkg]["LICENSES"]:
|
||||
lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
pkg_dic[pkg]["PN"], "generic_%s" %
|
||||
re.sub('\+', '', lic))
|
||||
# add explicity avoid of CLOSED license because isn't generic
|
||||
if lic == "CLOSED":
|
||||
continue
|
||||
|
||||
if not os.path.exists(lic_file):
|
||||
bb.warn("The license listed %s was not in the "\
|
||||
"licenses collected for recipe %s"
|
||||
% (lic, pkg_dic[pkg]["PN"]))
|
||||
|
||||
# Two options here:
|
||||
# - Just copy the manifest
|
||||
# - Copy the manifest and the license directories
|
||||
# With both options set we see a .5 M increase in core-image-minimal
|
||||
copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST')
|
||||
copy_lic_dirs = d.getVar('COPY_LIC_DIRS')
|
||||
if copy_lic_manifest == "1":
|
||||
rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'),
|
||||
'usr', 'share', 'common-licenses')
|
||||
bb.utils.mkdirhier(rootfs_license_dir)
|
||||
rootfs_license_manifest = os.path.join(rootfs_license_dir,
|
||||
os.path.split(license_manifest)[1])
|
||||
if not os.path.exists(rootfs_license_manifest):
|
||||
os.link(license_manifest, rootfs_license_manifest)
|
||||
|
||||
if copy_lic_dirs == "1":
|
||||
for pkg in sorted(pkg_dic):
|
||||
pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg)
|
||||
bb.utils.mkdirhier(pkg_rootfs_license_dir)
|
||||
pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
pkg_dic[pkg]["PN"])
|
||||
|
||||
pkg_manifest_licenses = [canonical_license(d, lic) \
|
||||
for lic in pkg_dic[pkg]["LICENSES"]]
|
||||
|
||||
licenses = os.listdir(pkg_license_dir)
|
||||
for lic in licenses:
|
||||
rootfs_license = os.path.join(rootfs_license_dir, lic)
|
||||
pkg_license = os.path.join(pkg_license_dir, lic)
|
||||
pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
|
||||
|
||||
if re.match("^generic_.*$", lic):
|
||||
generic_lic = canonical_license(d,
|
||||
re.search("^generic_(.*)$", lic).group(1))
|
||||
|
||||
# Do not copy generic license into package if isn't
|
||||
# declared into LICENSES of the package.
|
||||
if not re.sub('\+$', '', generic_lic) in \
|
||||
[re.sub('\+', '', lic) for lic in \
|
||||
pkg_manifest_licenses]:
|
||||
continue
|
||||
|
||||
if oe.license.license_ok(generic_lic,
|
||||
bad_licenses) == False:
|
||||
continue
|
||||
|
||||
if not os.path.exists(rootfs_license):
|
||||
os.link(pkg_license, rootfs_license)
|
||||
|
||||
if not os.path.exists(pkg_rootfs_license):
|
||||
os.symlink(os.path.join('..', lic), pkg_rootfs_license)
|
||||
else:
|
||||
if (oe.license.license_ok(canonical_license(d,
|
||||
lic), bad_licenses) == False or
|
||||
os.path.exists(pkg_rootfs_license)):
|
||||
continue
|
||||
|
||||
os.link(pkg_license, pkg_rootfs_license)
|
||||
|
||||
|
||||
def license_deployed_manifest(d):
|
||||
"""
|
||||
Write the license manifest for the deployed recipes.
|
||||
The deployed recipes usually includes the bootloader
|
||||
and extra files to boot the target.
|
||||
"""
|
||||
|
||||
dep_dic = {}
|
||||
man_dic = {}
|
||||
lic_dir = d.getVar("LICENSE_DIRECTORY")
|
||||
|
||||
dep_dic = get_deployed_dependencies(d)
|
||||
for dep in dep_dic.keys():
|
||||
man_dic[dep] = {}
|
||||
# It is necessary to mark this will be used for image manifest
|
||||
man_dic[dep]["IMAGE_MANIFEST"] = True
|
||||
man_dic[dep]["PN"] = dep
|
||||
man_dic[dep]["FILES"] = \
|
||||
" ".join(get_deployed_files(dep_dic[dep]))
|
||||
with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
|
||||
for line in f.readlines():
|
||||
key,val = line.split(": ", 1)
|
||||
man_dic[dep][key] = val[:-1]
|
||||
|
||||
lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
d.getVar('IMAGE_NAME'))
|
||||
bb.utils.mkdirhier(lic_manifest_dir)
|
||||
image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest')
|
||||
write_license_files(d, image_license_manifest, man_dic)
|
||||
|
||||
def get_deployed_dependencies(d):
|
||||
"""
|
||||
Get all the deployed dependencies of an image
|
||||
"""
|
||||
|
||||
deploy = {}
|
||||
# Get all the dependencies for the current task (rootfs).
|
||||
# Also get EXTRA_IMAGEDEPENDS because the bootloader is
|
||||
# usually in this var and not listed in rootfs.
|
||||
# At last, get the dependencies from boot classes because
|
||||
# it might contain the bootloader.
|
||||
taskdata = d.getVar("BB_TASKDEPDATA", False)
|
||||
depends = list(set([dep[0] for dep
|
||||
in list(taskdata.values())
|
||||
if not dep[0].endswith("-native")]))
|
||||
extra_depends = d.getVar("EXTRA_IMAGEDEPENDS")
|
||||
boot_depends = get_boot_dependencies(d)
|
||||
depends.extend(extra_depends.split())
|
||||
depends.extend(boot_depends)
|
||||
depends = list(set(depends))
|
||||
|
||||
# To verify what was deployed it checks the rootfs dependencies against
|
||||
# the SSTATE_MANIFESTS for "deploy" task.
|
||||
# The manifest file name contains the arch. Because we are not running
|
||||
# in the recipe context it is necessary to check every arch used.
|
||||
sstate_manifest_dir = d.getVar("SSTATE_MANIFESTS")
|
||||
archs = list(set(d.getVar("SSTATE_ARCHS").split()))
|
||||
for dep in depends:
|
||||
# Some recipes have an arch on their own, so we try that first.
|
||||
special_arch = d.getVar("PACKAGE_ARCH_pn-%s" % dep)
|
||||
if special_arch:
|
||||
sstate_manifest_file = os.path.join(sstate_manifest_dir,
|
||||
"manifest-%s-%s.deploy" % (special_arch, dep))
|
||||
if os.path.exists(sstate_manifest_file):
|
||||
deploy[dep] = sstate_manifest_file
|
||||
continue
|
||||
|
||||
for arch in archs:
|
||||
sstate_manifest_file = os.path.join(sstate_manifest_dir,
|
||||
"manifest-%s-%s.deploy" % (arch, dep))
|
||||
if os.path.exists(sstate_manifest_file):
|
||||
deploy[dep] = sstate_manifest_file
|
||||
break
|
||||
|
||||
return deploy
|
||||
get_deployed_dependencies[vardepsexclude] = "BB_TASKDEPDATA"
|
||||
|
||||
def get_boot_dependencies(d):
|
||||
"""
|
||||
Return the dependencies from boot tasks
|
||||
"""
|
||||
|
||||
depends = []
|
||||
taskdepdata = d.getVar("BB_TASKDEPDATA", False)
|
||||
# Only bootimg includes the depends flag
|
||||
boot_depends_string = d.getVarFlag("do_bootimg", "depends") or ""
|
||||
boot_depends = [dep.split(":")[0] for dep
|
||||
in boot_depends_string.split()
|
||||
if not dep.split(":")[0].endswith("-native")]
|
||||
for dep in boot_depends:
|
||||
info_file = os.path.join(d.getVar("LICENSE_DIRECTORY"),
|
||||
dep, "recipeinfo")
|
||||
# If the recipe and dependency name is the same
|
||||
if os.path.exists(info_file):
|
||||
depends.append(dep)
|
||||
# We need to search for the provider of the dependency
|
||||
else:
|
||||
for taskdep in taskdepdata.values():
|
||||
# The fifth field contains what the task provides
|
||||
if dep in taskdep[4]:
|
||||
info_file = os.path.join(
|
||||
d.getVar("LICENSE_DIRECTORY"),
|
||||
taskdep[0], "recipeinfo")
|
||||
if os.path.exists(info_file):
|
||||
depends.append(taskdep[0])
|
||||
break
|
||||
return depends
|
||||
get_boot_dependencies[vardepsexclude] = "BB_TASKDEPDATA"
|
||||
|
||||
def get_deployed_files(man_file):
|
||||
"""
|
||||
Get the files deployed from the sstate manifest
|
||||
"""
|
||||
|
||||
dep_files = []
|
||||
excluded_files = []
|
||||
with open(man_file, "r") as manifest:
|
||||
all_files = manifest.read()
|
||||
for f in all_files.splitlines():
|
||||
if ((not (os.path.islink(f) or os.path.isdir(f))) and
|
||||
not os.path.basename(f) in excluded_files):
|
||||
dep_files.append(os.path.basename(f))
|
||||
return dep_files
|
||||
|
||||
python do_populate_lic() {
|
||||
"""
|
||||
Populate LICENSE_DIRECTORY with licenses.
|
||||
@@ -675,11 +397,7 @@ SSTATETASKS += "do_populate_lic"
|
||||
do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
|
||||
do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND_prepend = "write_package_manifest; license_create_manifest; "
|
||||
do_rootfs[recrdeptask] += "do_populate_lic"
|
||||
|
||||
IMAGE_POSTPROCESS_COMMAND_prepend = "write_deploy_manifest; "
|
||||
do_image[recrdeptask] += "do_populate_lic"
|
||||
IMAGE_CLASSES_append = " license_image"
|
||||
|
||||
python do_populate_lic_setscene () {
|
||||
sstate_setscene(d)
|
||||
|
||||
238
meta/classes/license_image.bbclass
Normal file
238
meta/classes/license_image.bbclass
Normal file
@@ -0,0 +1,238 @@
|
||||
python write_package_manifest() {
|
||||
# Get list of installed packages
|
||||
license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}')
|
||||
bb.utils.mkdirhier(license_image_dir)
|
||||
from oe.rootfs import image_list_installed_packages
|
||||
from oe.utils import format_pkg_list
|
||||
|
||||
pkgs = image_list_installed_packages(d)
|
||||
output = format_pkg_list(pkgs)
|
||||
open(os.path.join(license_image_dir, 'package.manifest'),
|
||||
'w+').write(output)
|
||||
}
|
||||
|
||||
python license_create_manifest() {
|
||||
import oe.packagedata
|
||||
from oe.rootfs import image_list_installed_packages
|
||||
|
||||
build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS')
|
||||
if build_images_from_feeds == "1":
|
||||
return 0
|
||||
|
||||
pkg_dic = {}
|
||||
for pkg in sorted(image_list_installed_packages(d)):
|
||||
pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
|
||||
'runtime-reverse', pkg)
|
||||
pkg_name = os.path.basename(os.readlink(pkg_info))
|
||||
|
||||
pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info)
|
||||
if not "LICENSE" in pkg_dic[pkg_name].keys():
|
||||
pkg_lic_name = "LICENSE_" + pkg_name
|
||||
pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
|
||||
|
||||
rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
d.getVar('IMAGE_NAME'), 'license.manifest')
|
||||
write_license_files(d, rootfs_license_manifest, pkg_dic)
|
||||
}
|
||||
|
||||
def write_license_files(d, license_manifest, pkg_dic):
|
||||
import re
|
||||
|
||||
bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
|
||||
bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
|
||||
bad_licenses = expand_wildcard_licenses(d, bad_licenses)
|
||||
|
||||
with open(license_manifest, "w") as license_file:
|
||||
for pkg in sorted(pkg_dic):
|
||||
if bad_licenses:
|
||||
try:
|
||||
(pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \
|
||||
oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],
|
||||
bad_licenses, canonical_license, d)
|
||||
except oe.license.LicenseError as exc:
|
||||
bb.fatal('%s: %s' % (d.getVar('P'), exc))
|
||||
else:
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"])
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
|
||||
pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
|
||||
|
||||
if not "IMAGE_MANIFEST" in pkg_dic[pkg]:
|
||||
# Rootfs manifest
|
||||
license_file.write("PACKAGE NAME: %s\n" % pkg)
|
||||
license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
|
||||
license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
|
||||
license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
|
||||
|
||||
# If the package doesn't contain any file, that is, its size is 0, the license
|
||||
# isn't relevant as far as the final image is concerned. So doing license check
|
||||
# doesn't make much sense, skip it.
|
||||
if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
|
||||
continue
|
||||
else:
|
||||
# Image manifest
|
||||
license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
|
||||
license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
|
||||
license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
|
||||
license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
|
||||
|
||||
for lic in pkg_dic[pkg]["LICENSES"]:
|
||||
lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
pkg_dic[pkg]["PN"], "generic_%s" %
|
||||
re.sub('\+', '', lic))
|
||||
# add explicity avoid of CLOSED license because isn't generic
|
||||
if lic == "CLOSED":
|
||||
continue
|
||||
|
||||
if not os.path.exists(lic_file):
|
||||
bb.warn("The license listed %s was not in the "\
|
||||
"licenses collected for recipe %s"
|
||||
% (lic, pkg_dic[pkg]["PN"]))
|
||||
|
||||
# Two options here:
|
||||
# - Just copy the manifest
|
||||
# - Copy the manifest and the license directories
|
||||
# With both options set we see a .5 M increase in core-image-minimal
|
||||
copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST')
|
||||
copy_lic_dirs = d.getVar('COPY_LIC_DIRS')
|
||||
if copy_lic_manifest == "1":
|
||||
rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'),
|
||||
'usr', 'share', 'common-licenses')
|
||||
bb.utils.mkdirhier(rootfs_license_dir)
|
||||
rootfs_license_manifest = os.path.join(rootfs_license_dir,
|
||||
os.path.split(license_manifest)[1])
|
||||
if not os.path.exists(rootfs_license_manifest):
|
||||
os.link(license_manifest, rootfs_license_manifest)
|
||||
|
||||
if copy_lic_dirs == "1":
|
||||
for pkg in sorted(pkg_dic):
|
||||
pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg)
|
||||
bb.utils.mkdirhier(pkg_rootfs_license_dir)
|
||||
pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
pkg_dic[pkg]["PN"])
|
||||
|
||||
pkg_manifest_licenses = [canonical_license(d, lic) \
|
||||
for lic in pkg_dic[pkg]["LICENSES"]]
|
||||
|
||||
licenses = os.listdir(pkg_license_dir)
|
||||
for lic in licenses:
|
||||
rootfs_license = os.path.join(rootfs_license_dir, lic)
|
||||
pkg_license = os.path.join(pkg_license_dir, lic)
|
||||
pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
|
||||
|
||||
if re.match("^generic_.*$", lic):
|
||||
generic_lic = canonical_license(d,
|
||||
re.search("^generic_(.*)$", lic).group(1))
|
||||
|
||||
# Do not copy generic license into package if isn't
|
||||
# declared into LICENSES of the package.
|
||||
if not re.sub('\+$', '', generic_lic) in \
|
||||
[re.sub('\+', '', lic) for lic in \
|
||||
pkg_manifest_licenses]:
|
||||
continue
|
||||
|
||||
if oe.license.license_ok(generic_lic,
|
||||
bad_licenses) == False:
|
||||
continue
|
||||
|
||||
if not os.path.exists(rootfs_license):
|
||||
os.link(pkg_license, rootfs_license)
|
||||
|
||||
if not os.path.exists(pkg_rootfs_license):
|
||||
os.symlink(os.path.join('..', lic), pkg_rootfs_license)
|
||||
else:
|
||||
if (oe.license.license_ok(canonical_license(d,
|
||||
lic), bad_licenses) == False or
|
||||
os.path.exists(pkg_rootfs_license)):
|
||||
continue
|
||||
|
||||
os.link(pkg_license, pkg_rootfs_license)
|
||||
|
||||
|
||||
def license_deployed_manifest(d):
|
||||
"""
|
||||
Write the license manifest for the deployed recipes.
|
||||
The deployed recipes usually includes the bootloader
|
||||
and extra files to boot the target.
|
||||
"""
|
||||
|
||||
dep_dic = {}
|
||||
man_dic = {}
|
||||
lic_dir = d.getVar("LICENSE_DIRECTORY")
|
||||
|
||||
dep_dic = get_deployed_dependencies(d)
|
||||
for dep in dep_dic.keys():
|
||||
man_dic[dep] = {}
|
||||
# It is necessary to mark this will be used for image manifest
|
||||
man_dic[dep]["IMAGE_MANIFEST"] = True
|
||||
man_dic[dep]["PN"] = dep
|
||||
man_dic[dep]["FILES"] = \
|
||||
" ".join(get_deployed_files(dep_dic[dep]))
|
||||
with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
|
||||
for line in f.readlines():
|
||||
key,val = line.split(": ", 1)
|
||||
man_dic[dep][key] = val[:-1]
|
||||
|
||||
lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
d.getVar('IMAGE_NAME'))
|
||||
bb.utils.mkdirhier(lic_manifest_dir)
|
||||
image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest')
|
||||
write_license_files(d, image_license_manifest, man_dic)
|
||||
|
||||
def get_deployed_dependencies(d):
|
||||
"""
|
||||
Get all the deployed dependencies of an image
|
||||
"""
|
||||
|
||||
deploy = {}
|
||||
# Get all the dependencies for the current task (rootfs).
|
||||
# Also get EXTRA_IMAGEDEPENDS because the bootloader is
|
||||
# usually in this var and not listed in rootfs.
|
||||
# At last, get the dependencies from boot classes because
|
||||
# it might contain the bootloader.
|
||||
taskdata = d.getVar("BB_TASKDEPDATA", False)
|
||||
depends = list(set([dep[0] for dep
|
||||
in list(taskdata.values())
|
||||
if not dep[0].endswith("-native")]))
|
||||
|
||||
# To verify what was deployed it checks the rootfs dependencies against
|
||||
# the SSTATE_MANIFESTS for "deploy" task.
|
||||
# The manifest file name contains the arch. Because we are not running
|
||||
# in the recipe context it is necessary to check every arch used.
|
||||
sstate_manifest_dir = d.getVar("SSTATE_MANIFESTS")
|
||||
archs = list(set(d.getVar("SSTATE_ARCHS").split()))
|
||||
for dep in depends:
|
||||
for arch in archs:
|
||||
sstate_manifest_file = os.path.join(sstate_manifest_dir,
|
||||
"manifest-%s-%s.deploy" % (arch, dep))
|
||||
if os.path.exists(sstate_manifest_file):
|
||||
deploy[dep] = sstate_manifest_file
|
||||
break
|
||||
|
||||
return deploy
|
||||
get_deployed_dependencies[vardepsexclude] = "BB_TASKDEPDATA"
|
||||
|
||||
def get_deployed_files(man_file):
|
||||
"""
|
||||
Get the files deployed from the sstate manifest
|
||||
"""
|
||||
|
||||
dep_files = []
|
||||
excluded_files = []
|
||||
with open(man_file, "r") as manifest:
|
||||
all_files = manifest.read()
|
||||
for f in all_files.splitlines():
|
||||
if ((not (os.path.islink(f) or os.path.isdir(f))) and
|
||||
not os.path.basename(f) in excluded_files):
|
||||
dep_files.append(os.path.basename(f))
|
||||
return dep_files
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND_prepend = "write_package_manifest; license_create_manifest; "
|
||||
do_rootfs[recrdeptask] += "do_populate_lic"
|
||||
|
||||
python do_populate_lic_deploy() {
|
||||
license_deployed_manifest(d)
|
||||
}
|
||||
|
||||
addtask populate_lic_deploy before do_build after do_image_complete
|
||||
do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy"
|
||||
|
||||
@@ -345,8 +345,16 @@ def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
|
||||
return debugfiles.keys()
|
||||
|
||||
def append_source_info(file, sourcefile, d, fatal=True):
|
||||
cmd = "'dwarfsrcfiles' '%s'" % (file)
|
||||
(retval, output) = oe.utils.getstatusoutput(cmd)
|
||||
import subprocess
|
||||
|
||||
cmd = ["dwarfsrcfiles", file]
|
||||
try:
|
||||
output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
|
||||
retval = 0
|
||||
except subprocess.CalledProcessError as exc:
|
||||
output = exc.output
|
||||
retval = exc.returncode
|
||||
|
||||
# 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure
|
||||
if retval != 0 and retval != 255:
|
||||
msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "")
|
||||
@@ -359,10 +367,12 @@ def append_source_info(file, sourcefile, d, fatal=True):
|
||||
# of rpm's debugedit, which was writing them out that way, and the code elsewhere
|
||||
# is still assuming that.
|
||||
debuglistoutput = '\0'.join(debugsources) + '\0'
|
||||
lf = bb.utils.lockfile(sourcefile + ".lock")
|
||||
open(sourcefile, 'a').write(debuglistoutput)
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
|
||||
def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
|
||||
def splitdebuginfo(file, dvar, debugdir, debuglibdir, debugappend, debugsrcdir, sourcefile, d):
|
||||
# Function to split a single file into two components, one is the stripped
|
||||
# target system binary, the other contains any debugging information. The
|
||||
# two files are linked to reference each other.
|
||||
@@ -371,6 +381,15 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
|
||||
|
||||
import stat
|
||||
|
||||
src = file[len(dvar):]
|
||||
dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
|
||||
debugfile = dvar + dest
|
||||
|
||||
# Split the file...
|
||||
bb.utils.mkdirhier(os.path.dirname(debugfile))
|
||||
#bb.note("Split %s -> %s" % (file, debugfile))
|
||||
# Only store off the hard link reference if we successfully split!
|
||||
|
||||
dvar = d.getVar('PKGD')
|
||||
objcopy = d.getVar("OBJCOPY")
|
||||
|
||||
@@ -411,6 +430,7 @@ def copydebugsources(debugsrcdir, d):
|
||||
# and copied to the destination here.
|
||||
|
||||
import stat
|
||||
import subprocess
|
||||
|
||||
sourcefile = d.expand("${WORKDIR}/debugsources.list")
|
||||
if debugsrcdir and os.path.isfile(sourcefile):
|
||||
@@ -447,23 +467,20 @@ def copydebugsources(debugsrcdir, d):
|
||||
processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
|
||||
|
||||
cmd = processdebugsrc % (sourcefile, workbasedir, localsrc_prefix, workparentdir, dvar, debugsrcdir)
|
||||
(retval, output) = oe.utils.getstatusoutput(cmd)
|
||||
# Can "fail" if internal headers/transient sources are attempted
|
||||
#if retval:
|
||||
# bb.fatal("debug source copy failed with exit code %s (cmd was %s)" % (retval, cmd))
|
||||
try:
|
||||
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError:
|
||||
# Can "fail" if internal headers/transient sources are attempted
|
||||
pass
|
||||
|
||||
# cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced.
|
||||
# Work around this by manually finding and copying any symbolic links that made it through.
|
||||
cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s' 2>/dev/null)" % (dvar, debugsrcdir, dvar, debugsrcdir, workparentdir, dvar, debugsrcdir)
|
||||
(retval, output) = oe.utils.getstatusoutput(cmd)
|
||||
if retval:
|
||||
bb.fatal("debugsrc symlink fixup failed with exit code %s (cmd was %s)" % (retval, cmd))
|
||||
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
|
||||
# The copy by cpio may have resulted in some empty directories! Remove these
|
||||
cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir)
|
||||
(retval, output) = oe.utils.getstatusoutput(cmd)
|
||||
if retval:
|
||||
bb.fatal("empty directory removal failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
|
||||
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
|
||||
# Also remove debugsrcdir if its empty
|
||||
for p in nosuchdir[::-1]:
|
||||
@@ -624,6 +641,8 @@ python package_do_split_locales() {
|
||||
}
|
||||
|
||||
python perform_packagecopy () {
|
||||
import subprocess
|
||||
|
||||
dest = d.getVar('D')
|
||||
dvar = d.getVar('PKGD')
|
||||
|
||||
@@ -631,9 +650,7 @@ python perform_packagecopy () {
|
||||
# files to operate on
|
||||
# Preserve sparse files and hard links
|
||||
cmd = 'tar -cf - -C %s -p . | tar -xf - -C %s' % (dest, dvar)
|
||||
(retval, output) = oe.utils.getstatusoutput(cmd)
|
||||
if retval:
|
||||
bb.fatal("file copy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
|
||||
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
|
||||
# replace RPATHs for the nativesdk binaries, to make them relocatable
|
||||
if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d):
|
||||
@@ -880,6 +897,7 @@ python fixup_perms () {
|
||||
|
||||
python split_and_strip_files () {
|
||||
import stat, errno
|
||||
import subprocess
|
||||
|
||||
dvar = d.getVar('PKGD')
|
||||
pn = d.getVar('PN')
|
||||
@@ -916,43 +934,6 @@ python split_and_strip_files () {
|
||||
sourcefile = d.expand("${WORKDIR}/debugsources.list")
|
||||
bb.utils.remove(sourcefile)
|
||||
|
||||
# Return type (bits):
|
||||
# 0 - not elf
|
||||
# 1 - ELF
|
||||
# 2 - stripped
|
||||
# 4 - executable
|
||||
# 8 - shared library
|
||||
# 16 - kernel module
|
||||
def isELF(path):
|
||||
type = 0
|
||||
ret, result = oe.utils.getstatusoutput("file -b '%s'" % path)
|
||||
|
||||
if ret:
|
||||
msg = "split_and_strip_files: 'file %s' failed" % path
|
||||
package_qa_handle_error("split-strip", msg, d)
|
||||
return type
|
||||
|
||||
# Not stripped
|
||||
if "ELF" in result:
|
||||
type |= 1
|
||||
if "not stripped" not in result:
|
||||
type |= 2
|
||||
if "executable" in result:
|
||||
type |= 4
|
||||
if "shared" in result:
|
||||
type |= 8
|
||||
return type
|
||||
|
||||
def isStaticLib(path):
|
||||
if path.endswith('.a') and not os.path.islink(path):
|
||||
with open(path, 'rb') as fh:
|
||||
# The magic must include the first slash to avoid
|
||||
# matching golang static libraries
|
||||
magic = b'!<arch>\x0a/'
|
||||
start = fh.read(len(magic))
|
||||
return start == magic
|
||||
return False
|
||||
|
||||
#
|
||||
# First lets figure out all of the files we may have to process ... do this only once!
|
||||
#
|
||||
@@ -966,13 +947,15 @@ python split_and_strip_files () {
|
||||
skipfiles = (d.getVar("INHIBIT_PACKAGE_STRIP_FILES") or "").split()
|
||||
if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1' or \
|
||||
d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'):
|
||||
checkelf = {}
|
||||
checkelflinks = {}
|
||||
for root, dirs, files in cpath.walk(dvar):
|
||||
for f in files:
|
||||
file = os.path.join(root, f)
|
||||
if file.endswith(".ko") and file.find("/lib/modules/") != -1:
|
||||
kernmods.append(file)
|
||||
continue
|
||||
if isStaticLib(file):
|
||||
if oe.package.is_static_lib(file):
|
||||
staticlibs.append(file)
|
||||
continue
|
||||
|
||||
@@ -999,59 +982,63 @@ python split_and_strip_files () {
|
||||
# Check its an executable
|
||||
if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
|
||||
or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)):
|
||||
# If it's a symlink, and points to an ELF file, we capture the readlink target
|
||||
|
||||
if cpath.islink(file):
|
||||
target = os.readlink(file)
|
||||
if isELF(ltarget):
|
||||
#bb.note("Sym: %s (%d)" % (ltarget, isELF(ltarget)))
|
||||
symlinks[file] = target
|
||||
checkelflinks[file] = ltarget
|
||||
continue
|
||||
# Use a reference of device ID and inode number to identify files
|
||||
file_reference = "%d_%d" % (s.st_dev, s.st_ino)
|
||||
checkelf[file] = (file, file_reference)
|
||||
|
||||
# It's a file (or hardlink), not a link
|
||||
# ...but is it ELF, and is it already stripped?
|
||||
elf_file = isELF(file)
|
||||
if elf_file & 1:
|
||||
if elf_file & 2:
|
||||
if 'already-stripped' in (d.getVar('INSANE_SKIP_' + pn) or "").split():
|
||||
bb.note("Skipping file %s from %s for already-stripped QA test" % (file[len(dvar):], pn))
|
||||
else:
|
||||
msg = "File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn)
|
||||
package_qa_handle_error("already-stripped", msg, d)
|
||||
continue
|
||||
results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelflinks.values(), d)
|
||||
results_map = {}
|
||||
for (ltarget, elf_file) in results:
|
||||
results_map[ltarget] = elf_file
|
||||
for file in checkelflinks:
|
||||
ltarget = checkelflinks[file]
|
||||
# If it's a symlink, and points to an ELF file, we capture the readlink target
|
||||
if results_map[ltarget]:
|
||||
target = os.readlink(file)
|
||||
#bb.note("Sym: %s (%d)" % (ltarget, results_map[ltarget]))
|
||||
symlinks[file] = target
|
||||
|
||||
# At this point we have an unstripped elf file. We need to:
|
||||
# a) Make sure any file we strip is not hardlinked to anything else outside this tree
|
||||
# b) Only strip any hardlinked file once (no races)
|
||||
# c) Track any hardlinks between files so that we can reconstruct matching debug file hardlinks
|
||||
results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d)
|
||||
for (file, elf_file) in results:
|
||||
# It's a file (or hardlink), not a link
|
||||
# ...but is it ELF, and is it already stripped?
|
||||
if elf_file & 1:
|
||||
if elf_file & 2:
|
||||
if 'already-stripped' in (d.getVar('INSANE_SKIP_' + pn) or "").split():
|
||||
bb.note("Skipping file %s from %s for already-stripped QA test" % (file[len(dvar):], pn))
|
||||
else:
|
||||
msg = "File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn)
|
||||
package_qa_handle_error("already-stripped", msg, d)
|
||||
continue
|
||||
|
||||
# Use a reference of device ID and inode number to identify files
|
||||
file_reference = "%d_%d" % (s.st_dev, s.st_ino)
|
||||
if file_reference in inodes:
|
||||
os.unlink(file)
|
||||
os.link(inodes[file_reference][0], file)
|
||||
inodes[file_reference].append(file)
|
||||
else:
|
||||
inodes[file_reference] = [file]
|
||||
# break hardlink
|
||||
bb.utils.copyfile(file, file)
|
||||
elffiles[file] = elf_file
|
||||
# Modified the file so clear the cache
|
||||
cpath.updatecache(file)
|
||||
# At this point we have an unstripped elf file. We need to:
|
||||
# a) Make sure any file we strip is not hardlinked to anything else outside this tree
|
||||
# b) Only strip any hardlinked file once (no races)
|
||||
# c) Track any hardlinks between files so that we can reconstruct matching debug file hardlinks
|
||||
|
||||
# Use a reference of device ID and inode number to identify files
|
||||
file_reference = checkelf[file]
|
||||
if file_reference in inodes:
|
||||
os.unlink(file)
|
||||
os.link(inodes[file_reference][0], file)
|
||||
inodes[file_reference].append(file)
|
||||
else:
|
||||
inodes[file_reference] = [file]
|
||||
# break hardlink
|
||||
bb.utils.copyfile(file, file)
|
||||
elffiles[file] = elf_file
|
||||
# Modified the file so clear the cache
|
||||
cpath.updatecache(file)
|
||||
|
||||
#
|
||||
# First lets process debug splitting
|
||||
#
|
||||
if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'):
|
||||
for file in elffiles:
|
||||
src = file[len(dvar):]
|
||||
dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
|
||||
fpath = dvar + dest
|
||||
|
||||
# Split the file...
|
||||
bb.utils.mkdirhier(os.path.dirname(fpath))
|
||||
#bb.note("Split %s -> %s" % (file, fpath))
|
||||
# Only store off the hard link reference if we successfully split!
|
||||
splitdebuginfo(file, fpath, debugsrcdir, sourcefile, d)
|
||||
oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, debugdir, debuglibdir, debugappend, debugsrcdir, sourcefile, d))
|
||||
|
||||
if debugsrcdir and not targetos.startswith("mingw"):
|
||||
for file in staticlibs:
|
||||
@@ -1118,7 +1105,7 @@ python split_and_strip_files () {
|
||||
for f in kernmods:
|
||||
sfiles.append((f, 16, strip))
|
||||
|
||||
oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
|
||||
oe.utils.multiprocess_launch(oe.package.runstrip, sfiles, d)
|
||||
|
||||
#
|
||||
# End of strip
|
||||
@@ -1411,9 +1398,6 @@ fi
|
||||
pkgdest = d.getVar('PKGDEST')
|
||||
pkgdatadir = d.getVar('PKGDESTWORK')
|
||||
|
||||
# Take shared lock since we're only reading, not writing
|
||||
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
|
||||
|
||||
data_file = pkgdatadir + d.expand("/${PN}" )
|
||||
f = open(data_file, 'w')
|
||||
f.write("PACKAGES: %s\n" % packages)
|
||||
@@ -1518,7 +1502,6 @@ fi
|
||||
if bb.data.inherits_class('allarch', d) and not bb.data.inherits_class('packagegroup', d):
|
||||
write_extra_runtime_pkgs(global_variants, packages, pkgdatadir)
|
||||
|
||||
bb.utils.unlockfile(lf)
|
||||
}
|
||||
emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides"
|
||||
|
||||
@@ -1558,7 +1541,7 @@ python package_do_filedeps() {
|
||||
for files in chunks(pkgfiles[pkg], 100):
|
||||
pkglist.append((pkg, files, rpmdeps, pkgdest))
|
||||
|
||||
processed = oe.utils.multiprocess_exec( pkglist, oe.package.filedeprunner)
|
||||
processed = oe.utils.multiprocess_launch(oe.package.filedeprunner, pkglist, d)
|
||||
|
||||
provides_files = {}
|
||||
requires_files = {}
|
||||
@@ -1592,7 +1575,7 @@ SHLIBSWORKDIR = "${PKGDESTWORK}/${MLPREFIX}shlibs2"
|
||||
|
||||
python package_do_shlibs() {
|
||||
import re, pipes
|
||||
import subprocess as sub
|
||||
import subprocess
|
||||
|
||||
exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', False)
|
||||
if exclude_shlibs:
|
||||
@@ -1603,6 +1586,18 @@ python package_do_shlibs() {
|
||||
libdir_re = re.compile(".*/%s$" % d.getVar('baselib'))
|
||||
|
||||
packages = d.getVar('PACKAGES')
|
||||
|
||||
shlib_pkgs = []
|
||||
exclusion_list = d.getVar("EXCLUDE_PACKAGES_FROM_SHLIBS")
|
||||
if exclusion_list:
|
||||
for pkg in packages.split():
|
||||
if pkg not in exclusion_list.split():
|
||||
shlib_pkgs.append(pkg)
|
||||
else:
|
||||
bb.note("not generating shlibs for %s" % pkg)
|
||||
else:
|
||||
shlib_pkgs = packages.split()
|
||||
|
||||
targetos = d.getVar('TARGET_OS')
|
||||
|
||||
workdir = d.getVar('WORKDIR')
|
||||
@@ -1617,28 +1612,28 @@ python package_do_shlibs() {
|
||||
|
||||
shlibswork_dir = d.getVar('SHLIBSWORKDIR')
|
||||
|
||||
# Take shared lock since we're only reading, not writing
|
||||
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
|
||||
|
||||
def linux_so(file, needed, sonames, renames, pkgver):
|
||||
def linux_so(file, pkg, pkgver, d):
|
||||
needs_ldconfig = False
|
||||
needed = set()
|
||||
sonames = set()
|
||||
renames = []
|
||||
ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
|
||||
cmd = d.getVar('OBJDUMP') + " -p " + pipes.quote(file) + " 2>/dev/null"
|
||||
fd = os.popen(cmd)
|
||||
lines = fd.readlines()
|
||||
fd.close()
|
||||
rpath = []
|
||||
rpath = tuple()
|
||||
for l in lines:
|
||||
m = re.match("\s+RPATH\s+([^\s]*)", l)
|
||||
if m:
|
||||
rpaths = m.group(1).replace("$ORIGIN", ldir).split(":")
|
||||
rpath = list(map(os.path.normpath, rpaths))
|
||||
rpath = tuple(map(os.path.normpath, rpaths))
|
||||
for l in lines:
|
||||
m = re.match("\s+NEEDED\s+([^\s]*)", l)
|
||||
if m:
|
||||
dep = m.group(1)
|
||||
if dep not in needed[pkg]:
|
||||
needed[pkg].append((dep, file, rpath))
|
||||
if dep not in needed:
|
||||
needed.add((dep, file, rpath))
|
||||
m = re.match("\s+SONAME\s+([^\s]*)", l)
|
||||
if m:
|
||||
this_soname = m.group(1)
|
||||
@@ -1646,12 +1641,12 @@ python package_do_shlibs() {
|
||||
if not prov in sonames:
|
||||
# if library is private (only used by package) then do not build shlib for it
|
||||
if not private_libs or this_soname not in private_libs:
|
||||
sonames.append(prov)
|
||||
sonames.add(prov)
|
||||
if libdir_re.match(os.path.dirname(file)):
|
||||
needs_ldconfig = True
|
||||
if snap_symlinks and (os.path.basename(file) != this_soname):
|
||||
renames.append((file, os.path.join(os.path.dirname(file), this_soname)))
|
||||
return needs_ldconfig
|
||||
return (needs_ldconfig, needed, sonames, renames)
|
||||
|
||||
def darwin_so(file, needed, sonames, renames, pkgver):
|
||||
if not os.path.exists(file):
|
||||
@@ -1679,10 +1674,10 @@ python package_do_shlibs() {
|
||||
for combo in combos:
|
||||
if not combo in sonames:
|
||||
prov = (combo, ldir, pkgver)
|
||||
sonames.append(prov)
|
||||
sonames.add(prov)
|
||||
if file.endswith('.dylib') or file.endswith('.so'):
|
||||
rpath = []
|
||||
p = sub.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file],stdout=sub.PIPE,stderr=sub.PIPE)
|
||||
p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
# If returned successfully, process stdout for results
|
||||
if p.returncode == 0:
|
||||
@@ -1691,7 +1686,7 @@ python package_do_shlibs() {
|
||||
if l.startswith('path '):
|
||||
rpath.append(l.split()[1])
|
||||
|
||||
p = sub.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file],stdout=sub.PIPE,stderr=sub.PIPE)
|
||||
p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
# If returned successfully, process stdout for results
|
||||
if p.returncode == 0:
|
||||
@@ -1703,7 +1698,7 @@ python package_do_shlibs() {
|
||||
continue
|
||||
name = os.path.basename(l.split()[0]).rsplit(".", 1)[0]
|
||||
if name and name not in needed[pkg]:
|
||||
needed[pkg].append((name, file, []))
|
||||
needed[pkg].add((name, file, tuple()))
|
||||
|
||||
def mingw_dll(file, needed, sonames, renames, pkgver):
|
||||
if not os.path.exists(file):
|
||||
@@ -1711,18 +1706,18 @@ python package_do_shlibs() {
|
||||
|
||||
if file.endswith(".dll"):
|
||||
# assume all dlls are shared objects provided by the package
|
||||
sonames.append((os.path.basename(file), os.path.dirname(file).replace(pkgdest + "/" + pkg, ''), pkgver))
|
||||
sonames.add((os.path.basename(file), os.path.dirname(file).replace(pkgdest + "/" + pkg, ''), pkgver))
|
||||
|
||||
if (file.endswith(".dll") or file.endswith(".exe")):
|
||||
# use objdump to search for "DLL Name: .*\.dll"
|
||||
p = sub.Popen([d.expand("${HOST_PREFIX}objdump"), "-p", file], stdout = sub.PIPE, stderr= sub.PIPE)
|
||||
p = subprocess.Popen([d.expand("${HOST_PREFIX}objdump"), "-p", file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
# process the output, grabbing all .dll names
|
||||
if p.returncode == 0:
|
||||
for m in re.finditer("DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE):
|
||||
dllname = m.group(1)
|
||||
if dllname:
|
||||
needed[pkg].append((dllname, file, []))
|
||||
needed[pkg].add((dllname, file, tuple()))
|
||||
|
||||
if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS') == "1":
|
||||
snap_symlinks = True
|
||||
@@ -1732,9 +1727,13 @@ python package_do_shlibs() {
|
||||
use_ldconfig = bb.utils.contains('DISTRO_FEATURES', 'ldconfig', True, False, d)
|
||||
|
||||
needed = {}
|
||||
shlib_provider = oe.package.read_shlib_providers(d)
|
||||
|
||||
for pkg in packages.split():
|
||||
# Take shared lock since we're only reading, not writing
|
||||
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
|
||||
shlib_provider = oe.package.read_shlib_providers(d)
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
for pkg in shlib_pkgs:
|
||||
private_libs = d.getVar('PRIVATE_LIBS_' + pkg) or d.getVar('PRIVATE_LIBS') or ""
|
||||
private_libs = private_libs.split()
|
||||
needs_ldconfig = False
|
||||
@@ -1746,9 +1745,10 @@ python package_do_shlibs() {
|
||||
if not pkgver:
|
||||
pkgver = ver
|
||||
|
||||
needed[pkg] = []
|
||||
sonames = list()
|
||||
renames = list()
|
||||
needed[pkg] = set()
|
||||
sonames = set()
|
||||
renames = []
|
||||
linuxlist = []
|
||||
for file in pkgfiles[pkg]:
|
||||
soname = None
|
||||
if cpath.islink(file):
|
||||
@@ -1758,8 +1758,17 @@ python package_do_shlibs() {
|
||||
elif targetos.startswith("mingw"):
|
||||
mingw_dll(file, needed, sonames, renames, pkgver)
|
||||
elif os.access(file, os.X_OK) or lib_re.match(file):
|
||||
ldconfig = linux_so(file, needed, sonames, renames, pkgver)
|
||||
needs_ldconfig = needs_ldconfig or ldconfig
|
||||
linuxlist.append(file)
|
||||
|
||||
if linuxlist:
|
||||
results = oe.utils.multiprocess_launch(linux_so, linuxlist, d, extraargs=(pkg, pkgver, d))
|
||||
for r in results:
|
||||
ldconfig = r[0]
|
||||
needed[pkg] |= r[1]
|
||||
sonames |= r[2]
|
||||
renames.extend(r[3])
|
||||
needs_ldconfig = needs_ldconfig or ldconfig
|
||||
|
||||
for (old, new) in renames:
|
||||
bb.note("Renaming %s to %s" % (old, new))
|
||||
os.rename(old, new)
|
||||
@@ -1788,8 +1797,6 @@ python package_do_shlibs() {
|
||||
d.setVar('pkg_postinst_%s' % pkg, postinst)
|
||||
bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames))
|
||||
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
assumed_libs = d.getVar('ASSUME_SHLIBS')
|
||||
if assumed_libs:
|
||||
libdir = d.getVar("libdir")
|
||||
@@ -1806,7 +1813,7 @@ python package_do_shlibs() {
|
||||
|
||||
libsearchpath = [d.getVar('libdir'), d.getVar('base_libdir')]
|
||||
|
||||
for pkg in packages.split():
|
||||
for pkg in shlib_pkgs:
|
||||
bb.debug(2, "calculating shlib requirements for %s" % pkg)
|
||||
|
||||
private_libs = d.getVar('PRIVATE_LIBS_' + pkg) or d.getVar('PRIVATE_LIBS') or ""
|
||||
@@ -1827,7 +1834,7 @@ python package_do_shlibs() {
|
||||
for k in shlib_provider[n[0]].keys():
|
||||
shlib_provider_path.append(k)
|
||||
match = None
|
||||
for p in n[2] + shlib_provider_path + libsearchpath:
|
||||
for p in list(n[2]) + shlib_provider_path + libsearchpath:
|
||||
if p in shlib_provider[n[0]]:
|
||||
match = p
|
||||
break
|
||||
@@ -1902,9 +1909,6 @@ python package_do_pkgconfig () {
|
||||
if hdr == 'Requires':
|
||||
pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
|
||||
|
||||
# Take shared lock since we're only reading, not writing
|
||||
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
|
||||
|
||||
for pkg in packages.split():
|
||||
pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
|
||||
if pkgconfig_provided[pkg] != []:
|
||||
@@ -1913,6 +1917,9 @@ python package_do_pkgconfig () {
|
||||
f.write('%s\n' % p)
|
||||
f.close()
|
||||
|
||||
# Take shared lock since we're only reading, not writing
|
||||
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
|
||||
|
||||
# Go from least to most specific since the last one found wins
|
||||
for dir in reversed(shlibs_dirs):
|
||||
if not os.path.exists(dir):
|
||||
@@ -1928,6 +1935,8 @@ python package_do_pkgconfig () {
|
||||
for l in lines:
|
||||
pkgconfig_provided[pkg].append(l.rstrip())
|
||||
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
for pkg in packages.split():
|
||||
deps = []
|
||||
for n in pkgconfig_needed[pkg]:
|
||||
@@ -1945,8 +1954,6 @@ python package_do_pkgconfig () {
|
||||
for dep in deps:
|
||||
fd.write(dep + '\n')
|
||||
fd.close()
|
||||
|
||||
bb.utils.unlockfile(lf)
|
||||
}
|
||||
|
||||
def read_libdep_files(d):
|
||||
|
||||
@@ -41,32 +41,6 @@ def debian_arch_map(arch, tune):
|
||||
return arch
|
||||
|
||||
python do_package_deb () {
|
||||
|
||||
import multiprocessing
|
||||
import traceback
|
||||
|
||||
class DebianWritePkgProcess(multiprocessing.Process):
|
||||
def __init__(self, *args, **kwargs):
|
||||
multiprocessing.Process.__init__(self, *args, **kwargs)
|
||||
self._pconn, self._cconn = multiprocessing.Pipe()
|
||||
self._exception = None
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
multiprocessing.Process.run(self)
|
||||
self._cconn.send(None)
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
self._cconn.send((e, tb))
|
||||
|
||||
@property
|
||||
def exception(self):
|
||||
if self._pconn.poll():
|
||||
self._exception = self._pconn.recv()
|
||||
return self._exception
|
||||
|
||||
oldcwd = os.getcwd()
|
||||
|
||||
packages = d.getVar('PACKAGES')
|
||||
if not packages:
|
||||
bb.debug(1, "PACKAGES not defined, nothing to package")
|
||||
@@ -76,30 +50,7 @@ python do_package_deb () {
|
||||
if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK):
|
||||
os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"))
|
||||
|
||||
max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
|
||||
launched = []
|
||||
error = None
|
||||
pkgs = packages.split()
|
||||
while not error and pkgs:
|
||||
if len(launched) < max_process:
|
||||
p = DebianWritePkgProcess(target=deb_write_pkg, args=(pkgs.pop(), d))
|
||||
p.start()
|
||||
launched.append(p)
|
||||
for q in launched:
|
||||
# The finished processes are joined when calling is_alive()
|
||||
if not q.is_alive():
|
||||
launched.remove(q)
|
||||
if q.exception:
|
||||
error, traceback = q.exception
|
||||
break
|
||||
|
||||
for p in launched:
|
||||
p.join()
|
||||
|
||||
os.chdir(oldcwd)
|
||||
|
||||
if error:
|
||||
raise error
|
||||
oe.utils.multiprocess_launch(deb_write_pkg, packages.split(), d, extraargs=(d,))
|
||||
}
|
||||
do_package_deb[vardeps] += "deb_write_pkg"
|
||||
do_package_deb[vardepsexclude] = "BB_NUMBER_THREADS"
|
||||
|
||||
@@ -17,32 +17,6 @@ OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKA
|
||||
OPKGLIBDIR = "${localstatedir}/lib"
|
||||
|
||||
python do_package_ipk () {
|
||||
import multiprocessing
|
||||
import traceback
|
||||
|
||||
class IPKWritePkgProcess(multiprocessing.Process):
|
||||
def __init__(self, *args, **kwargs):
|
||||
multiprocessing.Process.__init__(self, *args, **kwargs)
|
||||
self._pconn, self._cconn = multiprocessing.Pipe()
|
||||
self._exception = None
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
multiprocessing.Process.run(self)
|
||||
self._cconn.send(None)
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
self._cconn.send((e, tb))
|
||||
|
||||
@property
|
||||
def exception(self):
|
||||
if self._pconn.poll():
|
||||
self._exception = self._pconn.recv()
|
||||
return self._exception
|
||||
|
||||
|
||||
oldcwd = os.getcwd()
|
||||
|
||||
workdir = d.getVar('WORKDIR')
|
||||
outdir = d.getVar('PKGWRITEDIRIPK')
|
||||
tmpdir = d.getVar('TMPDIR')
|
||||
@@ -61,30 +35,7 @@ python do_package_ipk () {
|
||||
if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK):
|
||||
os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"))
|
||||
|
||||
max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
|
||||
launched = []
|
||||
error = None
|
||||
pkgs = packages.split()
|
||||
while not error and pkgs:
|
||||
if len(launched) < max_process:
|
||||
p = IPKWritePkgProcess(target=ipk_write_pkg, args=(pkgs.pop(), d))
|
||||
p.start()
|
||||
launched.append(p)
|
||||
for q in launched:
|
||||
# The finished processes are joined when calling is_alive()
|
||||
if not q.is_alive():
|
||||
launched.remove(q)
|
||||
if q.exception:
|
||||
error, traceback = q.exception
|
||||
break
|
||||
|
||||
for p in launched:
|
||||
p.join()
|
||||
|
||||
os.chdir(oldcwd)
|
||||
|
||||
if error:
|
||||
raise error
|
||||
oe.utils.multiprocess_launch(ipk_write_pkg, packages.split(), d, extraargs=(d,))
|
||||
}
|
||||
do_package_ipk[vardeps] += "ipk_write_pkg"
|
||||
do_package_ipk[vardepsexclude] = "BB_NUMBER_THREADS"
|
||||
|
||||
@@ -715,17 +715,24 @@ sstate_task_postfunc[dirs] = "${WORKDIR}"
|
||||
#
|
||||
sstate_create_package () {
|
||||
TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX`
|
||||
|
||||
# Use pigz if available
|
||||
OPT="-cz"
|
||||
if [ -x "$(command -v pigz)" ]; then
|
||||
OPT="-I pigz -c"
|
||||
fi
|
||||
|
||||
# Need to handle empty directories
|
||||
if [ "$(ls -A)" ]; then
|
||||
set +e
|
||||
tar -czf $TFILE *
|
||||
tar $OPT -f $TFILE *
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
else
|
||||
tar -cz --file=$TFILE --files-from=/dev/null
|
||||
tar $OPT --file=$TFILE --files-from=/dev/null
|
||||
fi
|
||||
chmod 0664 $TFILE
|
||||
mv -f $TFILE ${SSTATE_PKG}
|
||||
|
||||
@@ -70,7 +70,7 @@ sysroot_stage_all() {
|
||||
python sysroot_strip () {
|
||||
inhibit_sysroot = d.getVar('INHIBIT_SYSROOT_STRIP')
|
||||
if inhibit_sysroot and oe.types.boolean(inhibit_sysroot):
|
||||
return 0
|
||||
return
|
||||
|
||||
dstdir = d.getVar('SYSROOT_DESTDIR')
|
||||
pn = d.getVar('PN')
|
||||
@@ -79,7 +79,7 @@ python sysroot_strip () {
|
||||
qa_already_stripped = 'already-stripped' in (d.getVar('INSANE_SKIP_' + pn) or "").split()
|
||||
strip_cmd = d.getVar("STRIP")
|
||||
|
||||
oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir,
|
||||
oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d,
|
||||
qa_already_stripped=qa_already_stripped)
|
||||
}
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ HOSTTOOLS += " \
|
||||
HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}"
|
||||
|
||||
# Link to these if present
|
||||
HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc sftp socat ssh sudo"
|
||||
HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo"
|
||||
|
||||
# Temporary add few more detected in bitbake world
|
||||
HOSTTOOLS_NONFATAL += "join nl size yes zcat"
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import stat
|
||||
import mmap
|
||||
import subprocess
|
||||
|
||||
def runstrip(arg):
|
||||
# Function to strip a single file, called from split_and_strip_files below
|
||||
# A working 'file' (one which works on the target architecture)
|
||||
#
|
||||
# The elftype is a bit pattern (explained in split_and_strip_files) to tell
|
||||
# The elftype is a bit pattern (explained in is_elf below) to tell
|
||||
# us what type of file we're processing...
|
||||
# 4 - executable
|
||||
# 8 - shared library
|
||||
# 16 - kernel module
|
||||
|
||||
import stat, subprocess
|
||||
|
||||
(file, elftype, strip) = arg
|
||||
|
||||
newmode = None
|
||||
@@ -34,18 +36,51 @@ def runstrip(arg):
|
||||
stripcmd.append(file)
|
||||
bb.debug(1, "runstrip: %s" % stripcmd)
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(stripcmd, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.error("runstrip: '%s' strip command failed with %s (%s)" % (stripcmd, e.returncode, e.output))
|
||||
output = subprocess.check_output(stripcmd, stderr=subprocess.STDOUT)
|
||||
|
||||
if newmode:
|
||||
os.chmod(file, origmode)
|
||||
|
||||
return
|
||||
# Detect .ko module by searching for "vermagic=" string
|
||||
def is_kernel_module(path):
|
||||
with open(path) as f:
|
||||
return mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ).find(b"vermagic=") >= 0
|
||||
|
||||
# Return type (bits):
|
||||
# 0 - not elf
|
||||
# 1 - ELF
|
||||
# 2 - stripped
|
||||
# 4 - executable
|
||||
# 8 - shared library
|
||||
# 16 - kernel module
|
||||
def is_elf(path):
|
||||
exec_type = 0
|
||||
result = subprocess.check_output(["file", "-b", path], stderr=subprocess.STDOUT).decode("utf-8")
|
||||
|
||||
def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=False):
|
||||
if "ELF" in result:
|
||||
exec_type |= 1
|
||||
if "not stripped" not in result:
|
||||
exec_type |= 2
|
||||
if "executable" in result:
|
||||
exec_type |= 4
|
||||
if "shared" in result:
|
||||
exec_type |= 8
|
||||
if "relocatable" in result:
|
||||
if path.endswith(".ko") and path.find("/lib/modules/") != -1 and is_kernel_module(path):
|
||||
exec_type |= 16
|
||||
return (path, exec_type)
|
||||
|
||||
def is_static_lib(path):
|
||||
if path.endswith('.a') and not os.path.islink(path):
|
||||
with open(path, 'rb') as fh:
|
||||
# The magic must include the first slash to avoid
|
||||
# matching golang static libraries
|
||||
magic = b'!<arch>\x0a/'
|
||||
start = fh.read(len(magic))
|
||||
return start == magic
|
||||
return False
|
||||
|
||||
def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripped=False):
|
||||
"""
|
||||
Strip executable code (like executables, shared libraries) _in_place_
|
||||
- Based on sysroot_strip in staging.bbclass
|
||||
@@ -56,39 +91,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
:param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP}
|
||||
This is for proper logging and messages only.
|
||||
"""
|
||||
import stat, errno, oe.path, oe.utils, mmap
|
||||
|
||||
# Detect .ko module by searching for "vermagic=" string
|
||||
def is_kernel_module(path):
|
||||
with open(path) as f:
|
||||
return mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ).find(b"vermagic=") >= 0
|
||||
|
||||
# Return type (bits):
|
||||
# 0 - not elf
|
||||
# 1 - ELF
|
||||
# 2 - stripped
|
||||
# 4 - executable
|
||||
# 8 - shared library
|
||||
# 16 - kernel module
|
||||
def is_elf(path):
|
||||
exec_type = 0
|
||||
ret, result = oe.utils.getstatusoutput("file -b '%s'" % path)
|
||||
|
||||
if ret:
|
||||
bb.error("split_and_strip_files: 'file %s' failed" % path)
|
||||
return exec_type
|
||||
|
||||
if "ELF" in result:
|
||||
exec_type |= 1
|
||||
if "not stripped" not in result:
|
||||
exec_type |= 2
|
||||
if "executable" in result:
|
||||
exec_type |= 4
|
||||
if "shared" in result:
|
||||
exec_type |= 8
|
||||
if "relocatable" in result and is_kernel_module(path):
|
||||
exec_type |= 16
|
||||
return exec_type
|
||||
import stat, errno, oe.path, oe.utils
|
||||
|
||||
elffiles = {}
|
||||
inodes = {}
|
||||
@@ -98,6 +101,8 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
#
|
||||
# First lets figure out all of the files we may have to process
|
||||
#
|
||||
checkelf = []
|
||||
inodecache = {}
|
||||
for root, dirs, files in os.walk(dstdir):
|
||||
for f in files:
|
||||
file = os.path.join(root, f)
|
||||
@@ -123,7 +128,11 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
|
||||
# It's a file (or hardlink), not a link
|
||||
# ...but is it ELF, and is it already stripped?
|
||||
elf_file = is_elf(file)
|
||||
checkelf.append(file)
|
||||
inodecache[file] = s.st_ino
|
||||
results = oe.utils.multiprocess_launch(is_elf, checkelf, d)
|
||||
for (file, elf_file) in results:
|
||||
#elf_file = is_elf(file)
|
||||
if elf_file & 1:
|
||||
if elf_file & 2:
|
||||
if qa_already_stripped:
|
||||
@@ -132,12 +141,12 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
bb.warn("File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dstdir):], pn))
|
||||
continue
|
||||
|
||||
if s.st_ino in inodes:
|
||||
if inodecache[file] in inodes:
|
||||
os.unlink(file)
|
||||
os.link(inodes[s.st_ino], file)
|
||||
os.link(inodes[inodecache[file]], file)
|
||||
else:
|
||||
# break hardlinks so that we do not strip the original.
|
||||
inodes[s.st_ino] = file
|
||||
inodes[inodecache[file]] = file
|
||||
bb.utils.copyfile(file, file)
|
||||
elffiles[file] = elf_file
|
||||
|
||||
@@ -149,8 +158,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
elf_file = int(elffiles[file])
|
||||
sfiles.append((file, elf_file, strip_cmd))
|
||||
|
||||
oe.utils.multiprocess_exec(sfiles, runstrip)
|
||||
|
||||
oe.utils.multiprocess_launch(runstrip, sfiles, d)
|
||||
|
||||
|
||||
def file_translate(file):
|
||||
|
||||
@@ -3,7 +3,6 @@ import os
|
||||
import glob
|
||||
import subprocess
|
||||
import shutil
|
||||
import multiprocessing
|
||||
import re
|
||||
import collections
|
||||
import bb
|
||||
@@ -177,7 +176,7 @@ class OpkgIndexer(Indexer):
|
||||
bb.note("There are no packages in %s!" % self.deploy_dir)
|
||||
return
|
||||
|
||||
oe.utils.multiprocess_exec(index_cmds, create_index)
|
||||
oe.utils.multiprocess_launch(create_index, index_cmds, self.d)
|
||||
|
||||
if signer:
|
||||
feed_sig_type = self.d.getVar('PACKAGE_FEED_GPG_SIGNATURE_TYPE')
|
||||
@@ -258,7 +257,7 @@ class DpkgIndexer(Indexer):
|
||||
bb.note("There are no packages in %s" % self.deploy_dir)
|
||||
return
|
||||
|
||||
oe.utils.multiprocess_exec(index_cmds, create_index)
|
||||
oe.utils.multiprocess_launch(create_index, index_cmds, self.d)
|
||||
if self.d.getVar('PACKAGE_FEED_SIGN') == '1':
|
||||
raise NotImplementedError('Package feed signing not implementd for dpkg')
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import subprocess
|
||||
import multiprocessing
|
||||
import traceback
|
||||
|
||||
def read_file(filename):
|
||||
try:
|
||||
@@ -246,38 +248,72 @@ def execute_pre_post_process(d, cmds):
|
||||
bb.note("Executing %s ..." % cmd)
|
||||
bb.build.exec_func(cmd, d)
|
||||
|
||||
def multiprocess_exec(commands, function):
|
||||
import signal
|
||||
import multiprocessing
|
||||
# For each item in items, call the function 'target' with item as the first
|
||||
# argument, extraargs as the other arguments and handle any exceptions in the
|
||||
# parent thread
|
||||
def multiprocess_launch(target, items, d, extraargs=None):
|
||||
|
||||
if not commands:
|
||||
return []
|
||||
class ProcessLaunch(multiprocessing.Process):
|
||||
def __init__(self, *args, **kwargs):
|
||||
multiprocessing.Process.__init__(self, *args, **kwargs)
|
||||
self._pconn, self._cconn = multiprocessing.Pipe()
|
||||
self._exception = None
|
||||
self._result = None
|
||||
|
||||
def init_worker():
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||
def run(self):
|
||||
try:
|
||||
ret = self._target(*self._args, **self._kwargs)
|
||||
self._cconn.send((None, ret))
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
self._cconn.send((e, tb))
|
||||
|
||||
fails = []
|
||||
def update(self):
|
||||
if self._pconn.poll():
|
||||
(e, tb) = self._pconn.recv()
|
||||
if e is not None:
|
||||
self._exception = (e, tb)
|
||||
else:
|
||||
self._result = tb
|
||||
|
||||
def failures(res):
|
||||
fails.append(res)
|
||||
@property
|
||||
def exception(self):
|
||||
self.update()
|
||||
return self._exception
|
||||
|
||||
nproc = min(multiprocessing.cpu_count(), len(commands))
|
||||
pool = bb.utils.multiprocessingpool(nproc, init_worker)
|
||||
|
||||
try:
|
||||
mapresult = pool.map_async(function, commands, error_callback=failures)
|
||||
|
||||
pool.close()
|
||||
pool.join()
|
||||
results = mapresult.get()
|
||||
except KeyboardInterrupt:
|
||||
pool.terminate()
|
||||
pool.join()
|
||||
raise
|
||||
|
||||
if fails:
|
||||
raise fails[0]
|
||||
@property
|
||||
def result(self):
|
||||
self.update()
|
||||
return self._result
|
||||
|
||||
max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
|
||||
launched = []
|
||||
errors = []
|
||||
results = []
|
||||
items = list(items)
|
||||
while (items and not errors) or launched:
|
||||
if not errors and items and len(launched) < max_process:
|
||||
args = (items.pop(),)
|
||||
if extraargs is not None:
|
||||
args = args + extraargs
|
||||
p = ProcessLaunch(target=target, args=args)
|
||||
p.start()
|
||||
launched.append(p)
|
||||
for q in launched:
|
||||
# The finished processes are joined when calling is_alive()
|
||||
if not q.is_alive():
|
||||
if q.exception:
|
||||
errors.append(q.exception)
|
||||
if q.result:
|
||||
results.append(q.result)
|
||||
launched.remove(q)
|
||||
# Paranoia doesn't hurt
|
||||
for p in launched:
|
||||
p.join()
|
||||
if errors:
|
||||
for (e, tb) in errors:
|
||||
bb.error(str(tb))
|
||||
bb.fatal("Fatal errors occurred in subprocesses, tracebacks printed above")
|
||||
return results
|
||||
|
||||
def squashspaces(string):
|
||||
|
||||
@@ -88,7 +88,7 @@ class BitbakeLayers(OESelftestTestCase):
|
||||
def test_bitbakelayers_createlayer(self):
|
||||
priority = 10
|
||||
layername = 'test-bitbakelayer-layercreate'
|
||||
layerpath = os.path.join(get_bb_var('COREBASE'), layername)
|
||||
layerpath = os.path.join(self.builddir, layername)
|
||||
self.assertFalse(os.path.exists(layerpath), '%s should not exist at this point in time' % layerpath)
|
||||
result = runCmd('bitbake-layers create-layer --priority=%d %s' % (priority, layerpath))
|
||||
self.track_for_cleanup(layerpath)
|
||||
|
||||
@@ -15,16 +15,26 @@ class BitbakeTests(OESelftestTestCase):
|
||||
return l
|
||||
|
||||
@OETestID(789)
|
||||
# Test bitbake can run from the <builddir>/conf directory
|
||||
def test_run_bitbake_from_dir_1(self):
|
||||
os.chdir(os.path.join(self.builddir, 'conf'))
|
||||
self.assertEqual(bitbake('-e').status, 0, msg = "bitbake couldn't run from \"conf\" dir")
|
||||
|
||||
@OETestID(790)
|
||||
# Test bitbake can run from the <builddir>'s parent directory
|
||||
def test_run_bitbake_from_dir_2(self):
|
||||
my_env = os.environ.copy()
|
||||
my_env['BBPATH'] = my_env['BUILDDIR']
|
||||
os.chdir(os.path.dirname(os.environ['BUILDDIR']))
|
||||
self.assertEqual(bitbake('-e', env=my_env).status, 0, msg = "bitbake couldn't run from builddir")
|
||||
self.assertEqual(bitbake('-e', env=my_env).status, 0, msg = "bitbake couldn't run from builddir's parent directory")
|
||||
|
||||
# Test bitbake can run from some other random system location (we use /tmp/)
|
||||
def test_run_bitbake_from_dir_3(self):
|
||||
my_env = os.environ.copy()
|
||||
my_env['BBPATH'] = my_env['BUILDDIR']
|
||||
os.chdir("/tmp/")
|
||||
self.assertEqual(bitbake('-e', env=my_env).status, 0, msg = "bitbake couldn't run from /tmp/")
|
||||
|
||||
|
||||
@OETestID(806)
|
||||
def test_event_handler(self):
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import sys
|
||||
from unittest.case import TestCase
|
||||
from oe.utils import packages_filter_out_system, trim_version
|
||||
from contextlib import contextmanager
|
||||
from io import StringIO
|
||||
from oe.utils import packages_filter_out_system, trim_version, multiprocess_launch
|
||||
|
||||
class TestPackagesFilterOutSystem(TestCase):
|
||||
def test_filter(self):
|
||||
@@ -49,3 +52,44 @@ class TestTrimVersion(TestCase):
|
||||
self.assertEqual(trim_version("1.2.3", 2), "1.2")
|
||||
self.assertEqual(trim_version("1.2.3", 3), "1.2.3")
|
||||
self.assertEqual(trim_version("1.2.3", 4), "1.2.3")
|
||||
|
||||
|
||||
class TestMultiprocessLaunch(TestCase):
|
||||
|
||||
def test_multiprocesslaunch(self):
|
||||
import bb
|
||||
|
||||
def testfunction(item, d):
|
||||
if item == "2" or item == "1":
|
||||
raise KeyError("Invalid number %s" % item)
|
||||
return "Found %s" % item
|
||||
|
||||
def dummyerror(msg):
|
||||
print("ERROR: %s" % msg)
|
||||
|
||||
@contextmanager
|
||||
def captured_output():
|
||||
new_out, new_err = StringIO(), StringIO()
|
||||
old_out, old_err = sys.stdout, sys.stderr
|
||||
try:
|
||||
sys.stdout, sys.stderr = new_out, new_err
|
||||
yield sys.stdout, sys.stderr
|
||||
finally:
|
||||
sys.stdout, sys.stderr = old_out, old_err
|
||||
|
||||
d = bb.data_smart.DataSmart()
|
||||
bb.error = dummyerror
|
||||
|
||||
# Assert the function returns the right results
|
||||
result = multiprocess_launch(testfunction, ["3", "4", "5", "6"], d, extraargs=(d,))
|
||||
self.assertIn("Found 3", result)
|
||||
self.assertIn("Found 4", result)
|
||||
self.assertIn("Found 5", result)
|
||||
self.assertIn("Found 6", result)
|
||||
self.assertEqual(len(result), 4)
|
||||
|
||||
# Assert the function prints exceptions
|
||||
with captured_output() as (out, err):
|
||||
self.assertRaises(bb.BBHandledException, multiprocess_launch, testfunction, ["1", "2", "3", "4", "5", "6"], d, extraargs=(d,))
|
||||
self.assertIn("KeyError: 'Invalid number 1'", out.getvalue())
|
||||
self.assertIn("KeyError: 'Invalid number 2'", out.getvalue())
|
||||
|
||||
@@ -10,6 +10,19 @@ class BuildhistoryDiffTests(BuildhistoryBase):
|
||||
target = 'xcursor-transparent-theme'
|
||||
self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
|
||||
self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True)
|
||||
result = runCmd("oe-pkgdata-util read-value PKGV %s" % target)
|
||||
pkgv = result.output.rstrip()
|
||||
result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR'))
|
||||
expected_output = 'PR changed from "r1" to "r0"'
|
||||
self.assertTrue(expected_output in result.output, msg="Did not find expected output: %s" % result.output)
|
||||
expected_endlines = [
|
||||
"xcursor-transparent-theme-dev: RDEPENDS: removed \"xcursor-transparent-theme (['= %s-r1'])\", added \"xcursor-transparent-theme (['= %s-r0'])\"" % (pkgv, pkgv),
|
||||
"xcursor-transparent-theme-staticdev: RDEPENDS: removed \"xcursor-transparent-theme-dev (['= %s-r1'])\", added \"xcursor-transparent-theme-dev (['= %s-r0'])\"" % (pkgv, pkgv)
|
||||
]
|
||||
for line in result.output.splitlines():
|
||||
for el in expected_endlines:
|
||||
if line.endswith(el):
|
||||
expected_endlines.remove(el)
|
||||
break
|
||||
else:
|
||||
self.fail('Unexpected line:\n%s\nExpected line endings:\n %s' % (line, '\n '.join(expected_endlines)))
|
||||
if expected_endlines:
|
||||
self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines))
|
||||
|
||||
@@ -99,58 +99,58 @@ class Wic(WicTestCase):
|
||||
@OETestID(1552)
|
||||
def test_version(self):
|
||||
"""Test wic --version"""
|
||||
self.assertEqual(0, runCmd('wic --version').status)
|
||||
runCmd('wic --version')
|
||||
|
||||
@OETestID(1208)
|
||||
def test_help(self):
|
||||
"""Test wic --help and wic -h"""
|
||||
self.assertEqual(0, runCmd('wic --help').status)
|
||||
self.assertEqual(0, runCmd('wic -h').status)
|
||||
runCmd('wic --help')
|
||||
runCmd('wic -h')
|
||||
|
||||
@OETestID(1209)
|
||||
def test_createhelp(self):
|
||||
"""Test wic create --help"""
|
||||
self.assertEqual(0, runCmd('wic create --help').status)
|
||||
runCmd('wic create --help')
|
||||
|
||||
@OETestID(1210)
|
||||
def test_listhelp(self):
|
||||
"""Test wic list --help"""
|
||||
self.assertEqual(0, runCmd('wic list --help').status)
|
||||
runCmd('wic list --help')
|
||||
|
||||
@OETestID(1553)
|
||||
def test_help_create(self):
|
||||
"""Test wic help create"""
|
||||
self.assertEqual(0, runCmd('wic help create').status)
|
||||
runCmd('wic help create')
|
||||
|
||||
@OETestID(1554)
|
||||
def test_help_list(self):
|
||||
"""Test wic help list"""
|
||||
self.assertEqual(0, runCmd('wic help list').status)
|
||||
runCmd('wic help list')
|
||||
|
||||
@OETestID(1215)
|
||||
def test_help_overview(self):
|
||||
"""Test wic help overview"""
|
||||
self.assertEqual(0, runCmd('wic help overview').status)
|
||||
runCmd('wic help overview')
|
||||
|
||||
@OETestID(1216)
|
||||
def test_help_plugins(self):
|
||||
"""Test wic help plugins"""
|
||||
self.assertEqual(0, runCmd('wic help plugins').status)
|
||||
runCmd('wic help plugins')
|
||||
|
||||
@OETestID(1217)
|
||||
def test_help_kickstart(self):
|
||||
"""Test wic help kickstart"""
|
||||
self.assertEqual(0, runCmd('wic help kickstart').status)
|
||||
runCmd('wic help kickstart')
|
||||
|
||||
@OETestID(1555)
|
||||
def test_list_images(self):
|
||||
"""Test wic list images"""
|
||||
self.assertEqual(0, runCmd('wic list images').status)
|
||||
runCmd('wic list images')
|
||||
|
||||
@OETestID(1556)
|
||||
def test_list_source_plugins(self):
|
||||
"""Test wic list source-plugins"""
|
||||
self.assertEqual(0, runCmd('wic list source-plugins').status)
|
||||
runCmd('wic list source-plugins')
|
||||
|
||||
@OETestID(1557)
|
||||
def test_listed_images_help(self):
|
||||
@@ -158,7 +158,7 @@ class Wic(WicTestCase):
|
||||
output = runCmd('wic list images').output
|
||||
imagelist = [line.split()[0] for line in output.splitlines()]
|
||||
for image in imagelist:
|
||||
self.assertEqual(0, runCmd('wic list %s help' % image).status)
|
||||
runCmd('wic list %s help' % image)
|
||||
|
||||
@OETestID(1213)
|
||||
def test_unsupported_subcommand(self):
|
||||
@@ -174,7 +174,7 @@ class Wic(WicTestCase):
|
||||
def test_build_image_name(self):
|
||||
"""Test wic create wictestdisk --image-name=core-image-minimal"""
|
||||
cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1157)
|
||||
@@ -182,7 +182,7 @@ class Wic(WicTestCase):
|
||||
def test_gpt_image(self):
|
||||
"""Test creation of core-image-minimal with gpt table and UUID boot"""
|
||||
cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
|
||||
|
||||
@OETestID(1346)
|
||||
@@ -196,7 +196,7 @@ class Wic(WicTestCase):
|
||||
bitbake('core-image-minimal core-image-minimal-initramfs')
|
||||
self.remove_config(config)
|
||||
cmd = "wic create mkhybridiso --image-name core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct")))
|
||||
self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso")))
|
||||
|
||||
@@ -205,7 +205,7 @@ class Wic(WicTestCase):
|
||||
def test_qemux86_directdisk(self):
|
||||
"""Test creation of qemux-86-directdisk image"""
|
||||
cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct")))
|
||||
|
||||
@OETestID(1350)
|
||||
@@ -213,7 +213,7 @@ class Wic(WicTestCase):
|
||||
def test_mkefidisk(self):
|
||||
"""Test creation of mkefidisk image"""
|
||||
cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct")))
|
||||
|
||||
@OETestID(1385)
|
||||
@@ -225,7 +225,7 @@ class Wic(WicTestCase):
|
||||
bitbake('core-image-minimal')
|
||||
self.remove_config(config)
|
||||
cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "directdisk-bootloader-config-*direct")))
|
||||
|
||||
@OETestID(1560)
|
||||
@@ -237,7 +237,7 @@ class Wic(WicTestCase):
|
||||
bitbake('core-image-minimal')
|
||||
self.remove_config(config)
|
||||
cmd = "wic create systemd-bootdisk -e core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct")))
|
||||
|
||||
@OETestID(1561)
|
||||
@@ -246,7 +246,7 @@ class Wic(WicTestCase):
|
||||
cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir
|
||||
kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal')
|
||||
self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct")))
|
||||
|
||||
@OETestID(1562)
|
||||
@@ -260,7 +260,7 @@ class Wic(WicTestCase):
|
||||
bitbake('core-image-minimal')
|
||||
self.remove_config(config)
|
||||
cmd = "wic create directdisk -e core-image-minimal"
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob("directdisk-*.direct")))
|
||||
|
||||
@OETestID(1212)
|
||||
@@ -273,37 +273,36 @@ class Wic(WicTestCase):
|
||||
'core-image-minimal'))
|
||||
bbvars = {key.lower(): value for key, value in bb_vars.items()}
|
||||
bbvars['resultdir'] = self.resultdir
|
||||
status = runCmd("wic create directdisk "
|
||||
runCmd("wic create directdisk "
|
||||
"-b %(staging_datadir)s "
|
||||
"-k %(deploy_dir_image)s "
|
||||
"-n %(recipe_sysroot_native)s "
|
||||
"-r %(image_rootfs)s "
|
||||
"-o %(resultdir)s" % bbvars).status
|
||||
self.assertEqual(0, status)
|
||||
"-o %(resultdir)s" % bbvars)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
|
||||
|
||||
@OETestID(1264)
|
||||
def test_compress_gzip(self):
|
||||
"""Test compressing an image with gzip"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name core-image-minimal "
|
||||
"-c gzip -o %s" % self.resultdir).status)
|
||||
"-c gzip -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.gz")))
|
||||
|
||||
@OETestID(1265)
|
||||
def test_compress_bzip2(self):
|
||||
"""Test compressing an image with bzip2"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-c bzip2 -o %s" % self.resultdir).status)
|
||||
"-c bzip2 -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.bz2")))
|
||||
|
||||
@OETestID(1266)
|
||||
def test_compress_xz(self):
|
||||
"""Test compressing an image with xz"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"--compress-with=xz -o %s" % self.resultdir).status)
|
||||
"--compress-with=xz -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.xz")))
|
||||
|
||||
@OETestID(1267)
|
||||
@@ -317,63 +316,62 @@ class Wic(WicTestCase):
|
||||
@OETestID(1558)
|
||||
def test_debug_short(self):
|
||||
"""Test -D option"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1658)
|
||||
def test_debug_long(self):
|
||||
"""Test --debug option"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"--debug -o %s" % self.resultdir).status)
|
||||
"--debug -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1563)
|
||||
def test_skip_build_check_short(self):
|
||||
"""Test -s option"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-s -o %s" % self.resultdir).status)
|
||||
"-s -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1671)
|
||||
def test_skip_build_check_long(self):
|
||||
"""Test --skip-build-check option"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"--skip-build-check "
|
||||
"--outdir %s" % self.resultdir).status)
|
||||
"--outdir %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1564)
|
||||
def test_build_rootfs_short(self):
|
||||
"""Test -f option"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-f -o %s" % self.resultdir).status)
|
||||
"-f -o %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1656)
|
||||
def test_build_rootfs_long(self):
|
||||
"""Test --build-rootfs option"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"--build-rootfs "
|
||||
"--outdir %s" % self.resultdir).status)
|
||||
"--outdir %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
|
||||
|
||||
@OETestID(1268)
|
||||
@only_for_arch(['i586', 'i686', 'x86_64'])
|
||||
def test_rootfs_indirect_recipes(self):
|
||||
"""Test usage of rootfs plugin with rootfs recipes"""
|
||||
status = runCmd("wic create directdisk-multi-rootfs "
|
||||
runCmd("wic create directdisk-multi-rootfs "
|
||||
"--image-name=core-image-minimal "
|
||||
"--rootfs rootfs1=core-image-minimal "
|
||||
"--rootfs rootfs2=core-image-minimal "
|
||||
"--outdir %s" % self.resultdir).status
|
||||
self.assertEqual(0, status)
|
||||
"--outdir %s" % self.resultdir)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "directdisk-multi-rootfs*.direct")))
|
||||
|
||||
@OETestID(1269)
|
||||
@@ -387,14 +385,13 @@ class Wic(WicTestCase):
|
||||
bbvars = {key.lower(): value for key, value in bb_vars.items()}
|
||||
bbvars['wks'] = "directdisk-multi-rootfs"
|
||||
bbvars['resultdir'] = self.resultdir
|
||||
status = runCmd("wic create %(wks)s "
|
||||
runCmd("wic create %(wks)s "
|
||||
"--bootimg-dir=%(staging_datadir)s "
|
||||
"--kernel-dir=%(deploy_dir_image)s "
|
||||
"--native-sysroot=%(recipe_sysroot_native)s "
|
||||
"--rootfs-dir rootfs1=%(image_rootfs)s "
|
||||
"--rootfs-dir rootfs2=%(image_rootfs)s "
|
||||
"--outdir %(resultdir)s" % bbvars).status
|
||||
self.assertEqual(0, status)
|
||||
"--outdir %(resultdir)s" % bbvars)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "%(wks)s-*.direct" % bbvars)))
|
||||
|
||||
@OETestID(1661)
|
||||
@@ -413,8 +410,8 @@ part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
|
||||
part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
|
||||
part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
|
||||
% (rootfs_dir, rootfs_dir))
|
||||
self.assertEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wks_file, self.resultdir)).status)
|
||||
runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wks_file, self.resultdir))
|
||||
|
||||
os.remove(wks_file)
|
||||
wicout = glob(self.resultdir + "%s-*direct" % 'temp')
|
||||
@@ -424,7 +421,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
||||
|
||||
# verify partition size with wic
|
||||
res = runCmd("parted -m %s unit b p 2>/dev/null" % wicimg)
|
||||
self.assertEqual(0, res.status)
|
||||
|
||||
# parse parted output which looks like this:
|
||||
# BYT;\n
|
||||
@@ -440,8 +436,8 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
||||
self.assertEqual(7, len(partln))
|
||||
start = int(partln[1].rstrip("B")) / 512
|
||||
length = int(partln[3].rstrip("B")) / 512
|
||||
self.assertEqual(0, runCmd("dd if=%s of=%s skip=%d count=%d" %
|
||||
(wicimg, part_file, start, length)).status)
|
||||
runCmd("dd if=%s of=%s skip=%d count=%d" %
|
||||
(wicimg, part_file, start, length))
|
||||
|
||||
def extract_files(debugfs_output):
|
||||
"""
|
||||
@@ -465,7 +461,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
||||
# /usr.
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part1"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertIn("etc", files)
|
||||
self.assertNotIn("usr", files)
|
||||
@@ -474,7 +469,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
||||
# directories.
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part2"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertNotIn("etc", files)
|
||||
self.assertNotIn("usr", files)
|
||||
@@ -484,7 +478,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
||||
# directory, but not the files inside it.
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part3"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertNotIn("etc", files)
|
||||
self.assertNotIn("usr", files)
|
||||
@@ -492,7 +485,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
||||
self.assertIn("bin", files)
|
||||
res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part3"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertIn(".", files)
|
||||
self.assertIn("..", files)
|
||||
@@ -530,8 +522,7 @@ class Wic2(WicTestCase):
|
||||
def test_bmap_short(self):
|
||||
"""Test generation of .bmap file -m option"""
|
||||
cmd = "wic create wictestdisk -e core-image-minimal -m -o %s" % self.resultdir
|
||||
status = runCmd(cmd).status
|
||||
self.assertEqual(0, status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct")))
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct.bmap")))
|
||||
|
||||
@@ -539,8 +530,7 @@ class Wic2(WicTestCase):
|
||||
def test_bmap_long(self):
|
||||
"""Test generation of .bmap file --bmap option"""
|
||||
cmd = "wic create wictestdisk -e core-image-minimal --bmap -o %s" % self.resultdir
|
||||
status = runCmd(cmd).status
|
||||
self.assertEqual(0, status)
|
||||
runCmd(cmd)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct")))
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct.bmap")))
|
||||
|
||||
@@ -584,10 +574,10 @@ class Wic2(WicTestCase):
|
||||
imgenvdir = self._get_image_env_path(image)
|
||||
native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
|
||||
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=%s -v %s -n %s -o %s"
|
||||
% (image, imgenvdir, native_sysroot,
|
||||
self.resultdir)).status)
|
||||
self.resultdir))
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct")))
|
||||
|
||||
@OETestID(1665)
|
||||
@@ -597,13 +587,13 @@ class Wic2(WicTestCase):
|
||||
imgenvdir = self._get_image_env_path(image)
|
||||
native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
|
||||
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=%s "
|
||||
"--vars %s "
|
||||
"--native-sysroot %s "
|
||||
"--outdir %s"
|
||||
% (image, imgenvdir, native_sysroot,
|
||||
self.resultdir)).status)
|
||||
self.resultdir))
|
||||
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct")))
|
||||
|
||||
@OETestID(1351)
|
||||
@@ -685,8 +675,8 @@ class Wic2(WicTestCase):
|
||||
"""
|
||||
wkspath, wksname = Wic2._make_fixed_size_wks(200)
|
||||
|
||||
self.assertEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wkspath, self.resultdir)).status)
|
||||
runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wkspath, self.resultdir))
|
||||
os.remove(wkspath)
|
||||
wicout = glob(self.resultdir + "%s-*direct" % wksname)
|
||||
self.assertEqual(1, len(wicout))
|
||||
@@ -695,9 +685,7 @@ class Wic2(WicTestCase):
|
||||
|
||||
# verify partition size with wic
|
||||
res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg,
|
||||
ignore_status=True,
|
||||
native_sysroot=self.native_sysroot)
|
||||
self.assertEqual(0, res.status)
|
||||
|
||||
# parse parted output which looks like this:
|
||||
# BYT;\n
|
||||
@@ -752,7 +740,7 @@ class Wic2(WicTestCase):
|
||||
'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n'])
|
||||
wks.flush()
|
||||
cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
wksname = os.path.splitext(os.path.basename(wks.name))[0]
|
||||
out = glob(self.resultdir + "%s-*direct" % wksname)
|
||||
self.assertEqual(1, len(out))
|
||||
@@ -772,7 +760,7 @@ class Wic2(WicTestCase):
|
||||
'part emptybtrfs --fstype btrfs --size 150M\n'])
|
||||
wks.flush()
|
||||
cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
wksname = os.path.splitext(os.path.basename(wks.name))[0]
|
||||
out = glob(self.resultdir + "%s-*direct" % wksname)
|
||||
self.assertEqual(1, len(out))
|
||||
@@ -785,7 +773,7 @@ class Wic2(WicTestCase):
|
||||
'--overhead-factor 1.2 --size 100k\n'])
|
||||
wks.flush()
|
||||
cmd = "wic create %s -e core-image-minimal -o %s" % (wks.name, self.resultdir)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
wksname = os.path.splitext(os.path.basename(wks.name))[0]
|
||||
out = glob(self.resultdir + "%s-*direct" % wksname)
|
||||
self.assertEqual(1, len(out))
|
||||
@@ -797,7 +785,7 @@ class Wic2(WicTestCase):
|
||||
cmd = "wic create sdimage-bootpart -e %s -o %s" % (img, self.resultdir)
|
||||
config = 'IMAGE_BOOT_FILES = "%s*"' % get_bb_var('KERNEL_IMAGETYPE', img)
|
||||
self.append_config(config)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
self.remove_config(config)
|
||||
self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct")))
|
||||
|
||||
@@ -833,9 +821,9 @@ class Wic2(WicTestCase):
|
||||
@OETestID(1857)
|
||||
def test_wic_ls(self):
|
||||
"""Test listing image content using 'wic ls'"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
images = glob(self.resultdir + "wictestdisk-*.direct")
|
||||
self.assertEqual(1, len(images))
|
||||
|
||||
@@ -843,20 +831,18 @@ class Wic2(WicTestCase):
|
||||
|
||||
# list partitions
|
||||
result = runCmd("wic ls %s -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertEqual(3, len(result.output.split('\n')))
|
||||
|
||||
# list directory content of the first partition
|
||||
result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertEqual(6, len(result.output.split('\n')))
|
||||
|
||||
@OETestID(1856)
|
||||
def test_wic_cp(self):
|
||||
"""Test copy files and directories to the the wic image."""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
images = glob(self.resultdir + "wictestdisk-*.direct")
|
||||
self.assertEqual(1, len(images))
|
||||
|
||||
@@ -864,19 +850,16 @@ class Wic2(WicTestCase):
|
||||
|
||||
# list directory content of the first partition
|
||||
result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertEqual(6, len(result.output.split('\n')))
|
||||
|
||||
with NamedTemporaryFile("w", suffix=".wic-cp") as testfile:
|
||||
testfile.write("test")
|
||||
|
||||
# copy file to the partition
|
||||
result = runCmd("wic cp %s %s:1/ -n %s" % (testfile.name, images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
runCmd("wic cp %s %s:1/ -n %s" % (testfile.name, images[0], sysroot))
|
||||
|
||||
# check if file is there
|
||||
result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertEqual(7, len(result.output.split('\n')))
|
||||
self.assertTrue(os.path.basename(testfile.name) in result.output)
|
||||
|
||||
@@ -887,21 +870,19 @@ class Wic2(WicTestCase):
|
||||
copy(testfile.name, testdir)
|
||||
|
||||
# copy directory to the partition
|
||||
result = runCmd("wic cp %s %s:1/ -n %s" % (testdir, images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
runCmd("wic cp %s %s:1/ -n %s" % (testdir, images[0], sysroot))
|
||||
|
||||
# check if directory is there
|
||||
result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertEqual(8, len(result.output.split('\n')))
|
||||
self.assertTrue(os.path.basename(testdir) in result.output)
|
||||
|
||||
@OETestID(1858)
|
||||
def test_wic_rm(self):
|
||||
"""Test removing files and directories from the the wic image."""
|
||||
self.assertEqual(0, runCmd("wic create mkefidisk "
|
||||
runCmd("wic create mkefidisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
images = glob(self.resultdir + "mkefidisk-*.direct")
|
||||
self.assertEqual(1, len(images))
|
||||
|
||||
@@ -909,21 +890,17 @@ class Wic2(WicTestCase):
|
||||
|
||||
# list directory content of the first partition
|
||||
result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertIn('\nBZIMAGE ', result.output)
|
||||
self.assertIn('\nEFI <DIR> ', result.output)
|
||||
|
||||
# remove file
|
||||
result = runCmd("wic rm %s:1/bzimage -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
runCmd("wic rm %s:1/bzimage -n %s" % (images[0], sysroot))
|
||||
|
||||
# remove directory
|
||||
result = runCmd("wic rm %s:1/efi -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
runCmd("wic rm %s:1/efi -n %s" % (images[0], sysroot))
|
||||
|
||||
# check if they're removed
|
||||
result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertNotIn('\nBZIMAGE ', result.output)
|
||||
self.assertNotIn('\nEFI <DIR> ', result.output)
|
||||
|
||||
@@ -942,7 +919,7 @@ class Wic2(WicTestCase):
|
||||
'part emptybtrfs --fstype btrfs --size 100M --mkfs-extraopts "--mixed -K"\n'])
|
||||
wks.flush()
|
||||
cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
wksname = os.path.splitext(os.path.basename(wks.name))[0]
|
||||
out = glob(self.resultdir + "%s-*direct" % wksname)
|
||||
self.assertEqual(1, len(out))
|
||||
@@ -972,7 +949,7 @@ class Wic2(WicTestCase):
|
||||
|
||||
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
|
||||
cmd = "wic write -n %s --expand 1:0 %s %s" % (sysroot, image_path, new_image_path)
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
runCmd(cmd)
|
||||
|
||||
# check if partitions are expanded
|
||||
orig = runCmd("wic ls %s -n %s" % (image_path, sysroot))
|
||||
@@ -1002,9 +979,9 @@ class Wic2(WicTestCase):
|
||||
|
||||
def test_wic_ls_ext(self):
|
||||
"""Test listing content of the ext partition using 'wic ls'"""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
images = glob(self.resultdir + "wictestdisk-*.direct")
|
||||
self.assertEqual(1, len(images))
|
||||
|
||||
@@ -1012,15 +989,14 @@ class Wic2(WicTestCase):
|
||||
|
||||
# list directory content of the second ext4 partition
|
||||
result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset(
|
||||
set(line.split()[-1] for line in result.output.split('\n') if line)))
|
||||
|
||||
def test_wic_cp_ext(self):
|
||||
"""Test copy files and directories to the ext partition."""
|
||||
self.assertEqual(0, runCmd("wic create wictestdisk "
|
||||
runCmd("wic create wictestdisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
images = glob(self.resultdir + "wictestdisk-*.direct")
|
||||
self.assertEqual(1, len(images))
|
||||
|
||||
@@ -1028,7 +1004,6 @@ class Wic2(WicTestCase):
|
||||
|
||||
# list directory content of the ext4 partition
|
||||
result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
dirs = set(line.split()[-1] for line in result.output.split('\n') if line)
|
||||
self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset(dirs))
|
||||
|
||||
@@ -1036,20 +1011,18 @@ class Wic2(WicTestCase):
|
||||
testfile.write("test")
|
||||
|
||||
# copy file to the partition
|
||||
result = runCmd("wic cp %s %s:2/ -n %s" % (testfile.name, images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
runCmd("wic cp %s %s:2/ -n %s" % (testfile.name, images[0], sysroot))
|
||||
|
||||
# check if file is there
|
||||
result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
newdirs = set(line.split()[-1] for line in result.output.split('\n') if line)
|
||||
self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)]))
|
||||
|
||||
def test_wic_rm_ext(self):
|
||||
"""Test removing files from the ext partition."""
|
||||
self.assertEqual(0, runCmd("wic create mkefidisk "
|
||||
runCmd("wic create mkefidisk "
|
||||
"--image-name=core-image-minimal "
|
||||
"-D -o %s" % self.resultdir).status)
|
||||
"-D -o %s" % self.resultdir)
|
||||
images = glob(self.resultdir + "mkefidisk-*.direct")
|
||||
self.assertEqual(1, len(images))
|
||||
|
||||
@@ -1057,14 +1030,11 @@ class Wic2(WicTestCase):
|
||||
|
||||
# list directory content of the /etc directory on ext4 partition
|
||||
result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertTrue('fstab' in [line.split()[-1] for line in result.output.split('\n') if line])
|
||||
|
||||
# remove file
|
||||
result = runCmd("wic rm %s:2/etc/fstab -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
runCmd("wic rm %s:2/etc/fstab -n %s" % (images[0], sysroot))
|
||||
|
||||
# check if it's removed
|
||||
result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
|
||||
self.assertEqual(0, result.status)
|
||||
self.assertTrue('fstab' not in [line.split()[-1] for line in result.output.split('\n') if line])
|
||||
|
||||
@@ -11,8 +11,8 @@ DEPENDS = "zlib kmod"
|
||||
SRC_URI = "${KERNELORG_MIRROR}/software/utils/pciutils/pciutils-${PV}.tar.xz \
|
||||
file://configure.patch"
|
||||
|
||||
SRC_URI[md5sum] = "8e52278399b7b35fcfc031bc05da80a8"
|
||||
SRC_URI[sha256sum] = "f346eeb90cce0910c05b877fe49eadc760fa084c0455fd313e39d4b2c2d4bb21"
|
||||
SRC_URI[md5sum] = "1adbcc258030ea92609100703f29c92c"
|
||||
SRC_URI[sha256sum] = "fcc0431cc951c3563f1e4f946d27c8e2161cfd81f25316e6bd783fa6118469e0"
|
||||
|
||||
inherit multilib_header pkgconfig
|
||||
|
||||
@@ -16,6 +16,7 @@ TOOLCHAIN_HOST_TASK = "\
|
||||
nativesdk-glibc-gconv-libjis \
|
||||
nativesdk-patchelf \
|
||||
nativesdk-libxcrypt \
|
||||
nativesdk-libnss-nis \
|
||||
"
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
|
||||
@@ -14,7 +14,7 @@ DEPENDS = "util-linux attr e2fsprogs lzo acl python3-setuptools-native"
|
||||
DEPENDS_append_class-target = " udev"
|
||||
RDEPENDS_${PN} = "libgcc"
|
||||
|
||||
SRCREV = "f7fc27cb20924cc340a2a522655969253dd97ae9"
|
||||
SRCREV = "33d16ffc0d176ff4a217a0491378d20ad34e0a90"
|
||||
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git \
|
||||
file://0001-Makefile-build-mktables-using-native-gcc.patch \
|
||||
file://0001-Add-LDFLAGS-when-building-libbtrfsutil.so.patch \
|
||||
@@ -1,74 +0,0 @@
|
||||
From 0c75ebaad09d6d3f2395dfe6160904af883dd0d9 Mon Sep 17 00:00:00 2001
|
||||
From: Andre McCurdy <armccurdy@gmail.com>
|
||||
Date: Tue, 15 May 2018 15:34:39 -0700
|
||||
Subject: [PATCH] linux/arm/raw_syscall.h: avoid r7 specified register
|
||||
variables with Thumb
|
||||
|
||||
If Thumb code is being generated and frame pointers are enabled, the
|
||||
Thumb frame pointer in r7 clashes with any local variable which may
|
||||
need to be assigned to r7 (e.g. the syscall NR when making a raw
|
||||
syscall).
|
||||
|
||||
With gcc, the double use of r7 results in a build error, e.g.
|
||||
|
||||
strace-4.22/tests/inject-nf.c:86:1: error: r7 cannot be used in asm here
|
||||
|
||||
With clang, the double use of r7 can result in the compiler silently
|
||||
generating broken code which crashes at run time due to frame pointer
|
||||
corruption:
|
||||
|
||||
https://bugs.llvm.org/show_bug.cgi?id=34165
|
||||
|
||||
In most cases the problem isn't visible as frame pointers will be
|
||||
disabled automatically due to optimisation level. However to handle
|
||||
cases where frame pointers are enabled (e.g. when CFLAGS etc are set
|
||||
to support a debug build, etc) provide a version of raw_syscall_0
|
||||
which manually saves and restores the frame pointer value in r7
|
||||
to a temporary register before setting up the syscall NR in r7
|
||||
and invoking the syscall.
|
||||
|
||||
* linux/arm/raw_syscall.h (raw_syscall_0) [__thumb__]: Provide
|
||||
an alternative version.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
|
||||
---
|
||||
linux/arm/raw_syscall.h | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/linux/arm/raw_syscall.h b/linux/arm/raw_syscall.h
|
||||
index 69c7e23..ec534ec 100644
|
||||
--- a/linux/arm/raw_syscall.h
|
||||
+++ b/linux/arm/raw_syscall.h
|
||||
@@ -36,12 +36,27 @@ static inline kernel_ulong_t
|
||||
raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err)
|
||||
{
|
||||
*err = 0;
|
||||
+
|
||||
+#ifdef __thumb__ /* && FRAME_POINTERS_ENABLED */
|
||||
+
|
||||
+ register kernel_ulong_t rt;
|
||||
+ register kernel_ulong_t r0 __asm__("r0");
|
||||
+ __asm__ __volatile__("mov %1,r7; mov r7,%2; swi 0x0; mov r7,%1"
|
||||
+ : "=r"(r0), "=&r"(rt)
|
||||
+ : "r"(nr)
|
||||
+ : "memory");
|
||||
+
|
||||
+#else
|
||||
+
|
||||
register kernel_ulong_t r7 __asm__("r7") = nr;
|
||||
register kernel_ulong_t r0 __asm__("r0");
|
||||
__asm__ __volatile__("swi 0x0"
|
||||
: "=r"(r0)
|
||||
: "r"(r7)
|
||||
: "memory");
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
return r0;
|
||||
}
|
||||
# define raw_syscall_0 raw_syscall_0
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -14,10 +14,9 @@ SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \
|
||||
file://mips-SIGEMT.patch \
|
||||
file://0001-caps-abbrev.awk-fix-gawk-s-path.patch \
|
||||
file://0001-tests-sigaction-Check-for-mips-and-alpha-before-usin.patch \
|
||||
file://0001-linux-arm-raw_syscall.h-avoid-r7-specified-register-.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "7a2a7d7715da6e6834bc65bd09bace1c"
|
||||
SRC_URI[sha256sum] = "068cd09264c95e4d591bbcd3ea08f99a693ed8663cd5169b0fdad72eb5bdb39d"
|
||||
SRC_URI[md5sum] = "fad4bba0947553cef34d46a9fd78f039"
|
||||
SRC_URI[sha256sum] = "7860a6965f1dd832747bd8281a04738274398d32c56e9fbd0a68b1bb9ec09aad"
|
||||
|
||||
inherit autotools ptest bluetooth
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From 23a3759b74d081b3b2849b0d37a0e5219f37813e Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 7 Jan 2016 22:37:48 +0000
|
||||
Subject: [PATCH] canonicalize_file_name is specific to glibc
|
||||
|
||||
When on Linux and not using glibc then we need to define
|
||||
canonicalize_file_name() API, therefore add a check for finding out if
|
||||
its not glibc
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Upstream-Status: Pending
|
||||
|
||||
agent/tcf/framework/mdep.c | 2 +-
|
||||
agent/tcf/framework/mdep.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c
|
||||
index 2b52ca8..7d09655 100644
|
||||
--- a/agent/tcf/framework/mdep.c
|
||||
+++ b/agent/tcf/framework/mdep.c
|
||||
@@ -1042,7 +1042,7 @@ char * canonicalize_file_name(const char * path) {
|
||||
return strdup(res);
|
||||
}
|
||||
|
||||
-#elif defined(__UCLIBC__)
|
||||
+#elif defined(__UCLIBC__) || !defined(__GLIBC__)
|
||||
|
||||
char * canonicalize_file_name(const char * path) {
|
||||
return realpath(path, NULL);
|
||||
diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h
|
||||
index 1e718a2..187c399 100644
|
||||
--- a/agent/tcf/framework/mdep.h
|
||||
+++ b/agent/tcf/framework/mdep.h
|
||||
@@ -276,7 +276,7 @@ extern int loc_clock_gettime(int, struct timespec *);
|
||||
|
||||
#define O_BINARY 0
|
||||
|
||||
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
|
||||
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || !defined(__GLIBC__)
|
||||
# define O_LARGEFILE 0
|
||||
extern char ** environ;
|
||||
extern char * canonicalize_file_name(const char * path);
|
||||
--
|
||||
2.7.0
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
Upstream-Status: Inappropriate [poky-specific fix]
|
||||
Actually pass the arguments to RANLIB.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
|
||||
Index: agent/Makefile.inc
|
||||
===================================================================
|
||||
--- agent.orig/Makefile.inc
|
||||
+++ agent/Makefile.inc
|
||||
@@ -88,6 +88,9 @@ ifneq ($(OPSYS),Windows)
|
||||
ifneq ($(CC),g++)
|
||||
OPTS += -Wmissing-prototypes
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -92,6 +92,7 @@ ifeq ($(OPSYS),GNU/Linux)
|
||||
OPTS += -DUSE_uuid_generate=0
|
||||
endif
|
||||
+ ifneq ($(RANLIB),)
|
||||
+ RANLIB += $@
|
||||
+ endif
|
||||
OPTS += -DENABLE_arch_$(shell uname -m)
|
||||
+ RANLIB += $@
|
||||
endif
|
||||
|
||||
# Compiler flags definition
|
||||
|
||||
ifneq ($(OPSYS),Windows)
|
||||
|
||||
@@ -5,14 +5,13 @@ BUGTRACKER = "https://bugs.eclipse.org/bugs/"
|
||||
LICENSE = "EPL-1.0 | EDL-1.0"
|
||||
LIC_FILES_CHKSUM = "file://edl-v10.html;md5=522a390a83dc186513f0500543ad3679"
|
||||
|
||||
SRCREV = "2dddd5f440a15d5406032fac20f206484513646f"
|
||||
PV = "1.4.0+git${SRCPV}"
|
||||
SRCREV = "a022ef2f1acfd9209a1bf792dda14ae4b0d1b60f"
|
||||
PV = "1.7.0+git${SRCPV}"
|
||||
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
|
||||
SRC_URI = "git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent;branch=1.4_neon_bugfix \
|
||||
SRC_URI = "git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent \
|
||||
file://fix_ranlib.patch \
|
||||
file://ldflags.patch \
|
||||
file://0001-canonicalize_file_name-is-specific-to-glibc.patch;striplevel=2 \
|
||||
file://tcf-agent.init \
|
||||
file://tcf-agent.service \
|
||||
"
|
||||
|
||||
46
meta/recipes-extended/bc/bc/libmath.h
Normal file
46
meta/recipes-extended/bc/bc/libmath.h
Normal file
@@ -0,0 +1,46 @@
|
||||
{"@iK20:s2:p@r",
|
||||
"@iF1,5.6,7,8,9,10,11,12,13,14,15[l0:KA:#Z1:l0:s7:pKA:s0:pl5:C1,0:",
|
||||
"s14:pl7:s0:pl14:RN1:l5:0<Z2:1s12:pl5:ns5:pN2:l2:s15:pK6:l15:+",
|
||||
"K.44:l5:*+s13:pl5:cS1+s2:pN3:l5:1>Z4:l10:1+s10:pl5:K2:/s5:pl2:",
|
||||
"1+s2:pJ3:N4:l13:s2:p1l5:+s14:pl5:s6:p1s8:pK2:s11:pN6:1B7:J5:N8:",
|
||||
"l11:i11:pJ6:N7:l6:l5:*s6:l8:l11:*s8:/s9:pl9:0=Z9:l10:0>Z10:N11:",
|
||||
"l10:d10:Z12:l14:l14:*s14:pJ11:N12:N10:l15:s2:pl12:Z13:1l14:/R",
|
||||
"N13:l14:1/RN9:l14:l9:+s14:pJ8:N5:0R]@r",
|
||||
"@iF2,5.7,9,10,11,12,13,14,15[l0:KA:#Z1:l0:s7:pKA:s0:pl5:C2,0:",
|
||||
"s14:pl7:s0:pl14:RN1:l5:0{Z2:1K10:l2:^-1/RN2:l2:s15:pK6:l2:+s2:",
|
||||
"pK2:s10:p0s11:pN3:l5:K2:}Z4:l10:K2:*s10:pl5:cRs5:pJ3:N4:N5:l5:",
|
||||
"K.5:{Z6:l10:K2:*s10:pl5:cRs5:pJ5:N6:l5:1-l5:1+/s13:s14:pl13:l13:",
|
||||
"*s12:pK3:s11:pN8:1B9:J7:N10:l11:K2:+s11:pJ8:N9:l13:l12:*s13:l11:",
|
||||
"/s9:pl9:0=Z11:l10:l14:*s14:pl15:s2:pl14:1/RN11:l14:l9:+s14:pJ10:N7:",
|
||||
"0R]@r",
|
||||
"@iF3,5.7,9,11,12,13,16,14,15[l0:KA:#Z1:l0:s7:pKA:s0:pl5:C3,0:",
|
||||
"s14:pl7:s0:pl14:RN1:l2:s15:pK1.1:l15:*K2:+s2:p1C4,0:s14:pl5:0",
|
||||
"<Z2:1s12:pl5:ns5:pN2:0s2:pl5:l14:/K2:+K4:/s13:pl5:K4:l13:*l14:",
|
||||
"*-s5:pl13:K2:%Z3:l5:ns5:pN3:l15:K2:+s2:pl5:s9:s14:pl5:nl5:*s16:",
|
||||
"pK3:s11:pN5:1B6:J4:N7:l11:K2:+s11:pJ5:N6:l9:l16:l11:l11:1-*/*",
|
||||
"s9:pl9:0=Z8:l15:s2:pl12:Z9:l14:n1/RN9:l14:1/RN8:l14:l9:+s14:p",
|
||||
"J7:N4:0R]@r",
|
||||
"@iF5,5.7,14,15[l0:KA:#Z1:l0:s7:pKA:s0:pl5:C5,0:s14:pl7:s0:pl14:",
|
||||
"RN1:l2:s15:pl2:K1.2:*s2:pl5:1C4,0:K2:*+C3,0:s14:pl15:s2:pl14:",
|
||||
"1/R0R]@r",
|
||||
"@iF4,5.6,7,9,10,11,12,13,16,14,15[l0:KA:#Z1:l0:s7:pKA:s0:pl5:",
|
||||
"C4,0:s14:pl7:s0:pl14:RN1:1s12:pl5:0<Z2:1ns12:pl5:ns5:pN2:l5:1",
|
||||
"=Z3:l2:K25:{Z4:K.7853981633974483096156608:l12:/RN4:l2:K40:{Z5:",
|
||||
"K.7853981633974483096156608458198757210492:l12:/RN5:l2:K60:{Z6:",
|
||||
"K.785398163397448309615660845819875721049292349843776455243736",
|
||||
":l12:/RN6:N3:l5:K.2:=Z7:l2:K25:{Z8:K.1973955598498807583700497",
|
||||
":l12:/RN8:l2:K40:{Z9:K.1973955598498807583700497651947902934475",
|
||||
":l12:/RN9:l2:K60:{Z10:K.197395559849880758370049765194790293447585103787852101517688",
|
||||
":l12:/RN10:N7:l2:s15:pl5:K.2:>Z11:l15:K5:+s2:pK.2:C4,0:s6:pN11:",
|
||||
"l15:K3:+s2:pN12:l5:K.2:>Z13:l10:1+s10:pl5:K.2:-1l5:K.2:*+/s5:",
|
||||
"pJ12:N13:l5:s13:s14:pl5:nl5:*s16:pK3:s11:pN15:1B16:J14:N17:l11:",
|
||||
"K2:+s11:pJ15:N16:l13:l16:*s13:l11:/s9:pl9:0=Z18:l15:s2:pl10:l6:",
|
||||
"*l14:+l12:/RN18:l14:l9:+s14:pJ17:N14:0R]@r",
|
||||
"@iF6,13,5.6,7,8,9,10,11,12,16,14,15[l0:KA:#Z1:l0:s7:pKA:s0:pl13:",
|
||||
"l5:C6,00:s14:pl7:s0:pl14:RN1:l2:s15:p0s2:pl13:1/s13:pl13:0<Z2:",
|
||||
"l13:ns13:pl13:K2:%1=Z3:1s12:pN3:N2:1s10:pK2:s11:pN5:l11:l13:{",
|
||||
"B6:J4:N7:l11:i11:pJ5:N6:l10:l11:*s10:pJ7:N4:K1.5:l15:*s2:pl5:",
|
||||
"l13:^K2:l13:^/l10:/s10:p1s9:s14:pl5:nl5:*K4:/s16:pK1.5:l15:*l10:",
|
||||
"cL+l10:cS-s2:p1s11:pN9:1B10:J8:N11:l11:i11:pJ9:N10:l9:l16:*l11:",
|
||||
"/l13:l11:+/s9:pl9:0=Z12:l15:s2:pl12:Z13:l10:nl14:*1/RN13:l10:",
|
||||
"l14:*1/RN12:l14:l9:+s14:pJ11:N8:0R]@r",0}
|
||||
24
meta/recipes-extended/bc/bc/no-gen-libmath.patch
Normal file
24
meta/recipes-extended/bc/bc/no-gen-libmath.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
These rules are not cross-friendly so delete them and we'll generate the file offline.
|
||||
|
||||
Upstream-Status: Inappropriate
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
|
||||
diff --git a/bc/Makefile.am b/bc/Makefile.am
|
||||
index d9d412e..f244241 100644
|
||||
--- a/bc/Makefile.am
|
||||
+++ b/bc/Makefile.am
|
||||
@@ -31,14 +31,6 @@ global.o: libmath.h
|
||||
|
||||
fbcOBJ = main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o
|
||||
|
||||
-libmath.h: libmath.b $(fbcOBJ) $(LIBBC)
|
||||
- echo '{0}' > libmath.h
|
||||
- $(MAKE) global.o
|
||||
- $(LINK) -o fbc $(fbcOBJ) global.o $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
|
||||
- ./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
|
||||
- $(srcdir)/fix-libmath_h
|
||||
- rm -f ./fbc ./global.o
|
||||
-
|
||||
sbcOBJ = main.o sbc.o scan.o execute.o global.o load.o storage.o util.o \
|
||||
warranty.o
|
||||
sbc.o: sbc.c
|
||||
@@ -1,26 +0,0 @@
|
||||
SUMMARY = "Arbitrary precision calculator language"
|
||||
HOMEPAGE = "http://www.gnu.org/software/bc/bc.html"
|
||||
|
||||
LICENSE = "GPLv2+ & LGPLv2.1"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
|
||||
file://COPYING.LIB;md5=d8045f3b8f929c1cb29a1e3fd737b499 \
|
||||
file://bc/bcdefs.h;endline=31;md5=46dffdaf10a99728dd8ce358e45d46d8 \
|
||||
file://dc/dc.h;endline=25;md5=2f9c558cdd80e31b4d904e48c2374328 \
|
||||
file://lib/number.c;endline=31;md5=99434a0898abca7784acfd36b8191199"
|
||||
|
||||
SECTION = "base"
|
||||
DEPENDS = "flex"
|
||||
PR = "r3"
|
||||
|
||||
SRC_URI = "${GNU_MIRROR}/bc/bc-${PV}.tar.gz \
|
||||
file://fix-segment-fault.patch "
|
||||
|
||||
SRC_URI[md5sum] = "d44b5dddebd8a7a7309aea6c36fda117"
|
||||
SRC_URI[sha256sum] = "4ef6d9f17c3c0d92d8798e35666175ecd3d8efac4009d6457b5c99cea72c0e33"
|
||||
|
||||
inherit autotools texinfo update-alternatives
|
||||
|
||||
ALTERNATIVE_${PN} = "dc"
|
||||
ALTERNATIVE_PRIORITY = "100"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
33
meta/recipes-extended/bc/bc_1.07.1.bb
Normal file
33
meta/recipes-extended/bc/bc_1.07.1.bb
Normal file
@@ -0,0 +1,33 @@
|
||||
SUMMARY = "Arbitrary precision calculator language"
|
||||
HOMEPAGE = "http://www.gnu.org/software/bc/bc.html"
|
||||
|
||||
LICENSE = "GPLv3+"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
|
||||
file://COPYING.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
|
||||
file://bc/bcdefs.h;endline=17;md5=4295c06df9e833519a342f7b5d43db06 \
|
||||
file://dc/dc.h;endline=18;md5=36b8c600b63ee8c3aeade2764f6b2a4b \
|
||||
file://lib/number.c;endline=20;md5=cf43068cc88f837731dc53240456cfaf"
|
||||
|
||||
SECTION = "base"
|
||||
DEPENDS = "flex-native"
|
||||
|
||||
SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
|
||||
file://no-gen-libmath.patch \
|
||||
file://libmath.h"
|
||||
SRC_URI[md5sum] = "cda93857418655ea43590736fc3ca9fc"
|
||||
SRC_URI[sha256sum] = "62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a"
|
||||
|
||||
inherit autotools texinfo update-alternatives
|
||||
|
||||
PACKAGECONFIG ??= "readline"
|
||||
PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
|
||||
PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit"
|
||||
|
||||
do_compile_prepend() {
|
||||
cp -f ${WORKDIR}/libmath.h ${B}/bc/libmath.h
|
||||
}
|
||||
|
||||
ALTERNATIVE_${PN} = "dc"
|
||||
ALTERNATIVE_PRIORITY = "100"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
@@ -1,28 +0,0 @@
|
||||
Upstream-Status: Pending
|
||||
|
||||
when run command such as 'echo "a = 13" | bc -l', it segmentation faults.
|
||||
This patch is from http://www.mail-archive.com/blfs-support@linuxfromscratch.org/msg04602.html.
|
||||
|
||||
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||
|
||||
--- bc-1.06/lib/number.c.orig 2003-09-26 21:14:02.000000000 +0000
|
||||
+++ bc-1.06/lib/number.c 2003-09-26 21:14:26.000000000 +0000
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <number.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
#include <ctype.h>/* Prototypes needed for external utility routines. */
|
||||
|
||||
#define bc_rt_warn rt_warn
|
||||
--- bc-1.06/bc/load.c.orig 2003-09-26 21:14:14.000000000 +0000
|
||||
+++ bc-1.06/bc/load.c 2003-09-26 21:14:26.000000000 +0000
|
||||
@@ -156,7 +156,7 @@
|
||||
long label_no;
|
||||
long vaf_name; /* variable, array or function number. */
|
||||
long func;
|
||||
- program_counter save_adr;
|
||||
+ static program_counter save_adr;
|
||||
|
||||
/* Initialize. */
|
||||
str = code;
|
||||
@@ -4,5 +4,5 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a23a74b3f4caf9616230789d94217acb"
|
||||
|
||||
SRC_URI += "file://0001-Include-needed-headers-explicitly.patch"
|
||||
|
||||
SRC_URI[md5sum] = "c40cefdc7649c7554ecf1d56bf485d09"
|
||||
SRC_URI[sha256sum] = "8ea4ffcce8dae68a1cbb6acaa131ae7e3e6c5765134e670aa9baa38c1bcc66ea"
|
||||
SRC_URI[md5sum] = "421f958db80e67a27eda1ff6b8ebcdeb"
|
||||
SRC_URI[sha256sum] = "a96265a22784c29888669f961a0896841d177853f8f057efe063e891962b9090"
|
||||
@@ -15,15 +15,16 @@ LICENSE_${PN}-dbg = "GPLv2+"
|
||||
LICENSE_${PN}-locale = "GPLv2+"
|
||||
LICENSE_liblzma = "PD"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=c475b6c7dca236740ace4bba553e8e1c \
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=97d554a32881fee0aa283d96e47cb24a \
|
||||
file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
|
||||
file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
|
||||
file://COPYING.LGPLv2.1;md5=4fbd65380cdd255951079008b364516c \
|
||||
file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 "
|
||||
file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \
|
||||
"
|
||||
|
||||
SRC_URI = "http://tukaani.org/xz/xz-${PV}.tar.gz"
|
||||
SRC_URI[md5sum] = "ef68674fb47a8b8e741b34e429d86e9d"
|
||||
SRC_URI[sha256sum] = "71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb"
|
||||
SRC_URI[md5sum] = "5ace3264bdd00c65eeec2891346f65e6"
|
||||
SRC_URI[sha256sum] = "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145"
|
||||
UPSTREAM_CHECK_REGEX = "xz-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
inherit autotools gettext
|
||||
@@ -11,9 +11,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=e021dd6dda6ff1e6b1044002fc662b9b \
|
||||
DEPENDS = "glib-2.0 cairo fontconfig freetype"
|
||||
|
||||
SRC_URI = "http://www.freedesktop.org/software/harfbuzz/release/${BP}.tar.bz2"
|
||||
|
||||
SRC_URI[md5sum] = "1466ab51fc5aaa6af4065936939cec62"
|
||||
SRC_URI[sha256sum] = "84574e1b1f65ca694cb8fb6905309665c0368af18a312357f8ff886ee2f29563"
|
||||
SRC_URI[md5sum] = "f176eeda0a4e51a056d3ea6b9e65c27f"
|
||||
SRC_URI[sha256sum] = "3c592f86fa0da69e2e0e98cae9f5d5b61def3bb7948aa00ca45748f27fa545fd"
|
||||
|
||||
inherit autotools pkgconfig lib_package gtk-doc
|
||||
|
||||
@@ -30,6 +29,8 @@ EXTRA_OECONF = " \
|
||||
|
||||
PACKAGES =+ "${PN}-icu ${PN}-icu-dev"
|
||||
|
||||
LEAD_SONAME = "libharfbuzz.so"
|
||||
|
||||
FILES_${PN}-icu = "${libdir}/libharfbuzz-icu.so.*"
|
||||
FILES_${PN}-icu-dev = "${libdir}/libharfbuzz-icu.la \
|
||||
${libdir}/libharfbuzz-icu.so \
|
||||
@@ -3,14 +3,14 @@ HOMEPAGE = "http://www.freedesktop.org/wiki/Software/libinput/"
|
||||
SECTION = "libs"
|
||||
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=2184aef38ff137ed33ce9a63b9d1eb8f"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=1f2ea9ebff3a2c6d458faf58492efb63"
|
||||
|
||||
DEPENDS = "libevdev udev mtdev"
|
||||
|
||||
SRC_URI = "http://www.freedesktop.org/software/${BPN}/${BP}.tar.xz \
|
||||
"
|
||||
SRC_URI[md5sum] = "a182dab52f4d33bc1ef50668dcf53cc6"
|
||||
SRC_URI[sha256sum] = "64a36c4f826f4b5d473bf2cb803122f96390a18243ec810f2ce8ac5076a0bc12"
|
||||
SRC_URI[md5sum] = "d179b5afbf414b34ce36ffe6ea8a401d"
|
||||
SRC_URI[sha256sum] = "6b36e1163d306c292ec8359b35aa65431cd29d0a5254923775e8019ff5018107"
|
||||
|
||||
UPSTREAM_CHECK_REGEX = "libinput-(?P<pver>\d+\.\d+\.(?!9\d+)\d+)"
|
||||
inherit meson pkgconfig lib_package
|
||||
@@ -5,7 +5,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5e6b20ea2ef94a998145f0ea3f788ee0"
|
||||
|
||||
DEPENDS += "libinput"
|
||||
|
||||
SRC_URI[md5sum] = "bdad198a7a9f2ce2c1f90d5e6760462b"
|
||||
SRC_URI[sha256sum] = "d4ad8dc5ad6f962a3f15f61ba9e9f8e37fa0b57eee9f484e2bd721d60ca72ee6"
|
||||
SRC_URI[md5sum] = "2d7519ac0e39d4c88f3be32e81a637aa"
|
||||
SRC_URI[sha256sum] = "21994d065fc26e85d1c3fc87d8479b9c22699ed5a0119df98fbe0000e84630a1"
|
||||
|
||||
FILES_${PN} += "${datadir}/X11/xorg.conf.d"
|
||||
@@ -9,8 +9,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
|
||||
DEPENDS = "gtk+3 vte"
|
||||
SECTION = "x11/utils"
|
||||
|
||||
#SRCREV tagged 0.1
|
||||
SRCREV = "3ad357db2302760b8a8817b5f4478dd87479442f"
|
||||
#SRCREV tagged 0.2
|
||||
SRCREV = "161276d0f5d1be8187010fd0d9581a6feca70ea5"
|
||||
SRC_URI = "git://git.yoctoproject.org/${BPN}"
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 338d073cab7b94fd7ec66322b969e8772b5e8cd7 Mon Sep 17 00:00:00 2001
|
||||
From 7eb7efb9ce89c66e14c194773c4dcf6478a6ca4d Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
Date: Mon, 22 Jan 2018 18:00:21 +0200
|
||||
Subject: [PATCH 5/5] configure.ac: use a custom value for the location of
|
||||
Subject: [PATCH] configure.ac: use a custom value for the location of
|
||||
gpg-agent socket in the filesystem
|
||||
|
||||
This should avoid clashes with the host gpg-agent observed on autobuilders.
|
||||
@@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 382ef1d..0570d7c 100644
|
||||
index 59a2e60..12d390b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1818,7 +1818,7 @@ AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
|
||||
@@ -1841,7 +1841,7 @@ AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
|
||||
|
||||
AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
|
||||
|
||||
@@ -26,6 +26,3 @@ index 382ef1d..0570d7c 100644
|
||||
[The name of the agent socket])
|
||||
AC_DEFINE_UNQUOTED(GPG_AGENT_EXTRA_SOCK_NAME, "S.gpg-agent.extra",
|
||||
[The name of the agent socket for remote access])
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
|
||||
SRC_URI_append_class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch"
|
||||
|
||||
|
||||
SRC_URI[md5sum] = "0db6d8ec569e260435a7d2bfb2ecfe5c"
|
||||
SRC_URI[sha256sum] = "777b4cb8ced21965a5053d4fa20fe11484f0a478f3d011cef508a1a49db50dcd"
|
||||
SRC_URI[md5sum] = "52c895a81f514a65e08923736c38654a"
|
||||
SRC_URI[sha256sum] = "6278eaabffa1ebc9fa2ceb3dc53eea9a1505ab02a668a86dd6fec06951af2164"
|
||||
|
||||
EXTRA_OECONF = "--disable-ldap \
|
||||
--disable-ccid-driver \
|
||||
@@ -15,8 +15,8 @@ UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html"
|
||||
SRC_URI = "${GNUPG_MIRROR}/libgpg-error/libgpg-error-${PV}.tar.bz2 \
|
||||
file://pkgconfig.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "5cc6df0fea27832e9cdbafc60f51561b"
|
||||
SRC_URI[sha256sum] = "40d0a823c9329478063903192a1f82496083b277265904878f4bc09e0db7a4ef"
|
||||
SRC_URI[md5sum] = "ef3d928a5a453fa701ecc3bb22be1c64"
|
||||
SRC_URI[sha256sum] = "c345c5e73cc2332f8d50db84a2280abfb1d8f6d4f1858b9daa30404db44540ca"
|
||||
|
||||
BINCONFIG = "${bindir}/gpg-error-config"
|
||||
|
||||
@@ -5,13 +5,11 @@ HOMEPAGE = "http://pyyaml.org/wiki/LibYAML"
|
||||
SECTION = "libs/devel"
|
||||
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=6015f088759b10e0bc2bf64898d4ae17"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=5591701d32590f9fa94f3bfee820b634"
|
||||
|
||||
SRC_URI = "http://pyyaml.org/download/libyaml/yaml-${PV}.tar.gz \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "1abf45bd3a96374fa55ca63b32f9f2f9"
|
||||
SRC_URI[sha256sum] = "8088e457264a98ba451a90b8661fcb4f9d6f478f7265d48322a196cec2480729"
|
||||
SRC_URI = "http://pyyaml.org/download/libyaml/yaml-${PV}.tar.gz"
|
||||
SRC_URI[md5sum] = "72724b9736923c517e5a8fc6757ef03d"
|
||||
SRC_URI[sha256sum] = "78281145641a080fb32d6e7a87b9c0664d611dcb4d542e90baf731f51cbb59cd"
|
||||
|
||||
S = "${WORKDIR}/yaml-${PV}"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
require shared-mime-info.inc
|
||||
|
||||
SRC_URI += "file://parallelmake.patch \
|
||||
file://install-data-hook.patch"
|
||||
|
||||
SRC_URI[md5sum] = "418c2ced9dc4dd5ca8b06a755e6d64e9"
|
||||
SRC_URI[sha256sum] = "c625a83b4838befc8cafcd54e3619946515d9e44d63d61c4adf7f5513ddfbebf"
|
||||
@@ -1,7 +0,0 @@
|
||||
require shared-mime-info.inc
|
||||
|
||||
SRC_URI += "file://parallelmake.patch \
|
||||
file://install-data-hook.patch"
|
||||
|
||||
SRC_URI[md5sum] = "45103889b91242850aa47f09325e798b"
|
||||
SRC_URI[sha256sum] = "5c0133ec4e228e41bdf52f726d271a2d821499c2ab97afd3aa3d6cf43efcdc83"
|
||||
@@ -1,464 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012, Intel Corporation.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
||||
# the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
LANG=C
|
||||
|
||||
echo
|
||||
echo "WARNING: This script is deprecated and will be removed soon."
|
||||
echo "Please consider using wic EFI images instead."
|
||||
echo
|
||||
|
||||
# Set to 1 to enable additional output
|
||||
DEBUG=0
|
||||
OUT="/dev/null"
|
||||
|
||||
#
|
||||
# Defaults
|
||||
#
|
||||
# 20 Mb for the boot partition
|
||||
BOOT_SIZE=20
|
||||
# 5% for swap
|
||||
SWAP_RATIO=5
|
||||
|
||||
# Cleanup after die()
|
||||
cleanup() {
|
||||
debug "Syncing and unmounting devices"
|
||||
# Unmount anything we mounted
|
||||
unmount $ROOTFS_MNT || error "Failed to unmount $ROOTFS_MNT"
|
||||
unmount $BOOTFS_MNT || error "Failed to unmount $BOOTFS_MNT"
|
||||
unmount $HDDIMG_ROOTFS_MNT || error "Failed to unmount $HDDIMG_ROOTFS_MNT"
|
||||
unmount $HDDIMG_MNT || error "Failed to unmount $HDDIMG_MNT"
|
||||
|
||||
# Remove the TMPDIR
|
||||
debug "Removing temporary files"
|
||||
if [ -d "$TMPDIR" ]; then
|
||||
rm -rf $TMPDIR || error "Failed to remove $TMPDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
trap 'die "Signal Received, Aborting..."' HUP INT TERM
|
||||
|
||||
# Logging routines
|
||||
WARNINGS=0
|
||||
ERRORS=0
|
||||
CLEAR="$(tput sgr0)"
|
||||
INFO="$(tput bold)"
|
||||
RED="$(tput setaf 1)$(tput bold)"
|
||||
GREEN="$(tput setaf 2)$(tput bold)"
|
||||
YELLOW="$(tput setaf 3)$(tput bold)"
|
||||
info() {
|
||||
echo "${INFO}$1${CLEAR}"
|
||||
}
|
||||
error() {
|
||||
ERRORS=$((ERRORS+1))
|
||||
echo "${RED}$1${CLEAR}"
|
||||
}
|
||||
warn() {
|
||||
WARNINGS=$((WARNINGS+1))
|
||||
echo "${YELLOW}$1${CLEAR}"
|
||||
}
|
||||
success() {
|
||||
echo "${GREEN}$1${CLEAR}"
|
||||
}
|
||||
die() {
|
||||
error "$1"
|
||||
cleanup
|
||||
exit 1
|
||||
}
|
||||
debug() {
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage: $(basename $0) [-v] DEVICE HDDIMG TARGET_DEVICE"
|
||||
echo " -v: Verbose debug"
|
||||
echo " DEVICE: The device to write the image to, e.g. /dev/sdh"
|
||||
echo " HDDIMG: The hddimg file to generate the efi disk from"
|
||||
echo " TARGET_DEVICE: The device the target will boot from, e.g. /dev/mmcblk0"
|
||||
}
|
||||
|
||||
image_details() {
|
||||
IMG=$1
|
||||
info "Image details"
|
||||
echo " image: $(stat --printf '%N\n' $IMG)"
|
||||
echo " size: $(stat -L --printf '%s bytes\n' $IMG)"
|
||||
echo " modified: $(stat -L --printf '%y\n' $IMG)"
|
||||
echo " type: $(file -L -b $IMG)"
|
||||
echo ""
|
||||
}
|
||||
|
||||
device_details() {
|
||||
DEV=$1
|
||||
BLOCK_SIZE=512
|
||||
|
||||
info "Device details"
|
||||
echo " device: $DEVICE"
|
||||
if [ -f "/sys/class/block/$DEV/device/vendor" ]; then
|
||||
echo " vendor: $(cat /sys/class/block/$DEV/device/vendor)"
|
||||
else
|
||||
echo " vendor: UNKOWN"
|
||||
fi
|
||||
if [ -f "/sys/class/block/$DEV/device/model" ]; then
|
||||
echo " model: $(cat /sys/class/block/$DEV/device/model)"
|
||||
else
|
||||
echo " model: UNKNOWN"
|
||||
fi
|
||||
if [ -f "/sys/class/block/$DEV/size" ]; then
|
||||
echo " size: $(($(cat /sys/class/block/$DEV/size) * $BLOCK_SIZE)) bytes"
|
||||
else
|
||||
echo " size: UNKNOWN"
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
|
||||
unmount_device() {
|
||||
grep -q $DEVICE /proc/mounts
|
||||
if [ $? -eq 0 ]; then
|
||||
warn "$DEVICE listed in /proc/mounts, attempting to unmount"
|
||||
umount $DEVICE* 2>/dev/null
|
||||
return $?
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
unmount() {
|
||||
if [ "$1" = "" ] ; then
|
||||
return 0
|
||||
fi
|
||||
grep -q $1 /proc/mounts
|
||||
if [ $? -eq 0 ]; then
|
||||
debug "Unmounting $1"
|
||||
umount $1
|
||||
return $?
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Parse and validate arguments
|
||||
#
|
||||
if [ $# -lt 3 ] || [ $# -gt 4 ]; then
|
||||
if [ $# -eq 1 ]; then
|
||||
AVAILABLE_DISK=`lsblk | grep "disk" | cut -f 1 -d " "`
|
||||
X=0
|
||||
for disk in `echo $AVAILABLE_DISK`; do
|
||||
mounted=`lsblk /dev/$disk | awk {'print $7'} | sed "s/MOUNTPOINT//"`
|
||||
if [ -z "$mounted" ]; then
|
||||
UNMOUNTED_AVAILABLES="$UNMOUNTED_AVAILABLES /dev/$disk"
|
||||
info "$X - /dev/$disk"
|
||||
X=`expr $X + 1`
|
||||
fi
|
||||
done
|
||||
if [ $X -eq 0 ]; then
|
||||
die "No unmounted device found."
|
||||
fi
|
||||
read -p "Choose unmounted device number: " DISK_NUMBER
|
||||
X=0
|
||||
for line in `echo $UNMOUNTED_AVAILABLES`; do
|
||||
if [ $DISK_NUMBER -eq $X ]; then
|
||||
DISK_TO_BE_FLASHED=$line
|
||||
break
|
||||
else
|
||||
X=`expr $X + 1`
|
||||
fi
|
||||
done
|
||||
if [ -z "$DISK_TO_BE_FLASHED" ]; then
|
||||
die "Option \"$DISK_NUMBER\" is invalid. Choose a valid option"
|
||||
else
|
||||
if [ -z `echo $DISK_TO_BE_FLASHED | grep "mmc"` ]; then
|
||||
TARGET_TO_BE_BOOT="/dev/sda"
|
||||
else
|
||||
TARGET_TO_BE_BOOT="/dev/mmcblk0"
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
echo "Choose a name of the device that will be boot from"
|
||||
echo -n "Recommended name is: "
|
||||
info "$TARGET_TO_BE_BOOT"
|
||||
read -p "Is target device okay? [y/N]: " RESPONSE
|
||||
if [ "$RESPONSE" != "y" ]; then
|
||||
read -p "Choose target device name: " TARGET_TO_BE_BOOT
|
||||
fi
|
||||
echo ""
|
||||
if [ -z "$TARGET_TO_BE_BOOT" ]; then
|
||||
die "Error: choose a valid target name"
|
||||
fi
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "-v" ]; then
|
||||
DEBUG=1
|
||||
OUT="1"
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ -z "$AVAILABLE_DISK" ]; then
|
||||
DEVICE=$1
|
||||
HDDIMG=$2
|
||||
TARGET_DEVICE=$3
|
||||
else
|
||||
DEVICE=$DISK_TO_BE_FLASHED
|
||||
HDDIMG=$1
|
||||
TARGET_DEVICE=$TARGET_TO_BE_BOOT
|
||||
fi
|
||||
|
||||
LINK=$(readlink $DEVICE)
|
||||
if [ $? -eq 0 ]; then
|
||||
DEVICE="$LINK"
|
||||
fi
|
||||
|
||||
if [ ! -w "$DEVICE" ]; then
|
||||
usage
|
||||
if [ ! -e "${DEVICE}" ] ; then
|
||||
die "Device $DEVICE cannot be found"
|
||||
else
|
||||
die "Device $DEVICE is not writable (need to run under sudo?)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e "$HDDIMG" ]; then
|
||||
usage
|
||||
die "HDDIMG $HDDIMG does not exist"
|
||||
fi
|
||||
|
||||
#
|
||||
# Ensure the hddimg is not mounted
|
||||
#
|
||||
unmount "$HDDIMG" || die "Failed to unmount $HDDIMG"
|
||||
|
||||
#
|
||||
# Check if any $DEVICE partitions are mounted
|
||||
#
|
||||
unmount_device || die "Failed to unmount $DEVICE"
|
||||
|
||||
#
|
||||
# Confirm device with user
|
||||
#
|
||||
image_details $HDDIMG
|
||||
device_details $(basename $DEVICE)
|
||||
echo -n "${INFO}Prepare EFI image on $DEVICE [y/N]?${CLEAR} "
|
||||
read RESPONSE
|
||||
if [ "$RESPONSE" != "y" ]; then
|
||||
echo "Image creation aborted"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Prepare the temporary working space
|
||||
#
|
||||
TMPDIR=$(mktemp -d mkefidisk-XXX) || die "Failed to create temporary mounting directory."
|
||||
HDDIMG_MNT=$TMPDIR/hddimg
|
||||
HDDIMG_ROOTFS_MNT=$TMPDIR/hddimg_rootfs
|
||||
ROOTFS_MNT=$TMPDIR/rootfs
|
||||
BOOTFS_MNT=$TMPDIR/bootfs
|
||||
mkdir $HDDIMG_MNT || die "Failed to create $HDDIMG_MNT"
|
||||
mkdir $HDDIMG_ROOTFS_MNT || die "Failed to create $HDDIMG_ROOTFS_MNT"
|
||||
mkdir $ROOTFS_MNT || die "Failed to create $ROOTFS_MNT"
|
||||
mkdir $BOOTFS_MNT || die "Failed to create $BOOTFS_MNT"
|
||||
|
||||
|
||||
#
|
||||
# Partition $DEVICE
|
||||
#
|
||||
DEVICE_SIZE=$(parted -s $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//")
|
||||
# If the device size is not reported there may not be a valid label
|
||||
if [ "$DEVICE_SIZE" = "" ] ; then
|
||||
parted -s $DEVICE mklabel msdos || die "Failed to create MSDOS partition table"
|
||||
DEVICE_SIZE=$(parted -s $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//")
|
||||
fi
|
||||
SWAP_SIZE=$((DEVICE_SIZE*SWAP_RATIO/100))
|
||||
ROOTFS_SIZE=$((DEVICE_SIZE-BOOT_SIZE-SWAP_SIZE))
|
||||
ROOTFS_START=$((BOOT_SIZE))
|
||||
ROOTFS_END=$((ROOTFS_START+ROOTFS_SIZE))
|
||||
SWAP_START=$((ROOTFS_END))
|
||||
|
||||
# MMC devices use a partition prefix character 'p'
|
||||
PART_PREFIX=""
|
||||
if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then
|
||||
PART_PREFIX="p"
|
||||
fi
|
||||
BOOTFS=$DEVICE${PART_PREFIX}1
|
||||
ROOTFS=$DEVICE${PART_PREFIX}2
|
||||
SWAP=$DEVICE${PART_PREFIX}3
|
||||
|
||||
TARGET_PART_PREFIX=""
|
||||
if [ ! "${TARGET_DEVICE#/dev/mmcblk}" = "${TARGET_DEVICE}" ]; then
|
||||
TARGET_PART_PREFIX="p"
|
||||
fi
|
||||
TARGET_ROOTFS=$TARGET_DEVICE${TARGET_PART_PREFIX}2
|
||||
TARGET_SWAP=$TARGET_DEVICE${TARGET_PART_PREFIX}3
|
||||
|
||||
echo ""
|
||||
info "Boot partition size: $BOOT_SIZE MB ($BOOTFS)"
|
||||
info "ROOTFS partition size: $ROOTFS_SIZE MB ($ROOTFS)"
|
||||
info "Swap partition size: $SWAP_SIZE MB ($SWAP)"
|
||||
echo ""
|
||||
|
||||
# Use MSDOS by default as GPT cannot be reliably distributed in disk image form
|
||||
# as it requires the backup table to be on the last block of the device, which
|
||||
# of course varies from device to device.
|
||||
|
||||
info "Partitioning installation media ($DEVICE)"
|
||||
|
||||
debug "Deleting partition table on $DEVICE"
|
||||
dd if=/dev/zero of=$DEVICE bs=512 count=2 >$OUT 2>&1 || die "Failed to zero beginning of $DEVICE"
|
||||
|
||||
debug "Creating new partition table (MSDOS) on $DEVICE"
|
||||
parted -s $DEVICE mklabel msdos >$OUT 2>&1 || die "Failed to create MSDOS partition table"
|
||||
|
||||
debug "Creating boot partition on $BOOTFS"
|
||||
parted -s $DEVICE mkpart primary 0% $BOOT_SIZE >$OUT 2>&1 || die "Failed to create BOOT partition"
|
||||
|
||||
debug "Enabling boot flag on $BOOTFS"
|
||||
parted -s $DEVICE set 1 boot on >$OUT 2>&1 || die "Failed to enable boot flag"
|
||||
|
||||
debug "Creating ROOTFS partition on $ROOTFS"
|
||||
parted -s $DEVICE mkpart primary $ROOTFS_START $ROOTFS_END >$OUT 2>&1 || die "Failed to create ROOTFS partition"
|
||||
|
||||
debug "Creating swap partition on $SWAP"
|
||||
parted -s $DEVICE mkpart primary $SWAP_START 100% >$OUT 2>&1 || die "Failed to create SWAP partition"
|
||||
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
parted -s $DEVICE print
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Check if any $DEVICE partitions are mounted after partitioning
|
||||
#
|
||||
unmount_device || die "Failed to unmount $DEVICE partitions"
|
||||
|
||||
|
||||
#
|
||||
# Format $DEVICE partitions
|
||||
#
|
||||
info "Formatting partitions"
|
||||
debug "Formatting $BOOTFS as vfat"
|
||||
if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then
|
||||
mkfs.vfat -I $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS"
|
||||
else
|
||||
mkfs.vfat $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS"
|
||||
fi
|
||||
|
||||
debug "Formatting $ROOTFS as ext3"
|
||||
mkfs.ext3 -F $ROOTFS -L "ROOT" >$OUT 2>&1 || die "Failed to format $ROOTFS"
|
||||
|
||||
debug "Formatting swap partition ($SWAP)"
|
||||
mkswap $SWAP >$OUT 2>&1 || die "Failed to prepare swap"
|
||||
|
||||
|
||||
#
|
||||
# Installing to $DEVICE
|
||||
#
|
||||
debug "Mounting images and device in preparation for installation"
|
||||
mount -o ro,loop $HDDIMG $HDDIMG_MNT >$OUT 2>&1 || error "Failed to mount $HDDIMG"
|
||||
mount -o ro,loop $HDDIMG_MNT/rootfs.img $HDDIMG_ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount rootfs.img"
|
||||
mount $ROOTFS $ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount $ROOTFS on $ROOTFS_MNT"
|
||||
mount $BOOTFS $BOOTFS_MNT >$OUT 2>&1 || error "Failed to mount $BOOTFS on $BOOTFS_MNT"
|
||||
|
||||
info "Preparing boot partition"
|
||||
EFIDIR="$BOOTFS_MNT/EFI/BOOT"
|
||||
cp $HDDIMG_MNT/vmlinuz $BOOTFS_MNT >$OUT 2>&1 || error "Failed to copy vmlinuz"
|
||||
# Copy the efi loader and configs (booti*.efi and grub.cfg if it exists)
|
||||
cp -r $HDDIMG_MNT/EFI $BOOTFS_MNT >$OUT 2>&1 || error "Failed to copy EFI dir"
|
||||
# Silently ignore a missing systemd-boot loader dir (we might just be a GRUB image)
|
||||
cp -r $HDDIMG_MNT/loader $BOOTFS_MNT >$OUT 2>&1
|
||||
|
||||
# Update the boot loaders configurations for an installed image
|
||||
# Remove any existing root= kernel parameters and:
|
||||
# o Add a root= parameter with the target rootfs
|
||||
# o Specify ro so fsck can be run during boot
|
||||
# o Specify rootwait in case the target media is an asyncronous block device
|
||||
# such as MMC or USB disks
|
||||
# o Specify "quiet" to minimize boot time when using slow serial consoles
|
||||
|
||||
# Look for a GRUB installation
|
||||
GRUB_CFG="$EFIDIR/grub.cfg"
|
||||
if [ -e "$GRUB_CFG" ]; then
|
||||
info "Configuring GRUB"
|
||||
# Delete the install entry
|
||||
sed -i "/menuentry 'install'/,/^}/d" $GRUB_CFG
|
||||
# Delete the initrd lines
|
||||
sed -i "/initrd /d" $GRUB_CFG
|
||||
# Delete any LABEL= strings
|
||||
sed -i "s/ LABEL=[^ ]*/ /" $GRUB_CFG
|
||||
|
||||
sed -i "s@ root=[^ ]*@ @" $GRUB_CFG
|
||||
sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $GRUB_CFG
|
||||
fi
|
||||
|
||||
# Look for a systemd-boot installation
|
||||
SYSTEMD_BOOT_ENTRIES="$BOOTFS_MNT/loader/entries"
|
||||
SYSTEMD_BOOT_CFG="$SYSTEMD_BOOT_ENTRIES/boot.conf"
|
||||
if [ -d "$SYSTEMD_BOOT_ENTRIES" ]; then
|
||||
info "Configuring SystemD-boot"
|
||||
# remove the install target if it exists
|
||||
rm $SYSTEMD_BOOT_ENTRIES/install.conf >$OUT 2>&1
|
||||
|
||||
if [ ! -e "$SYSTEMD_BOOT_CFG" ]; then
|
||||
echo "ERROR: $SYSTEMD_BOOT_CFG not found"
|
||||
fi
|
||||
|
||||
sed -i "/initrd /d" $SYSTEMD_BOOT_CFG
|
||||
sed -i "s@ root=[^ ]*@ @" $SYSTEMD_BOOT_CFG
|
||||
sed -i "s@options *LABEL=boot @options LABEL=Boot root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $SYSTEMD_BOOT_CFG
|
||||
fi
|
||||
|
||||
# Ensure we have at least one EFI bootloader configured
|
||||
if [ ! -e $GRUB_CFG ] && [ ! -e $SYSTEMD_BOOT_CFG ]; then
|
||||
die "No EFI bootloader configuration found"
|
||||
fi
|
||||
|
||||
|
||||
info "Copying ROOTFS files (this may take a while)"
|
||||
cp -a $HDDIMG_ROOTFS_MNT/* $ROOTFS_MNT >$OUT 2>&1 || die "Root FS copy failed"
|
||||
|
||||
echo "$TARGET_SWAP swap swap defaults 0 0" >> $ROOTFS_MNT/etc/fstab
|
||||
|
||||
# We dont want udev to mount our root device while we're booting...
|
||||
if [ -d $ROOTFS_MNT/etc/udev/ ] ; then
|
||||
echo "$TARGET_DEVICE" >> $ROOTFS_MNT/etc/udev/mount.blacklist
|
||||
fi
|
||||
|
||||
# Add startup.nsh script for automated boot
|
||||
printf "fs0:\%s\BOOT\%s\n" "EFI" "bootx64.efi" > $BOOTFS_MNT/startup.nsh
|
||||
|
||||
|
||||
# Call cleanup to unmount devices and images and remove the TMPDIR
|
||||
cleanup
|
||||
|
||||
echo ""
|
||||
if [ $WARNINGS -ne 0 ] && [ $ERRORS -eq 0 ]; then
|
||||
echo "${YELLOW}Installation completed with warnings${CLEAR}"
|
||||
echo "${YELLOW}Warnings: $WARNINGS${CLEAR}"
|
||||
elif [ $ERRORS -ne 0 ]; then
|
||||
echo "${RED}Installation encountered errors${CLEAR}"
|
||||
echo "${RED}Errors: $ERRORS${CLEAR}"
|
||||
echo "${YELLOW}Warnings: $WARNINGS${CLEAR}"
|
||||
else
|
||||
success "Installation completed successfully"
|
||||
fi
|
||||
echo ""
|
||||
@@ -110,6 +110,4 @@ pseudo="$OECORE_NATIVE_SYSROOT/usr/bin/pseudo"
|
||||
if [ -e "$pseudo" ]; then
|
||||
echo "PSEUDO=$pseudo"
|
||||
PSEUDO="$pseudo"
|
||||
else
|
||||
echo "PSEUDO $pseudo is not found."
|
||||
fi
|
||||
|
||||
@@ -60,7 +60,7 @@ tool_find=`/usr/bin/which $tool 2>/dev/null`
|
||||
|
||||
if [ -n "$tool_find" ] ; then
|
||||
# add old path to allow usage of host tools
|
||||
PATH=$PATH:$OLD_PATH $@
|
||||
PATH=$PATH:$OLD_PATH "$@"
|
||||
else
|
||||
echo "Error: Unable to find '$tool' in $PATH"
|
||||
echo "Error: Have you run 'bitbake $native_recipe -caddto_recipe_sysroot'?"
|
||||
|
||||
Reference in New Issue
Block a user