subtree updates
meta-raspberrypi: b6a1645a97..c57b464b88:
Lluis Campos (1):
rpi-cmdline: do_compile: Use pure Python syntax to get `CMDLINE`
meta-openembedded: 2eb39477a7..a755af4fb5:
Adrian Zaharia (1):
lapack: add packageconfig for lapacke
Akash Hadke (1):
polkit: Add --shell /bin/nologin to polkitd user
Alex Kiernan (3):
ntpsec: Add UPSTREAM_CHECK_URI
libgpiod: Detect ptest using PTEST_ENABLED
ostree: Cleanup PACKAGECONFIGs
Anuj Mittal (1):
yasm: fix buildpaths warning
Atanas Bunchev (1):
python3-twitter: Upgrade 4.8.0 -> 4.10.1
Bartosz Golaszewski (4):
imagemagick: add PACKAGECONFIG for C++ bindings
python3-matplotlib: don't use PYTHON_PN
python3-matplotlib: add packaging to RDEPENDS
python3-matplotlib: bump to 3.5.2
Bruce Ashfield (3):
vboxguestdrivers: fix build against 5.19 kernel / libc-headers
zfs: update to v2.1.5
vboxguestdrivers: make kernel shared directory dependency explicit
Carsten Bäcker (1):
spdlog: Fix CMake flag
Changqing Li (3):
fuse3: support ptest
redis: fix do_patch fuzz warning
dlt-daemon: fix dlt-system.service failed since buffer overflow
Clément Péron (1):
python: add Pydantic data validation package
Devendra Tewari (1):
android-tools: sleep more in android-gadget-start
Ed Tanous (1):
Add python-requests-unixsocket recipe
Enguerrand de Ribaucourt (1):
mdio-tools: add recipes
Etienne Cordonnier (1):
uutils-coreutils: add recipe
Jagadeesh Krishnanjanappa (4):
python3-asgiref: add recipe
python3-django: make 3.2.x as default version
python3-django: Add python3-asgiref runtime dependency
python3-django: remove 2.2.x recipe
Jan Luebbe (2):
chrony: add support for config and source snippet includes
gensio: upgrade 2.3.1 -> 2.5.2
Jan Vermaete (1):
makeself: added makeself as new recipe
Jim Broadus (1):
networkmanager: fix iptables and nft paths
Jose Quaresma (2):
wireguard-module: 1.0.20210219 -> 1.0.20220627
wireguard-tools: Add a new package for wg-quick
Julian Haller (2):
pcsc-lite: upgrade 1.9.0 -> 1.9.8
ccid: upgrade 1.4.33 -> 1.5.0
Justin Bronder (1):
lmdb: only set SONAME on the shared library
Khem Raj (61):
mariadb: Inherit pkgconfig
mariadb: Add packageconfig for lz4 and enable it
ibus: Swith to use main branch instead of master
kronosnet: Upgrade to 1.24
ostree: Upgrade to 2022.5 release
sdbus-c++-libsystemd: Fix build with glibc 2.36
xfstests: Upgrade to v2022.07.10
autofs: Fix build with glibc 2.36
audit: Upgrade to 3.0.8 and fix build with linux 5.17+
pcp: Add to USERADD_PACKAGES instead of override
mozjs: Use RUST_HOST_SYS and RUST_TARGET_SYS
fluentbit: Fix build with clang
audit: Fix build with musl
fluentbit: Fix build with musl
klibc: Upgrade to 2.0.10
gnome-keyring,cunit,xfce4-panel: Do not inherit remove-libtool class here
mpd: Update to 0.23.8
openipmi: Enable largefile cflags
proftpd: Always enable largefile support
netperf: Always enable largefile support
openipmi: Always enable largefile support
unbound: Always enable largefile support
sysbench: Always enable largefile support
libmtp: Always enable largefile support
toybox: Fix build with glibc 2.36+
xfstests: Upgrade to 2022.07.31 release
libmpd: Fix function returns and casts
audit: Revert the tweak done in configure step in do_install
mpd: Upgrade to 0.23.9
fluentbit: Use CMAKE_C_STANDARD_LIBRARIES cmake var to pass libatomic
fluentbit: Upgrade to 1.9.7 and fix build on x86
klibc: Fix build with kernel 5.19 headers
ntpsec: Add -D_GNU_SOURCE and fix building with devtool
gd: Fix build with clang-15
cpulimit: Define -D_GNU_SOURCE
safec: Remove unused variable 'len'
ncftp: Enable autoreconf
ncftp: Fix TMPDIR path embedding into ncftpget
libb64: Switch to github fork and upgrade to 2.0.0.1+git
dhrystone: Disable warnings as errors with clang
dibbler: Fix build with musl
fio: Fix additional warnings seen with musl
ssmtp: Fix null pointer assignments
gst-editing-services: Add recipe
rygel: Upgrade to 0.40.4
libesmtp: Define _GNU_SOURCE
python3-grpcio: Enable largefile support explicitly
libteam: Include missing headers for strrchr and memcmp
neon: Upgrade to 0.32.2
satyr: Fix build on musl/clang
libmusicbrainz: Avoid -Wnonnull warning
aom: Upgrade to 3.4.0
vorbis-tools: Fix build on musl
dvb-apps: Use tarball for SRC_URI and fix build on musl
python3-netifaces: Fix build with python3 and musl
python3-pyephem: Fix build with python3 and musl
samba: Fix warnings in configure tests for rpath checks
lirc: Fix build on musl
mongodb: Fix boost build with clang-15
crda: Fix build with clang-15
monkey: Fix build with musl
Lei Maohui (2):
dnf-plugin-tui: Fix somw issue in postinstall process.
xrdp: Fix buildpaths warning.
Leon Anavi (16):
python3-nocasedict: Upgrade 1.0.3 -> 1.0.4
python3-frozenlist: Upgrade 1.3.0 -> 1.3.1
python3-networkx: Upgrade 2.8.4 -> 2.8.5
python3-pyhamcrest: Upgrade 2.0.3 -> 2.0.4
python3-aiohue: Upgrade 4.4.2 -> 4.5.0
python3-pyperf: Upgrade 2.3.0 -> 2.4.1
python3-eth-abi: Upgrade 3.0.0 -> 3.0.1
python3-cytoolz: Upgrade 0.11.2 -> 0.12.0
python3-yarl: Upgrade 1.7.2 -> 1.8.1
python3-term: Upgrade 2.3 -> 2.4
python3-coverage: Upgrade 6.4.1 -> 6.4.4
python3-regex: Upgrade 2022.7.25 -> 2022.8.17
python3-awesomeversion: Upgrade 22.6.0 -> 22.8.0
python3-typed-ast: Upgrade 1.5.2 -> 1.5.4
python3-prompt-toolkit: Upgrade 3.0.24 -> 3.0.30
python3-prettytable: Upgrade 3.1.1 -> 3.3.0
Markus Volk (6):
libass: update to v1.16.0
spdlog: update to v1.10.0
waylandpp: add recipe
wireplumber: update to v0.4.11
pipewire: update to v0.3.56
pipewire: improve runtime dependency settings
Marta Rybczynska (1):
polkit: update patches for musl compilation
Matthias Klein (1):
libftdi: update to 1.5
Mike Crowe (1):
yasm: Only depend on xmlto when docs are enabled
Mike Petersen (1):
sshpass: add recipe
Mingli Yu (10):
net-snmp: set ac_cv_path_PSPROG
postgresql: Fix the buildpaths issue
freeradius: Fix buildpaths issue
openipmi: Fix buildpaths issue
apache2: Fix the buildpaths issue
frr: fix buildpaths issue
nspr: fix buildpaths issue
liblockfile: fix buildpaths issue
freediameter: fix buildpaths issue
postgresql: make sure pam conf installed when pam enabled
Ovidiu Panait (1):
net-snmp: upgrade 5.9.1 -> 5.9.3
Paulo Neves (1):
fluentbit Upgrade to 1.3.5 -> 1.9.6
Philip Balister (2):
python3-pybind11: Update to Version 2.10.0.
Remove dead link and old information from the README.
Potin Lai (7):
libplist: add libplist_git.bb
libimobiledevice-glue: SRCREV bump bc6c44b..d2ff796
libimobiledevice: add libimobiledevice_git.bb
libirecovery: SRCREV bump e190945..ab5b4d8
libusbmuxd: add libusbmuxd_git.bb
usbmuxd: add usbmuxd_git.bb
idevicerestore: SRCREV bump 280575b..7d622d9
Richard Purdie (1):
lmdb: Don't inherit base
Sam Van Den Berge (1):
python3-jsonrpcserver: add patch to use importlib.resources instead of pkg_resources
Saul Wold (10):
libipc-signal-perl: Fix LICENSE string
libdigest-hmac-perl: Fix LICENSE string
libio-socket-ssl-perl: Fix LICENSE string
libdigest-sha1-perl: Fix LICENSE string
libmime-types-perl: Fix LICENSE string
libauthen-sasl-perl: Fix LICENSE string
libnet-ldap-perl: Fix LICENSE string
libxml-libxml-perl: Fix LICENSE string
libnet-telnet-perl: Fix LICENSE string
libproc-waitstat-perl: Fix LICENSE string
Sean Anderson (2):
image_types_sparse: Pad source image to block size
image_types_sparse: Generate "don't care" chunks
Vyacheslav Yurkov (4):
protobuf: correct ptest dependency
protobuf: 3.19.4 -> 3.21.5 upgrade
protobuf: change build system to cmake
protobuf: disable protoc binary for target
Wang Mingyu (60):
cifs-utils: upgrade 6.15 -> 7.0
geocode-glib: upgrade 3.26.3 -> 3.26.4
gjs: upgrade 1.72.1 -> 1.72.2
htpdate: upgrade 1.3.5 -> 1.3.6
icewm: upgrade 2.9.8 -> 2.9.9
ipc-run: upgrade 20200505.0 -> 20220807.0
iwd: upgrade 1.28 -> 1.29
ldns: upgrade 1.8.1 -> 1.8.2
libadwaita: upgrade 1.1.3 -> 1.1.4
libencode-perl: upgrade 3.18 -> 3.19
libmime-charset-perl: upgrade 1.012.2 -> 1.013.1
libtest-warn-perl: upgrade 0.36 -> 0.37
nano: upgrade 6.3 -> 6.4
nbdkit: upgrade 1.31.15 -> 1.32.1
netdata: upgrade 1.35.1 -> 1.36.0
fio: upgrade 3.30 -> 3.31
nlohmann-json: upgrade 3.10.5 -> 3.11.2
poco: upgrade 1.12.1 -> 1.12.2
postgresql: upgrade 14.4 -> 14.5
poppler: upgrade 22.07.0 -> 22.08.0
smarty: upgrade 4.1.1 -> 4.2.0
tracker: upgrade 3.3.2 -> 3.3.3
uftp: upgrade 5.0 -> 5.0.1
xdg-user-dirs: upgrade 0.17 -> 0.18
python3-pycodestyle: upgrade 2.9.0 -> 2.9.1
python3-pyzmq: upgrade 23.2.0 -> 23.2.1
python3-setuptools-declarative-requirements: upgrade 1.2.0 -> 1.3.0
python3-sqlalchemy: upgrade 1.4.39 -> 1.4.40
python3-werkzeug: upgrade 2.2.1 -> 2.2.2
python3-xmlschema: upgrade 2.0.1 -> 2.0.2
python3-yappi: upgrade 1.3.5 -> 1.3.6
ade: upgrade 0.1.1f -> 0.1.2
babl: upgrade 0.1.92 -> 0.1.94
ctags: upgrade 5.9.20220703.0 -> 5.9.20220821.0
grilo-plugins: upgrade 0.3.14 -> 0.3.15
ldns: upgrade 1.8.2 -> 1.8.3
libcurses-perl: upgrade 1.38 -> 1.41
mosquitto: upgrade 2.0.14 -> 2.0.15
nbdkit: upgrade 1.32.1 -> 1.33.1
netdata: upgrade 1.36.0 -> 1.36.1
libsdl2-ttf: upgrade 2.20.0 -> 2.20.1
xfstests: upgrade 2022.07.31 -> 2022.08.07
php: upgrade 8.1.8 -> 8.1.9
rdma-core: upgrade 41.0 -> 42.0
spitools: upgrade 1.0.1 -> 1.0.2
unbound: upgrade 1.16.1 -> 1.16.2
zlog: upgrade 1.2.15 -> 1.2.16
python3-hexbytes: upgrade 0.2.3 -> 0.3.0
python3-pythonping: upgrade 1.1.2 -> 1.1.3
python3-jsonrpcserver: Add dependence python3-typing-extensions
feh: upgrade 3.9 -> 3.9.1
gnome-bluetooth: upgrade 42.2 -> 42.3
hunspell: upgrade 1.7.0 -> 1.7.1
gtk4: upgrade 4.6.6 -> 4.6.7
logwatch: upgrade 7.6 -> 7.7
bdwgc: upgrade 8.2.0 -> 8.2.2
tcpreplay: upgrade 4.4.1 -> 4.4.2
tree: upgrade 2.0.2 -> 2.0.3
xfsdump: upgrade 3.1.10 -> 3.1.11
babl: upgrade 0.1.94 -> 0.1.96
Wolfgang Meyer (1):
libsdl2-ttf: upgrade 2.0.18 -> 2.20.0
Xu Huan (18):
python3-protobuf: upgrade 4.21.3 -> 4.21.4
python3-pycodestyle: upgrade 2.8.0 -> 2.9.0
python3-pyflakes: upgrade 2.4.0 -> 2.5.0
python3-pythonping: upgrade 1.1.1 -> 1.1.2
python3-regex: upgrade 2022.7.24 -> 2022.7.25
python3-werkzeug: upgrade 2.2.0 -> 2.2.1
python3-google-auth: upgrade 2.9.1 -> 2.10.0
python3-humanize: upgrade 4.2.3 -> 4.3.0
python3-hexbytes: upgrade 0.2.2 -> 0.2.3
python3-imageio: upgrade 2.21.0 -> 2.21.1
python3-nocaselist: upgrade 1.0.5 -> 1.0.6
python3-protobuf: upgrade 4.21.4 -> 4.21.5
python3-pycares: upgrade 4.2.1 -> 4.2.2
python3-fastjsonschema: upgrade 2.16.1 -> 2.16.2
python3-google-api-python-client: upgrade 2.56.0 -> 2.57.0
python3-google-auth: upgrade 2.10.0 -> 2.11.0
python3-grpcio-tools: upgrade 1.47.0 -> 1.48.0
python3-grpcio: upgrade 1.47.0 -> 1.48.0
Yi Zhao (5):
strongswan: upgrade 5.9.6 -> 5.9.7
libldb: upgrade 2.3.3 -> 2.3.4
samba: upgrade 4.14.13 -> 4.14.14
python3-jsonrpcserver: upgrade 5.0.7 -> 5.0.8
samba: fix buildpaths issue
wangmy (16):
gedit: upgrade 42.1 -> 42.2
libwacom: upgrade 2.3.0 -> 2.4.0
htpdate: upgrade 1.3.4 -> 1.3.5
nbdkit: upgrade 1.31.14 -> 1.31.15
pure-ftpd: upgrade 1.0.50 -> 1.0.51
avro-c: upgrade 1.11.0 -> 1.11.1
debootstrap: upgrade 1.0.126 -> 1.0.127
freerdp: upgrade 2.7.0 -> 2.8.0
icewm: upgrade 2.9.7 -> 2.9.8
libmxml: upgrade 3.3 -> 3.3.1
poco: upgrade 1.12.0 -> 1.12.1
xfontsel: upgrade 1.0.6 -> 1.1.0
xmessage: upgrade 1.0.5 -> 1.0.6
xrefresh: upgrade 1.0.6 -> 1.0.7
zabbix: upgrade 6.0.5 -> 6.2.1
xrdp: upgrade 0.9.18 -> 0.9.19
zhengrq.fnst (4):
python3-asttokens: upgrade 2.0.7 -> 2.0.8
python3-charset-normalizer: upgrade 2.1.0 -> 2.1.1
python3-eth-account: 0.6.1 -> 0.7.0
python3-cantools: upgrade 37.1.0 -> 37.1.2
zhengruoqin (12):
python3-dominate: upgrade 2.6.0 -> 2.7.0
python3-flask-login: upgrade 0.6.1 -> 0.6.2
python3-google-api-python-client: upgrade 2.54.0 -> 2.55.0
python3-haversine: upgrade 2.5.1 -> 2.6.0
python3-imageio: upgrade 2.19.5 -> 2.21.0
python3-autobahn: upgrade 22.6.1 -> 22.7.1
python3-engineio: upgrade 4.3.3 -> 4.3.4
python3-flask: upgrade 2.1.3 -> 2.2.2
python3-gcovr: upgrade 5.1 -> 5.2
python3-google-api-python-client: upgrade 2.55.0 -> 2.56.0
python3-asttokens: upgrade 2.0.5 -> 2.0.7
python3-zeroconf: upgrade 0.38.7 -> 0.39.0
meta-security: 2a2d650ee0..10fdc2b13a:
Anton Antonov (2):
Use CARGO_TARGET_SUBDIR in do_install
parsec-service: Update oeqa tests
Armin Kuster (8):
python3-privacyidea: update to 3.7.3
lkrg-module: update to 0.9.5
apparmor: update to 3.0.6
packagegroup-core-security: add space for appends
cryptmount: Add new pkg
packagegroup-core-security: add pkg to grp
cyptmount: Fix mount.h conflicts seen with glibc 2.36+
kas: update testimage inherit
John Edward Broadbent (1):
meta-security: Add recipe for Glome
Mingli Yu (1):
samhain-standalone: fix buildpaths issue
poky: fc59c28724..9b1db65e7d:
Alejandro Hernandez Samaniego (1):
baremetal-image.bbclass: Emulate image.bbclass to handle new classes scope
Alex Stewart (1):
maintainers: update opkg maintainer
Alexander Kanavin (113):
kmscube: address linux 5.19 fails
rpm: update 4.17.0 -> 4.17.1
go: update 1.18.4 -> 1.19
bluez5: update 5.64 -> 5.65
python3-pip: update 22.2.1 -> 22.2.2
ffmpeg: update 5.0.1 -> 5.1
iproute2: upgrade 5.18.0 -> 5.19.0
harfbuzz: upgrade 4.4.1 -> 5.1.0
libwpe: upgrade 1.12.0 -> 1.12.2
bind: upgrade 9.18.4 -> 9.18.5
diffoscope: upgrade 218 -> 220
ell: upgrade 0.51 -> 0.52
gnutls: upgrade 3.7.6 -> 3.7.7
iso-codes: upgrade 4.10.0 -> 4.11.0
kea: upgrade 2.0.2 -> 2.2.0
kexec-tools: upgrade 2.0.24 -> 2.0.25
libcap: upgrade 2.64 -> 2.65
libevdev: upgrade 1.12.1 -> 1.13.0
libnotify: upgrade 0.8.0 -> 0.8.1
libwebp: upgrade 1.2.2 -> 1.2.3
libxcvt: upgrade 0.1.1 -> 0.1.2
mesa: upgrade 22.1.3 -> 22.1.5
mobile-broadband-provider-info: upgrade 20220511 -> 20220725
nettle: upgrade 3.8 -> 3.8.1
piglit: upgrade to latest revision
puzzles: upgrade to latest revision
python3: upgrade 3.10.5 -> 3.10.6
python3-dtschema: upgrade 2022.7 -> 2022.8
python3-hypothesis: upgrade 6.50.1 -> 6.54.1
python3-jsonschema: upgrade 4.9.0 -> 4.9.1
python3-markdown: upgrade 3.3.7 -> 3.4.1
python3-setuptools: upgrade 63.3.0 -> 63.4.1
python3-sphinx: upgrade 5.0.2 -> 5.1.1
python3-urllib3: upgrade 1.26.10 -> 1.26.11
sqlite3: upgrade 3.39.1 -> 3.39.2
sysklogd: upgrade 2.4.0 -> 2.4.2
webkitgtk: upgrade 2.36.4 -> 2.36.5
kernel-dev: working with kernel using devtool does not require building and installing eSDK
sdk-manual: describe how to use extensible SDK functionality directly in a Yocto build
dropbear: merge .inc into .bb
rust: update 1.62.0 -> 1.62.1
cmake: update 3.23.2 -> 3.24.0
weston: upgrade 10.0.1 -> 10.0.2
patchelf: update 0.14.5 -> 0.15.0
patchelf: replace a rejected patch with an equivalent uninative.bbclass tweak
weston: exclude pre-releases from version check
tzdata: upgrade 2022a -> 2022b
libcgroup: update 2.0.2 -> 3.0.0
python3-setuptools-rust: update 1.4.1 -> 1.5.1
shadow: update 4.11.1 -> 4.12.1
slang: update 2.3.2 -> 2.3.3
xz: update 5.2.5 -> 5.2.6
gdk-pixbuf: update 2.42.8 -> 2.42.9
xorgproto: update 2022.1 -> 2022.2
boost-build-native: update 4.4.1 -> 1.80.0
boost: update 1.79.0 -> 1.80.0
vulkan-samples: update to latest revision
epiphany: upgrade 42.3 -> 42.4
git: upgrade 2.37.1 -> 2.37.2
glib-networking: upgrade 2.72.1 -> 2.72.2
gnu-efi: upgrade 3.0.14 -> 3.0.15
gpgme: upgrade 1.17.1 -> 1.18.0
libjpeg-turbo: upgrade 2.1.3 -> 2.1.4
libwebp: upgrade 1.2.3 -> 1.2.4
lighttpd: upgrade 1.4.65 -> 1.4.66
mesa: upgrade 22.1.5 -> 22.1.6
meson: upgrade 0.63.0 -> 0.63.1
mpg123: upgrade 1.30.1 -> 1.30.2
pango: upgrade 1.50.8 -> 1.50.9
piglit: upgrade to latest revision
pkgconf: upgrade 1.8.0 -> 1.9.2
python3-dtschema: upgrade 2022.8 -> 2022.8.1
python3-more-itertools: upgrade 8.13.0 -> 8.14.0
python3-numpy: upgrade 1.23.1 -> 1.23.2
python3-pbr: upgrade 5.9.0 -> 5.10.0
python3-pyelftools: upgrade 0.28 -> 0.29
python3-pytz: upgrade 2022.1 -> 2022.2.1
strace: upgrade 5.18 -> 5.19
sysklogd: upgrade 2.4.2 -> 2.4.4
wireless-regdb: upgrade 2022.06.06 -> 2022.08.12
wpebackend-fdo: upgrade 1.12.0 -> 1.12.1
python3-hatchling: update 1.6.0 -> 1.8.0
python3-setuptools: update 63.4.1 -> 65.0.2
devtool: do not leave behind source trees in workspace/sources
systemtap: add a patch to address a python 3.11 failure
bitbake: bitbake-layers: initialize tinfoil before registering command line arguments
scripts/oe-setup-builddir: add a check that TEMPLATECONF is valid
bitbake-layers: add a command to save the active build configuration as a template into a layer
bitbake-layers: add ability to save current layer repository configuration into a file
scripts/oe-setup-layers: add a script that restores the layer configuration from a json file
selftest/bblayers: add a test for creating a layer setup and using it to restore the layers
selftest/bblayers: adjust the revision for the layer setup test
perl: run builds from a pristine source tree
meta-poky/conf: move default templates to conf/templates/default/
syslinux: mark all pending patches as Inactive-Upstream
shadow: correct the pam patch status
mtd-utils: remove patch that adds -I option
gstreamer1.0-plugins-bad: remove an unneeded patch
ghostscript: remove unneeded patch
ovmf: drop the force no-stack-protector patch
python: submit CC to cc_basename patch upstream
mc: submit perl warnings patch upstream
sysvinit: send install.patch upstream
valgrind: (re)send ppc instructions patch upstream
gdk-pixbuf: submit fatal-loader.patch upstream
libsdl2: follow upstream version is even rule
python3-pip: submit reproducible.patch upstream
python3-pip: remove unneeded reproducible.patch
llvm: remove 0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
scripts/oe-setup-builddir: migrate build/conf/templateconf.cfg to new template locations
meta/files/layers.schema.json: drop the layers property
scripts/oe-setup-builddir: write to conf/templateconf.cfg after the build is set up
scripts/oe-setup-builddir: make environment variable the highest priority source for TEMPLATECONF
Alexandre Belloni (1):
ruby: drop capstone support
Andrei Gherzan (7):
shadow: Enable subid support
rootfspostcommands.py: Restructure sort_passwd and related functions
rootfspostcommands.py: Cleanup subid backup files generated by shadow-utils
selftest: Add module for testing rootfs postcommands
rootfs-postcommands.bbclass: Follow function rename in rootfspostcommands.py
shadow: Avoid nss warning/error with musl
linux-yocto: Fix COMPATIBLE_MACHINE regex match
Andrey Konovalov (2):
mesa: add pipe-loader's libraries to libopencl-mesa package
mesa: build clover with native LLVM codegen support for freedreno
Anuj Mittal (1):
poky.conf: add ubuntu-22.04 to tested distros
Armin Kuster (1):
system-requirements.rst: remove EOL and Centos7 hosts
Aryaman Gupta (1):
bitbake: runqueue: add memory pressure regulation
Awais Belal (1):
kernel-fitimage.bbclass: only package unique DTBs
Beniamin Sandu (1):
libpam: use /run instead of /var/run in systemd tmpfiles
Bertrand Marquis (1):
sysvinit-inittab/start_getty: Fix respawn too fast
Bruce Ashfield (22):
linux-yocto/5.15: update to v5.15.58
linux-yocto/5.10: update to v5.10.134
linux-yocto-rt/5.15: update to -rt48 (and fix -stable merge)
linux-libc-headers: update to v5.19
kernel-devsrc: support arm v5.19+ on target build
kernel-devsrc: support powerpc on v5.19+
lttng-modules: fix build against mips and v5.19 kernel
linux-yocto: introduce v5.19 reference kernel recipes
meta/conf: update preferred linux-yocto version to v5.19
linux-yocto: drop v5.10 reference kernel recipes
linux-yocto/5.15: update to v5.15.59
linux-yocto/5.15: fix reproducibility issues
linux-yocto/5.19: cfg: update x32 configuration fragment
linux-yocto/5.19: fix reproducibility issues
poky: update preferred version to v5.19
poky: change preferred kernel version to 5.15 in poky-alt
yocto-bsp: drop v5.10 bbappend and create 5.19 placeholder
lttng-modules: replace mips compaction fix with upstream change
linux-yocto/5.15: update to v5.15.60
linux-yocto/5.19: update to v5.19.1
linux-yocto/5.19: update to v5.19.3
linux-yocto/5.15: update to v5.15.62
Changqing Li (1):
apt: fix nativesdk-apt build failure during the second time build
Chen Qi (2):
python3-hypothesis: revert back to 6.46.11
python3-requests: add python3-compression dependency
Drew Moseley (1):
rng-tools: Replace obsolete "wants systemd-udev-settle"
Enrico Scholz (2):
npm.bbclass: fix typo in 'fund' config option
npm.bbclass: fix architecture mapping
Ernst Sjöstrand (1):
cve-check: Don't use f-strings
Jacob Kroon (1):
python3-cython: Remove debug lines
Jan Luebbe (2):
openssh: sync local ssh_config + sshd_config files with upstream 8.7p1
openssh: add support for config snippet includes to ssh and sshd
JeongBong Seo (1):
wic: add 'none' fstype for custom image
Johannes Schneider (1):
classes: rootfs-postcommands: autologin root on serial-getty
Jon Mason (2):
oeqa/parselogs: add qemuarmv5 arm-charlcd masking
ref-manual: add numa to machine features
Jose Quaresma (4):
bitbake: build: prefix the tasks with a timestamp in the log task_order
archiver.bbclass: some recipes that uses the kernelsrc bbclass uses the shared source
linux-yocto: prepend the the value with a space when append to KERNEL_EXTRA_ARGS
shaderc: upgrade 2022.1 -> 2022.2
Joshua Watt (4):
bitbake: siggen: Fix insufficent entropy in sigtask file names
bitbake: utils: Pass lock argument in fileslocked
classes: cve-check: Get shared database lock
meta/files: add layer setup JSON schema and example
Kai Kang (1):
packagegroup-self-hosted: update for strace
Kevin Hao (1):
uboot-config.bbclass: Don't bail out early in multi configs
Khem Raj (83):
qemu: Fix build with glibc 2.36
mtd-utils: Fix build with glibc 2.36
stress-ng: Upgrade to 0.14.03
bootchart2: Fix build with glibc 2.36+
ltp: Fix sys/mount.h conflicts needed for glibc 2.36+ compile
efivar: Fix build with glibc 2.36
cracklib: Drop using register keyword
util-linux: Define pidfd_* function signatures
util-linux: Upgrade to 2.38.1
tcp-wrappers: Fix implicit-function-declaration warnings
perl-cross: Correct function signatures in configure_func.sh
perl: Pass additional flags to enable lfs and gnu source
sysvinit: Fix mount.h conflicts seen with glibc 2.36+
glibc: Bump to 2.36
glibc: Update patch status
zip: Enable largefile support based on distro feature
zip: Make configure checks to be more robust
unzip: Fix configure tests to use modern C
unzip: Enable largefile support when enabled in distro
iproute2: Fix netns check during configure
glibc: Bump to latest 2.36 branch
gstreamer1.0-plugins-base: Include required system headers for isspace() and sscanf()
musl: Upgrade to latest tip of trunk
zip: Always enable LARGE_FILE_SUPPORT
libmicrohttpd: Enable largefile support unconditionally
unzip: Always enable largefile support
default-distrovars: Remove largefile from defualt DISTRO_FEATURES
zlib: Resolve CVE-2022-37434
json-c: Fix function prototypes
rsync: Backport fix to address CVE-2022-29154
rsync: Upgrade to 3.2.5
libtirpc: Backport fix for CVE-2021-46828
libxml2: Ignore CVE-2016-3709
tiff: Backport a patch for CVE-2022-34526
libtirpc: Upgrade to 1.3.3
perf: Add packageconfig for libbfd support and use disabled as default
connman: Backports for security fixes
systemd: Upgrade to 251.4 and fix build with binutils 2.39
time: Add missing include for memset
screen: Add missing include files in configure checks
setserial: Fix build with clang
expect: Fix implicit-function-declaration warnings
spirv-tools: Remove default copy constructor in header
boost: Compile out stdlib unary/binary_functions for c++11 and newer
vulkan-samples: Qualify move as std::move
apt: Do not use std::binary_function
ltp: Fix sys/mount.h and linux/mount.h conflict
rpm: Remove -Wimplicit-function-declaration warnings
binutils: Upgrade to 2.39 release
binutils-cross: Disable gprofng for when building cross binutils
binutils: Package up gprofng
binutils: Disable gprofng when using clang
binutils-cross-canadian: Package up new gprofng.rc file
autoconf: Fix strict prototype errors in generated tests
rsync: Add missing prototypes to function declarations
nfs-utils: Upgrade to 2.6.2
webkitgtk: Upgrade to 2.36.6 minor update
musl: Update to tip
binutils: Disable gprofng on musl systems
binutils: Upgrade to latest on 2.39 release branch
cargo_common.bbclass: Add missing space in shell conditional code
rng-tools: Remove depndencies on hwrng
ccache: Update the patch status
ccache: Fix build with gcc12 on musl
alsa-plugins: Include missing string.h
xinetd: Pass missing -D_GNU_SOURCE
watchdog: Include needed system header for function decls
libcgroup: Use GNU strerror_r only when its available
pinentry: enable _XOPEN_SOURCE on musl for wchar usage in curses
apr: Use correct strerror_r implementation based on libc type
gcr: Define _GNU_SOURCE
ltp: Adjust types to match create_fifo_thread return
gcc: Upgrade to 12.2.0
glibc: Update to latest on 2.36
ltp: Remove -mfpmath=sse on x86-64 too
apr: Cache configure tests which use AC_TRY_RUN
rust: Fix build failure on riscv32
ncurses: Fix configure tests for exit and mbstate_t
rust-llvm: Update to matching LLVM_VERSION from rust-source
librepo: Fix build on musl
rsync: Turn on -pedantic-errors at the end of 'configure'
ccache: Upgrade to 4.6.2
xmlto: Update to use upstream tip of trunk
Konrad Weihmann (1):
python3: disable user site-pkg for native target
Lee Chee Yang (1):
migration guides: add release notes for 4.0.3
Luca Ceresoli (1):
libmnl: remove unneeded SRC_URI 'name' option
Markus Volk (2):
connman: add PACKAGECONFIG to support iwd
packagegroup-base.bb: add a configure option to set the wireless-daemon
Martin Jansa (5):
glibc: revert one upstream change to work around broken DEBUG_BUILD build
syslinux: Fix build with glibc-2.36
syslinux: refresh patches with devtool
glibc: fix new upstream build issue with DEBUG_BUILD build
glibc: apply proposed patch from upstream instead of revert
Mateusz Marciniec (2):
util-linux: Remove --enable-raw from EXTRA_OECONF
util-linux: Improve check for magic in configure.ac
Michael Halstead (1):
uninative: Upgrade to 3.7 to work with glibc 2.36
Michael Opdenacker (1):
dev-manual: use proper note directive
Mingli Yu (1):
bitbake: fetch: use BPN instead
Neil Horman (1):
bitbake: Fix npm to use https rather than http
Paul Eggleton (1):
relocate_sdk.py: ensure interpreter size error causes relocation to fail
Pavel Zhukov (6):
package_rpm: Do not replace square brackets in %files
selftest: Add regression test for rpm filesnames
parselogs: Ignore xf86OpenConsole error
bitbake: gitsm: Error out if submodule refers to parent repo
bitbake: tests: Add Timeout class
bitbake: tests: Add test for possible gitsm deadlock
Peter Bergin (3):
rust-cross-canadian: rename shell variables for easier appends
packagegroup-rust-cross-canadian: add native compiler environment
oeqa/sdk: extend rust test to also use a build script
Peter Marko (1):
create-spdx: handle links to inaccessible locations
Quentin Schulz (3):
docs: conf.py: update yocto_git base URL
docs: README: add TeX font package required for building PDF
docs: ref-manual: system-requirements: add missing packages
Randy MacLeod (1):
rust: update from 1.62.1 to 1.63.0
Rasmus Villemoes (1):
bitbake.conf: set BB_DEFAULT_UMASK using ??=
Richard Purdie (85):
oeqa/selftest/sstate: Ensure tests are deterministic
nativesdk: Clear TUNE_FEATURES
populate_sdk_base: Disable rust SDK for MIPS n32
selftest/reproducible: Exclude rust/rust-dbg for now until we can fix
conf/distro/no-static-libs: Allow static musl for rust
rust-target-config: Add mips n32 target information
rust-common: Add CXXFLAGS
rust-common: Drop export directive from wrappers
rust-common: Rework wrappers to handle musl
rust: Work around reproducibility issues
rust: Switch to use RUST_XXX_SYS consistently
rust.inc: Rename variables to make code clearer
rust.inc: Fix cross build llvm-config handling
rust/mesa: Drop obsolete YOCTO_ALTERNATE_MULTILIB_NAME
rust-target-config: Show clear error when target isn't defined
rust: Generate per recipe target configuration files
rust-common/rust: Improve bootstrap BUILD_SYS handling
cargo_common: Handle build SYS as well as HOST/TARGET
rust-llvm: Enable nativesdk variant
rust.inc: Fix for cross compilation configuration
rust-common: Update to match cross targets
rust-target-config: Make target workaround generic
rust-common: Simplify libc handling
cargo: Drop cross-canadian variant and fix/use nativesdk
rust-common: Set rustlibdir to match target expectation
rust-cross-canadian: Simplify and fix
rust: Drop cross/crosssdk
rust: Enable nativesdk and target builds + replace rust-tools-cross-canadian
rust: Fix musl builds
rust: Ensure buildpaths are handled in debug symbols correctly
rust: Update README
selftest/wic: Tweak test case to not depend on kernel size
bitbake: runqueue: Ensure deferred tasks are sorted by multiconfig
bitbake: runqueue: Improve deadlock warning messages
bitbake: runqueue: Drop deadlock breaking force fail
rust-common: Remove conflict with utils create_wrapper
kern-devsrc: Drop auto.conf creation
cargo: Work around host system library conflicts
rust-cross-canadian: Use shell from SDK, not the host
buildhistory: Only use image-artifact-names as an image class
rust: Remove unneeded RUST_TARGETGENS settings
meta-skeleton/hello-mod: Switch to SPDX-License-Identifier
perf: Fix reproducibility issues with 5.19 onwards
selftest/runtime_test/incompatible_lic: Use IMAGE_CLASSES for testimage
testexport: Fix to work as an image class
testexport: Use IMAGE_CLASSES for testimage
selftest/runtime_test: Use testexport in IMAGE_CLASSES, not globally
bitbake: BBHandler: Allow earlier exit for classes not found
bitbake: BBHandler: Make inherit calls more directly
bitbake: bitbake: Add copyright headers where missing
bitbake: BBHandler/cooker: Implement recipe and global classes
classes: Add copyright statements to files without one
scripts: Add copyright statements to files without one
classes: Add SPDX license identifiers
lib: Add copyright statements to files without one
insane: Update to allow for class layout changes
classes: Update classes to match new bitbake class scope functionality
recipetool: Update for class changes
package: Switch debug source handling to use prefix map
libgcc/gcc-runtime: Improve source reference handling
bitbake.conf: Handle S and B separately for debug mapping
python3-cython: Update code to match debug path changes
gcc-cross: Fix relative links
gcc: Resolve relative prefix-map filenames
gcc: Add a patch to avoid hardcoded paths in libgcc on powerpc
gcc: Update patch status to submitted for two patches
valgrind: Disable drd/tests/std_thread2 ptest
valgrind: Update to match debug file layout changes
skeleton/service: Ensure debug path handling works as intended
distrooverrides: Move back to classes whilst it's usage is clarified
vim: Upgrade 9.0.0115 -> 9.0.0242
icu: Drop binconfig support (icu-config)
libtirpc: Mark CVE-2021-46828 as resolved
bitbake: runqueue: Change pressure file warning to a note
rust-target-config: Drop has-elf-tls option
llvm: Add llvm-config wrapper to improve flags handling
mesa: Rework llvm handling
rust-target-config: Fix qemuppc target cpu option
rust: Fix crossbeam-utils for arches without atomics
pseudo: Update to include recent upstream minor fixes
bitbake: Revert "fetch: use BPN instead"
vim: Upgrade 9.0.0242 -> 9.0.0341
gcc-multilib-config: Fix i686 toolchain relocation issues
kernel: Always set CC and LD for the kernel build
kernel: Use consistent make flags for menuconfig
Robert Joslyn (1):
curl: Update to 7.85.0
Ross Burton (9):
oeqa/qemurunner: add run_serial() comment
oeqa/commands: add support for running cross tools to runCmd
oeqa/selftest: rewrite gdbserver test
libxml2: wrap xmllint to use the correct XML catalogues
oeqa/selftest: add test for debuginfod
libgcrypt: remove obsolete pkgconfig install
libgcrypt: remove obsolete patch
libgcrypt: rewrite ptest
cve-check: close cursors as soon as possible
Sakib Sajal (2):
qemu: fix CVE-2021-3507
qemu: fix CVE-2022-0216
Shubham Kulkarni (1):
sanity: add a comment to ensure CONNECTIVITY_CHECK_URIS is correct
Simone Weiss (1):
json-c: Add ptest for json-c
Sundeep KOKKONDA (1):
glibc : stable 2.35 branch updates
Thomas Roos (1):
oeqa devtool: Add tests to cover devtool handling of various git URL styles
Tom Hochstein (1):
piglit: Add PACKAGECONFIG for glx and opencl
Tom Rini (1):
qemux86-64: Allow higher tunes
Ulrich Ölmann (1):
scripts/runqemu.README: fix typos and trailing whitespaces
William A. Kennington III (1):
image_types: Set SOURCE_DATE_EPOCH for squashfs
Yang Xu (1):
insane.bbclass: Skip patches not in oe-core by full path
Yogesh Tyagi (1):
gdbserver : add selftest
Yongxin Liu (1):
grub2: fix several CVEs
wangmy (19):
msmtp: upgrade 1.8.20 -> 1.8.22
bind: upgrade 9.18.5 -> 9.18.6
btrfs-tools: upgrade 5.18.1 -> 5.19
libdnf: upgrade 0.67.0 -> 0.68.0
librepo: upgrade 1.14.3 -> 1.14.4
pkgconf: upgrade 1.9.2 -> 1.9.3
python3-pygments: upgrade 2.12.0 -> 2.13.0
ethtool: upgrade 5.18 -> 5.19
librsvg: upgrade 2.54.4 -> 2.54.5
libtasn1: upgrade 4.18.0 -> 4.19.0
liburcu: upgrade 0.13.1 -> 0.13.2
libwpe: upgrade 1.12.2 -> 1.12.3
lttng-tools: upgrade 2.13.7 -> 2.13.8
lttng-ust: upgrade 2.13.3 -> 2.13.4
libatomic-ops: upgrade 7.6.12 -> 7.6.14
lz4: upgrade 1.9.3 -> 1.9.4
python3-hatchling: upgrade 1.8.0 -> 1.8.1
python3-urllib3: upgrade 1.26.11 -> 1.26.12
repo: upgrade 2.28 -> 2.29.1
meta-arm: 20a629180c..52f07a4b0b:
Anton Antonov (11):
arm/optee-os: backport RWX permission error patch
work around for too few arguments to function init_disassemble_info() error
arm/optee-os: backport linker warning patches
arm/tf-a-tests: work around RWX permission error on segment
Recipes for Trusted Services dependencies.
Recipes for Trusted Services Secure Partitions
ARM-FFA kernel drivers and kernel configs for Trusted Services
Trusted Services test/demo NWd tools
psa-api-tests for Trusted Services
Include Trusted Services SPs into optee-os image
Define qemuarm64-secureboot-ts CI pipeline and include it into meta-arm
Gowtham Suresh Kumar (2):
arm-bsp/secure-partitions: fix SMM gateway bug for EFI GetVariable()
arm-bsp/u-boot: drop EFI GetVariable() workarounds patches
Jon Mason (11):
arm-bsp/fvp-base-arm32: Update kernel patch for v5.19
arm/qemuarm64-secureboot: remove tfa memory patch
arm/linux-yocto: remove optee num pages kernel config variable
arm-bsp/juno: drop scmi patch
arm/qemuarm-secureboot: remove vmalloc from QB_KERNEL_CMDLINE_APPEND
arm/fvp: use image-artifact-names as an image class
atp/atp: drop package inherits
arm/optee: Update to 3.18
arm-bsp/fvp-base: set preferred kernel to 5.15
arm/arm-bsp: Add yocto-kernel-cache bluetooth support
arm-bsp/corstone1000: use compressed kernel image
Khem Raj (2):
gator-daemon: Define _GNU_SOURCE feature test macro
optee-os: Add section attribute parameters when clang is used
Peter Hoyes (3):
docs: Update FVP_CONSOLES in runfvp documentation
docs: Introduce meta-arm OEQA documentation
arm/oeqa: Make linuxboot test case timeout configurable
Richard Purdie (1):
gem5/gem5-m5ops: Drop uneeded package inherit
Ross Burton (2):
arm/trusted-firmware-a: remove redundant patches
arm/trusted-firmware-a: work around RWX permission error on segment
Rui Miguel Silva (2):
arm-bsp:corstone500: rebase u-boot patches on v2022.07
arm-bsp/corstone1000: rebase u-boot patches on top v2022.07
Vishnu Banavath (3):
arm-bsp/trusted-firmware-a: Bump TF-A version for N1SDP
arm-bsp/optee: add optee-os support for N1SDP target
arm/optee: update optee-client to v3.18
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I90aa0a94410dd208163af126566d22c77787abc2
diff --git a/poky/meta/classes/allarch.bbclass b/poky/meta/classes/allarch.bbclass
deleted file mode 100644
index a766a65..0000000
--- a/poky/meta/classes/allarch.bbclass
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# This class is used for architecture independent recipes/data files (usually scripts)
-#
-
-python allarch_package_arch_handler () {
- if bb.data.inherits_class("native", d) or bb.data.inherits_class("nativesdk", d) \
- or bb.data.inherits_class("crosssdk", d):
- return
-
- variants = d.getVar("MULTILIB_VARIANTS")
- if not variants:
- d.setVar("PACKAGE_ARCH", "all" )
-}
-
-addhandler allarch_package_arch_handler
-allarch_package_arch_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-python () {
- # Allow this class to be included but overridden - only set
- # the values if we're still "all" package arch.
- if d.getVar("PACKAGE_ARCH") == "all":
- # No need for virtual/libc or a cross compiler
- d.setVar("INHIBIT_DEFAULT_DEPS","1")
-
- # Set these to a common set of values, we shouldn't be using them other that for WORKDIR directory
- # naming anyway
- d.setVar("baselib", "lib")
- d.setVar("TARGET_ARCH", "allarch")
- d.setVar("TARGET_OS", "linux")
- d.setVar("TARGET_CC_ARCH", "none")
- d.setVar("TARGET_LD_ARCH", "none")
- d.setVar("TARGET_AS_ARCH", "none")
- d.setVar("TARGET_FPU", "")
- d.setVar("TARGET_PREFIX", "")
- # Expand PACKAGE_EXTRA_ARCHS since the staging code needs this
- # (this removes any dependencies from the hash perspective)
- d.setVar("PACKAGE_EXTRA_ARCHS", d.getVar("PACKAGE_EXTRA_ARCHS"))
- d.setVar("SDK_ARCH", "none")
- d.setVar("SDK_CC_ARCH", "none")
- d.setVar("TARGET_CPPFLAGS", "none")
- d.setVar("TARGET_CFLAGS", "none")
- d.setVar("TARGET_CXXFLAGS", "none")
- d.setVar("TARGET_LDFLAGS", "none")
- d.setVar("POPULATESYSROOTDEPS", "")
-
- # Avoid this being unnecessarily different due to nuances of
- # the target machine that aren't important for "all" arch
- # packages.
- d.setVar("LDFLAGS", "")
-
- # No need to do shared library processing or debug symbol handling
- d.setVar("EXCLUDE_FROM_SHLIBS", "1")
- d.setVar("INHIBIT_PACKAGE_DEBUG_SPLIT", "1")
- d.setVar("INHIBIT_PACKAGE_STRIP", "1")
-
- # These multilib values shouldn't change allarch packages so exclude them
- d.appendVarFlag("emit_pkgdata", "vardepsexclude", " MULTILIB_VARIANTS")
- d.appendVarFlag("write_specfile", "vardepsexclude", " MULTILIBS")
- d.appendVarFlag("do_package", "vardepsexclude", " package_do_shlibs")
- elif bb.data.inherits_class('packagegroup', d) and not bb.data.inherits_class('nativesdk', d):
- bb.error("Please ensure recipe %s sets PACKAGE_ARCH before inherit packagegroup" % d.getVar("FILE"))
-}
-
-def qemu_wrapper_cmdline(data, rootfs_path, library_paths):
- return 'false'
diff --git a/poky/meta/classes/archiver.bbclass b/poky/meta/classes/archiver.bbclass
index 5da369d..0710c1e 100644
--- a/poky/meta/classes/archiver.bbclass
+++ b/poky/meta/classes/archiver.bbclass
@@ -1,5 +1,9 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
#
# This bbclass is used for creating archive for:
# 1) original (or unpacked) source: ARCHIVER_MODE[src] = "original"
@@ -459,7 +463,9 @@
def is_work_shared(d):
pn = d.getVar('PN')
- return bb.data.inherits_class('kernel', d) or pn.startswith('gcc-source')
+ return pn.startswith('gcc-source') or \
+ bb.data.inherits_class('kernel', d) or \
+ (bb.data.inherits_class('kernelsrc', d) and d.getVar('S') == d.getVar('STAGING_KERNEL_DIR'))
# Run do_unpack and do_patch
python do_unpack_and_patch() {
diff --git a/poky/meta/classes/autotools-brokensep.bbclass b/poky/meta/classes/autotools-brokensep.bbclass
deleted file mode 100644
index 71cf97a..0000000
--- a/poky/meta/classes/autotools-brokensep.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-# Autotools class for recipes where separate build dir doesn't work
-# Ideally we should fix software so it does work. Standard autotools supports
-# this.
-inherit autotools
-B = "${S}"
diff --git a/poky/meta/classes/autotools.bbclass b/poky/meta/classes/autotools.bbclass
deleted file mode 100644
index 4ab2460..0000000
--- a/poky/meta/classes/autotools.bbclass
+++ /dev/null
@@ -1,254 +0,0 @@
-def get_autotools_dep(d):
- if d.getVar('INHIBIT_AUTOTOOLS_DEPS'):
- return ''
-
- pn = d.getVar('PN')
- deps = ''
-
- if pn in ['autoconf-native', 'automake-native']:
- return deps
- deps += 'autoconf-native automake-native '
-
- if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
- deps += 'libtool-native '
- if not bb.data.inherits_class('native', d) \
- and not bb.data.inherits_class('nativesdk', d) \
- and not bb.data.inherits_class('cross', d) \
- and not d.getVar('INHIBIT_DEFAULT_DEPS'):
- deps += 'libtool-cross '
-
- return deps
-
-
-DEPENDS:prepend = "${@get_autotools_dep(d)} "
-
-inherit siteinfo
-
-# Space separated list of shell scripts with variables defined to supply test
-# results for autoconf tests we cannot run at build time.
-# The value of this variable is filled in in a prefunc because it depends on
-# the contents of the sysroot.
-export CONFIG_SITE
-
-acpaths ?= "default"
-EXTRA_AUTORECONF = "--exclude=autopoint --exclude=gtkdocize"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
-
-# When building tools for use at build-time it's recommended for the build
-# system to use these variables when cross-compiling.
-# (http://sources.redhat.com/autobook/autobook/autobook_270.html)
-export CPP_FOR_BUILD = "${BUILD_CPP}"
-export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}"
-
-export CC_FOR_BUILD = "${BUILD_CC}"
-export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
-
-export CXX_FOR_BUILD = "${BUILD_CXX}"
-export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
-
-export LD_FOR_BUILD = "${BUILD_LD}"
-export LDFLAGS_FOR_BUILD = "${BUILD_LDFLAGS}"
-
-def append_libtool_sysroot(d):
- # Only supply libtool sysroot option for non-native packages
- if not bb.data.inherits_class('native', d):
- return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
- return ""
-
-CONFIGUREOPTS = " --build=${BUILD_SYS} \
- --host=${HOST_SYS} \
- --target=${TARGET_SYS} \
- --prefix=${prefix} \
- --exec_prefix=${exec_prefix} \
- --bindir=${bindir} \
- --sbindir=${sbindir} \
- --libexecdir=${libexecdir} \
- --datadir=${datadir} \
- --sysconfdir=${sysconfdir} \
- --sharedstatedir=${sharedstatedir} \
- --localstatedir=${localstatedir} \
- --libdir=${libdir} \
- --includedir=${includedir} \
- --oldincludedir=${oldincludedir} \
- --infodir=${infodir} \
- --mandir=${mandir} \
- --disable-silent-rules \
- ${CONFIGUREOPT_DEPTRACK} \
- ${@append_libtool_sysroot(d)}"
-CONFIGUREOPT_DEPTRACK ?= "--disable-dependency-tracking"
-
-CACHED_CONFIGUREVARS ?= ""
-
-AUTOTOOLS_SCRIPT_PATH ?= "${S}"
-CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure"
-
-AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}"
-
-oe_runconf () {
- # Use relative path to avoid buildpaths in files
- cfgscript_name="`basename ${CONFIGURE_SCRIPT}`"
- cfgscript=`python3 -c "import os; print(os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.'))"`/$cfgscript_name
- if [ -x "$cfgscript" ] ; then
- bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
- if ! CONFIG_SHELL=${CONFIG_SHELL-/bin/bash} ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then
- bbnote "The following config.log files may provide further information."
- bbnote `find ${B} -ignore_readdir_race -type f -name config.log`
- bbfatal_log "configure failed"
- fi
- else
- bbfatal "no configure script found at $cfgscript"
- fi
-}
-
-CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
-
-autotools_preconfigure() {
- if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
- if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
- if [ "${S}" != "${B}" ]; then
- echo "Previously configured separate build directory detected, cleaning ${B}"
- rm -rf ${B}
- mkdir -p ${B}
- else
- # At least remove the .la files since automake won't automatically
- # regenerate them even if CFLAGS/LDFLAGS are different
- cd ${S}
- if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then
- oe_runmake clean
- fi
- find ${S} -ignore_readdir_race -name \*.la -delete
- fi
- fi
- fi
-}
-
-autotools_postconfigure(){
- if [ -n "${CONFIGURESTAMPFILE}" ]; then
- mkdir -p `dirname ${CONFIGURESTAMPFILE}`
- echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
- fi
-}
-
-EXTRACONFFUNCS ??= ""
-
-EXTRA_OECONF:append = " ${PACKAGECONFIG_CONFARGS}"
-
-do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}"
-do_compile[prefuncs] += "autotools_aclocals"
-do_install[prefuncs] += "autotools_aclocals"
-do_configure[postfuncs] += "autotools_postconfigure"
-
-ACLOCALDIR = "${STAGING_DATADIR}/aclocal"
-ACLOCALEXTRAPATH = ""
-ACLOCALEXTRAPATH:class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
-ACLOCALEXTRAPATH:class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
-
-python autotools_aclocals () {
- sitefiles, searched = siteinfo_get_files(d, sysrootcache=True)
- d.setVar("CONFIG_SITE", " ".join(sitefiles))
-}
-
-do_configure[file-checksums] += "${@' '.join(siteinfo_get_files(d, sysrootcache=False)[1])}"
-
-CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am"
-
-autotools_do_configure() {
- # WARNING: gross hack follows:
- # An autotools built package generally needs these scripts, however only
- # automake or libtoolize actually install the current versions of them.
- # This is a problem in builds that do not use libtool or automake, in the case
- # where we -need- the latest version of these scripts. e.g. running a build
- # for a package whose autotools are old, on an x86_64 machine, which the old
- # config.sub does not support. Work around this by installing them manually
- # regardless.
-
- PRUNE_M4=""
-
- for ac in `find ${S} -ignore_readdir_race -name configure.in -o -name configure.ac`; do
- rm -f `dirname $ac`/configure
- done
- if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then
- olddir=`pwd`
- cd ${AUTOTOOLS_SCRIPT_PATH}
- mkdir -p ${ACLOCALDIR}
- ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/"
- if [ x"${acpaths}" = xdefault ]; then
- acpaths=
- for i in `find ${AUTOTOOLS_SCRIPT_PATH} -ignore_readdir_race -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
- grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
- acpaths="$acpaths -I $i"
- done
- else
- acpaths="${acpaths}"
- fi
- acpaths="$acpaths ${ACLOCALEXTRAPATH}"
- AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'`
- automake --version
- echo "AUTOV is $AUTOV"
- if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
- ACLOCAL="$ACLOCAL --automake-acdir=${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
- fi
- # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
- # like it was auto-generated. Work around this by blowing it away
- # by hand, unless the package specifically asked not to run aclocal.
- if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
- rm -f aclocal.m4
- fi
- if [ -e configure.in ]; then
- CONFIGURE_AC=configure.in
- else
- CONFIGURE_AC=configure.ac
- fi
- if grep -q "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC; then
- if grep -q "sed.*POTFILES" $CONFIGURE_AC; then
- : do nothing -- we still have an old unmodified configure.ac
- else
- bbnote Executing glib-gettextize --force --copy
- echo "no" | glib-gettextize --force --copy
- fi
- elif [ "${BPN}" != "gettext" ] && grep -q "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC; then
- # We'd call gettextize here if it wasn't so broken...
- cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
- if [ -d ${S}/po/ ]; then
- cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po/
- if [ ! -e ${S}/po/remove-potcdate.sin ]; then
- cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/
- fi
- fi
- PRUNE_M4="$PRUNE_M4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4"
- fi
- mkdir -p m4
-
- for i in $PRUNE_M4; do
- find ${S} -ignore_readdir_race -name $i -delete
- done
-
- bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
- ACLOCAL="$ACLOCAL" autoreconf -Wcross -Wno-obsolete --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || die "autoreconf execution failed."
- cd $olddir
- fi
- if [ -e ${CONFIGURE_SCRIPT} ]; then
- oe_runconf
- else
- bbnote "nothing to configure"
- fi
-}
-
-autotools_do_compile() {
- oe_runmake
-}
-
-autotools_do_install() {
- oe_runmake 'DESTDIR=${D}' install
- # Info dir listing isn't interesting at this point so remove it if it exists.
- if [ -e "${D}${infodir}/dir" ]; then
- rm -f ${D}${infodir}/dir
- fi
-}
-
-inherit siteconfig
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
-
-B = "${WORKDIR}/build"
diff --git a/poky/meta/classes/baremetal-image.bbclass b/poky/meta/classes/baremetal-image.bbclass
deleted file mode 100644
index cb9e250..0000000
--- a/poky/meta/classes/baremetal-image.bbclass
+++ /dev/null
@@ -1,122 +0,0 @@
-# Baremetal image class
-#
-# This class is meant to be inherited by recipes for baremetal/RTOS applications
-# It contains code that would be used by all of them, every recipe just needs to
-# override certain variables.
-#
-# For scalability purposes, code within this class focuses on the "image" wiring
-# to satisfy the OpenEmbedded image creation and testing infrastructure.
-#
-# See meta-skeleton for a working example.
-
-
-# Toolchain should be baremetal or newlib based.
-# TCLIBC="baremetal" or TCLIBC="newlib"
-COMPATIBLE_HOST:libc-musl:class-target = "null"
-COMPATIBLE_HOST:libc-glibc:class-target = "null"
-
-
-inherit rootfs-postcommands
-
-# Set some defaults, but these should be overriden by each recipe if required
-IMGDEPLOYDIR ?= "${WORKDIR}/deploy-${PN}-image-complete"
-BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}"
-IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}"
-IMAGE_NAME_SUFFIX ?= ""
-
-do_rootfs[dirs] = "${IMGDEPLOYDIR} ${DEPLOY_DIR_IMAGE}"
-
-do_image(){
- install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.bin
- install ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.elf
-}
-
-do_image_complete(){
- :
-}
-
-python do_rootfs(){
- from oe.utils import execute_pre_post_process
- from pathlib import Path
-
- # Write empty manifest file to satisfy test infrastructure
- deploy_dir = d.getVar('IMGDEPLOYDIR')
- link_name = d.getVar('IMAGE_LINK_NAME')
- manifest_name = d.getVar('IMAGE_MANIFEST')
-
- Path(manifest_name).touch()
- if os.path.exists(manifest_name) and link_name:
- manifest_link = deploy_dir + "/" + link_name + ".manifest"
- if manifest_link != manifest_name:
- if os.path.lexists(manifest_link):
- os.remove(manifest_link)
- os.symlink(os.path.basename(manifest_name), manifest_link)
- # A lot of postprocess commands assume the existence of rootfs/etc
- sysconfdir = d.getVar("IMAGE_ROOTFS") + d.getVar('sysconfdir')
- bb.utils.mkdirhier(sysconfdir)
-
- execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND'))
-}
-
-
-# Assure binaries, manifest and qemubootconf are populated on DEPLOY_DIR_IMAGE
-do_image_complete[dirs] = "${TOPDIR}"
-SSTATETASKS += "do_image_complete"
-SSTATE_SKIP_CREATION:task-image-complete = '1'
-do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
-do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
-addtask do_image_complete after do_image before do_build
-
-python do_image_complete_setscene () {
- sstate_setscene(d)
-}
-addtask do_image_complete_setscene
-
-# QEMU generic Baremetal/RTOS parameters
-QB_DEFAULT_KERNEL ?= "${IMAGE_LINK_NAME}.bin"
-QB_MEM ?= "-m 256"
-QB_DEFAULT_FSTYPE ?= "bin"
-QB_DTB ?= ""
-QB_OPT_APPEND:append = " -nographic"
-
-# RISC-V tunes set the BIOS, unset, and instruct QEMU to
-# ignore the BIOS and boot from -kernel
-QB_DEFAULT_BIOS:qemuriscv64 = ""
-QB_DEFAULT_BIOS:qemuriscv32 = ""
-QB_OPT_APPEND:append:qemuriscv64 = " -bios none"
-QB_OPT_APPEND:append:qemuriscv32 = " -bios none"
-
-
-# Use the medium-any code model for the RISC-V 64 bit implementation,
-# since medlow can only access addresses below 0x80000000 and RAM
-# starts at 0x80000000 on RISC-V 64
-# Keep RISC-V 32 using -mcmodel=medlow (symbols lie between -2GB:2GB)
-CFLAGS:append:qemuriscv64 = " -mcmodel=medany"
-
-
-# This next part is necessary to trick the build system into thinking
-# its building an image recipe so it generates the qemuboot.conf
-addtask do_rootfs before do_image after do_install
-addtask do_image after do_rootfs before do_image_complete
-addtask do_image_complete after do_image before do_build
-inherit qemuboot
-
-# Based on image.bbclass to make sure we build qemu
-python(){
- # do_addto_recipe_sysroot doesnt exist for all recipes, but we need it to have
- # /usr/bin on recipe-sysroot (qemu) populated
- # The do_addto_recipe_sysroot dependency is coming from EXTRA_IMAGDEPENDS now,
- # we just need to add the logic to add its dependency to do_image.
- def extraimage_getdepends(task):
- deps = ""
- for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
- # Make sure we only add it for qemu
- if 'qemu' in dep:
- if ":" in dep:
- deps += " %s " % (dep)
- else:
- deps += " %s:%s" % (dep, task)
- return deps
- d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_sysroot'))
-}
diff --git a/poky/meta/classes/base.bbclass b/poky/meta/classes/base.bbclass
deleted file mode 100644
index 571b675..0000000
--- a/poky/meta/classes/base.bbclass
+++ /dev/null
@@ -1,783 +0,0 @@
-BB_DEFAULT_TASK ?= "build"
-CLASSOVERRIDE ?= "class-target"
-
-inherit patch
-inherit staging
-
-inherit mirrors
-inherit utils
-inherit utility-tasks
-inherit logging
-
-OE_EXTRA_IMPORTS ?= ""
-
-OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust oe.buildcfg ${OE_EXTRA_IMPORTS}"
-OE_IMPORTS[type] = "list"
-
-PACKAGECONFIG_CONFARGS ??= ""
-
-def oe_import(d):
- import sys
-
- bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")]
- sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path]
-
- import oe.data
- for toimport in oe.data.typed_value("OE_IMPORTS", d):
- try:
- # Make a python object accessible from the metadata
- bb.utils._context[toimport.split(".", 1)[0]] = __import__(toimport)
- except AttributeError as e:
- bb.error("Error importing OE modules: %s" % str(e))
- return ""
-
-# We need the oe module name space early (before INHERITs get added)
-OE_IMPORTED := "${@oe_import(d)}"
-
-inherit metadata_scm
-
-def lsb_distro_identifier(d):
- adjust = d.getVar('LSB_DISTRO_ADJUST')
- adjust_func = None
- if adjust:
- try:
- adjust_func = globals()[adjust]
- except KeyError:
- pass
- return oe.lsb.distro_identifier(adjust_func)
-
-die() {
- bbfatal_log "$*"
-}
-
-oe_runmake_call() {
- bbnote ${MAKE} ${EXTRA_OEMAKE} "$@"
- ${MAKE} ${EXTRA_OEMAKE} "$@"
-}
-
-oe_runmake() {
- oe_runmake_call "$@" || die "oe_runmake failed"
-}
-
-
-def get_base_dep(d):
- if d.getVar('INHIBIT_DEFAULT_DEPS', False):
- return ""
- return "${BASE_DEFAULT_DEPS}"
-
-BASE_DEFAULT_DEPS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs virtual/libc"
-
-BASEDEPENDS = ""
-BASEDEPENDS:class-target = "${@get_base_dep(d)}"
-BASEDEPENDS:class-nativesdk = "${@get_base_dep(d)}"
-
-DEPENDS:prepend="${BASEDEPENDS} "
-
-FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files"], d)}"
-# THISDIR only works properly with imediate expansion as it has to run
-# in the context of the location its used (:=)
-THISDIR = "${@os.path.dirname(d.getVar('FILE'))}"
-
-def extra_path_elements(d):
- path = ""
- elements = (d.getVar('EXTRANATIVEPATH') or "").split()
- for e in elements:
- path = path + "${STAGING_BINDIR_NATIVE}/" + e + ":"
- return path
-
-PATH:prepend = "${@extra_path_elements(d)}"
-
-def get_lic_checksum_file_list(d):
- filelist = []
- lic_files = d.getVar("LIC_FILES_CHKSUM") or ''
- tmpdir = d.getVar("TMPDIR")
- s = d.getVar("S")
- b = d.getVar("B")
- workdir = d.getVar("WORKDIR")
-
- urls = lic_files.split()
- for url in urls:
- # We only care about items that are absolute paths since
- # any others should be covered by SRC_URI.
- try:
- (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
- if method != "file" or not path:
- raise bb.fetch.MalformedUrl(url)
-
- if path[0] == '/':
- if path.startswith((tmpdir, s, b, workdir)):
- continue
- filelist.append(path + ":" + str(os.path.exists(path)))
- except bb.fetch.MalformedUrl:
- bb.fatal(d.getVar('PN') + ": LIC_FILES_CHKSUM contains an invalid URL: " + url)
- return " ".join(filelist)
-
-def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
- tools = d.getVar(toolsvar).split()
- origbbenv = d.getVar("BB_ORIGENV", False)
- path = origbbenv.getVar("PATH")
- # Need to ignore our own scripts directories to avoid circular links
- for p in path.split(":"):
- if p.endswith("/scripts"):
- path = path.replace(p, "/ignoreme")
- bb.utils.mkdirhier(dest)
- notfound = []
- for tool in tools:
- desttool = os.path.join(dest, tool)
- if not os.path.exists(desttool):
- # clean up dead symlink
- if os.path.islink(desttool):
- os.unlink(desttool)
- srctool = bb.utils.which(path, tool, executable=True)
- # gcc/g++ may link to ccache on some hosts, e.g.,
- # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
- # would return /usr/local/bin/ccache/gcc, but what we need is
- # /usr/bin/gcc, this code can check and fix that.
- if "ccache" in srctool:
- srctool = bb.utils.which(path, tool, executable=True, direction=1)
- if srctool:
- os.symlink(srctool, desttool)
- else:
- notfound.append(tool)
-
- if notfound and fatal:
- bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound))
-
-addtask fetch
-do_fetch[dirs] = "${DL_DIR}"
-do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
-do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}"
-do_fetch[vardeps] += "SRCREV"
-do_fetch[network] = "1"
-python base_do_fetch() {
-
- src_uri = (d.getVar('SRC_URI') or "").split()
- if not src_uri:
- return
-
- try:
- fetcher = bb.fetch2.Fetch(src_uri, d)
- fetcher.download()
- except bb.fetch2.BBFetchException as e:
- bb.fatal("Bitbake Fetcher Error: " + repr(e))
-}
-
-addtask unpack after do_fetch
-do_unpack[dirs] = "${WORKDIR}"
-
-do_unpack[cleandirs] = "${@d.getVar('S') if os.path.normpath(d.getVar('S')) != os.path.normpath(d.getVar('WORKDIR')) else os.path.join('${S}', 'patches')}"
-
-python base_do_unpack() {
- src_uri = (d.getVar('SRC_URI') or "").split()
- if not src_uri:
- return
-
- try:
- fetcher = bb.fetch2.Fetch(src_uri, d)
- fetcher.unpack(d.getVar('WORKDIR'))
- except bb.fetch2.BBFetchException as e:
- bb.fatal("Bitbake Fetcher Error: " + repr(e))
-}
-
-SSTATETASKS += "do_deploy_source_date_epoch"
-
-do_deploy_source_date_epoch () {
- mkdir -p ${SDE_DEPLOYDIR}
- if [ -e ${SDE_FILE} ]; then
- echo "Deploying SDE from ${SDE_FILE} -> ${SDE_DEPLOYDIR}."
- cp -p ${SDE_FILE} ${SDE_DEPLOYDIR}/__source_date_epoch.txt
- else
- echo "${SDE_FILE} not found!"
- fi
-}
-
-python do_deploy_source_date_epoch_setscene () {
- sstate_setscene(d)
- bb.utils.mkdirhier(d.getVar('SDE_DIR'))
- sde_file = os.path.join(d.getVar('SDE_DEPLOYDIR'), '__source_date_epoch.txt')
- if os.path.exists(sde_file):
- target = d.getVar('SDE_FILE')
- bb.debug(1, "Moving setscene SDE file %s -> %s" % (sde_file, target))
- bb.utils.rename(sde_file, target)
- else:
- bb.debug(1, "%s not found!" % sde_file)
-}
-
-do_deploy_source_date_epoch[dirs] = "${SDE_DEPLOYDIR}"
-do_deploy_source_date_epoch[sstate-plaindirs] = "${SDE_DEPLOYDIR}"
-addtask do_deploy_source_date_epoch_setscene
-addtask do_deploy_source_date_epoch before do_configure after do_patch
-
-python create_source_date_epoch_stamp() {
- # Version: 1
- source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('S'))
- oe.reproducible.epochfile_write(source_date_epoch, d.getVar('SDE_FILE'), d)
-}
-do_unpack[postfuncs] += "create_source_date_epoch_stamp"
-
-def get_source_date_epoch_value(d):
- return oe.reproducible.epochfile_read(d.getVar('SDE_FILE'), d)
-
-def get_layers_branch_rev(d):
- revisions = oe.buildcfg.get_layer_revisions(d)
- layers_branch_rev = ["%-20s = \"%s:%s\"" % (r[1], r[2], r[3]) for r in revisions]
- i = len(layers_branch_rev)-1
- p1 = layers_branch_rev[i].find("=")
- s1 = layers_branch_rev[i][p1:]
- while i > 0:
- p2 = layers_branch_rev[i-1].find("=")
- s2= layers_branch_rev[i-1][p2:]
- if s1 == s2:
- layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2]
- i -= 1
- else:
- i -= 1
- p1 = layers_branch_rev[i].find("=")
- s1= layers_branch_rev[i][p1:]
- return layers_branch_rev
-
-
-BUILDCFG_FUNCS ??= "buildcfg_vars get_layers_branch_rev buildcfg_neededvars"
-BUILDCFG_FUNCS[type] = "list"
-
-def buildcfg_vars(d):
- statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
- for var in statusvars:
- value = d.getVar(var)
- if value is not None:
- yield '%-20s = "%s"' % (var, value)
-
-def buildcfg_neededvars(d):
- needed_vars = oe.data.typed_value("BUILDCFG_NEEDEDVARS", d)
- pesteruser = []
- for v in needed_vars:
- val = d.getVar(v)
- if not val or val == 'INVALID':
- pesteruser.append(v)
-
- if pesteruser:
- bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
-
-addhandler base_eventhandler
-base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed"
-python base_eventhandler() {
- import bb.runqueue
-
- if isinstance(e, bb.event.ConfigParsed):
- if not d.getVar("NATIVELSBSTRING", False):
- d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))
- d.setVar("ORIGNATIVELSBSTRING", d.getVar("NATIVELSBSTRING", False))
- d.setVar('BB_VERSION', bb.__version__)
-
- # There might be no bb.event.ConfigParsed event if bitbake server is
- # running, so check bb.event.BuildStarted too to make sure ${HOSTTOOLS_DIR}
- # exists.
- if isinstance(e, bb.event.ConfigParsed) or \
- (isinstance(e, bb.event.BuildStarted) and not os.path.exists(d.getVar('HOSTTOOLS_DIR'))):
- # Works with the line in layer.conf which changes PATH to point here
- setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS', d)
- setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS_NONFATAL', d, fatal=False)
-
- if isinstance(e, bb.event.MultiConfigParsed):
- # We need to expand SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS in each of the multiconfig data stores
- # own contexts so the variables get expanded correctly for that arch, then inject back into
- # the main data store.
- deps = []
- for config in e.mcdata:
- deps.append(e.mcdata[config].getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS"))
- deps = " ".join(deps)
- e.mcdata[''].setVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS", deps)
-
- if isinstance(e, bb.event.BuildStarted):
- localdata = bb.data.createCopy(d)
- statuslines = []
- for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
- g = globals()
- if func not in g:
- bb.warn("Build configuration function '%s' does not exist" % func)
- else:
- flines = g[func](localdata)
- if flines:
- statuslines.extend(flines)
-
- statusheader = d.getVar('BUILDCFG_HEADER')
- if statusheader:
- bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
-
- # This code is to silence warnings where the SDK variables overwrite the
- # target ones and we'd see dulpicate key names overwriting each other
- # for various PREFERRED_PROVIDERS
- if isinstance(e, bb.event.RecipePreFinalise):
- if d.getVar("TARGET_PREFIX") == d.getVar("SDK_PREFIX"):
- d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils")
- d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc")
- d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++")
- d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs")
-
- if isinstance(e, bb.event.RecipeParsed):
- #
- # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set
- # skip parsing for all the other providers which will mean they get uninstalled from the
- # sysroot since they're now "unreachable". This makes switching virtual/kernel work in
- # particular.
- #
- pn = d.getVar('PN')
- source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False)
- if not source_mirror_fetch:
- provs = (d.getVar("PROVIDES") or "").split()
- multiprovidersallowed = (d.getVar("BB_MULTI_PROVIDER_ALLOWED") or "").split()
- for p in provs:
- if p.startswith("virtual/") and p not in multiprovidersallowed:
- profprov = d.getVar("PREFERRED_PROVIDER_" + p)
- if profprov and pn != profprov:
- raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn))
-}
-
-CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
-CLEANBROKEN = "0"
-
-addtask configure after do_patch
-do_configure[dirs] = "${B}"
-base_do_configure() {
- if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
- if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
- cd ${B}
- if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then
- oe_runmake clean
- fi
- # -ignore_readdir_race does not work correctly with -delete;
- # use xargs to avoid spurious build failures
- find ${B} -ignore_readdir_race -name \*.la -type f -print0 | xargs -0 rm -f
- fi
- fi
- if [ -n "${CONFIGURESTAMPFILE}" ]; then
- mkdir -p `dirname ${CONFIGURESTAMPFILE}`
- echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
- fi
-}
-
-addtask compile after do_configure
-do_compile[dirs] = "${B}"
-base_do_compile() {
- if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
- oe_runmake || die "make failed"
- else
- bbnote "nothing to compile"
- fi
-}
-
-addtask install after do_compile
-do_install[dirs] = "${B}"
-# Remove and re-create ${D} so that is it guaranteed to be empty
-do_install[cleandirs] = "${D}"
-
-base_do_install() {
- :
-}
-
-base_do_package() {
- :
-}
-
-addtask build after do_populate_sysroot
-do_build[noexec] = "1"
-do_build[recrdeptask] += "do_deploy"
-do_build () {
- :
-}
-
-def set_packagetriplet(d):
- archs = []
- tos = []
- tvs = []
-
- archs.append(d.getVar("PACKAGE_ARCHS").split())
- tos.append(d.getVar("TARGET_OS"))
- tvs.append(d.getVar("TARGET_VENDOR"))
-
- def settriplet(d, varname, archs, tos, tvs):
- triplets = []
- for i in range(len(archs)):
- for arch in archs[i]:
- triplets.append(arch + tvs[i] + "-" + tos[i])
- triplets.reverse()
- d.setVar(varname, " ".join(triplets))
-
- settriplet(d, "PKGTRIPLETS", archs, tos, tvs)
-
- variants = d.getVar("MULTILIB_VARIANTS") or ""
- for item in variants.split():
- localdata = bb.data.createCopy(d)
- overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
- localdata.setVar("OVERRIDES", overrides)
-
- archs.append(localdata.getVar("PACKAGE_ARCHS").split())
- tos.append(localdata.getVar("TARGET_OS"))
- tvs.append(localdata.getVar("TARGET_VENDOR"))
-
- settriplet(d, "PKGMLTRIPLETS", archs, tos, tvs)
-
-python () {
- import string, re
-
- # Handle backfilling
- oe.utils.features_backfill("DISTRO_FEATURES", d)
- oe.utils.features_backfill("MACHINE_FEATURES", d)
-
- if d.getVar("S")[-1] == '/':
- bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
- if d.getVar("B")[-1] == '/':
- bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
-
- if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")):
- d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}")
- if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):
- d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}")
-
- # To add a recipe to the skip list , set:
- # SKIP_RECIPE[pn] = "message"
- pn = d.getVar('PN')
- skip_msg = d.getVarFlag('SKIP_RECIPE', pn)
- if skip_msg:
- bb.debug(1, "Skipping %s %s" % (pn, skip_msg))
- raise bb.parse.SkipRecipe("Recipe will be skipped because: %s" % (skip_msg))
-
- # Handle PACKAGECONFIG
- #
- # These take the form:
- #
- # PACKAGECONFIG ??= "<default options>"
- # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends,foo_runtime_recommends,foo_conflict_packageconfig"
- pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
- if pkgconfigflags:
- pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
- pn = d.getVar("PN")
-
- mlprefix = d.getVar("MLPREFIX")
-
- def expandFilter(appends, extension, prefix):
- appends = bb.utils.explode_deps(d.expand(" ".join(appends)))
- newappends = []
- for a in appends:
- if a.endswith("-native") or ("-cross-" in a):
- newappends.append(a)
- elif a.startswith("virtual/"):
- subs = a.split("/", 1)[1]
- if subs.startswith(prefix):
- newappends.append(a + extension)
- else:
- newappends.append("virtual/" + prefix + subs + extension)
- else:
- if a.startswith(prefix):
- newappends.append(a + extension)
- else:
- newappends.append(prefix + a + extension)
- return newappends
-
- def appendVar(varname, appends):
- if not appends:
- return
- if varname.find("DEPENDS") != -1:
- if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d) :
- appends = expandFilter(appends, "", "nativesdk-")
- elif bb.data.inherits_class('native', d):
- appends = expandFilter(appends, "-native", "")
- elif mlprefix:
- appends = expandFilter(appends, "", mlprefix)
- varname = d.expand(varname)
- d.appendVar(varname, " " + " ".join(appends))
-
- extradeps = []
- extrardeps = []
- extrarrecs = []
- extraconf = []
- for flag, flagval in sorted(pkgconfigflags.items()):
- items = flagval.split(",")
- num = len(items)
- if num > 6:
- bb.error("%s: PACKAGECONFIG[%s] Only enable,disable,depend,rdepend,rrecommend,conflict_packageconfig can be specified!"
- % (d.getVar('PN'), flag))
-
- if flag in pkgconfig:
- if num >= 3 and items[2]:
- extradeps.append(items[2])
- if num >= 4 and items[3]:
- extrardeps.append(items[3])
- if num >= 5 and items[4]:
- extrarrecs.append(items[4])
- if num >= 1 and items[0]:
- extraconf.append(items[0])
- elif num >= 2 and items[1]:
- extraconf.append(items[1])
-
- if num >= 6 and items[5]:
- conflicts = set(items[5].split())
- invalid = conflicts.difference(set(pkgconfigflags.keys()))
- if invalid:
- bb.error("%s: PACKAGECONFIG[%s] Invalid conflict package config%s '%s' specified."
- % (d.getVar('PN'), flag, 's' if len(invalid) > 1 else '', ' '.join(invalid)))
-
- if flag in pkgconfig:
- intersec = conflicts.intersection(set(pkgconfig))
- if intersec:
- bb.fatal("%s: PACKAGECONFIG[%s] Conflict package config%s '%s' set in PACKAGECONFIG."
- % (d.getVar('PN'), flag, 's' if len(intersec) > 1 else '', ' '.join(intersec)))
-
- appendVar('DEPENDS', extradeps)
- appendVar('RDEPENDS:${PN}', extrardeps)
- appendVar('RRECOMMENDS:${PN}', extrarrecs)
- appendVar('PACKAGECONFIG_CONFARGS', extraconf)
-
- pn = d.getVar('PN')
- license = d.getVar('LICENSE')
- if license == "INVALID" and pn != "defaultpkgname":
- bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
-
- if bb.data.inherits_class('license', d):
- check_license_format(d)
- unmatched_license_flags = check_license_flags(d)
- if unmatched_license_flags:
- if len(unmatched_license_flags) == 1:
- message = "because it has a restricted license '{0}'. Which is not listed in LICENSE_FLAGS_ACCEPTED".format(unmatched_license_flags[0])
- else:
- message = "because it has restricted licenses {0}. Which are not listed in LICENSE_FLAGS_ACCEPTED".format(
- ", ".join("'{0}'".format(f) for f in unmatched_license_flags))
- bb.debug(1, "Skipping %s %s" % (pn, message))
- raise bb.parse.SkipRecipe(message)
-
- # If we're building a target package we need to use fakeroot (pseudo)
- # in order to capture permissions, owners, groups and special files
- if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
- d.appendVarFlag('do_prepare_recipe_sysroot', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
- d.appendVarFlag('do_install', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
- d.setVarFlag('do_install', 'fakeroot', '1')
- d.appendVarFlag('do_package', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
- d.setVarFlag('do_package', 'fakeroot', '1')
- d.setVarFlag('do_package_setscene', 'fakeroot', '1')
- d.appendVarFlag('do_package_setscene', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
- d.setVarFlag('do_devshell', 'fakeroot', '1')
- d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
-
- need_machine = d.getVar('COMPATIBLE_MACHINE')
- if need_machine and not d.getVar('PARSE_ALL_RECIPES', False):
- import re
- compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")
- for m in compat_machines:
- if re.match(need_machine, m):
- break
- else:
- raise bb.parse.SkipRecipe("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE'))
-
- source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) or d.getVar('PARSE_ALL_RECIPES', False)
- if not source_mirror_fetch:
- need_host = d.getVar('COMPATIBLE_HOST')
- if need_host:
- import re
- this_host = d.getVar('HOST_SYS')
- if not re.match(need_host, this_host):
- raise bb.parse.SkipRecipe("incompatible with host %s (not in COMPATIBLE_HOST)" % this_host)
-
- bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
-
- check_license = False if pn.startswith("nativesdk-") else True
- for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}",
- "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}",
- "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]:
- if pn.endswith(d.expand(t)):
- check_license = False
- if pn.startswith("gcc-source-"):
- check_license = False
-
- if check_license and bad_licenses:
- bad_licenses = expand_wildcard_licenses(d, bad_licenses)
-
- exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split()
-
- for lic_exception in exceptions:
- if ":" in lic_exception:
- lic_exception = lic_exception.split(":")[1]
- if lic_exception in oe.license.obsolete_license_list():
- bb.fatal("Obsolete license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception)
-
- pkgs = d.getVar('PACKAGES').split()
- skipped_pkgs = {}
- unskipped_pkgs = []
- for pkg in pkgs:
- remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions)
-
- incompatible_lic = incompatible_license(d, remaining_bad_licenses, pkg)
- if incompatible_lic:
- skipped_pkgs[pkg] = incompatible_lic
- else:
- unskipped_pkgs.append(pkg)
-
- if unskipped_pkgs:
- for pkg in skipped_pkgs:
- bb.debug(1, "Skipping the package %s at do_rootfs because of incompatible license(s): %s" % (pkg, ' '.join(skipped_pkgs[pkg])))
- d.setVar('_exclude_incompatible-' + pkg, ' '.join(skipped_pkgs[pkg]))
- for pkg in unskipped_pkgs:
- bb.debug(1, "Including the package %s" % pkg)
- else:
- incompatible_lic = incompatible_license(d, bad_licenses)
- for pkg in skipped_pkgs:
- incompatible_lic += skipped_pkgs[pkg]
- incompatible_lic = sorted(list(set(incompatible_lic)))
-
- if incompatible_lic:
- bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic)))
- raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic))
-
- needsrcrev = False
- srcuri = d.getVar('SRC_URI')
- for uri_string in srcuri.split():
- uri = bb.fetch.URI(uri_string)
- # Also check downloadfilename as the URL path might not be useful for sniffing
- path = uri.params.get("downloadfilename", uri.path)
-
- # HTTP/FTP use the wget fetcher
- if uri.scheme in ("http", "https", "ftp"):
- d.appendVarFlag('do_fetch', 'depends', ' wget-native:do_populate_sysroot')
-
- # Svn packages should DEPEND on subversion-native
- if uri.scheme == "svn":
- needsrcrev = True
- d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot')
-
- # Git packages should DEPEND on git-native
- elif uri.scheme in ("git", "gitsm"):
- needsrcrev = True
- d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot')
-
- # Mercurial packages should DEPEND on mercurial-native
- elif uri.scheme == "hg":
- needsrcrev = True
- d.appendVar("EXTRANATIVEPATH", ' python3-native ')
- d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot')
-
- # Perforce packages support SRCREV = "${AUTOREV}"
- elif uri.scheme == "p4":
- needsrcrev = True
-
- # OSC packages should DEPEND on osc-native
- elif uri.scheme == "osc":
- d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot')
-
- elif uri.scheme == "npm":
- d.appendVarFlag('do_fetch', 'depends', ' nodejs-native:do_populate_sysroot')
-
- elif uri.scheme == "repo":
- needsrcrev = True
- d.appendVarFlag('do_fetch', 'depends', ' repo-native:do_populate_sysroot')
-
- # *.lz4 should DEPEND on lz4-native for unpacking
- if path.endswith('.lz4'):
- d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot')
-
- # *.zst should DEPEND on zstd-native for unpacking
- elif path.endswith('.zst'):
- d.appendVarFlag('do_unpack', 'depends', ' zstd-native:do_populate_sysroot')
-
- # *.lz should DEPEND on lzip-native for unpacking
- elif path.endswith('.lz'):
- d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot')
-
- # *.xz should DEPEND on xz-native for unpacking
- elif path.endswith('.xz') or path.endswith('.txz'):
- d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
- # .zip should DEPEND on unzip-native for unpacking
- elif path.endswith('.zip') or path.endswith('.jar'):
- d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot')
-
- # Some rpm files may be compressed internally using xz (for example, rpms from Fedora)
- elif path.endswith('.rpm'):
- d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
- # *.deb should DEPEND on xz-native for unpacking
- elif path.endswith('.deb'):
- d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
-
- if needsrcrev:
- d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
-
- # Gather all named SRCREVs to add to the sstate hash calculation
- # This anonymous python snippet is called multiple times so we
- # need to be careful to not double up the appends here and cause
- # the base hash to mismatch the task hash
- for uri in srcuri.split():
- parm = bb.fetch.decodeurl(uri)[5]
- uri_names = parm.get("name", "").split(",")
- for uri_name in filter(None, uri_names):
- srcrev_name = "SRCREV_{}".format(uri_name)
- if srcrev_name not in (d.getVarFlag("do_fetch", "vardeps") or "").split():
- d.appendVarFlag("do_fetch", "vardeps", " {}".format(srcrev_name))
-
- set_packagetriplet(d)
-
- # 'multimachine' handling
- mach_arch = d.getVar('MACHINE_ARCH')
- pkg_arch = d.getVar('PACKAGE_ARCH')
-
- if (pkg_arch == mach_arch):
- # Already machine specific - nothing further to do
- return
-
- #
- # We always try to scan SRC_URI for urls with machine overrides
- # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0
- #
- override = d.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH')
- if override != '0':
- paths = []
- fpaths = (d.getVar('FILESPATH') or '').split(':')
- machine = d.getVar('MACHINE')
- for p in fpaths:
- if os.path.basename(p) == machine and os.path.isdir(p):
- paths.append(p)
-
- if paths:
- for s in srcuri.split():
- if not s.startswith("file://"):
- continue
- fetcher = bb.fetch2.Fetch([s], d)
- local = fetcher.localpath(s)
- for mp in paths:
- if local.startswith(mp):
- #bb.note("overriding PACKAGE_ARCH from %s to %s for %s" % (pkg_arch, mach_arch, pn))
- d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
- return
-
- packages = d.getVar('PACKAGES').split()
- for pkg in packages:
- pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg)
-
- # We could look for != PACKAGE_ARCH here but how to choose
- # if multiple differences are present?
- # Look through PACKAGE_ARCHS for the priority order?
- if pkgarch and pkgarch == mach_arch:
- d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
- bb.warn("Recipe %s is marked as only being architecture specific but seems to have machine specific packages?! The recipe may as well mark itself as machine specific directly." % d.getVar("PN"))
-}
-
-addtask cleansstate after do_clean
-python do_cleansstate() {
- sstate_clean_cachefiles(d)
-}
-addtask cleanall after do_cleansstate
-do_cleansstate[nostamp] = "1"
-
-python do_cleanall() {
- src_uri = (d.getVar('SRC_URI') or "").split()
- if not src_uri:
- return
-
- try:
- fetcher = bb.fetch2.Fetch(src_uri, d)
- fetcher.clean()
- except bb.fetch2.BBFetchException as e:
- bb.fatal(str(e))
-}
-do_cleanall[nostamp] = "1"
-
-
-EXPORT_FUNCTIONS do_fetch do_unpack do_configure do_compile do_install do_package
diff --git a/poky/meta/classes/bash-completion.bbclass b/poky/meta/classes/bash-completion.bbclass
deleted file mode 100644
index 803b2ca..0000000
--- a/poky/meta/classes/bash-completion.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-DEPENDS:append:class-target = " bash-completion"
-
-PACKAGES += "${PN}-bash-completion"
-
-FILES:${PN}-bash-completion = "${datadir}/bash-completion ${sysconfdir}/bash_completion.d"
-
-RDEPENDS:${PN}-bash-completion = "bash-completion"
diff --git a/poky/meta/classes/bin_package.bbclass b/poky/meta/classes/bin_package.bbclass
deleted file mode 100644
index f0407e1..0000000
--- a/poky/meta/classes/bin_package.bbclass
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# Common variable and task for the binary package recipe.
-# Basic principle:
-# * The files have been unpacked to ${S} by base.bbclass
-# * Skip do_configure and do_compile
-# * Use do_install to install the files to ${D}
-#
-# Note:
-# The "subdir" parameter in the SRC_URI is useful when the input package
-# is rpm, ipk, deb and so on, for example:
-#
-# SRC_URI = "http://foo.com/foo-1.0-r1.i586.rpm;subdir=foo-1.0"
-#
-# Then the files would be unpacked to ${WORKDIR}/foo-1.0, otherwise
-# they would be in ${WORKDIR}.
-#
-
-# Skip the unwanted steps
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-
-# Install the files to ${D}
-bin_package_do_install () {
- # Do it carefully
- [ -d "${S}" ] || exit 1
- if [ -z "$(ls -A ${S})" ]; then
- bbfatal bin_package has nothing to install. Be sure the SRC_URI unpacks into S.
- fi
- cd ${S}
- install -d ${D}${base_prefix}
- tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - . \
- | tar --no-same-owner -xpf - -C ${D}${base_prefix}
-}
-
-FILES:${PN} = "/"
-
-EXPORT_FUNCTIONS do_install
diff --git a/poky/meta/classes/binconfig-disabled.bbclass b/poky/meta/classes/binconfig-disabled.bbclass
deleted file mode 100644
index e8ac41b..0000000
--- a/poky/meta/classes/binconfig-disabled.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Class to disable binconfig files instead of installing them
-#
-
-# The list of scripts which should be disabled.
-BINCONFIG ?= ""
-
-FILES:${PN}-dev += "${bindir}/*-config"
-
-do_install:append () {
- for x in ${BINCONFIG}; do
- # Make the disabled script emit invalid parameters for those configure
- # scripts which call it without checking the return code.
- echo "#!/bin/sh" > ${D}$x
- echo "echo 'ERROR: $x should not be used, use an alternative such as pkg-config' >&2" >> ${D}$x
- echo "echo '--should-not-have-used-$x'" >> ${D}$x
- echo "exit 1" >> ${D}$x
- chmod +x ${D}$x
- done
-}
-
-SYSROOT_PREPROCESS_FUNCS += "binconfig_disabled_sysroot_preprocess"
-
-binconfig_disabled_sysroot_preprocess () {
- for x in ${BINCONFIG}; do
- configname=`basename $x`
- install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
- install ${D}$x ${SYSROOT_DESTDIR}${bindir_crossscripts}
- done
-}
diff --git a/poky/meta/classes/binconfig.bbclass b/poky/meta/classes/binconfig.bbclass
deleted file mode 100644
index 6e0c882..0000000
--- a/poky/meta/classes/binconfig.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-FILES:${PN}-dev += "${bindir}/*-config"
-
-# The namespaces can clash here hence the two step replace
-def get_binconfig_mangle(d):
- s = "-e ''"
- if not bb.data.inherits_class('native', d):
- optional_quote = r"\(\"\?\)"
- s += " -e 's:=%s${base_libdir}:=\\1OEBASELIBDIR:;'" % optional_quote
- s += " -e 's:=%s${libdir}:=\\1OELIBDIR:;'" % optional_quote
- s += " -e 's:=%s${includedir}:=\\1OEINCDIR:;'" % optional_quote
- s += " -e 's:=%s${datadir}:=\\1OEDATADIR:'" % optional_quote
- s += " -e 's:=%s${prefix}/:=\\1OEPREFIX/:'" % optional_quote
- s += " -e 's:=%s${exec_prefix}/:=\\1OEEXECPREFIX/:'" % optional_quote
- s += " -e 's:-L${libdir}:-LOELIBDIR:;'"
- s += " -e 's:-I${includedir}:-IOEINCDIR:;'"
- s += " -e 's:-L${WORKDIR}:-LOELIBDIR:'"
- s += " -e 's:-I${WORKDIR}:-IOEINCDIR:'"
- s += " -e 's:OEBASELIBDIR:${STAGING_BASELIBDIR}:;'"
- s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'"
- s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'"
- s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'"
- s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'"
- s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'"
- if d.getVar("OE_BINCONFIG_EXTRA_MANGLE", False):
- s += d.getVar("OE_BINCONFIG_EXTRA_MANGLE")
-
- return s
-
-BINCONFIG_GLOB ?= "*-config"
-
-PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess"
-
-binconfig_package_preprocess () {
- for config in `find ${PKGD} -type f -name '${BINCONFIG_GLOB}'`; do
- sed -i \
- -e 's:${STAGING_BASELIBDIR}:${base_libdir}:g;' \
- -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
- -e 's:${STAGING_INCDIR}:${includedir}:g;' \
- -e 's:${STAGING_DATADIR}:${datadir}:' \
- -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \
- $config
- done
-}
-
-SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess"
-
-binconfig_sysroot_preprocess () {
- for config in `find ${S} -type f -name '${BINCONFIG_GLOB}'` `find ${B} -type f -name '${BINCONFIG_GLOB}'`; do
- configname=`basename $config`
- install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
- sed ${@get_binconfig_mangle(d)} $config > ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname
- chmod u+x ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname
- done
-}
diff --git a/poky/meta/classes/buildhistory.bbclass b/poky/meta/classes/buildhistory.bbclass
index 4ba9ec8..395f594 100644
--- a/poky/meta/classes/buildhistory.bbclass
+++ b/poky/meta/classes/buildhistory.bbclass
@@ -6,8 +6,10 @@
# Copyright (C) 2011-2016 Intel Corporation
# Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org>
#
+# SPDX-License-Identifier: MIT
+#
-inherit image-artifact-names
+IMAGE_CLASSES += "image-artifact-names"
BUILDHISTORY_FEATURES ?= "image package sdk"
BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory"
diff --git a/poky/meta/classes/buildstats-summary.bbclass b/poky/meta/classes/buildstats-summary.bbclass
index f9b241b..12e8f17 100644
--- a/poky/meta/classes/buildstats-summary.bbclass
+++ b/poky/meta/classes/buildstats-summary.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Summarize sstate usage at the end of the build
python buildstats_summary () {
import collections
diff --git a/poky/meta/classes/buildstats.bbclass b/poky/meta/classes/buildstats.bbclass
deleted file mode 100644
index 132ecaa..0000000
--- a/poky/meta/classes/buildstats.bbclass
+++ /dev/null
@@ -1,296 +0,0 @@
-BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
-
-################################################################################
-# Build statistics gathering.
-#
-# The CPU and Time gathering/tracking functions and bbevent inspiration
-# were written by Christopher Larson.
-#
-################################################################################
-
-def get_buildprocess_cputime(pid):
- with open("/proc/%d/stat" % pid, "r") as f:
- fields = f.readline().rstrip().split()
- # 13: utime, 14: stime, 15: cutime, 16: cstime
- return sum(int(field) for field in fields[13:16])
-
-def get_process_cputime(pid):
- import resource
- with open("/proc/%d/stat" % pid, "r") as f:
- fields = f.readline().rstrip().split()
- stats = {
- 'utime' : fields[13],
- 'stime' : fields[14],
- 'cutime' : fields[15],
- 'cstime' : fields[16],
- }
- iostats = {}
- if os.path.isfile("/proc/%d/io" % pid):
- with open("/proc/%d/io" % pid, "r") as f:
- while True:
- i = f.readline().strip()
- if not i:
- break
- if not ":" in i:
- # one more extra line is appended (empty or containing "0")
- # most probably due to race condition in kernel while
- # updating IO stats
- break
- i = i.split(": ")
- iostats[i[0]] = i[1]
- resources = resource.getrusage(resource.RUSAGE_SELF)
- childres = resource.getrusage(resource.RUSAGE_CHILDREN)
- return stats, iostats, resources, childres
-
-def get_cputime():
- with open("/proc/stat", "r") as f:
- fields = f.readline().rstrip().split()[1:]
- return sum(int(field) for field in fields)
-
-def set_timedata(var, d, server_time):
- d.setVar(var, server_time)
-
-def get_timedata(var, d, end_time):
- oldtime = d.getVar(var, False)
- if oldtime is None:
- return
- return end_time - oldtime
-
-def set_buildtimedata(var, d):
- import time
- time = time.time()
- cputime = get_cputime()
- proctime = get_buildprocess_cputime(os.getpid())
- d.setVar(var, (time, cputime, proctime))
-
-def get_buildtimedata(var, d):
- import time
- timedata = d.getVar(var, False)
- if timedata is None:
- return
- oldtime, oldcpu, oldproc = timedata
- procdiff = get_buildprocess_cputime(os.getpid()) - oldproc
- cpudiff = get_cputime() - oldcpu
- end_time = time.time()
- timediff = end_time - oldtime
- if cpudiff > 0:
- cpuperc = float(procdiff) * 100 / cpudiff
- else:
- cpuperc = None
- return timediff, cpuperc
-
-def write_task_data(status, logfile, e, d):
- with open(os.path.join(logfile), "a") as f:
- elapsedtime = get_timedata("__timedata_task", d, e.time)
- if elapsedtime:
- f.write(d.expand("${PF}: %s\n" % e.task))
- f.write(d.expand("Elapsed time: %0.2f seconds\n" % elapsedtime))
- cpu, iostats, resources, childres = get_process_cputime(os.getpid())
- if cpu:
- f.write("utime: %s\n" % cpu['utime'])
- f.write("stime: %s\n" % cpu['stime'])
- f.write("cutime: %s\n" % cpu['cutime'])
- f.write("cstime: %s\n" % cpu['cstime'])
- for i in iostats:
- f.write("IO %s: %s\n" % (i, iostats[i]))
- rusages = ["ru_utime", "ru_stime", "ru_maxrss", "ru_minflt", "ru_majflt", "ru_inblock", "ru_oublock", "ru_nvcsw", "ru_nivcsw"]
- for i in rusages:
- f.write("rusage %s: %s\n" % (i, getattr(resources, i)))
- for i in rusages:
- f.write("Child rusage %s: %s\n" % (i, getattr(childres, i)))
- if status == "passed":
- f.write("Status: PASSED \n")
- else:
- f.write("Status: FAILED \n")
- f.write("Ended: %0.2f \n" % e.time)
-
-def write_host_data(logfile, e, d, type):
- import subprocess, os, datetime
- # minimum time allowed for each command to run, in seconds
- time_threshold = 0.5
- limit = 10
- # the total number of commands
- num_cmds = 0
- msg = ""
- if type == "interval":
- # interval at which data will be logged
- interval = d.getVar("BB_HEARTBEAT_EVENT", False)
- if interval is None:
- bb.warn("buildstats: Collecting host data at intervals failed. Set BB_HEARTBEAT_EVENT=\"<interval>\" in conf/local.conf for the interval at which host data will be logged.")
- d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
- return
- interval = int(interval)
- cmds = d.getVar('BB_LOG_HOST_STAT_CMDS_INTERVAL')
- msg = "Host Stats: Collecting data at %d second intervals.\n" % interval
- if cmds is None:
- d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
- bb.warn("buildstats: Collecting host data at intervals failed. Set BB_LOG_HOST_STAT_CMDS_INTERVAL=\"command1 ; command2 ; ... \" in conf/local.conf.")
- return
- if type == "failure":
- cmds = d.getVar('BB_LOG_HOST_STAT_CMDS_FAILURE')
- msg = "Host Stats: Collecting data on failure.\n"
- msg += "Failed at task: " + e.task + "\n"
- if cmds is None:
- d.setVar("BB_LOG_HOST_STAT_ON_FAILURE", "0")
- bb.warn("buildstats: Collecting host data on failure failed. Set BB_LOG_HOST_STAT_CMDS_FAILURE=\"command1 ; command2 ; ... \" in conf/local.conf.")
- return
- c_san = []
- for cmd in cmds.split(";"):
- if len(cmd) == 0:
- continue
- num_cmds += 1
- c_san.append(cmd)
- if num_cmds == 0:
- if type == "interval":
- d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
- if type == "failure":
- d.setVar("BB_LOG_HOST_STAT_ON_FAILURE", "0")
- return
-
- # return if the interval is not enough to run all commands within the specified BB_HEARTBEAT_EVENT interval
- if type == "interval":
- limit = interval / num_cmds
- if limit <= time_threshold:
- d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0")
- bb.warn("buildstats: Collecting host data failed. BB_HEARTBEAT_EVENT interval not enough to run the specified commands. Increase value of BB_HEARTBEAT_EVENT in conf/local.conf.")
- return
-
- # set the environment variables
- path = d.getVar("PATH")
- opath = d.getVar("BB_ORIGENV", False).getVar("PATH")
- ospath = os.environ['PATH']
- os.environ['PATH'] = path + ":" + opath + ":" + ospath
- with open(logfile, "a") as f:
- f.write("Event Time: %f\nDate: %s\n" % (e.time, datetime.datetime.now()))
- f.write("%s" % msg)
- for c in c_san:
- try:
- output = subprocess.check_output(c.split(), stderr=subprocess.STDOUT, timeout=limit).decode('utf-8')
- except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError) as err:
- output = "Error running command: %s\n%s\n" % (c, err)
- f.write("%s\n%s\n" % (c, output))
- # reset the environment
- os.environ['PATH'] = ospath
-
-python run_buildstats () {
- import bb.build
- import bb.event
- import time, subprocess, platform
-
- bn = d.getVar('BUILDNAME')
- ########################################################################
- # bitbake fires HeartbeatEvent even before a build has been
- # triggered, causing BUILDNAME to be None
- ########################################################################
- if bn is not None:
- bsdir = os.path.join(d.getVar('BUILDSTATS_BASE'), bn)
- taskdir = os.path.join(bsdir, d.getVar('PF'))
- if isinstance(e, bb.event.HeartbeatEvent) and bb.utils.to_boolean(d.getVar("BB_LOG_HOST_STAT_ON_INTERVAL")):
- bb.utils.mkdirhier(bsdir)
- write_host_data(os.path.join(bsdir, "host_stats_interval"), e, d, "interval")
-
- if isinstance(e, bb.event.BuildStarted):
- ########################################################################
- # If the kernel was not configured to provide I/O statistics, issue
- # a one time warning.
- ########################################################################
- if not os.path.isfile("/proc/%d/io" % os.getpid()):
- bb.warn("The Linux kernel on your build host was not configured to provide process I/O statistics. (CONFIG_TASK_IO_ACCOUNTING is not set)")
-
- ########################################################################
- # at first pass make the buildstats hierarchy and then
- # set the buildname
- ########################################################################
- bb.utils.mkdirhier(bsdir)
- set_buildtimedata("__timedata_build", d)
- build_time = os.path.join(bsdir, "build_stats")
- # write start of build into build_time
- with open(build_time, "a") as f:
- host_info = platform.uname()
- f.write("Host Info: ")
- for x in host_info:
- if x:
- f.write(x + " ")
- f.write("\n")
- f.write("Build Started: %0.2f \n" % d.getVar('__timedata_build', False)[0])
-
- elif isinstance(e, bb.event.BuildCompleted):
- build_time = os.path.join(bsdir, "build_stats")
- with open(build_time, "a") as f:
- ########################################################################
- # Write build statistics for the build
- ########################################################################
- timedata = get_buildtimedata("__timedata_build", d)
- if timedata:
- time, cpu = timedata
- # write end of build and cpu used into build_time
- f.write("Elapsed time: %0.2f seconds \n" % (time))
- if cpu:
- f.write("CPU usage: %0.1f%% \n" % cpu)
-
- if isinstance(e, bb.build.TaskStarted):
- set_timedata("__timedata_task", d, e.time)
- bb.utils.mkdirhier(taskdir)
- # write into the task event file the name and start time
- with open(os.path.join(taskdir, e.task), "a") as f:
- f.write("Event: %s \n" % bb.event.getName(e))
- f.write("Started: %0.2f \n" % e.time)
-
- elif isinstance(e, bb.build.TaskSucceeded):
- write_task_data("passed", os.path.join(taskdir, e.task), e, d)
- if e.task == "do_rootfs":
- bs = os.path.join(bsdir, "build_stats")
- with open(bs, "a") as f:
- rootfs = d.getVar('IMAGE_ROOTFS')
- if os.path.isdir(rootfs):
- try:
- rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
- stderr=subprocess.STDOUT).decode('utf-8')
- f.write("Uncompressed Rootfs size: %s" % rootfs_size)
- except subprocess.CalledProcessError as err:
- bb.warn("Failed to get rootfs size: %s" % err.output.decode('utf-8'))
-
- elif isinstance(e, bb.build.TaskFailed):
- # Can have a failure before TaskStarted so need to mkdir here too
- bb.utils.mkdirhier(taskdir)
- write_task_data("failed", os.path.join(taskdir, e.task), e, d)
- ########################################################################
- # Lets make things easier and tell people where the build failed in
- # build_status. We do this here because BuildCompleted triggers no
- # matter what the status of the build actually is
- ########################################################################
- build_status = os.path.join(bsdir, "build_stats")
- with open(build_status, "a") as f:
- f.write(d.expand("Failed at: ${PF} at task: %s \n" % e.task))
- if bb.utils.to_boolean(d.getVar("BB_LOG_HOST_STAT_ON_FAILURE")):
- write_host_data(os.path.join(bsdir, "host_stats_%s_failure" % e.task), e, d, "failure")
-}
-
-addhandler run_buildstats
-run_buildstats[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.event.HeartbeatEvent bb.build.TaskStarted bb.build.TaskSucceeded bb.build.TaskFailed"
-
-python runqueue_stats () {
- import buildstats
- from bb import event, runqueue
- # We should not record any samples before the first task has started,
- # because that's the first activity shown in the process chart.
- # Besides, at that point we are sure that the build variables
- # are available that we need to find the output directory.
- # The persistent SystemStats is stored in the datastore and
- # closed when the build is done.
- system_stats = d.getVar('_buildstats_system_stats', False)
- if not system_stats and isinstance(e, (bb.runqueue.sceneQueueTaskStarted, bb.runqueue.runQueueTaskStarted)):
- system_stats = buildstats.SystemStats(d)
- d.setVar('_buildstats_system_stats', system_stats)
- if system_stats:
- # Ensure that we sample at important events.
- done = isinstance(e, bb.event.BuildCompleted)
- if system_stats.sample(e, force=done):
- d.setVar('_buildstats_system_stats', system_stats)
- if done:
- system_stats.close()
- d.delVar('_buildstats_system_stats')
-}
-
-addhandler runqueue_stats
-runqueue_stats[eventmask] = "bb.runqueue.sceneQueueTaskStarted bb.runqueue.runQueueTaskStarted bb.event.HeartbeatEvent bb.event.BuildCompleted bb.event.MonitorDiskEvent"
diff --git a/poky/meta/classes/cargo.bbclass b/poky/meta/classes/cargo.bbclass
deleted file mode 100644
index 4a780a5..0000000
--- a/poky/meta/classes/cargo.bbclass
+++ /dev/null
@@ -1,90 +0,0 @@
-##
-## Purpose:
-## This class is used by any recipes that are built using
-## Cargo.
-
-inherit cargo_common
-
-# the binary we will use
-CARGO = "cargo"
-
-# We need cargo to compile for the target
-BASEDEPENDS:append = " cargo-native"
-
-# Ensure we get the right rust variant
-DEPENDS:append:class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
-DEPENDS:append:class-nativesdk = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
-DEPENDS:append:class-native = " rust-native"
-
-# Enable build separation
-B = "${WORKDIR}/build"
-
-# In case something fails in the build process, give a bit more feedback on
-# where the issue occured
-export RUST_BACKTRACE = "1"
-
-# The directory of the Cargo.toml relative to the root directory, per default
-# assume there's a Cargo.toml directly in the root directory
-CARGO_SRC_DIR ??= ""
-
-# The actual path to the Cargo.toml
-MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
-
-RUSTFLAGS ??= ""
-BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
-
-# This is based on the content of CARGO_BUILD_FLAGS and generally will need to
-# change if CARGO_BUILD_FLAGS changes.
-BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_TARGET_SUBDIR="${HOST_SYS}/${BUILD_DIR}"
-oe_cargo_build () {
- export RUSTFLAGS="${RUSTFLAGS}"
- export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
- bbnote "cargo = $(which ${CARGO})"
- bbnote "rustc = $(which ${RUSTC})"
- bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
- "${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
-}
-
-do_compile[progress] = "outof:\s+(\d+)/(\d+)"
-cargo_do_compile () {
- oe_cargo_fix_env
- oe_cargo_build
-}
-
-cargo_do_install () {
- local have_installed=false
- for tgt in "${B}/target/${CARGO_TARGET_SUBDIR}/"*; do
- case $tgt in
- *.so|*.rlib)
- install -d "${D}${rustlibdir}"
- install -m755 "$tgt" "${D}${rustlibdir}"
- have_installed=true
- ;;
- *examples)
- if [ -d "$tgt" ]; then
- for example in "$tgt/"*; do
- if [ -f "$example" ] && [ -x "$example" ]; then
- install -d "${D}${bindir}"
- install -m755 "$example" "${D}${bindir}"
- have_installed=true
- fi
- done
- fi
- ;;
- *)
- if [ -f "$tgt" ] && [ -x "$tgt" ]; then
- install -d "${D}${bindir}"
- install -m755 "$tgt" "${D}${bindir}"
- have_installed=true
- fi
- ;;
- esac
- done
- if ! $have_installed; then
- die "Did not find anything to install"
- fi
-}
-
-EXPORT_FUNCTIONS do_compile do_install
diff --git a/poky/meta/classes/cargo_common.bbclass b/poky/meta/classes/cargo_common.bbclass
deleted file mode 100644
index 39f3282..0000000
--- a/poky/meta/classes/cargo_common.bbclass
+++ /dev/null
@@ -1,124 +0,0 @@
-##
-## Purpose:
-## This class is to support building with cargo. It
-## must be different than cargo.bbclass because Rust
-## now builds with Cargo but cannot use cargo.bbclass
-## due to dependencies and assumptions in cargo.bbclass
-## that Rust & Cargo are already installed. So this
-## is used by cargo.bbclass and Rust
-##
-
-# add crate fetch support
-inherit rust-common
-
-# Where we download our registry and dependencies to
-export CARGO_HOME = "${WORKDIR}/cargo_home"
-
-# The pkg-config-rs library used by cargo build scripts disables itself when
-# cross compiling unless this is defined. We set up pkg-config appropriately
-# for cross compilation, so tell it we know better than it.
-export PKG_CONFIG_ALLOW_CROSS = "1"
-
-# Don't instruct cargo to use crates downloaded by bitbake. Some rust packages,
-# for example the rust compiler itself, come with their own vendored sources.
-# Specifying two [source.crates-io] will not work.
-CARGO_DISABLE_BITBAKE_VENDORING ?= "0"
-
-# Used by libstd-rs to point to the vendor dir included in rustc src
-CARGO_VENDORING_DIRECTORY ?= "${CARGO_HOME}/bitbake"
-
-CARGO_RUST_TARGET_CCLD ?= "${RUST_TARGET_CCLD}"
-cargo_common_do_configure () {
- mkdir -p ${CARGO_HOME}/bitbake
-
- cat <<- EOF > ${CARGO_HOME}/config
- # EXTRA_OECARGO_PATHS
- paths = [
- $(for p in ${EXTRA_OECARGO_PATHS}; do echo \"$p\",; done)
- ]
- EOF
-
- cat <<- EOF >> ${CARGO_HOME}/config
-
- # Local mirror vendored by bitbake
- [source.bitbake]
- directory = "${CARGO_VENDORING_DIRECTORY}"
- EOF
-
- if [ ${CARGO_DISABLE_BITBAKE_VENDORING} = "0" ]; then
- cat <<- EOF >> ${CARGO_HOME}/config
-
- [source.crates-io]
- replace-with = "bitbake"
- local-registry = "/nonexistant"
- EOF
- fi
-
- cat <<- EOF >> ${CARGO_HOME}/config
-
- [http]
- # Multiplexing can't be enabled because http2 can't be enabled
- # in curl-native without dependency loops
- multiplexing = false
-
- # Ignore the hard coded and incorrect path to certificates
- cainfo = "${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt"
-
- EOF
-
- cat <<- EOF >> ${CARGO_HOME}/config
-
- # HOST_SYS
- [target.${HOST_SYS}]
- linker = "${CARGO_RUST_TARGET_CCLD}"
- EOF
-
- if [ "${HOST_SYS}" != "${BUILD_SYS}" ]; then
- cat <<- EOF >> ${CARGO_HOME}/config
-
- # BUILD_SYS
- [target.${BUILD_SYS}]
- linker = "${RUST_BUILD_CCLD}"
- EOF
- fi
-
- # Put build output in build directory preferred by bitbake instead of
- # inside source directory unless they are the same
- if [ "${B}" != "${S}" ]; then
- cat <<- EOF >> ${CARGO_HOME}/config
-
- [build]
- # Use out of tree build destination to avoid poluting the source tree
- target-dir = "${B}/target"
- EOF
- fi
-
- cat <<- EOF >> ${CARGO_HOME}/config
-
- [term]
- progress.when = 'always'
- progress.width = 80
- EOF
-}
-
-oe_cargo_fix_env () {
- export CC="${RUST_TARGET_CC}"
- export CXX="${RUST_TARGET_CXX}"
- export CFLAGS="${CFLAGS}"
- export CXXFLAGS="${CXXFLAGS}"
- export AR="${AR}"
- export TARGET_CC="${RUST_TARGET_CC}"
- export TARGET_CXX="${RUST_TARGET_CXX}"
- export TARGET_CFLAGS="${CFLAGS}"
- export TARGET_CXXFLAGS="${CXXFLAGS}"
- export TARGET_AR="${AR}"
- export HOST_CC="${RUST_BUILD_CC}"
- export HOST_CXX="${RUST_BUILD_CXX}"
- export HOST_CFLAGS="${BUILD_CFLAGS}"
- export HOST_CXXFLAGS="${BUILD_CXXFLAGS}"
- export HOST_AR="${BUILD_AR}"
-}
-
-EXTRA_OECARGO_PATHS ??= ""
-
-EXPORT_FUNCTIONS do_configure
diff --git a/poky/meta/classes/ccache.bbclass b/poky/meta/classes/ccache.bbclass
index 4532894..34becb6 100644
--- a/poky/meta/classes/ccache.bbclass
+++ b/poky/meta/classes/ccache.bbclass
@@ -1,4 +1,10 @@
#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
# Usage:
# - Enable ccache
# Add the following line to a conffile such as conf/local.conf:
diff --git a/poky/meta/classes/ccmake.bbclass b/poky/meta/classes/ccmake.bbclass
index df5134a..c5b4bf6 100644
--- a/poky/meta/classes/ccmake.bbclass
+++ b/poky/meta/classes/ccmake.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
inherit terminal
python do_ccmake() {
diff --git a/poky/meta/classes/chrpath.bbclass b/poky/meta/classes/chrpath.bbclass
index 26b984c..1aecb4d 100644
--- a/poky/meta/classes/chrpath.bbclass
+++ b/poky/meta/classes/chrpath.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
CHRPATH_BIN ?= "chrpath"
PREPROCESS_RELOCATE_DIRS ?= ""
diff --git a/poky/meta/classes/cmake.bbclass b/poky/meta/classes/cmake.bbclass
deleted file mode 100644
index d9bcddb..0000000
--- a/poky/meta/classes/cmake.bbclass
+++ /dev/null
@@ -1,217 +0,0 @@
-# Path to the CMake file to process.
-OECMAKE_SOURCEPATH ??= "${S}"
-
-DEPENDS:prepend = "cmake-native "
-B = "${WORKDIR}/build"
-
-# What CMake generator to use.
-# The supported options are "Unix Makefiles" or "Ninja".
-OECMAKE_GENERATOR ?= "Ninja"
-
-python() {
- generator = d.getVar("OECMAKE_GENERATOR")
- if "Unix Makefiles" in generator:
- args = "-G '" + generator + "' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE")
- d.setVar("OECMAKE_GENERATOR_ARGS", args)
- d.setVarFlag("do_compile", "progress", "percent")
- elif "Ninja" in generator:
- args = "-G '" + generator + "' -DCMAKE_MAKE_PROGRAM=ninja"
- d.appendVar("DEPENDS", " ninja-native")
- d.setVar("OECMAKE_GENERATOR_ARGS", args)
- d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+")
- else:
- bb.fatal("Unknown CMake Generator %s" % generator)
-}
-OECMAKE_AR ?= "${AR}"
-
-# Compiler flags
-OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
-OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
-OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
-OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
-
-def oecmake_map_compiler(compiler, d):
- args = d.getVar(compiler).split()
- if args[0] == "ccache":
- return args[1], args[0]
- return args[0], ""
-
-# C/C++ Compiler (without cpu arch/tune arguments)
-OECMAKE_C_COMPILER ?= "${@oecmake_map_compiler('CC', d)[0]}"
-OECMAKE_C_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CC', d)[1]}"
-OECMAKE_CXX_COMPILER ?= "${@oecmake_map_compiler('CXX', d)[0]}"
-OECMAKE_CXX_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CXX', d)[1]}"
-
-# clear compiler vars for allarch to avoid sig hash difference
-OECMAKE_C_COMPILER_allarch = ""
-OECMAKE_C_COMPILER_LAUNCHER_allarch = ""
-OECMAKE_CXX_COMPILER_allarch = ""
-OECMAKE_CXX_COMPILER_LAUNCHER_allarch = ""
-
-OECMAKE_RPATH ?= ""
-OECMAKE_PERLNATIVE_DIR ??= ""
-OECMAKE_EXTRA_ROOT_PATH ?= ""
-
-OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY"
-OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM:class-native = "BOTH"
-
-EXTRA_OECMAKE:append = " ${PACKAGECONFIG_CONFARGS}"
-
-export CMAKE_BUILD_PARALLEL_LEVEL
-CMAKE_BUILD_PARALLEL_LEVEL:task-compile = "${@oe.utils.parallel_make(d, False)}"
-CMAKE_BUILD_PARALLEL_LEVEL:task-install = "${@oe.utils.parallel_make(d, True)}"
-
-OECMAKE_TARGET_COMPILE ?= "all"
-OECMAKE_TARGET_INSTALL ?= "install"
-
-def map_host_os_to_system_name(host_os):
- if host_os.startswith('mingw'):
- return 'Windows'
- if host_os.startswith('linux'):
- return 'Linux'
- return host_os
-
-# CMake expects target architectures in the format of uname(2),
-# which do not always match TARGET_ARCH, so all the necessary
-# conversions should happen here.
-def map_host_arch_to_uname_arch(host_arch):
- if host_arch == "powerpc":
- return "ppc"
- if host_arch == "powerpc64le":
- return "ppc64le"
- if host_arch == "powerpc64":
- return "ppc64"
- return host_arch
-
-cmake_do_generate_toolchain_file() {
- if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
- cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )"
- fi
- cat > ${WORKDIR}/toolchain.cmake <<EOF
-# CMake system name must be something like "Linux".
-# This is important for cross-compiling.
-$cmake_crosscompiling
-set( CMAKE_SYSTEM_NAME ${@map_host_os_to_system_name(d.getVar('HOST_OS'))} )
-set( CMAKE_SYSTEM_PROCESSOR ${@map_host_arch_to_uname_arch(d.getVar('HOST_ARCH'))} )
-set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
-set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
-set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
-set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
-set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
-find_program( CMAKE_AR ${OECMAKE_AR} DOC "Archiver" REQUIRED )
-
-set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
-set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
-set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
-set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
-set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
-set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
-set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
-set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
-
-# only search in the paths provided so cmake doesnt pick
-# up libraries and tools from the native build machine
-set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${STAGING_DIR_NATIVE} ${CROSS_DIR} ${OECMAKE_PERLNATIVE_DIR} ${OECMAKE_EXTRA_ROOT_PATH} ${EXTERNAL_TOOLCHAIN} ${HOSTTOOLS_DIR})
-set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ${OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM} )
-set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-set( CMAKE_PROGRAM_PATH "/" )
-
-# Use qt.conf settings
-set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
-
-# We need to set the rpath to the correct directory as cmake does not provide any
-# directory as rpath by default
-set( CMAKE_INSTALL_RPATH ${OECMAKE_RPATH} )
-
-# Use RPATHs relative to build directory for reproducibility
-set( CMAKE_BUILD_RPATH_USE_ORIGIN ON )
-
-# Use our cmake modules
-list(APPEND CMAKE_MODULE_PATH "${STAGING_DATADIR}/cmake/Modules/")
-
-# add for non /usr/lib libdir, e.g. /usr/lib64
-set( CMAKE_LIBRARY_PATH ${libdir} ${base_libdir})
-
-# add include dir to implicit includes in case it differs from /usr/include
-list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${includedir})
-list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${includedir})
-
-EOF
-}
-
-addtask generate_toolchain_file after do_patch before do_configure
-
-CONFIGURE_FILES = "CMakeLists.txt"
-
-do_configure[cleandirs] = "${@d.getVar('B') if d.getVar('S') != d.getVar('B') else ''}"
-
-cmake_do_configure() {
- if [ "${OECMAKE_BUILDPATH}" ]; then
- bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH. The default behaviour is now out-of-tree builds with B=WORKDIR/build."
- fi
-
- if [ "${S}" = "${B}" ]; then
- find ${B} -name CMakeFiles -or -name Makefile -or -name cmake_install.cmake -or -name CMakeCache.txt -delete
- fi
-
- # Just like autotools cmake can use a site file to cache result that need generated binaries to run
- if [ -e ${WORKDIR}/site-file.cmake ] ; then
- oecmake_sitefile="-C ${WORKDIR}/site-file.cmake"
- else
- oecmake_sitefile=
- fi
-
- cmake \
- ${OECMAKE_GENERATOR_ARGS} \
- $oecmake_sitefile \
- ${OECMAKE_SOURCEPATH} \
- -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
- -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \
- -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \
- -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \
- -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
- -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix') + '/')} \
- -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \
- -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \
- -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \
- -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \
- -DPYTHON_EXECUTABLE:PATH=${PYTHON} \
- -DPython_EXECUTABLE:PATH=${PYTHON} \
- -DPython3_EXECUTABLE:PATH=${PYTHON} \
- -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
- -DCMAKE_INSTALL_SO_NO_EXE=0 \
- -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
- -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
- -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON \
- -DFETCHCONTENT_FULLY_DISCONNECTED=ON \
- ${EXTRA_OECMAKE} \
- -Wno-dev
-}
-
-# To disable verbose cmake logs for a given recipe or globally config metadata e.g. local.conf
-# add following
-#
-# CMAKE_VERBOSE = ""
-#
-
-CMAKE_VERBOSE ??= "VERBOSE=1"
-
-# Then run do_compile again
-cmake_runcmake_build() {
- bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build '${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
- eval ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build '${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
-}
-
-cmake_do_compile() {
- cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
-}
-
-cmake_do_install() {
- DESTDIR='${D}' cmake_runcmake_build --target ${OECMAKE_TARGET_INSTALL}
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file
diff --git a/poky/meta/classes/cml1.bbclass b/poky/meta/classes/cml1.bbclass
deleted file mode 100644
index d319d66..0000000
--- a/poky/meta/classes/cml1.bbclass
+++ /dev/null
@@ -1,101 +0,0 @@
-# returns all the elements from the src uri that are .cfg files
-def find_cfgs(d):
- sources=src_patches(d, True)
- sources_list=[]
- for s in sources:
- if s.endswith('.cfg'):
- sources_list.append(s)
-
- return sources_list
-
-cml1_do_configure() {
- set -e
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- yes '' | oe_runmake oldconfig
-}
-
-EXPORT_FUNCTIONS do_configure
-addtask configure after do_unpack do_patch before do_compile
-
-inherit terminal
-
-OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC"
-HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
-HOSTLDFLAGS = "${BUILD_LDFLAGS}"
-CROSS_CURSES_LIB = "-lncurses -ltinfo"
-CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"'
-TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
-
-KCONFIG_CONFIG_COMMAND ??= "menuconfig"
-KCONFIG_CONFIG_ROOTDIR ??= "${B}"
-python do_menuconfig() {
- import shutil
-
- config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config")
- configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config.orig")
-
- try:
- mtime = os.path.getmtime(config)
- shutil.copy(config, configorig)
- except OSError:
- mtime = 0
-
- # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
- d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig")
- d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig")
- d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}")
- d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1")
- # ensure that environment variables are overwritten with this tasks 'd' values
- d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
-
- oe_terminal("sh -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
- d.getVar('PN') + ' Configuration', d)
-
- # FIXME this check can be removed when the minimum bitbake version has been bumped
- if hasattr(bb.build, 'write_taint'):
- try:
- newmtime = os.path.getmtime(config)
- except OSError:
- newmtime = 0
-
- if newmtime > mtime:
- bb.note("Configuration changed, recompile will be forced")
- bb.build.write_taint('do_compile', d)
-}
-do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
-do_menuconfig[nostamp] = "1"
-do_menuconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
-addtask menuconfig after do_configure
-
-python do_diffconfig() {
- import shutil
- import subprocess
-
- workdir = d.getVar('WORKDIR')
- fragment = workdir + '/fragment.cfg'
- configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config.orig")
- config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config")
-
- try:
- md5newconfig = bb.utils.md5_file(configorig)
- md5config = bb.utils.md5_file(config)
- isdiff = md5newconfig != md5config
- except IOError as e:
- bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
-
- if isdiff:
- statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment
- subprocess.call(statement, shell=True)
- # No need to check the exit code as we know it's going to be
- # non-zero, but that's what we expect.
- shutil.copy(configorig, config)
-
- bb.plain("Config fragment has been dumped into:\n %s" % fragment)
- else:
- if os.path.exists(fragment):
- os.unlink(fragment)
-}
-
-do_diffconfig[nostamp] = "1"
-do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
-addtask diffconfig
diff --git a/poky/meta/classes/compress_doc.bbclass b/poky/meta/classes/compress_doc.bbclass
deleted file mode 100644
index 379b6c1..0000000
--- a/poky/meta/classes/compress_doc.bbclass
+++ /dev/null
@@ -1,263 +0,0 @@
-# Compress man pages in ${mandir} and info pages in ${infodir}
-#
-# 1. The doc will be compressed to gz format by default.
-#
-# 2. It will automatically correct the compressed doc which is not
-# in ${DOC_COMPRESS} but in ${DOC_COMPRESS_LIST} to the format
-# of ${DOC_COMPRESS} policy
-#
-# 3. It is easy to add a new type compression by editing
-# local.conf, such as:
-# DOC_COMPRESS_LIST:append = ' abc'
-# DOC_COMPRESS = 'abc'
-# DOC_COMPRESS_CMD[abc] = 'abc compress cmd ***'
-# DOC_DECOMPRESS_CMD[abc] = 'abc decompress cmd ***'
-
-# All supported compression policy
-DOC_COMPRESS_LIST ?= "gz xz bz2"
-
-# Compression policy, must be one of ${DOC_COMPRESS_LIST}
-DOC_COMPRESS ?= "gz"
-
-# Compression shell command
-DOC_COMPRESS_CMD[gz] ?= 'gzip -v -9 -n'
-DOC_COMPRESS_CMD[bz2] ?= "bzip2 -v -9"
-DOC_COMPRESS_CMD[xz] ?= "xz -v"
-
-# Decompression shell command
-DOC_DECOMPRESS_CMD[gz] ?= 'gunzip -v'
-DOC_DECOMPRESS_CMD[bz2] ?= "bunzip2 -v"
-DOC_DECOMPRESS_CMD[xz] ?= "unxz -v"
-
-PACKAGE_PREPROCESS_FUNCS += "package_do_compress_doc compress_doc_updatealternatives"
-python package_do_compress_doc() {
- compress_mode = d.getVar('DOC_COMPRESS')
- compress_list = (d.getVar('DOC_COMPRESS_LIST') or '').split()
- if compress_mode not in compress_list:
- bb.fatal('Compression policy %s not supported (not listed in %s)\n' % (compress_mode, compress_list))
-
- dvar = d.getVar('PKGD')
- compress_cmds = {}
- decompress_cmds = {}
- for mode in compress_list:
- compress_cmds[mode] = d.getVarFlag('DOC_COMPRESS_CMD', mode)
- decompress_cmds[mode] = d.getVarFlag('DOC_DECOMPRESS_CMD', mode)
-
- mandir = os.path.abspath(dvar + os.sep + d.getVar("mandir"))
- if os.path.exists(mandir):
- # Decompress doc files which format is not compress_mode
- decompress_doc(mandir, compress_mode, decompress_cmds)
- compress_doc(mandir, compress_mode, compress_cmds)
-
- infodir = os.path.abspath(dvar + os.sep + d.getVar("infodir"))
- if os.path.exists(infodir):
- # Decompress doc files which format is not compress_mode
- decompress_doc(infodir, compress_mode, decompress_cmds)
- compress_doc(infodir, compress_mode, compress_cmds)
-}
-
-def _get_compress_format(file, compress_format_list):
- for compress_format in compress_format_list:
- compress_suffix = '.' + compress_format
- if file.endswith(compress_suffix):
- return compress_format
-
- return ''
-
-# Collect hardlinks to dict, each element in dict lists hardlinks
-# which points to the same doc file.
-# {hardlink10: [hardlink11, hardlink12],,,}
-# The hardlink10, hardlink11 and hardlink12 are the same file.
-def _collect_hardlink(hardlink_dict, file):
- for hardlink in hardlink_dict:
- # Add to the existed hardlink
- if os.path.samefile(hardlink, file):
- hardlink_dict[hardlink].append(file)
- return hardlink_dict
-
- hardlink_dict[file] = []
- return hardlink_dict
-
-def _process_hardlink(hardlink_dict, compress_mode, shell_cmds, decompress=False):
- import subprocess
- for target in hardlink_dict:
- if decompress:
- compress_format = _get_compress_format(target, shell_cmds.keys())
- cmd = "%s -f %s" % (shell_cmds[compress_format], target)
- bb.note('decompress hardlink %s' % target)
- else:
- cmd = "%s -f %s" % (shell_cmds[compress_mode], target)
- bb.note('compress hardlink %s' % target)
- (retval, output) = subprocess.getstatusoutput(cmd)
- if retval:
- bb.warn("de/compress file failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
- return
-
- for hardlink_dup in hardlink_dict[target]:
- if decompress:
- # Remove compress suffix
- compress_suffix = '.' + compress_format
- new_hardlink = hardlink_dup[:-len(compress_suffix)]
- new_target = target[:-len(compress_suffix)]
- else:
- # Append compress suffix
- compress_suffix = '.' + compress_mode
- new_hardlink = hardlink_dup + compress_suffix
- new_target = target + compress_suffix
-
- bb.note('hardlink %s-->%s' % (new_hardlink, new_target))
- if not os.path.exists(new_hardlink):
- os.link(new_target, new_hardlink)
- if os.path.exists(hardlink_dup):
- os.unlink(hardlink_dup)
-
-def _process_symlink(file, compress_format, decompress=False):
- compress_suffix = '.' + compress_format
- if decompress:
- # Remove compress suffix
- new_linkname = file[:-len(compress_suffix)]
- new_source = os.readlink(file)[:-len(compress_suffix)]
- else:
- # Append compress suffix
- new_linkname = file + compress_suffix
- new_source = os.readlink(file) + compress_suffix
-
- bb.note('symlink %s-->%s' % (new_linkname, new_source))
- if not os.path.exists(new_linkname):
- os.symlink(new_source, new_linkname)
-
- os.unlink(file)
-
-def _is_info(file):
- flags = '.info .info-'.split()
- for flag in flags:
- if flag in os.path.basename(file):
- return True
-
- return False
-
-def _is_man(file):
- import re
-
- # It refers MANSECT-var in man(1.6g)'s man.config
- # ".1:.1p:.8:.2:.3:.3p:.4:.5:.6:.7:.9:.0p:.tcl:.n:.l:.p:.o"
- # Not start with '.', and contain the above colon-seperate element
- p = re.compile(r'[^\.]+\.([1-9lnop]|0p|tcl)')
- if p.search(file):
- return True
-
- return False
-
-def _is_compress_doc(file, compress_format_list):
- compress_format = _get_compress_format(file, compress_format_list)
- compress_suffix = '.' + compress_format
- if file.endswith(compress_suffix):
- # Remove the compress suffix
- uncompress_file = file[:-len(compress_suffix)]
- if _is_info(uncompress_file) or _is_man(uncompress_file):
- return True, compress_format
-
- return False, ''
-
-def compress_doc(topdir, compress_mode, compress_cmds):
- import subprocess
- hardlink_dict = {}
- for root, dirs, files in os.walk(topdir):
- for f in files:
- file = os.path.join(root, f)
- if os.path.isdir(file):
- continue
-
- if _is_info(file) or _is_man(file):
- # Symlink
- if os.path.islink(file):
- _process_symlink(file, compress_mode)
- # Hardlink
- elif os.lstat(file).st_nlink > 1:
- _collect_hardlink(hardlink_dict, file)
- # Normal file
- elif os.path.isfile(file):
- cmd = "%s %s" % (compress_cmds[compress_mode], file)
- (retval, output) = subprocess.getstatusoutput(cmd)
- if retval:
- bb.warn("compress failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
- continue
- bb.note('compress file %s' % file)
-
- _process_hardlink(hardlink_dict, compress_mode, compress_cmds)
-
-# Decompress doc files which format is not compress_mode
-def decompress_doc(topdir, compress_mode, decompress_cmds):
- import subprocess
- hardlink_dict = {}
- decompress = True
- for root, dirs, files in os.walk(topdir):
- for f in files:
- file = os.path.join(root, f)
- if os.path.isdir(file):
- continue
-
- res, compress_format = _is_compress_doc(file, decompress_cmds.keys())
- # Decompress files which format is not compress_mode
- if res and compress_mode!=compress_format:
- # Symlink
- if os.path.islink(file):
- _process_symlink(file, compress_format, decompress)
- # Hardlink
- elif os.lstat(file).st_nlink > 1:
- _collect_hardlink(hardlink_dict, file)
- # Normal file
- elif os.path.isfile(file):
- cmd = "%s %s" % (decompress_cmds[compress_format], file)
- (retval, output) = subprocess.getstatusoutput(cmd)
- if retval:
- bb.warn("decompress failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
- continue
- bb.note('decompress file %s' % file)
-
- _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress)
-
-python compress_doc_updatealternatives () {
- if not bb.data.inherits_class('update-alternatives', d):
- return
-
- mandir = d.getVar("mandir")
- infodir = d.getVar("infodir")
- compress_mode = d.getVar('DOC_COMPRESS')
- for pkg in (d.getVar('PACKAGES') or "").split():
- old_names = (d.getVar('ALTERNATIVE:%s' % pkg) or "").split()
- new_names = []
- for old_name in old_names:
- old_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', old_name)
- old_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name) or \
- d.getVarFlag('ALTERNATIVE_TARGET', old_name) or \
- d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or \
- d.getVar('ALTERNATIVE_TARGET') or \
- old_link
- # Sometimes old_target is specified as relative to the link name.
- old_target = os.path.join(os.path.dirname(old_link), old_target)
-
- # The updatealternatives used for compress doc
- if mandir in old_target or infodir in old_target:
- new_name = old_name + '.' + compress_mode
- new_link = old_link + '.' + compress_mode
- new_target = old_target + '.' + compress_mode
- d.delVarFlag('ALTERNATIVE_LINK_NAME', old_name)
- d.setVarFlag('ALTERNATIVE_LINK_NAME', new_name, new_link)
- if d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name):
- d.delVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name)
- d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, new_name, new_target)
- elif d.getVarFlag('ALTERNATIVE_TARGET', old_name):
- d.delVarFlag('ALTERNATIVE_TARGET', old_name)
- d.setVarFlag('ALTERNATIVE_TARGET', new_name, new_target)
- elif d.getVar('ALTERNATIVE_TARGET_%s' % pkg):
- d.setVar('ALTERNATIVE_TARGET_%s' % pkg, new_target)
- elif d.getVar('ALTERNATIVE_TARGET'):
- d.setVar('ALTERNATIVE_TARGET', new_target)
-
- new_names.append(new_name)
-
- if new_names:
- d.setVar('ALTERNATIVE:%s' % pkg, ' '.join(new_names))
-}
-
diff --git a/poky/meta/classes/copyleft_compliance.bbclass b/poky/meta/classes/copyleft_compliance.bbclass
index eabf12c..9ff9956 100644
--- a/poky/meta/classes/copyleft_compliance.bbclass
+++ b/poky/meta/classes/copyleft_compliance.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Deploy sources for recipes for compliance with copyleft-style licenses
# Defaults to using symlinks, as it's a quick operation, and one can easily
# follow the links when making use of the files (e.g. tar with the -h arg).
diff --git a/poky/meta/classes/copyleft_filter.bbclass b/poky/meta/classes/copyleft_filter.bbclass
index c36bce4..83cd900 100644
--- a/poky/meta/classes/copyleft_filter.bbclass
+++ b/poky/meta/classes/copyleft_filter.bbclass
@@ -1,10 +1,14 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Filter the license, the copyleft_should_include returns True for the
# COPYLEFT_LICENSE_INCLUDE recipe, and False for the
# COPYLEFT_LICENSE_EXCLUDE.
#
# By default, includes all GPL and LGPL, and excludes CLOSED and Proprietary.
-#
-# vi:sts=4:sw=4:et
COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL* AGPL*'
COPYLEFT_LICENSE_INCLUDE[type] = 'list'
diff --git a/poky/meta/classes/core-image.bbclass b/poky/meta/classes/core-image.bbclass
deleted file mode 100644
index 84fd3ee..0000000
--- a/poky/meta/classes/core-image.bbclass
+++ /dev/null
@@ -1,79 +0,0 @@
-# Common code for generating core reference images
-#
-# Copyright (C) 2007-2011 Linux Foundation
-
-# IMAGE_FEATURES control content of the core reference images
-#
-# By default we install packagegroup-core-boot and packagegroup-base-extended packages;
-# this gives us working (console only) rootfs.
-#
-# Available IMAGE_FEATURES:
-#
-# - weston - Weston Wayland compositor
-# - x11 - X server
-# - x11-base - X server with minimal environment
-# - x11-sato - OpenedHand Sato environment
-# - tools-debug - debugging tools
-# - eclipse-debug - Eclipse remote debugging support
-# - tools-profile - profiling tools
-# - tools-testapps - tools usable to make some device tests
-# - tools-sdk - SDK (C/C++ compiler, autotools, etc.)
-# - nfs-server - NFS server
-# - nfs-client - NFS client
-# - ssh-server-dropbear - SSH server (dropbear)
-# - ssh-server-openssh - SSH server (openssh)
-# - hwcodecs - Install hardware acceleration codecs
-# - package-management - installs package management tools and preserves the package manager database
-# - debug-tweaks - makes an image suitable for development, e.g. allowing passwordless root logins
-# - empty-root-password
-# - allow-empty-password
-# - allow-root-login
-# - post-install-logging
-# - dev-pkgs - development packages (headers, etc.) for all installed packages in the rootfs
-# - dbg-pkgs - debug symbol packages for all installed packages in the rootfs
-# - lic-pkgs - license packages for all installed pacakges in the rootfs, requires
-# LICENSE_CREATE_PACKAGE="1" to be set when building packages too
-# - doc-pkgs - documentation packages for all installed packages in the rootfs
-# - bash-completion-pkgs - bash-completion packages for recipes using bash-completion bbclass
-# - ptest-pkgs - ptest packages for all ptest-enabled recipes
-# - read-only-rootfs - tweaks an image to support read-only rootfs
-# - stateless-rootfs - systemctl-native not run, image populated by systemd at runtime
-# - splash - bootup splash screen
-#
-FEATURE_PACKAGES_weston = "packagegroup-core-weston"
-FEATURE_PACKAGES_x11 = "packagegroup-core-x11"
-FEATURE_PACKAGES_x11-base = "packagegroup-core-x11-base"
-FEATURE_PACKAGES_x11-sato = "packagegroup-core-x11-sato"
-FEATURE_PACKAGES_tools-debug = "packagegroup-core-tools-debug"
-FEATURE_PACKAGES_eclipse-debug = "packagegroup-core-eclipse-debug"
-FEATURE_PACKAGES_tools-profile = "packagegroup-core-tools-profile"
-FEATURE_PACKAGES_tools-testapps = "packagegroup-core-tools-testapps"
-FEATURE_PACKAGES_tools-sdk = "packagegroup-core-sdk packagegroup-core-standalone-sdk-target"
-FEATURE_PACKAGES_nfs-server = "packagegroup-core-nfs-server"
-FEATURE_PACKAGES_nfs-client = "packagegroup-core-nfs-client"
-FEATURE_PACKAGES_ssh-server-dropbear = "packagegroup-core-ssh-dropbear"
-FEATURE_PACKAGES_ssh-server-openssh = "packagegroup-core-ssh-openssh"
-FEATURE_PACKAGES_hwcodecs = "${MACHINE_HWCODECS}"
-
-
-# IMAGE_FEATURES_REPLACES_foo = 'bar1 bar2'
-# Including image feature foo would replace the image features bar1 and bar2
-IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear"
-
-# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2'
-# An error exception would be raised if both image features foo and bar1(or bar2) are included
-
-MACHINE_HWCODECS ??= ""
-
-CORE_IMAGE_BASE_INSTALL = '\
- packagegroup-core-boot \
- packagegroup-base-extended \
- \
- ${CORE_IMAGE_EXTRA_INSTALL} \
- '
-
-CORE_IMAGE_EXTRA_INSTALL ?= ""
-
-IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
-
-inherit image
diff --git a/poky/meta/classes/cpan-base.bbclass b/poky/meta/classes/cpan-base.bbclass
deleted file mode 100644
index 93d11e1..0000000
--- a/poky/meta/classes/cpan-base.bbclass
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# cpan-base providers various perl related information needed for building
-# cpan modules
-#
-FILES:${PN} += "${libdir}/perl5 ${datadir}/perl5"
-
-DEPENDS += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}"
-RDEPENDS:${PN} += "${@["perl", ""][(bb.data.inherits_class('native', d))]}"
-
-inherit perl-version
-
-def is_target(d):
- if not bb.data.inherits_class('native', d):
- return "yes"
- return "no"
-
-PERLLIBDIRS = "${libdir}/perl5"
-PERLLIBDIRS:class-native = "${libdir}/perl5"
-
-def cpan_upstream_check_pattern(d):
- for x in (d.getVar('SRC_URI') or '').split(' '):
- if x.startswith("https://cpan.metacpan.org"):
- _pattern = x.split('/')[-1].replace(d.getVar('PV'), r'(?P<pver>\d+.\d+)')
- return _pattern
- return ''
-
-UPSTREAM_CHECK_REGEX ?= "${@cpan_upstream_check_pattern(d)}"
diff --git a/poky/meta/classes/cpan.bbclass b/poky/meta/classes/cpan.bbclass
deleted file mode 100644
index 18f1b9d..0000000
--- a/poky/meta/classes/cpan.bbclass
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# This is for perl modules that use the old Makefile.PL build system
-#
-inherit cpan-base perlnative
-
-EXTRA_CPANFLAGS ?= ""
-EXTRA_PERLFLAGS ?= ""
-
-# Env var which tells perl if it should use host (no) or target (yes) settings
-export PERLCONFIGTARGET = "${@is_target(d)}"
-
-# Env var which tells perl where the perl include files are
-export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE"
-export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}"
-export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
-export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
-export PERLHOSTARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
-
-cpan_do_configure () {
- yes '' | perl ${EXTRA_PERLFLAGS} Makefile.PL INSTALLDIRS=vendor NO_PERLLOCAL=1 NO_PACKLIST=1 PERL=$(which perl) ${EXTRA_CPANFLAGS}
-
- # Makefile.PLs can exit with success without generating a
- # Makefile, e.g. in cases of missing configure time
- # dependencies. This is considered a best practice by
- # cpantesters.org. See:
- # * http://wiki.cpantesters.org/wiki/CPANAuthorNotes
- # * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html
- [ -e Makefile ] || bbfatal "No Makefile was generated by Makefile.PL"
-
- if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
- . ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh
- # Use find since there can be a Makefile generated for each Makefile.PL
- for f in `find -name Makefile.PL`; do
- f2=`echo $f | sed -e 's/.PL//'`
- test -f $f2 || continue
- sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
- -e 's/perl.real/perl/' \
- -e "s|^\(CCFLAGS =.*\)|\1 ${CFLAGS}|" \
- $f2
- done
- fi
-}
-
-do_configure:append:class-target() {
- find . -name Makefile | xargs sed -E -i \
- -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
-}
-
-do_configure:append:class-nativesdk() {
- find . -name Makefile | xargs sed -E -i \
- -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
-}
-
-cpan_do_compile () {
- oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
-}
-
-cpan_do_install () {
- oe_runmake DESTDIR="${D}" install_vendor
- for PERLSCRIPT in `grep -rIEl '#! *${bindir}/perl-native.*/perl' ${D}`; do
- sed -i -e 's|${bindir}/perl-native.*/perl|/usr/bin/env nativeperl|' $PERLSCRIPT
- done
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/cpan_build.bbclass b/poky/meta/classes/cpan_build.bbclass
deleted file mode 100644
index f3fb466..0000000
--- a/poky/meta/classes/cpan_build.bbclass
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# This is for perl modules that use the new Build.PL build system
-#
-inherit cpan-base perlnative
-
-EXTRA_CPAN_BUILD_FLAGS ?= ""
-
-# Env var which tells perl if it should use host (no) or target (yes) settings
-export PERLCONFIGTARGET = "${@is_target(d)}"
-export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
-export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
-export PERLHOSTARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
-export LD = "${CCLD}"
-
-cpan_build_do_configure () {
- if [ "${@is_target(d)}" = "yes" ]; then
- # build for target
- . ${STAGING_LIBDIR}/perl5/config.sh
- fi
-
- perl Build.PL --installdirs vendor --destdir ${D} \
- ${EXTRA_CPAN_BUILD_FLAGS}
-
- # Build.PLs can exit with success without generating a
- # Build, e.g. in cases of missing configure time
- # dependencies. This is considered a best practice by
- # cpantesters.org. See:
- # * http://wiki.cpantesters.org/wiki/CPANAuthorNotes
- # * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html
- [ -e Build ] || bbfatal "No Build was generated by Build.PL"
-}
-
-cpan_build_do_compile () {
- perl Build --perl "${bindir}/perl" verbose=1
-}
-
-cpan_build_do_install () {
- perl Build install --destdir ${D}
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/create-spdx.bbclass b/poky/meta/classes/create-spdx.bbclass
index 10deba6..47dd12c 100644
--- a/poky/meta/classes/create-spdx.bbclass
+++ b/poky/meta/classes/create-spdx.bbclass
@@ -1,4 +1,6 @@
#
+# Copyright OpenEmbedded Contributors
+#
# SPDX-License-Identifier: GPL-2.0-only
#
@@ -216,7 +218,7 @@
filepath = Path(subdir) / file
filename = str(filepath.relative_to(topdir))
- if filepath.is_file() and not filepath.is_symlink():
+ if not filepath.is_symlink() and filepath.is_file():
spdx_file = oe.spdx.SPDXFile()
spdx_file.SPDXID = get_spdxid(file_counter)
for t in get_types(filepath):
diff --git a/poky/meta/classes/cross-canadian.bbclass b/poky/meta/classes/cross-canadian.bbclass
deleted file mode 100644
index a0e9d23..0000000
--- a/poky/meta/classes/cross-canadian.bbclass
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# NOTE - When using this class the user is responsible for ensuring that
-# TRANSLATED_TARGET_ARCH is added into PN. This ensures that if the TARGET_ARCH
-# is changed, another nativesdk xxx-canadian-cross can be installed
-#
-
-
-# SDK packages are built either explicitly by the user,
-# or indirectly via dependency. No need to be in 'world'.
-EXCLUDE_FROM_WORLD = "1"
-NATIVESDKLIBC ?= "libc-glibc"
-LIBCOVERRIDE = ":${NATIVESDKLIBC}"
-CLASSOVERRIDE = "class-cross-canadian"
-STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}:${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-#
-# Update BASE_PACKAGE_ARCH and PACKAGE_ARCHS
-#
-PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}"
-BASECANADIANEXTRAOS ?= "linux-musl"
-CANADIANEXTRAOS = "${BASECANADIANEXTRAOS}"
-CANADIANEXTRAVENDOR = ""
-MODIFYTOS ??= "1"
-python () {
- archs = d.getVar('PACKAGE_ARCHS').split()
- sdkarchs = []
- for arch in archs:
- sdkarchs.append(arch + '-${SDKPKGSUFFIX}')
- d.setVar('PACKAGE_ARCHS', " ".join(sdkarchs))
-
- # Allow the following code segment to be disabled, e.g. meta-environment
- if d.getVar("MODIFYTOS") != "1":
- return
-
- if d.getVar("TCLIBC") in [ 'baremetal', 'newlib' ]:
- return
-
- tos = d.getVar("TARGET_OS")
- tos_known = ["mingw32"]
- extralibcs = [""]
- if "musl" in d.getVar("BASECANADIANEXTRAOS"):
- extralibcs.append("musl")
- if "android" in tos:
- extralibcs.append("android")
- for variant in ["", "spe", "x32", "eabi", "n32", "_ilp32"]:
- for libc in extralibcs:
- entry = "linux"
- if variant and libc:
- entry = entry + "-" + libc + variant
- elif variant:
- entry = entry + "-gnu" + variant
- elif libc:
- entry = entry + "-" + libc
- tos_known.append(entry)
- if tos not in tos_known:
- bb.fatal("Building cross-candian for an unknown TARGET_SYS (%s), please update cross-canadian.bbclass" % d.getVar("TARGET_SYS"))
-
- for n in ["PROVIDES", "DEPENDS"]:
- d.setVar(n, d.getVar(n))
- d.setVar("STAGING_BINDIR_TOOLCHAIN", d.getVar("STAGING_BINDIR_TOOLCHAIN"))
- for prefix in ["AR", "AS", "DLLTOOL", "CC", "CXX", "GCC", "LD", "LIPO", "NM", "OBJDUMP", "RANLIB", "STRIP", "WINDRES"]:
- n = prefix + "_FOR_TARGET"
- d.setVar(n, d.getVar(n))
- # This is a bit ugly. We need to zero LIBC/ABI extension which will change TARGET_OS
- # however we need the old value in some variables. We expand those here first.
- tarch = d.getVar("TARGET_ARCH")
- if tarch == "x86_64":
- d.setVar("LIBCEXTENSION", "")
- d.setVar("ABIEXTENSION", "")
- d.appendVar("CANADIANEXTRAOS", " linux-gnux32")
- for extraos in d.getVar("BASECANADIANEXTRAOS").split():
- d.appendVar("CANADIANEXTRAOS", " " + extraos + "x32")
- elif tarch == "powerpc":
- # PowerPC can build "linux" and "linux-gnuspe"
- d.setVar("LIBCEXTENSION", "")
- d.setVar("ABIEXTENSION", "")
- d.appendVar("CANADIANEXTRAOS", " linux-gnuspe")
- for extraos in d.getVar("BASECANADIANEXTRAOS").split():
- d.appendVar("CANADIANEXTRAOS", " " + extraos + "spe")
- elif tarch == "mips64":
- d.appendVar("CANADIANEXTRAOS", " linux-gnun32")
- for extraos in d.getVar("BASECANADIANEXTRAOS").split():
- d.appendVar("CANADIANEXTRAOS", " " + extraos + "n32")
- if tarch == "arm" or tarch == "armeb":
- d.appendVar("CANADIANEXTRAOS", " linux-gnueabi linux-musleabi")
- d.setVar("TARGET_OS", "linux-gnueabi")
- else:
- d.setVar("TARGET_OS", "linux")
-
- # Also need to handle multilib target vendors
- vendors = d.getVar("CANADIANEXTRAVENDOR")
- if not vendors:
- vendors = all_multilib_tune_values(d, 'TARGET_VENDOR')
- origvendor = d.getVar("TARGET_VENDOR_MULTILIB_ORIGINAL")
- if origvendor:
- d.setVar("TARGET_VENDOR", origvendor)
- if origvendor not in vendors.split():
- vendors = origvendor + " " + vendors
- d.setVar("CANADIANEXTRAVENDOR", vendors)
-}
-MULTIMACH_TARGET_SYS = "${PACKAGE_ARCH}${HOST_VENDOR}-${HOST_OS}"
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-STAGING_DIR_HOST = "${RECIPE_SYSROOT}"
-
-TOOLCHAIN_OPTIONS = " --sysroot=${RECIPE_SYSROOT}"
-
-PATH:append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}"
-PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/"
-
-HOST_ARCH = "${SDK_ARCH}"
-HOST_VENDOR = "${SDK_VENDOR}"
-HOST_OS = "${SDK_OS}"
-HOST_PREFIX = "${SDK_PREFIX}"
-HOST_CC_ARCH = "${SDK_CC_ARCH}"
-HOST_LD_ARCH = "${SDK_LD_ARCH}"
-HOST_AS_ARCH = "${SDK_AS_ARCH}"
-
-#assign DPKG_ARCH
-DPKG_ARCH = "${@debian_arch_map(d.getVar('SDK_ARCH'), '')}"
-
-CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
-CFLAGS = "${BUILDSDK_CFLAGS}"
-CXXFLAGS = "${BUILDSDK_CFLAGS}"
-LDFLAGS = "${BUILDSDK_LDFLAGS} \
- -Wl,-rpath-link,${STAGING_LIBDIR}/.. \
- -Wl,-rpath,${libdir}/.. "
-
-#
-# We need chrpath >= 0.14 to ensure we can deal with 32 and 64 bit
-# binaries
-#
-DEPENDS:append = " chrpath-replacement-native"
-EXTRANATIVEPATH += "chrpath-native"
-
-# Path mangling needed by the cross packaging
-# Note that we use := here to ensure that libdir and includedir are
-# target paths.
-target_base_prefix := "${base_prefix}"
-target_prefix := "${prefix}"
-target_exec_prefix := "${exec_prefix}"
-target_base_libdir = "${target_base_prefix}/${baselib}"
-target_libdir = "${target_exec_prefix}/${baselib}"
-target_includedir := "${includedir}"
-
-# Change to place files in SDKPATH
-base_prefix = "${SDKPATHNATIVE}"
-prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-bindir = "${exec_prefix}/bin/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-sbindir = "${bindir}"
-base_bindir = "${bindir}"
-base_sbindir = "${bindir}"
-libdir = "${exec_prefix}/lib/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-libexecdir = "${exec_prefix}/libexec/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-FILES:${PN} = "${prefix}"
-
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${exec_prefix}/lib/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
-
-do_populate_sysroot[stamp-extra-info] = ""
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "${SDKUSE_NLS}"
-
-# We have to us TARGET_ARCH but we care about the absolute value
-# and not any particular tune that is enabled.
-TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
-
-PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
-# If MLPREFIX is set by multilib code, shlibs
-# points to the wrong place so force it
-SHLIBSDIRS = "${PKGDATA_DIR}/nativesdk-shlibs2"
-SHLIBSWORKDIR = "${PKGDATA_DIR}/nativesdk-shlibs2"
-
-cross_canadian_bindirlinks () {
- for i in linux ${CANADIANEXTRAOS}
- do
- for v in ${CANADIANEXTRAVENDOR}
- do
- d=${D}${bindir}/../${TARGET_ARCH}$v-$i
- if [ -d $d ];
- then
- continue
- fi
- install -d $d
- for j in `ls ${D}${bindir}`
- do
- p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
- ln -s ../${TARGET_SYS}/$j $d/$p
- done
- done
- done
-}
diff --git a/poky/meta/classes/cross.bbclass b/poky/meta/classes/cross.bbclass
deleted file mode 100644
index 9d95107..0000000
--- a/poky/meta/classes/cross.bbclass
+++ /dev/null
@@ -1,97 +0,0 @@
-inherit relocatable
-
-# Cross packages are built indirectly via dependency,
-# no need for them to be a direct target of 'world'
-EXCLUDE_FROM_WORLD = "1"
-
-CLASSOVERRIDE = "class-cross"
-PACKAGES = ""
-PACKAGES_DYNAMIC = ""
-PACKAGES_DYNAMIC:class-native = ""
-
-HOST_ARCH = "${BUILD_ARCH}"
-HOST_VENDOR = "${BUILD_VENDOR}"
-HOST_OS = "${BUILD_OS}"
-HOST_PREFIX = "${BUILD_PREFIX}"
-HOST_CC_ARCH = "${BUILD_CC_ARCH}"
-HOST_LD_ARCH = "${BUILD_LD_ARCH}"
-HOST_AS_ARCH = "${BUILD_AS_ARCH}"
-
-# No strip sysroot when DEBUG_BUILD is enabled
-INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
-
-STAGING_DIR_HOST = "${RECIPE_SYSROOT_NATIVE}"
-
-PACKAGE_ARCH = "${BUILD_ARCH}"
-
-MULTIMACH_TARGET_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
-
-export PKG_CONFIG_DIR = "${exec_prefix}/lib/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = ""
-
-TARGET_CPPFLAGS = ""
-TARGET_CFLAGS = ""
-TARGET_CXXFLAGS = ""
-TARGET_LDFLAGS = ""
-
-CPPFLAGS = "${BUILD_CPPFLAGS}"
-CFLAGS = "${BUILD_CFLAGS}"
-CXXFLAGS = "${BUILD_CFLAGS}"
-LDFLAGS = "${BUILD_LDFLAGS}"
-
-TOOLCHAIN_OPTIONS = ""
-
-# This class encodes staging paths into its scripts data so can only be
-# reused if we manipulate the paths.
-SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
-
-# Path mangling needed by the cross packaging
-# Note that we use := here to ensure that libdir and includedir are
-# target paths.
-target_base_prefix := "${root_prefix}"
-target_prefix := "${prefix}"
-target_exec_prefix := "${exec_prefix}"
-target_base_libdir = "${target_base_prefix}/${baselib}"
-target_libdir = "${target_exec_prefix}/${baselib}"
-target_includedir := "${includedir}"
-
-# Overrides for paths
-CROSS_TARGET_SYS_DIR = "${TARGET_SYS}"
-prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-base_prefix = "${STAGING_DIR_NATIVE}"
-exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-bindir = "${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}"
-sbindir = "${bindir}"
-base_bindir = "${bindir}"
-base_sbindir = "${bindir}"
-libdir = "${exec_prefix}/lib/${CROSS_TARGET_SYS_DIR}"
-libexecdir = "${exec_prefix}/libexec/${CROSS_TARGET_SYS_DIR}"
-
-do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "no"
-
-export CC = "${BUILD_CC}"
-export CXX = "${BUILD_CXX}"
-export FC = "${BUILD_FC}"
-export CPP = "${BUILD_CPP}"
-export LD = "${BUILD_LD}"
-export CCLD = "${BUILD_CCLD}"
-export AR = "${BUILD_AR}"
-export AS = "${BUILD_AS}"
-export RANLIB = "${BUILD_RANLIB}"
-export STRIP = "${BUILD_STRIP}"
-export NM = "${BUILD_NM}"
-
-inherit nopackages
-
-python do_addto_recipe_sysroot () {
- bb.build.exec_func("extend_recipe_sysroot", d)
-}
-addtask addto_recipe_sysroot after do_populate_sysroot
-do_addto_recipe_sysroot[deptask] = "do_populate_sysroot"
-
-PATH:prepend = "${COREBASE}/scripts/cross-intercept:"
diff --git a/poky/meta/classes/crosssdk.bbclass b/poky/meta/classes/crosssdk.bbclass
deleted file mode 100644
index 04aecb6..0000000
--- a/poky/meta/classes/crosssdk.bbclass
+++ /dev/null
@@ -1,51 +0,0 @@
-inherit cross
-
-CLASSOVERRIDE = "class-crosssdk"
-NATIVESDKLIBC ?= "libc-glibc"
-LIBCOVERRIDE = ":${NATIVESDKLIBC}"
-MACHINEOVERRIDES = ""
-PACKAGE_ARCH = "${SDK_ARCH}"
-
-python () {
- # set TUNE_PKGARCH to SDK_ARCH
- d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH'))
- # Set features here to prevent appends and distro features backfill
- # from modifying nativesdk distro features
- features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split())
- filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split())
- d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
-}
-
-STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-# This class encodes staging paths into its scripts data so can only be
-# reused if we manipulate the paths.
-SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
-
-TARGET_ARCH = "${SDK_ARCH}"
-TARGET_VENDOR = "${SDK_VENDOR}"
-TARGET_OS = "${SDK_OS}"
-TARGET_PREFIX = "${SDK_PREFIX}"
-TARGET_CC_ARCH = "${SDK_CC_ARCH}"
-TARGET_LD_ARCH = "${SDK_LD_ARCH}"
-TARGET_AS_ARCH = "${SDK_AS_ARCH}"
-TARGET_CPPFLAGS = ""
-TARGET_CFLAGS = ""
-TARGET_CXXFLAGS = ""
-TARGET_LDFLAGS = ""
-TARGET_FPU = ""
-
-
-target_libdir = "${SDKPATHNATIVE}${libdir_nativesdk}"
-target_includedir = "${SDKPATHNATIVE}${includedir_nativesdk}"
-target_base_libdir = "${SDKPATHNATIVE}${base_libdir_nativesdk}"
-target_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-target_exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-baselib = "lib"
-
-do_packagedata[stamp-extra-info] = ""
-
-# Need to force this to ensure consitency across architectures
-EXTRA_OECONF_GCC_FLOAT = ""
-
-USE_NLS = "no"
diff --git a/poky/meta/classes/cve-check.bbclass b/poky/meta/classes/cve-check.bbclass
index da7f933..4b4ea78 100644
--- a/poky/meta/classes/cve-check.bbclass
+++ b/poky/meta/classes/cve-check.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# This class is used to check recipes against public CVEs.
#
# In order to use this class just inherit the class in the
@@ -139,17 +145,18 @@
"""
from oe.cve_check import get_patched_cves
- if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
- try:
- patched_cves = get_patched_cves(d)
- except FileNotFoundError:
- bb.fatal("Failure in searching patches")
- ignored, patched, unpatched, status = check_cves(d, patched_cves)
- if patched or unpatched or (d.getVar("CVE_CHECK_COVERAGE") == "1" and status):
- cve_data = get_cve_info(d, patched + unpatched + ignored)
- cve_write_data(d, patched, unpatched, ignored, cve_data, status)
- else:
- bb.note("No CVE database found, skipping CVE check")
+ with bb.utils.fileslocked([d.getVar("CVE_CHECK_DB_FILE_LOCK")], shared=True):
+ if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
+ try:
+ patched_cves = get_patched_cves(d)
+ except FileNotFoundError:
+ bb.fatal("Failure in searching patches")
+ ignored, patched, unpatched, status = check_cves(d, patched_cves)
+ if patched or unpatched or (d.getVar("CVE_CHECK_COVERAGE") == "1" and status):
+ cve_data = get_cve_info(d, patched + unpatched + ignored)
+ cve_write_data(d, patched, unpatched, ignored, cve_data, status)
+ else:
+ bb.note("No CVE database found, skipping CVE check")
}
@@ -290,7 +297,8 @@
vendor = "%"
# Find all relevant CVE IDs.
- for cverow in conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor)):
+ cve_cursor = conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor))
+ for cverow in cve_cursor:
cve = cverow[0]
if cve in cve_ignore:
@@ -309,7 +317,8 @@
vulnerable = False
ignored = False
- for row in conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor)):
+ product_cursor = conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor))
+ for row in product_cursor:
(_, _, _, version_start, operator_start, version_end, operator_end) = row
#bb.debug(2, "Evaluating row " + str(row))
if cve in cve_ignore:
@@ -353,10 +362,12 @@
bb.note("%s-%s is vulnerable to %s" % (pn, real_pv, cve))
cves_unpatched.append(cve)
break
+ product_cursor.close()
if not vulnerable:
bb.note("%s-%s is not vulnerable to %s" % (pn, real_pv, cve))
patched_cves.add(cve)
+ cve_cursor.close()
if not cves_in_product:
bb.note("No CVE records found for product %s, pn %s" % (product, pn))
@@ -381,14 +392,15 @@
conn = sqlite3.connect(db_file, uri=True)
for cve in cves:
- for row in conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,)):
+ cursor = conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,))
+ for row in cursor:
cve_data[row[0]] = {}
cve_data[row[0]]["summary"] = row[1]
cve_data[row[0]]["scorev2"] = row[2]
cve_data[row[0]]["scorev3"] = row[3]
cve_data[row[0]]["modified"] = row[4]
cve_data[row[0]]["vector"] = row[5]
-
+ cursor.close()
conn.close()
return cve_data
diff --git a/poky/meta/classes/debian.bbclass b/poky/meta/classes/debian.bbclass
deleted file mode 100644
index 8367be9..0000000
--- a/poky/meta/classes/debian.bbclass
+++ /dev/null
@@ -1,150 +0,0 @@
-# Debian package renaming only occurs when a package is built
-# We therefore have to make sure we build all runtime packages
-# before building the current package to make the packages runtime
-# depends are correct
-#
-# Custom library package names can be defined setting
-# DEBIANNAME: + pkgname to the desired name.
-#
-# Better expressed as ensure all RDEPENDS package before we package
-# This means we can't have circular RDEPENDS/RRECOMMENDS
-
-AUTO_LIBNAME_PKGS = "${PACKAGES}"
-
-inherit package
-
-DEBIANRDEP = "do_packagedata"
-do_package_write_ipk[deptask] = "${DEBIANRDEP}"
-do_package_write_deb[deptask] = "${DEBIANRDEP}"
-do_package_write_tar[deptask] = "${DEBIANRDEP}"
-do_package_write_rpm[deptask] = "${DEBIANRDEP}"
-do_package_write_ipk[rdeptask] = "${DEBIANRDEP}"
-do_package_write_deb[rdeptask] = "${DEBIANRDEP}"
-do_package_write_tar[rdeptask] = "${DEBIANRDEP}"
-do_package_write_rpm[rdeptask] = "${DEBIANRDEP}"
-
-python () {
- if not d.getVar("PACKAGES"):
- d.setVar("DEBIANRDEP", "")
-}
-
-python debian_package_name_hook () {
- import glob, copy, stat, errno, re, pathlib, subprocess
-
- pkgdest = d.getVar("PKGDEST")
- packages = d.getVar('PACKAGES')
- so_re = re.compile(r"lib.*\.so")
-
- def socrunch(s):
- s = s.lower().replace('_', '-')
- m = re.match(r"^(.*)(.)\.so\.(.*)$", s)
- if m is None:
- return None
- if m.group(2) in '0123456789':
- bin = '%s%s-%s' % (m.group(1), m.group(2), m.group(3))
- else:
- bin = m.group(1) + m.group(2) + m.group(3)
- dev = m.group(1) + m.group(2)
- return (bin, dev)
-
- def isexec(path):
- try:
- s = os.stat(path)
- except (os.error, AttributeError):
- return 0
- return (s[stat.ST_MODE] & stat.S_IEXEC)
-
- def add_rprovides(pkg, d):
- newpkg = d.getVar('PKG:' + pkg)
- if newpkg and newpkg != pkg:
- provs = (d.getVar('RPROVIDES:' + pkg) or "").split()
- if pkg not in provs:
- d.appendVar('RPROVIDES:' + pkg, " " + pkg + " (=" + d.getVar("PKGV") + ")")
-
- def auto_libname(packages, orig_pkg):
- p = lambda var: pathlib.PurePath(d.getVar(var))
- libdirs = (p("base_libdir"), p("libdir"))
- bindirs = (p("base_bindir"), p("base_sbindir"), p("bindir"), p("sbindir"))
-
- sonames = []
- has_bins = 0
- has_libs = 0
- for f in pkgfiles[orig_pkg]:
- # This is .../packages-split/orig_pkg/
- pkgpath = pathlib.PurePath(pkgdest, orig_pkg)
- # Strip pkgpath off the full path to a file in the package, re-root
- # so it is absolute, and then get the parent directory of the file.
- path = pathlib.PurePath("/") / (pathlib.PurePath(f).relative_to(pkgpath).parent)
- if path in bindirs:
- has_bins = 1
- if path in libdirs:
- has_libs = 1
- if so_re.match(os.path.basename(f)):
- try:
- cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f]
- output = subprocess.check_output(cmd).decode("utf-8")
- for m in re.finditer(r"\s+SONAME\s+([^\s]+)", output):
- if m.group(1) not in sonames:
- sonames.append(m.group(1))
- except subprocess.CalledProcessError:
- pass
- bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames))
- soname = None
- if len(sonames) == 1:
- soname = sonames[0]
- elif len(sonames) > 1:
- lead = d.getVar('LEAD_SONAME')
- if lead:
- r = re.compile(lead)
- filtered = []
- for s in sonames:
- if r.match(s):
- filtered.append(s)
- if len(filtered) == 1:
- soname = filtered[0]
- elif len(filtered) > 1:
- bb.note("Multiple matches (%s) for LEAD_SONAME '%s'" % (", ".join(filtered), lead))
- else:
- bb.note("Multiple libraries (%s) found, but LEAD_SONAME '%s' doesn't match any of them" % (", ".join(sonames), lead))
- else:
- bb.note("Multiple libraries (%s) found and LEAD_SONAME not defined" % ", ".join(sonames))
-
- if has_libs and not has_bins and soname:
- soname_result = socrunch(soname)
- if soname_result:
- (pkgname, devname) = soname_result
- for pkg in packages.split():
- if (d.getVar('PKG:' + pkg, False) or d.getVar('DEBIAN_NOAUTONAME:' + pkg, False)):
- add_rprovides(pkg, d)
- continue
- debian_pn = d.getVar('DEBIANNAME:' + pkg, False)
- if debian_pn:
- newpkg = debian_pn
- elif pkg == orig_pkg:
- newpkg = pkgname
- else:
- newpkg = pkg.replace(orig_pkg, devname, 1)
- mlpre=d.getVar('MLPREFIX')
- if mlpre:
- if not newpkg.find(mlpre) == 0:
- newpkg = mlpre + newpkg
- if newpkg != pkg:
- bb.note("debian: renaming %s to %s" % (pkg, newpkg))
- d.setVar('PKG:' + pkg, newpkg)
- add_rprovides(pkg, d)
- else:
- add_rprovides(orig_pkg, d)
-
- # reversed sort is needed when some package is substring of another
- # ie in ncurses we get without reverse sort:
- # DEBUG: LIBNAMES: pkgname libtic5 devname libtic pkg ncurses-libtic orig_pkg ncurses-libtic debian_pn None newpkg libtic5
- # and later
- # DEBUG: LIBNAMES: pkgname libtic5 devname libtic pkg ncurses-libticw orig_pkg ncurses-libtic debian_pn None newpkg libticw
- # so we need to handle ncurses-libticw->libticw5 before ncurses-libtic->libtic5
- for pkg in sorted((d.getVar('AUTO_LIBNAME_PKGS') or "").split(), reverse=True):
- auto_libname(packages, pkg)
-}
-
-EXPORT_FUNCTIONS package_name_hook
-
-DEBIAN_NAMES = "1"
diff --git a/poky/meta/classes/deploy.bbclass b/poky/meta/classes/deploy.bbclass
deleted file mode 100644
index 7fbffe9..0000000
--- a/poky/meta/classes/deploy.bbclass
+++ /dev/null
@@ -1,12 +0,0 @@
-DEPLOYDIR = "${WORKDIR}/deploy-${PN}"
-SSTATETASKS += "do_deploy"
-do_deploy[sstate-inputdirs] = "${DEPLOYDIR}"
-do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-
-python do_deploy_setscene () {
- sstate_setscene(d)
-}
-addtask do_deploy_setscene
-do_deploy[dirs] = "${B}"
-do_deploy[cleandirs] = "${DEPLOYDIR}"
-do_deploy[stamp-extra-info] = "${MACHINE_ARCH}"
diff --git a/poky/meta/classes/devicetree.bbclass b/poky/meta/classes/devicetree.bbclass
deleted file mode 100644
index 2a62ae7..0000000
--- a/poky/meta/classes/devicetree.bbclass
+++ /dev/null
@@ -1,148 +0,0 @@
-# This bbclass implements device tree compliation for user provided device tree
-# sources. The compilation of the device tree sources is the same as the kernel
-# device tree compilation process, this includes being able to include sources
-# from the kernel such as soc dtsi files or header files such as gpio.h. In
-# addition to device trees this bbclass also handles compilation of device tree
-# overlays.
-#
-# The output of this class behaves similar to how kernel-devicetree.bbclass
-# operates in that the output files are installed into /boot/devicetree.
-# However this class on purpose separates the deployed device trees into the
-# 'devicetree' subdirectory. This prevents clashes with the kernel-devicetree
-# output. Additionally the device trees are populated into the sysroot for
-# access via the sysroot from within other recipes.
-
-SECTION ?= "bsp"
-
-# The default inclusion of kernel device tree includes and headers means that
-# device trees built with them are at least GPL-2.0-only (and in some cases dual
-# licensed). Default to GPL-2.0-only if the recipe does not specify a license.
-LICENSE ?= "GPL-2.0-only"
-LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
-
-INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS += "dtc-native"
-
-inherit deploy kernel-arch
-
-COMPATIBLE_MACHINE ?= "^$"
-
-PROVIDES = "virtual/dtb"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-SYSROOT_DIRS += "/boot/devicetree"
-FILES:${PN} = "/boot/devicetree/*.dtb /boot/devicetree/*.dtbo"
-
-S = "${WORKDIR}"
-B = "${WORKDIR}/build"
-
-# Default kernel includes, these represent what are normally used for in-kernel
-# sources.
-KERNEL_INCLUDE ??= " \
- ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts \
- ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/* \
- ${STAGING_KERNEL_DIR}/scripts/dtc/include-prefixes \
- "
-
-DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion."
-DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}"
-DT_FILES_PATH[doc] = "Defaults to source directory, can be used to select dts files that are not in source (e.g. generated)."
-DT_FILES_PATH ?= "${S}"
-
-DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot."
-DT_PADDING_SIZE ??= "0x3000"
-DT_RESERVED_MAP[doc] = "Number of reserved map entires."
-DT_RESERVED_MAP ??= "8"
-DT_BOOT_CPU[doc] = "The boot cpu, defaults to 0"
-DT_BOOT_CPU ??= "0"
-
-DTC_FLAGS ?= "-R ${DT_RESERVED_MAP} -b ${DT_BOOT_CPU}"
-DTC_PPFLAGS ?= "-nostdinc -undef -D__DTS__ -x assembler-with-cpp"
-DTC_BFLAGS ?= "-p ${DT_PADDING_SIZE} -@"
-DTC_OFLAGS ?= "-p 0 -@ -H epapr"
-
-python () {
- if d.getVar("KERNEL_INCLUDE"):
- # auto add dependency on kernel tree, but only if kernel include paths
- # are specified.
- d.appendVarFlag("do_compile", "depends", " virtual/kernel:do_configure")
-}
-
-def expand_includes(varname, d):
- import glob
- includes = set()
- # expand all includes with glob
- for i in (d.getVar(varname) or "").split():
- for g in glob.glob(i):
- if os.path.isdir(g): # only add directories to include path
- includes.add(g)
- return includes
-
-def devicetree_source_is_overlay(path):
- # determine if a dts file is an overlay by checking if it uses "/plugin/;"
- with open(path, "r") as f:
- for i in f:
- if i.startswith("/plugin/;"):
- return True
- return False
-
-def devicetree_compile(dtspath, includes, d):
- import subprocess
- dts = os.path.basename(dtspath)
- dtname = os.path.splitext(dts)[0]
- bb.note("Processing {0} [{1}]".format(dtname, dts))
-
- # preprocess
- ppargs = d.getVar("BUILD_CPP").split()
- ppargs += (d.getVar("DTC_PPFLAGS") or "").split()
- for i in includes:
- ppargs.append("-I{0}".format(i))
- ppargs += ["-o", "{0}.pp".format(dts), dtspath]
- bb.note("Running {0}".format(" ".join(ppargs)))
- subprocess.run(ppargs, check = True)
-
- # determine if the file is an overlay or not (using the preprocessed file)
- isoverlay = devicetree_source_is_overlay("{0}.pp".format(dts))
-
- # compile
- dtcargs = ["dtc"] + (d.getVar("DTC_FLAGS") or "").split()
- if isoverlay:
- dtcargs += (d.getVar("DTC_OFLAGS") or "").split()
- else:
- dtcargs += (d.getVar("DTC_BFLAGS") or "").split()
- for i in includes:
- dtcargs += ["-i", i]
- dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")]
- dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)]
- bb.note("Running {0}".format(" ".join(dtcargs)))
- subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-
-python devicetree_do_compile() {
- includes = expand_includes("DT_INCLUDE", d)
- listpath = d.getVar("DT_FILES_PATH")
- for dts in os.listdir(listpath):
- dtspath = os.path.join(listpath, dts)
- try:
- if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)):
- continue # skip non-.dts files and non-overlay files
- except:
- continue # skip if can't determine if overlay
- devicetree_compile(dtspath, includes, d)
-}
-
-devicetree_do_install() {
- for DTB_FILE in `ls *.dtb *.dtbo`; do
- install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/devicetree/${DTB_FILE}
- done
-}
-
-devicetree_do_deploy() {
- for DTB_FILE in `ls *.dtb *.dtbo`; do
- install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/devicetree/${DTB_FILE}
- done
-}
-addtask deploy before do_build after do_install
-
-EXPORT_FUNCTIONS do_compile do_install do_deploy
-
diff --git a/poky/meta/classes/devshell.bbclass b/poky/meta/classes/devshell.bbclass
deleted file mode 100644
index 247d044..0000000
--- a/poky/meta/classes/devshell.bbclass
+++ /dev/null
@@ -1,160 +0,0 @@
-inherit terminal
-
-DEVSHELL = "${SHELL}"
-
-PATH:prepend:task-devshell = "${COREBASE}/scripts/git-intercept:"
-
-python do_devshell () {
- if d.getVarFlag("do_devshell", "manualfakeroot"):
- d.prependVar("DEVSHELL", "pseudo ")
- fakeenv = d.getVar("FAKEROOTENV").split()
- for f in fakeenv:
- k = f.split("=")
- d.setVar(k[0], k[1])
- d.appendVar("OE_TERMINAL_EXPORTS", " " + k[0])
- d.delVarFlag("do_devshell", "fakeroot")
-
- oe_terminal(d.getVar('DEVSHELL'), 'OpenEmbedded Developer Shell', d)
-}
-
-addtask devshell after do_patch do_prepare_recipe_sysroot
-
-# The directory that the terminal starts in
-DEVSHELL_STARTDIR ?= "${S}"
-do_devshell[dirs] = "${DEVSHELL_STARTDIR}"
-do_devshell[nostamp] = "1"
-do_devshell[network] = "1"
-
-# devshell and fakeroot/pseudo need careful handling since only the final
-# command should run under fakeroot emulation, any X connection should
-# be done as the normal user. We therfore carefully construct the envionment
-# manually
-python () {
- if d.getVarFlag("do_devshell", "fakeroot"):
- # We need to signal our code that we want fakeroot however we
- # can't manipulate the environment and variables here yet (see YOCTO #4795)
- d.setVarFlag("do_devshell", "manualfakeroot", "1")
- d.delVarFlag("do_devshell", "fakeroot")
-}
-
-def pydevshell(d):
-
- import code
- import select
- import signal
- import termios
-
- m, s = os.openpty()
- sname = os.ttyname(s)
-
- def noechoicanon(fd):
- old = termios.tcgetattr(fd)
- old[3] = old[3] &~ termios.ECHO &~ termios.ICANON
- # &~ termios.ISIG
- termios.tcsetattr(fd, termios.TCSADRAIN, old)
-
- # No echo or buffering over the pty
- noechoicanon(s)
-
- pid = os.fork()
- if pid:
- os.close(m)
- oe_terminal("oepydevshell-internal.py %s %d" % (sname, pid), 'OpenEmbedded Developer PyShell', d)
- os._exit(0)
- else:
- os.close(s)
-
- os.dup2(m, sys.stdin.fileno())
- os.dup2(m, sys.stdout.fileno())
- os.dup2(m, sys.stderr.fileno())
-
- bb.utils.nonblockingfd(sys.stdout)
- bb.utils.nonblockingfd(sys.stderr)
- bb.utils.nonblockingfd(sys.stdin)
-
- _context = {
- "os": os,
- "bb": bb,
- "time": time,
- "d": d,
- }
-
- ps1 = "pydevshell> "
- ps2 = "... "
- buf = []
- more = False
-
- i = code.InteractiveInterpreter(locals=_context)
- print("OE PyShell (PN = %s)\n" % d.getVar("PN"))
-
- def prompt(more):
- if more:
- prompt = ps2
- else:
- prompt = ps1
- sys.stdout.write(prompt)
- sys.stdout.flush()
-
- # Restore Ctrl+C since bitbake masks this
- def signal_handler(signal, frame):
- raise KeyboardInterrupt
- signal.signal(signal.SIGINT, signal_handler)
-
- child = None
-
- prompt(more)
- while True:
- try:
- try:
- (r, _, _) = select.select([sys.stdin], [], [], 1)
- if not r:
- continue
- line = sys.stdin.readline().strip()
- if not line:
- prompt(more)
- continue
- except EOFError as e:
- sys.stdout.write("\n")
- sys.stdout.flush()
- except (OSError, IOError) as e:
- if e.errno == 11:
- continue
- if e.errno == 5:
- return
- raise
- else:
- if not child:
- child = int(line)
- continue
- buf.append(line)
- source = "\n".join(buf)
- more = i.runsource(source, "<pyshell>")
- if not more:
- buf = []
- sys.stderr.flush()
- prompt(more)
- except KeyboardInterrupt:
- i.write("\nKeyboardInterrupt\n")
- buf = []
- more = False
- prompt(more)
- except SystemExit:
- # Easiest way to ensure everything exits
- os.kill(child, signal.SIGTERM)
- break
-
-python do_pydevshell() {
- import signal
-
- try:
- pydevshell(d)
- except SystemExit:
- # Stop the SIGTERM above causing an error exit code
- return
- finally:
- return
-}
-addtask pydevshell after do_patch
-
-do_pydevshell[nostamp] = "1"
-do_pydevshell[network] = "1"
diff --git a/poky/meta/classes/devtool-source.bbclass b/poky/meta/classes/devtool-source.bbclass
index 41900e6..a02b1e9 100644
--- a/poky/meta/classes/devtool-source.bbclass
+++ b/poky/meta/classes/devtool-source.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Development tool - source extraction helper class
#
# NOTE: this class is intended for use by devtool and should not be
diff --git a/poky/meta/classes/devupstream.bbclass b/poky/meta/classes/devupstream.bbclass
deleted file mode 100644
index ba6dc41..0000000
--- a/poky/meta/classes/devupstream.bbclass
+++ /dev/null
@@ -1,55 +0,0 @@
-# Class for use in BBCLASSEXTEND to make it easier to have a single recipe that
-# can build both stable tarballs and snapshots from upstream source
-# repositories.
-#
-# Usage:
-# BBCLASSEXTEND = "devupstream:target"
-# SRC_URI:class-devupstream = "git://git.example.com/example;branch=master"
-# SRCREV:class-devupstream = "abcdef"
-#
-# If the first entry in SRC_URI is a git: URL then S is rewritten to
-# WORKDIR/git.
-#
-# There are a few caveats that remain to be solved:
-# - You can't build native or nativesdk recipes using for example
-# devupstream:native, you can only build target recipes.
-# - If the fetcher requires native tools (such as subversion-native) then
-# bitbake won't be able to add them automatically.
-
-python devupstream_virtclass_handler () {
- # Do nothing if this is inherited, as it's for BBCLASSEXTEND
- if "devupstream" not in (d.getVar('BBCLASSEXTEND') or ""):
- bb.error("Don't inherit devupstream, use BBCLASSEXTEND")
- return
-
- variant = d.getVar("BBEXTENDVARIANT")
- if variant not in ("target", "native"):
- bb.error("Unsupported variant %s. Pass the variant when using devupstream, for example devupstream:target" % variant)
- return
-
- # Develpment releases are never preferred by default
- d.setVar("DEFAULT_PREFERENCE", "-1")
-
- src_uri = d.getVar("SRC_URI:class-devupstream") or d.getVar("SRC_URI")
- uri = bb.fetch2.URI(src_uri.split()[0])
-
- if uri.scheme == "git" and not d.getVar("S:class-devupstream"):
- d.setVar("S", "${WORKDIR}/git")
-
- # Modify the PV if the recipe hasn't already overridden it
- pv = d.getVar("PV")
- proto_marker = "+" + uri.scheme
- if proto_marker not in pv and not d.getVar("PV:class-devupstream"):
- d.setVar("PV", pv + proto_marker + "${SRCPV}")
-
- if variant == "native":
- pn = d.getVar("PN")
- d.setVar("PN", "%s-native" % (pn))
- fn = d.getVar("FILE")
- bb.parse.BBHandler.inherit("native", fn, 0, d)
-
- d.appendVar("CLASSOVERRIDE", ":class-devupstream")
-}
-
-addhandler devupstream_virtclass_handler
-devupstream_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
diff --git a/poky/meta/classes/distro_features_check.bbclass b/poky/meta/classes/distro_features_check.bbclass
deleted file mode 100644
index 8124a8c..0000000
--- a/poky/meta/classes/distro_features_check.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-# Temporarily provide fallback to the old name of the class
-
-python __anonymous() {
- bb.warn("distro_features_check.bbclass is deprecated, please use features_check.bbclass instead")
-}
-
-inherit features_check
diff --git a/poky/meta/classes/distrooverrides.bbclass b/poky/meta/classes/distrooverrides.bbclass
index bf3a2b2..8d9d7cd 100644
--- a/poky/meta/classes/distrooverrides.bbclass
+++ b/poky/meta/classes/distrooverrides.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Turns certain DISTRO_FEATURES into overrides with the same
# name plus a df- prefix. Ensures that these special
# distro features remain set also for native and nativesdk
diff --git a/poky/meta/classes/dos2unix.bbclass b/poky/meta/classes/dos2unix.bbclass
deleted file mode 100644
index 3fc17e2..0000000
--- a/poky/meta/classes/dos2unix.bbclass
+++ /dev/null
@@ -1,14 +0,0 @@
-# Class for use to convert all CRLF line terminators to LF
-# provided that some projects are being developed/maintained
-# on Windows so they have different line terminators(CRLF) vs
-# on Linux(LF), which can cause annoying patching errors during
-# git push/checkout processes.
-
-do_convert_crlf_to_lf[depends] += "dos2unix-native:do_populate_sysroot"
-
-# Convert CRLF line terminators to LF
-do_convert_crlf_to_lf () {
- find ${S} -type f -exec dos2unix {} \;
-}
-
-addtask convert_crlf_to_lf after do_unpack before do_patch
diff --git a/poky/meta/classes/externalsrc.bbclass b/poky/meta/classes/externalsrc.bbclass
deleted file mode 100644
index 90792a7..0000000
--- a/poky/meta/classes/externalsrc.bbclass
+++ /dev/null
@@ -1,268 +0,0 @@
-# Copyright (C) 2012 Linux Foundation
-# Author: Richard Purdie
-# Some code and influence taken from srctree.bbclass:
-# Copyright (C) 2009 Chris Larson <clarson@kergoth.com>
-# Released under the MIT license (see COPYING.MIT for the terms)
-#
-# externalsrc.bbclass enables use of an existing source tree, usually external to
-# the build system to build a piece of software rather than the usual fetch/unpack/patch
-# process.
-#
-# To use, add externalsrc to the global inherit and set EXTERNALSRC to point at the
-# directory you want to use containing the sources e.g. from local.conf for a recipe
-# called "myrecipe" you would do:
-#
-# INHERIT += "externalsrc"
-# EXTERNALSRC:pn-myrecipe = "/path/to/my/source/tree"
-#
-# In order to make this class work for both target and native versions (or with
-# multilibs/cross or other BBCLASSEXTEND variants), B is set to point to a separate
-# directory under the work directory (split source and build directories). This is
-# the default, but the build directory can be set to the source directory if
-# circumstances dictate by setting EXTERNALSRC_BUILD to the same value, e.g.:
-#
-# EXTERNALSRC_BUILD:pn-myrecipe = "/path/to/my/source/tree"
-#
-
-SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
-EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}"
-
-python () {
- externalsrc = d.getVar('EXTERNALSRC')
- externalsrcbuild = d.getVar('EXTERNALSRC_BUILD')
-
- if externalsrc and not externalsrc.startswith("/"):
- bb.error("EXTERNALSRC must be an absolute path")
- if externalsrcbuild and not externalsrcbuild.startswith("/"):
- bb.error("EXTERNALSRC_BUILD must be an absolute path")
-
- # If this is the base recipe and EXTERNALSRC is set for it or any of its
- # derivatives, then enable BB_DONT_CACHE to force the recipe to always be
- # re-parsed so that the file-checksums function for do_compile is run every
- # time.
- bpn = d.getVar('BPN')
- classextend = (d.getVar('BBCLASSEXTEND') or '').split()
- if bpn == d.getVar('PN') or not classextend:
- if (externalsrc or
- ('native' in classextend and
- d.getVar('EXTERNALSRC:pn-%s-native' % bpn)) or
- ('nativesdk' in classextend and
- d.getVar('EXTERNALSRC:pn-nativesdk-%s' % bpn)) or
- ('cross' in classextend and
- d.getVar('EXTERNALSRC:pn-%s-cross' % bpn))):
- d.setVar('BB_DONT_CACHE', '1')
-
- if externalsrc:
- import oe.recipeutils
- import oe.path
-
- d.setVar('S', externalsrc)
- if externalsrcbuild:
- d.setVar('B', externalsrcbuild)
- else:
- d.setVar('B', '${WORKDIR}/${BPN}-${PV}/')
-
- local_srcuri = []
- fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
- for url in fetch.urls:
- url_data = fetch.ud[url]
- parm = url_data.parm
- if (url_data.type == 'file' or
- url_data.type == 'npmsw' or url_data.type == 'crate' or
- 'type' in parm and parm['type'] == 'kmeta'):
- local_srcuri.append(url)
-
- d.setVar('SRC_URI', ' '.join(local_srcuri))
-
- # Dummy value because the default function can't be called with blank SRC_URI
- d.setVar('SRCPV', '999')
-
- if d.getVar('CONFIGUREOPT_DEPTRACK') == '--disable-dependency-tracking':
- d.setVar('CONFIGUREOPT_DEPTRACK', '')
-
- tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
-
- for task in tasks:
- if task.endswith("_setscene"):
- # sstate is never going to work for external source trees, disable it
- bb.build.deltask(task, d)
- elif os.path.realpath(d.getVar('S')) == os.path.realpath(d.getVar('B')):
- # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
- d.appendVarFlag(task, "lockfiles", " ${S}/singletask.lock")
-
- for funcname in [task, "base_" + task, "kernel_" + task]:
- # We do not want our source to be wiped out, ever (kernel.bbclass does this for do_clean)
- cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(funcname, 'cleandirs', False) or '')
- setvalue = False
- for cleandir in cleandirs[:]:
- if oe.path.is_path_parent(externalsrc, d.expand(cleandir)):
- cleandirs.remove(cleandir)
- setvalue = True
- if setvalue:
- d.setVarFlag(funcname, 'cleandirs', ' '.join(cleandirs))
-
- fetch_tasks = ['do_fetch', 'do_unpack']
- # If we deltask do_patch, there's no dependency to ensure do_unpack gets run, so add one
- # Note that we cannot use d.appendVarFlag() here because deps is expected to be a list object, not a string
- d.setVarFlag('do_configure', 'deps', (d.getVarFlag('do_configure', 'deps', False) or []) + ['do_unpack'])
-
- for task in d.getVar("SRCTREECOVEREDTASKS").split():
- if local_srcuri and task in fetch_tasks:
- continue
- bb.build.deltask(task, d)
- if task == 'do_unpack':
- # The reproducible build create_source_date_epoch_stamp function must
- # be run after the source is available and before the
- # do_deploy_source_date_epoch task. In the normal case, it's attached
- # to do_unpack as a postfuncs, but since we removed do_unpack (above)
- # we need to move the function elsewhere. The easiest thing to do is
- # move it into the prefuncs of the do_deploy_source_date_epoch task.
- # This is safe, as externalsrc runs with the source already unpacked.
- d.prependVarFlag('do_deploy_source_date_epoch', 'prefuncs', 'create_source_date_epoch_stamp ')
-
- d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
- d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ")
-
- d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}')
- d.setVarFlag('do_configure', 'file-checksums', '${@srctree_configure_hash_files(d)}')
-
- # We don't want the workdir to go away
- d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN'))
-
- bb.build.addtask('do_buildclean',
- 'do_clean' if d.getVar('S') == d.getVar('B') else None,
- None, d)
-
- # If B=S the same builddir is used even for different architectures.
- # Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that
- # change of do_configure task hash is correctly detected and stamps are
- # invalidated if e.g. MACHINE changes.
- if d.getVar('S') == d.getVar('B'):
- configstamp = '${TMPDIR}/work-shared/${PN}/${EXTENDPE}${PV}-${PR}/configure.sstate'
- d.setVar('CONFIGURESTAMPFILE', configstamp)
- d.setVar('STAMP', '${STAMPS_DIR}/work-shared/${PN}/${EXTENDPE}${PV}-${PR}')
- d.setVar('STAMPCLEAN', '${STAMPS_DIR}/work-shared/${PN}/*-*')
-}
-
-python externalsrc_configure_prefunc() {
- s_dir = d.getVar('S')
- # Create desired symlinks
- symlinks = (d.getVar('EXTERNALSRC_SYMLINKS') or '').split()
- newlinks = []
- for symlink in symlinks:
- symsplit = symlink.split(':', 1)
- lnkfile = os.path.join(s_dir, symsplit[0])
- target = d.expand(symsplit[1])
- if len(symsplit) > 1:
- if os.path.islink(lnkfile):
- # Link already exists, leave it if it points to the right location already
- if os.readlink(lnkfile) == target:
- continue
- os.unlink(lnkfile)
- elif os.path.exists(lnkfile):
- # File/dir exists with same name as link, just leave it alone
- continue
- os.symlink(target, lnkfile)
- newlinks.append(symsplit[0])
- # Hide the symlinks from git
- try:
- git_exclude_file = os.path.join(s_dir, '.git/info/exclude')
- if os.path.exists(git_exclude_file):
- with open(git_exclude_file, 'r+') as efile:
- elines = efile.readlines()
- for link in newlinks:
- if link in elines or '/'+link in elines:
- continue
- efile.write('/' + link + '\n')
- except IOError as ioe:
- bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git')
-}
-
-python externalsrc_compile_prefunc() {
- # Make it obvious that this is happening, since forgetting about it could lead to much confusion
- bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC')))
-}
-
-do_buildclean[dirs] = "${S} ${B}"
-do_buildclean[nostamp] = "1"
-do_buildclean[doc] = "Call 'make clean' or equivalent in ${B}"
-externalsrc_do_buildclean() {
- if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
- rm -f ${@' '.join([x.split(':')[0] for x in (d.getVar('EXTERNALSRC_SYMLINKS') or '').split()])}
- if [ "${CLEANBROKEN}" != "1" ]; then
- oe_runmake clean || die "make failed"
- fi
- else
- bbnote "nothing to do - no makefile found"
- fi
-}
-
-def srctree_hash_files(d, srcdir=None):
- import shutil
- import subprocess
- import tempfile
- import hashlib
-
- s_dir = srcdir or d.getVar('EXTERNALSRC')
- git_dir = None
-
- try:
- git_dir = os.path.join(s_dir,
- subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
- top_git_dir = os.path.join(s_dir, subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'],
- stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
- if git_dir == top_git_dir:
- git_dir = None
- except subprocess.CalledProcessError:
- pass
-
- ret = " "
- if git_dir is not None:
- oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1-%s' % d.getVar('PN'))
- with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index:
- # Clone index
- shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name)
- # Update our custom index
- env = os.environ.copy()
- env['GIT_INDEX_FILE'] = tmp_index.name
- subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
- git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
- submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8")
- for line in submodule_helper.splitlines():
- module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
- if os.path.isdir(module_dir):
- proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
- proc.communicate()
- proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
- stdout, _ = proc.communicate()
- git_sha1 += stdout.decode("utf-8")
- sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
- with open(oe_hash_file, 'w') as fobj:
- fobj.write(sha1)
- ret = oe_hash_file + ':True'
- else:
- ret = s_dir + '/*:True'
- return ret
-
-def srctree_configure_hash_files(d):
- """
- Get the list of files that should trigger do_configure to re-execute,
- based on the value of CONFIGURE_FILES
- """
- in_files = (d.getVar('CONFIGURE_FILES') or '').split()
- out_items = []
- search_files = []
- for entry in in_files:
- if entry.startswith('/'):
- out_items.append('%s:%s' % (entry, os.path.exists(entry)))
- else:
- search_files.append(entry)
- if search_files:
- s_dir = d.getVar('EXTERNALSRC')
- for root, _, files in os.walk(s_dir):
- for f in files:
- if f in search_files:
- out_items.append('%s:True' % os.path.join(root, f))
- return ' '.join(out_items)
-
-EXPORT_FUNCTIONS do_buildclean
diff --git a/poky/meta/classes/extrausers.bbclass b/poky/meta/classes/extrausers.bbclass
index a8ef660..94576b8 100644
--- a/poky/meta/classes/extrausers.bbclass
+++ b/poky/meta/classes/extrausers.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# This bbclass is used for image level user/group configuration.
# Inherit this class if you want to make EXTRA_USERS_PARAMS effective.
diff --git a/poky/meta/classes/features_check.bbclass b/poky/meta/classes/features_check.bbclass
deleted file mode 100644
index 3ef6b35..0000000
--- a/poky/meta/classes/features_check.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-# Allow checking of required and conflicting features
-#
-# xxx = [DISTRO,MACHINE,COMBINED,IMAGE]
-#
-# ANY_OF_xxx_FEATURES: ensure at least one item on this list is included
-# in xxx_FEATURES.
-# REQUIRED_xxx_FEATURES: ensure every item on this list is included
-# in xxx_FEATURES.
-# CONFLICT_xxx_FEATURES: ensure no item in this list is included in
-# xxx_FEATURES.
-#
-# Copyright 2019 (C) Texas Instruments Inc.
-# Copyright 2013 (C) O.S. Systems Software LTDA.
-
-python () {
- if d.getVar('PARSE_ALL_RECIPES', False):
- return
-
- unused = True
-
- for kind in ['DISTRO', 'MACHINE', 'COMBINED', 'IMAGE']:
- if d.getVar('ANY_OF_' + kind + '_FEATURES') is None and not d.hasOverrides('ANY_OF_' + kind + '_FEATURES') and \
- d.getVar('REQUIRED_' + kind + '_FEATURES') is None and not d.hasOverrides('REQUIRED_' + kind + '_FEATURES') and \
- d.getVar('CONFLICT_' + kind + '_FEATURES') is None and not d.hasOverrides('CONFLICT_' + kind + '_FEATURES'):
- continue
-
- unused = False
-
- # Assume at least one var is set.
- features = set((d.getVar(kind + '_FEATURES') or '').split())
-
- any_of_features = set((d.getVar('ANY_OF_' + kind + '_FEATURES') or '').split())
- if any_of_features:
- if set.isdisjoint(any_of_features, features):
- raise bb.parse.SkipRecipe("one of '%s' needs to be in %s_FEATURES"
- % (' '.join(any_of_features), kind))
-
- required_features = set((d.getVar('REQUIRED_' + kind + '_FEATURES') or '').split())
- if required_features:
- missing = set.difference(required_features, features)
- if missing:
- raise bb.parse.SkipRecipe("missing required %s feature%s '%s' (not in %s_FEATURES)"
- % (kind.lower(), 's' if len(missing) > 1 else '', ' '.join(missing), kind))
-
- conflict_features = set((d.getVar('CONFLICT_' + kind + '_FEATURES') or '').split())
- if conflict_features:
- conflicts = set.intersection(conflict_features, features)
- if conflicts:
- raise bb.parse.SkipRecipe("conflicting %s feature%s '%s' (in %s_FEATURES)"
- % (kind.lower(), 's' if len(conflicts) > 1 else '', ' '.join(conflicts), kind))
-
- if unused:
- bb.warn("Recipe inherits features_check but doesn't use it")
-}
diff --git a/poky/meta/classes/fontcache.bbclass b/poky/meta/classes/fontcache.bbclass
deleted file mode 100644
index 442bfc7..0000000
--- a/poky/meta/classes/fontcache.bbclass
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# This class will generate the proper postinst/postrm scriptlets for font
-# packages.
-#
-
-PACKAGE_WRITE_DEPS += "qemu-native"
-inherit qemu
-
-FONT_PACKAGES ??= "${PN}"
-FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils"
-FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig"
-FONTCONFIG_CACHE_PARAMS ?= "-v"
-# You can change this to e.g. FC_DEBUG=16 to debug fc-cache issues,
-# something has to be set, because qemuwrapper is using this variable after -E
-# multiple variables aren't allowed because for qemu they are separated
-# by comma and in -n "$D" case they should be separated by space
-FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1"
-fontcache_common() {
-if [ -n "$D" ] ; then
- $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \
- 'bindir="${bindir}"' \
- 'libdir="${libdir}"' \
- 'libexecdir="${libexecdir}"' \
- 'base_libdir="${base_libdir}"' \
- 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
- 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
- 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
-else
- ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS}
-fi
-}
-
-python () {
- font_pkgs = d.getVar('FONT_PACKAGES').split()
- deps = d.getVar("FONT_EXTRA_RDEPENDS")
-
- for pkg in font_pkgs:
- if deps: d.appendVar('RDEPENDS:' + pkg, ' '+deps)
-}
-
-python add_fontcache_postinsts() {
- for pkg in d.getVar('FONT_PACKAGES').split():
- bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
- postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('fontcache_common')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('fontcache_common')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
-PACKAGEFUNCS =+ "add_fontcache_postinsts"
diff --git a/poky/meta/classes/fs-uuid.bbclass b/poky/meta/classes/fs-uuid.bbclass
deleted file mode 100644
index 9b53dfb..0000000
--- a/poky/meta/classes/fs-uuid.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-# Extract UUID from ${ROOTFS}, which must have been built
-# by the time that this function gets called. Only works
-# on ext file systems and depends on tune2fs.
-def get_rootfs_uuid(d):
- import subprocess
- rootfs = d.getVar('ROOTFS')
- output = subprocess.check_output(['tune2fs', '-l', rootfs])
- for line in output.split('\n'):
- if line.startswith('Filesystem UUID:'):
- uuid = line.split()[-1]
- bb.note('UUID of %s: %s' % (rootfs, uuid))
- return uuid
- bb.fatal('Could not determine filesystem UUID of %s' % rootfs)
-
-# Replace the special <<uuid-of-rootfs>> inside a string (like the
-# root= APPEND string in a syslinux.cfg or systemd-boot entry) with the
-# actual UUID of the rootfs. Does nothing if the special string
-# is not used.
-def replace_rootfs_uuid(d, string):
- UUID_PLACEHOLDER = '<<uuid-of-rootfs>>'
- if UUID_PLACEHOLDER in string:
- uuid = get_rootfs_uuid(d)
- string = string.replace(UUID_PLACEHOLDER, uuid)
- return string
diff --git a/poky/meta/classes/gconf.bbclass b/poky/meta/classes/gconf.bbclass
deleted file mode 100644
index 9d3668e..0000000
--- a/poky/meta/classes/gconf.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-DEPENDS += "gconf"
-PACKAGE_WRITE_DEPS += "gconf-native"
-
-# These are for when gconftool is used natively and the prefix isn't necessarily
-# the sysroot. TODO: replicate the postinst logic for -native packages going
-# into sysroot as they won't be running their own install-time schema
-# registration (disabled below) nor the postinst script (as they don't happen).
-export GCONF_SCHEMA_INSTALL_SOURCE = "xml:merged:${STAGING_DIR_NATIVE}${sysconfdir}/gconf/gconf.xml.defaults"
-export GCONF_BACKEND_DIR = "${STAGING_LIBDIR_NATIVE}/GConf/2"
-
-# Disable install-time schema registration as we're a packaging system so this
-# happens in the postinst script, not at install time. Set both the configure
-# script option and the traditional envionment variable just to make sure.
-EXTRA_OECONF += "--disable-schemas-install"
-export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL = "1"
-
-gconf_postinst() {
-if [ "x$D" != "x" ]; then
- export GCONF_CONFIG_SOURCE="xml::$D${sysconfdir}/gconf/gconf.xml.defaults"
-else
- export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
-fi
-
-SCHEMA_LOCATION=$D/etc/gconf/schemas
-for SCHEMA in ${SCHEMA_FILES}; do
- if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
- HOME=$D/root gconftool-2 \
- --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
- fi
-done
-}
-
-gconf_prerm() {
-SCHEMA_LOCATION=/etc/gconf/schemas
-for SCHEMA in ${SCHEMA_FILES}; do
- if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
- HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 \
- --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
- fi
-done
-}
-
-python populate_packages:append () {
- import re
- packages = d.getVar('PACKAGES').split()
- pkgdest = d.getVar('PKGDEST')
-
- for pkg in packages:
- schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
- schemas = []
- schema_re = re.compile(r".*\.schemas$")
- if os.path.exists(schema_dir):
- for f in os.listdir(schema_dir):
- if schema_re.match(f):
- schemas.append(f)
- if schemas != []:
- bb.note("adding gconf postinst and prerm scripts to %s" % pkg)
- d.setVar('SCHEMA_FILES', " ".join(schemas))
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('gconf_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
- prerm = d.getVar('pkg_prerm:%s' % pkg)
- if not prerm:
- prerm = '#!/bin/sh\n'
- prerm += d.getVar('gconf_prerm')
- d.setVar('pkg_prerm:%s' % pkg, prerm)
- d.appendVar("RDEPENDS:%s" % pkg, ' ' + d.getVar('MLPREFIX', False) + 'gconf')
-}
diff --git a/poky/meta/classes/gettext.bbclass b/poky/meta/classes/gettext.bbclass
deleted file mode 100644
index f11cb04..0000000
--- a/poky/meta/classes/gettext.bbclass
+++ /dev/null
@@ -1,22 +0,0 @@
-def gettext_dependencies(d):
- if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'):
- return ""
- if d.getVar('USE_NLS') == 'no':
- return "gettext-minimal-native"
- return "gettext-native"
-
-def gettext_oeconf(d):
- if d.getVar('USE_NLS') == 'no':
- return '--disable-nls'
- # Remove the NLS bits if USE_NLS is no or INHIBIT_DEFAULT_DEPS is set
- if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'):
- return '--disable-nls'
- return "--enable-nls"
-
-BASEDEPENDS:append = " ${@gettext_dependencies(d)}"
-EXTRA_OECONF:append = " ${@gettext_oeconf(d)}"
-
-# Without this, msgfmt from gettext-native will not find ITS files
-# provided by target recipes (for example, polkit.its).
-GETTEXTDATADIRS:append:class-target = ":${STAGING_DATADIR}/gettext"
-export GETTEXTDATADIRS
diff --git a/poky/meta/classes/gi-docgen.bbclass b/poky/meta/classes/gi-docgen.bbclass
deleted file mode 100644
index 15581ca..0000000
--- a/poky/meta/classes/gi-docgen.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-# gi-docgen is a new gnome documentation generator, which
-# seems to be a successor to gtk-doc:
-# https://gitlab.gnome.org/GNOME/gi-docgen
-
-# This variable is set to True if api-documentation is in
-# DISTRO_FEATURES, and False otherwise.
-GIDOCGEN_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'True', 'False', d)}"
-# When building native recipes, disable gi-docgen, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-GIDOCGEN_ENABLED:class-native = "False"
-GIDOCGEN_ENABLED:class-nativesdk = "False"
-
-# meson: default option name to enable/disable gi-docgen. This matches most
-# projects' configuration. In doubts - check meson_options.txt in project's
-# source path.
-GIDOCGEN_MESON_OPTION ?= 'gtk_doc'
-GIDOCGEN_MESON_ENABLE_FLAG ?= 'true'
-GIDOCGEN_MESON_DISABLE_FLAG ?= 'false'
-
-# Auto enable/disable based on GIDOCGEN_ENABLED
-EXTRA_OEMESON:prepend = "-D${GIDOCGEN_MESON_OPTION}=${@bb.utils.contains('GIDOCGEN_ENABLED', 'True', '${GIDOCGEN_MESON_ENABLE_FLAG}', '${GIDOCGEN_MESON_DISABLE_FLAG}', d)} "
-
-DEPENDS:append = "${@' gi-docgen-native gi-docgen' if d.getVar('GIDOCGEN_ENABLED') == 'True' else ''}"
-
diff --git a/poky/meta/classes/gio-module-cache.bbclass b/poky/meta/classes/gio-module-cache.bbclass
deleted file mode 100644
index 021eeb1..0000000
--- a/poky/meta/classes/gio-module-cache.bbclass
+++ /dev/null
@@ -1,38 +0,0 @@
-PACKAGE_WRITE_DEPS += "qemu-native"
-inherit qemu
-
-GIO_MODULE_PACKAGES ??= "${PN}"
-
-gio_module_cache_common() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_gio_module_cache ${PKG} \
- mlprefix=${MLPREFIX} \
- binprefix=${MLPREFIX} \
- libdir=${libdir} \
- libexecdir=${libexecdir} \
- base_libdir=${base_libdir} \
- bindir=${bindir}
-else
- ${libexecdir}/${MLPREFIX}gio-querymodules ${libdir}/gio/modules/
-fi
-}
-
-python populate_packages:append () {
- packages = d.getVar('GIO_MODULE_PACKAGES').split()
-
- for pkg in packages:
- bb.note("adding gio-module-cache postinst and postrm scripts to %s" % pkg)
-
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('gio_module_cache_common')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg)
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('gio_module_cache_common')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
diff --git a/poky/meta/classes/glide.bbclass b/poky/meta/classes/glide.bbclass
deleted file mode 100644
index 2db4ac6..0000000
--- a/poky/meta/classes/glide.bbclass
+++ /dev/null
@@ -1,9 +0,0 @@
-# Handle Glide Vendor Package Management use
-#
-# Copyright 2018 (C) O.S. Systems Software LTDA.
-
-DEPENDS:append = " glide-native"
-
-do_compile:prepend() {
- ( cd ${B}/src/${GO_IMPORT} && glide install )
-}
diff --git a/poky/meta/classes/gnomebase.bbclass b/poky/meta/classes/gnomebase.bbclass
deleted file mode 100644
index 9a5bd9a..0000000
--- a/poky/meta/classes/gnomebase.bbclass
+++ /dev/null
@@ -1,31 +0,0 @@
-def gnome_verdir(v):
- return ".".join(v.split(".")[:-1])
-
-
-GNOME_COMPRESS_TYPE ?= "xz"
-SECTION ?= "x11/gnome"
-GNOMEBN ?= "${BPN}"
-SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@gnome_verdir("${PV}")}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive"
-
-FILES:${PN} += "${datadir}/application-registry \
- ${datadir}/mime-info \
- ${datadir}/mime/packages \
- ${datadir}/mime/application \
- ${datadir}/gnome-2.0 \
- ${datadir}/polkit* \
- ${datadir}/GConf \
- ${datadir}/glib-2.0/schemas \
- ${datadir}/appdata \
- ${datadir}/icons \
-"
-
-FILES:${PN}-doc += "${datadir}/devhelp"
-
-GNOMEBASEBUILDCLASS ??= "autotools"
-inherit ${GNOMEBASEBUILDCLASS} pkgconfig
-
-do_install:append() {
- rm -rf ${D}${localstatedir}/lib/scrollkeeper/*
- rm -rf ${D}${localstatedir}/scrollkeeper/*
- rm -f ${D}${datadir}/applications/*.cache
-}
diff --git a/poky/meta/classes/go-mod.bbclass b/poky/meta/classes/go-mod.bbclass
deleted file mode 100644
index 674d243..0000000
--- a/poky/meta/classes/go-mod.bbclass
+++ /dev/null
@@ -1,20 +0,0 @@
-# Handle Go Modules support
-#
-# When using Go Modules, the the current working directory MUST be at or below
-# the location of the 'go.mod' file when the go tool is used, and there is no
-# way to tell it to look elsewhere. It will automatically look upwards for the
-# file, but not downwards.
-#
-# To support this use case, we provide the `GO_WORKDIR` variable, which defaults
-# to `GO_IMPORT` but allows for easy override.
-#
-# Copyright 2020 (C) O.S. Systems Software LTDA.
-
-# The '-modcacherw' option ensures we have write access to the cached objects so
-# we avoid errors during clean task as well as when removing the TMPDIR.
-GOBUILDFLAGS:append = " -modcacherw"
-
-inherit go
-
-GO_WORKDIR ?= "${GO_IMPORT}"
-do_compile[dirs] += "${B}/src/${GO_WORKDIR}"
diff --git a/poky/meta/classes/go-ptest.bbclass b/poky/meta/classes/go-ptest.bbclass
deleted file mode 100644
index b282ff7..0000000
--- a/poky/meta/classes/go-ptest.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-inherit go ptest
-
-do_compile_ptest_base() {
- export TMPDIR="${GOTMPDIR}"
- rm -f ${B}/.go_compiled_tests.list
- go_list_package_tests | while read pkg; do
- cd ${B}/src/$pkg
- ${GO} test ${GOPTESTBUILDFLAGS} $pkg
- find . -mindepth 1 -maxdepth 1 -type f -name '*.test' -exec echo $pkg/{} \; | \
- sed -e's,/\./,/,'>> ${B}/.go_compiled_tests.list
- done
- do_compile_ptest
-}
-
-do_compile_ptest_base[dirs] =+ "${GOTMPDIR}"
-
-go_make_ptest_wrapper() {
- cat >${D}${PTEST_PATH}/run-ptest <<EOF
-#!/bin/sh
-RC=0
-run_test() (
- cd "\$1"
- ((((./\$2 ${GOPTESTFLAGS}; echo \$? >&3) | sed -r -e"s,^(PASS|SKIP|FAIL)\$,\\1: \$1/\$2," >&4) 3>&1) | (read rc; exit \$rc)) 4>&1
- exit \$?)
-EOF
-
-}
-
-do_install_ptest_base() {
- test -f "${B}/.go_compiled_tests.list" || exit 0
- install -d ${D}${PTEST_PATH}
- go_stage_testdata
- go_make_ptest_wrapper
- havetests=""
- while read test; do
- testdir=`dirname $test`
- testprog=`basename $test`
- install -d ${D}${PTEST_PATH}/$testdir
- install -m 0755 ${B}/src/$test ${D}${PTEST_PATH}/$test
- echo "run_test $testdir $testprog || RC=1" >> ${D}${PTEST_PATH}/run-ptest
- havetests="yes"
- done < ${B}/.go_compiled_tests.list
- if [ -n "$havetests" ]; then
- echo "exit \$RC" >> ${D}${PTEST_PATH}/run-ptest
- chmod +x ${D}${PTEST_PATH}/run-ptest
- else
- rm -rf ${D}${PTEST_PATH}
- fi
- do_install_ptest
- chown -R root:root ${D}${PTEST_PATH}
-}
-
-INSANE_SKIP:${PN}-ptest += "ldflags"
-
diff --git a/poky/meta/classes/go.bbclass b/poky/meta/classes/go.bbclass
deleted file mode 100644
index cd2daed..0000000
--- a/poky/meta/classes/go.bbclass
+++ /dev/null
@@ -1,164 +0,0 @@
-inherit goarch
-inherit linuxloader
-
-GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
-
-export GODEBUG = "gocachehash=1"
-
-GOROOT:class-native = "${STAGING_LIBDIR_NATIVE}/go"
-GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"
-GOROOT = "${STAGING_LIBDIR}/go"
-export GOROOT
-export GOROOT_FINAL = "${libdir}/go"
-export GOCACHE = "${B}/.cache"
-
-export GOARCH = "${TARGET_GOARCH}"
-export GOOS = "${TARGET_GOOS}"
-export GOHOSTARCH="${BUILD_GOARCH}"
-export GOHOSTOS="${BUILD_GOOS}"
-
-GOARM[export] = "0"
-GOARM:arm:class-target = "${TARGET_GOARM}"
-GOARM:arm:class-target[export] = "1"
-
-GO386[export] = "0"
-GO386:x86:class-target = "${TARGET_GO386}"
-GO386:x86:class-target[export] = "1"
-
-GOMIPS[export] = "0"
-GOMIPS:mips:class-target = "${TARGET_GOMIPS}"
-GOMIPS:mips:class-target[export] = "1"
-
-DEPENDS_GOLANG:class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime"
-DEPENDS_GOLANG:class-native = "go-native"
-DEPENDS_GOLANG:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime"
-
-DEPENDS:append = " ${DEPENDS_GOLANG}"
-
-GO_LINKSHARED ?= "${@'-linkshared' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH_LINK = "${@'-Wl,-rpath-link=${STAGING_DIR_TARGET}${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH = "${@'-r ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH:class-native = "${@'-r ${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_RPATH_LINK:class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
-GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}"
-GO_LINKMODE ?= ""
-GO_LINKMODE:class-nativesdk = "--linkmode=external"
-GO_LINKMODE:class-native = "--linkmode=external"
-GO_EXTRA_LDFLAGS ?= ""
-GO_LINUXLOADER ?= "-I ${@get_linuxloader(d)}"
-# Use system loader. If uninative is used, the uninative loader will be patched automatically
-GO_LINUXLOADER:class-native = ""
-GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_LINUXLOADER} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
-export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
-export GOPATH_OMIT_IN_ACTIONID ?= "1"
-export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
-export GOPTESTFLAGS ?= ""
-GOBUILDFLAGS:prepend:task-compile = "${GO_PARALLEL_BUILD} "
-
-export GO = "${HOST_PREFIX}go"
-GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
-GOTOOLDIR:class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
-export GOTOOLDIR
-
-export CGO_ENABLED ?= "1"
-export CGO_CFLAGS ?= "${CFLAGS}"
-export CGO_CPPFLAGS ?= "${CPPFLAGS}"
-export CGO_CXXFLAGS ?= "${CXXFLAGS}"
-export CGO_LDFLAGS ?= "${LDFLAGS}"
-
-GO_INSTALL ?= "${GO_IMPORT}/..."
-GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
-
-B = "${WORKDIR}/build"
-export GOPATH = "${B}"
-export GOENV = "off"
-export GOTMPDIR ?= "${WORKDIR}/build-tmp"
-GOTMPDIR[vardepvalue] = ""
-
-python go_do_unpack() {
- src_uri = (d.getVar('SRC_URI') or "").split()
- if len(src_uri) == 0:
- return
-
- fetcher = bb.fetch2.Fetch(src_uri, d)
- for url in fetcher.urls:
- if fetcher.ud[url].type == 'git':
- if fetcher.ud[url].parm.get('destsuffix') is None:
- s_dirname = os.path.basename(d.getVar('S'))
- fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src', d.getVar('GO_IMPORT')) + '/'
- fetcher.unpack(d.getVar('WORKDIR'))
-}
-
-go_list_packages() {
- ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
- egrep -v '${GO_INSTALL_FILTEROUT}'
-}
-
-go_list_package_tests() {
- ${GO} list -f '{{.ImportPath}} {{.TestGoFiles}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
- grep -v '\[\]$' | \
- egrep -v '${GO_INSTALL_FILTEROUT}' | \
- awk '{ print $1 }'
-}
-
-go_do_configure() {
- ln -snf ${S}/src ${B}/
-}
-do_configure[dirs] =+ "${GOTMPDIR}"
-
-go_do_compile() {
- export TMPDIR="${GOTMPDIR}"
- if [ -n "${GO_INSTALL}" ]; then
- if [ -n "${GO_LINKSHARED}" ]; then
- ${GO} install ${GOBUILDFLAGS} `go_list_packages`
- rm -rf ${B}/bin
- fi
- ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} `go_list_packages`
- fi
-}
-do_compile[dirs] =+ "${GOTMPDIR}"
-do_compile[cleandirs] = "${B}/bin ${B}/pkg"
-
-go_do_install() {
- install -d ${D}${libdir}/go/src/${GO_IMPORT}
- tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' . | \
- tar -C ${D}${libdir}/go/src/${GO_IMPORT} --no-same-owner -xf -
- tar -C ${B} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' pkg | \
- tar -C ${D}${libdir}/go --no-same-owner -xf -
-
- if [ -n "`ls ${B}/${GO_BUILD_BINDIR}/`" ]; then
- install -d ${D}${bindir}
- install -m 0755 ${B}/${GO_BUILD_BINDIR}/* ${D}${bindir}/
- fi
-}
-
-go_stage_testdata() {
- oldwd="$PWD"
- cd ${S}/src
- find ${GO_IMPORT} -depth -type d -name testdata | while read d; do
- if echo "$d" | grep -q '/vendor/'; then
- continue
- fi
- parent=`dirname $d`
- install -d ${D}${PTEST_PATH}/$parent
- cp --preserve=mode,timestamps -R $d ${D}${PTEST_PATH}/$parent/
- done
- cd "$oldwd"
-}
-
-EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install
-
-FILES:${PN}-dev = "${libdir}/go/src"
-FILES:${PN}-staticdev = "${libdir}/go/pkg"
-
-INSANE_SKIP:${PN} += "ldflags"
-
-# Add -buildmode=pie to GOBUILDFLAGS to satisfy "textrel" QA checking, but mips
-# doesn't support -buildmode=pie, so skip the QA checking for mips/rv32 and its
-# variants.
-python() {
- if 'mips' in d.getVar('TARGET_ARCH') or 'riscv32' in d.getVar('TARGET_ARCH'):
- d.appendVar('INSANE_SKIP:%s' % d.getVar('PN'), " textrel")
- else:
- d.appendVar('GOBUILDFLAGS', ' -buildmode=pie')
-}
diff --git a/poky/meta/classes/goarch.bbclass b/poky/meta/classes/goarch.bbclass
deleted file mode 100644
index 92fec16..0000000
--- a/poky/meta/classes/goarch.bbclass
+++ /dev/null
@@ -1,116 +0,0 @@
-BUILD_GOOS = "${@go_map_os(d.getVar('BUILD_OS'), d)}"
-BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH'), d)}"
-BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}"
-HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}"
-HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}"
-HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d)}"
-HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-HOST_GOARM:class-native = "7"
-HOST_GO386:class-native = "sse2"
-HOST_GOMIPS:class-native = "hardfloat"
-HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
-TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
-TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
-TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d)}"
-TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
-TARGET_GOARM:class-native = "7"
-TARGET_GO386:class-native = "sse2"
-TARGET_GOMIPS:class-native = "hardfloat"
-TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
-GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}"
-
-# Use the MACHINEOVERRIDES to map ARM CPU architecture passed to GO via GOARM.
-# This is combined with *_ARCH to set HOST_GOARM and TARGET_GOARM.
-BASE_GOARM = ''
-BASE_GOARM:armv7ve = '7'
-BASE_GOARM:armv7a = '7'
-BASE_GOARM:armv6 = '6'
-BASE_GOARM:armv5 = '5'
-
-# Go supports dynamic linking on a limited set of architectures.
-# See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go
-GO_DYNLINK = ""
-GO_DYNLINK:arm ?= "1"
-GO_DYNLINK:aarch64 ?= "1"
-GO_DYNLINK:x86 ?= "1"
-GO_DYNLINK:x86-64 ?= "1"
-GO_DYNLINK:powerpc64 ?= "1"
-GO_DYNLINK:powerpc64le ?= "1"
-GO_DYNLINK:class-native ?= ""
-GO_DYNLINK:class-nativesdk = ""
-
-# define here because everybody inherits this class
-#
-COMPATIBLE_HOST:linux-gnux32 = "null"
-COMPATIBLE_HOST:linux-muslx32 = "null"
-COMPATIBLE_HOST:powerpc = "null"
-COMPATIBLE_HOST:powerpc64 = "null"
-COMPATIBLE_HOST:mipsarchn32 = "null"
-
-ARM_INSTRUCTION_SET:armv4 = "arm"
-ARM_INSTRUCTION_SET:armv5 = "arm"
-ARM_INSTRUCTION_SET:armv6 = "arm"
-
-TUNE_CCARGS:remove = "-march=mips32r2"
-SECURITY_NOPIE_CFLAGS ??= ""
-
-# go can't be built with ccache:
-# gcc: fatal error: no input files
-CCACHE_DISABLE ?= "1"
-
-def go_map_arch(a, d):
- import re
- if re.match('i.86', a):
- return '386'
- elif a == 'x86_64':
- return 'amd64'
- elif re.match('arm.*', a):
- return 'arm'
- elif re.match('aarch64.*', a):
- return 'arm64'
- elif re.match('mips64el.*', a):
- return 'mips64le'
- elif re.match('mips64.*', a):
- return 'mips64'
- elif a == 'mips':
- return 'mips'
- elif a == 'mipsel':
- return 'mipsle'
- elif re.match('p(pc|owerpc)(64le)', a):
- return 'ppc64le'
- elif re.match('p(pc|owerpc)(64)', a):
- return 'ppc64'
- elif a == 'riscv64':
- return 'riscv64'
- else:
- raise bb.parse.SkipRecipe("Unsupported CPU architecture: %s" % a)
-
-def go_map_arm(a, d):
- if a.startswith("arm"):
- return d.getVar('BASE_GOARM')
- return ''
-
-def go_map_386(a, f, d):
- import re
- if re.match('i.86', a):
- if ('core2' in f) or ('corei7' in f):
- return 'sse2'
- else:
- return 'softfloat'
- return ''
-
-def go_map_mips(a, f, d):
- import re
- if a == 'mips' or a == 'mipsel':
- if 'fpu-hard' in f:
- return 'hardfloat'
- else:
- return 'softfloat'
- return ''
-
-def go_map_os(o, d):
- if o.startswith('linux'):
- return 'linux'
- return o
diff --git a/poky/meta/classes/gobject-introspection-data.bbclass b/poky/meta/classes/gobject-introspection-data.bbclass
deleted file mode 100644
index d90cdb4..0000000
--- a/poky/meta/classes/gobject-introspection-data.bbclass
+++ /dev/null
@@ -1,12 +0,0 @@
-# This variable is set to True if gobject-introspection-data is in
-# DISTRO_FEATURES and qemu-usermode is in MACHINE_FEATURES, and False otherwise.
-#
-# It should be used in recipes to determine whether introspection data should be built,
-# so that qemu use can be avoided when necessary.
-GI_DATA_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'gobject-introspection-data', \
- bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}"
-
-do_compile:prepend() {
- # This prevents g-ir-scanner from writing cache data to $HOME
- export GI_SCANNER_DISABLE_CACHE=1
-}
diff --git a/poky/meta/classes/gobject-introspection.bbclass b/poky/meta/classes/gobject-introspection.bbclass
deleted file mode 100644
index 7bf9feb..0000000
--- a/poky/meta/classes/gobject-introspection.bbclass
+++ /dev/null
@@ -1,55 +0,0 @@
-# Inherit this class in recipes to enable building their introspection files
-
-# python3native is inherited to prevent introspection tools being run with
-# host's python 3 (they need to be run with native python 3)
-#
-# This also sets up autoconf-based recipes to build introspection data (or not),
-# depending on distro and machine features (see gobject-introspection-data class).
-inherit python3native gobject-introspection-data
-
-# meson: default option name to enable/disable introspection. This matches most
-# project's configuration. In doubts - check meson_options.txt in project's
-# source path.
-GIR_MESON_OPTION ?= 'introspection'
-GIR_MESON_ENABLE_FLAG ?= 'true'
-GIR_MESON_DISABLE_FLAG ?= 'false'
-
-# Define g-i options such that they can be disabled completely when GIR_MESON_OPTION is empty
-GIRMESONTARGET = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GIR_MESON_ENABLE_FLAG}', '${GIR_MESON_DISABLE_FLAG}', d)} "
-GIRMESONBUILD = "-D${GIR_MESON_OPTION}=${GIR_MESON_DISABLE_FLAG} "
-# Auto enable/disable based on GI_DATA_ENABLED
-EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} "
-EXTRA_OEMESON:prepend:class-target = "${@['', '${GIRMESONTARGET}'][d.getVar('GIR_MESON_OPTION') != '']}"
-# When building native recipes, disable introspection, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-EXTRA_OECONF:prepend:class-native = "--disable-introspection "
-EXTRA_OECONF:prepend:class-nativesdk = "--disable-introspection "
-EXTRA_OEMESON:prepend:class-native = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}"
-EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}"
-
-# Generating introspection data depends on a combination of native and target
-# introspection tools, and qemu to run the target tools.
-DEPENDS:append:class-target = " gobject-introspection gobject-introspection-native qemu-native"
-
-# Even though introspection is disabled on -native, gobject-introspection package is still
-# needed for m4 macros.
-DEPENDS:append:class-native = " gobject-introspection-native"
-DEPENDS:append:class-nativesdk = " gobject-introspection-native"
-
-# This is used by introspection tools to find .gir includes
-export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
-
-do_configure:prepend:class-target () {
- # introspection.m4 pre-packaged with upstream tarballs does not yet
- # have our fixes
- mkdir -p ${S}/m4
- cp ${STAGING_DIR_TARGET}/${datadir}/aclocal/introspection.m4 ${S}/m4
-}
-
-# .typelib files are needed at runtime and so they go to the main package (so
-# they'll be together with libraries they support).
-FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib"
-
-# .gir files go to dev package, as they're needed for developing (but not for
-# running) things that depends on introspection.
-FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir"
diff --git a/poky/meta/classes/grub-efi-cfg.bbclass b/poky/meta/classes/grub-efi-cfg.bbclass
deleted file mode 100644
index ea21b3d..0000000
--- a/poky/meta/classes/grub-efi-cfg.bbclass
+++ /dev/null
@@ -1,123 +0,0 @@
-# grub-efi.bbclass
-# Copyright (c) 2011, Intel Corporation.
-# All rights reserved.
-#
-# Released under the MIT license (see packages/COPYING)
-
-# Provide grub-efi specific functions for building bootable images.
-
-# External variables
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-# ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
-# ${LABELS} - a list of targets for the automatic config
-# ${APPEND} - an override list of append strings for each label
-# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
-# ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
-# ${GRUB_ROOT} - grub's root device.
-
-GRUB_SERIAL ?= "console=ttyS0,115200"
-GRUB_CFG_VM = "${S}/grub_vm.cfg"
-GRUB_CFG_LIVE = "${S}/grub_live.cfg"
-GRUB_TIMEOUT ?= "10"
-#FIXME: build this from the machine config
-GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
-
-GRUB_ROOT ?= "${ROOT}"
-APPEND ?= ""
-
-# Uses MACHINE specific KERNEL_IMAGETYPE
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# Need UUID utility code.
-inherit fs-uuid
-
-python build_efi_cfg() {
- import sys
-
- workdir = d.getVar('WORKDIR')
- if not workdir:
- bb.error("WORKDIR not defined, unable to package")
- return
-
- gfxserial = d.getVar('GRUB_GFXSERIAL') or ""
-
- labels = d.getVar('LABELS')
- if not labels:
- bb.debug(1, "LABELS not defined, nothing to do")
- return
-
- if labels == []:
- bb.debug(1, "No labels, nothing to do")
- return
-
- cfile = d.getVar('GRUB_CFG')
- if not cfile:
- bb.fatal('Unable to read GRUB_CFG')
-
- try:
- cfgfile = open(cfile, 'w')
- except OSError:
- bb.fatal('Unable to open %s' % cfile)
-
- cfgfile.write('# Automatically created by OE\n')
-
- opts = d.getVar('GRUB_OPTS')
- if opts:
- for opt in opts.split(';'):
- cfgfile.write('%s\n' % opt)
-
- cfgfile.write('default=%s\n' % (labels.split()[0]))
-
- timeout = d.getVar('GRUB_TIMEOUT')
- if timeout:
- cfgfile.write('timeout=%s\n' % timeout)
- else:
- cfgfile.write('timeout=50\n')
-
- root = d.getVar('GRUB_ROOT')
- if not root:
- bb.fatal('GRUB_ROOT not defined')
-
- if gfxserial == "1":
- btypes = [ [ " graphics console", "" ],
- [ " serial console", d.getVar('GRUB_SERIAL') or "" ] ]
- else:
- btypes = [ [ "", "" ] ]
-
- for label in labels.split():
- localdata = d.createCopy()
-
- overrides = localdata.getVar('OVERRIDES')
- if not overrides:
- bb.fatal('OVERRIDES not defined')
-
- localdata.setVar('OVERRIDES', 'grub_' + label + ':' + overrides)
-
- for btype in btypes:
- cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
- lb = label
- if label == "install":
- lb = "install-efi"
- kernel = localdata.getVar('KERNEL_IMAGETYPE')
- cfgfile.write('linux /%s LABEL=%s' % (kernel, lb))
-
- cfgfile.write(' %s' % replace_rootfs_uuid(d, root))
-
- append = localdata.getVar('APPEND')
- initrd = localdata.getVar('INITRD')
-
- if append:
- append = replace_rootfs_uuid(d, append)
- cfgfile.write(' %s' % (append))
-
- cfgfile.write(' %s' % btype[1])
- cfgfile.write('\n')
-
- if initrd:
- cfgfile.write('initrd /initrd')
- cfgfile.write('\n}\n')
-
- cfgfile.close()
-}
-build_efi_cfg[vardepsexclude] += "OVERRIDES"
diff --git a/poky/meta/classes/grub-efi.bbclass b/poky/meta/classes/grub-efi.bbclass
deleted file mode 100644
index 8fc6999..0000000
--- a/poky/meta/classes/grub-efi.bbclass
+++ /dev/null
@@ -1,8 +0,0 @@
-inherit grub-efi-cfg
-require conf/image-uefi.conf
-
-efi_populate() {
- efi_populate_common "$1" grub-efi
-
- install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
-}
diff --git a/poky/meta/classes/gsettings.bbclass b/poky/meta/classes/gsettings.bbclass
deleted file mode 100644
index 3fa5bd4..0000000
--- a/poky/meta/classes/gsettings.bbclass
+++ /dev/null
@@ -1,42 +0,0 @@
-# A bbclass to handle installed GSettings (glib) schemas, updated the compiled
-# form on package install and remove.
-#
-# The compiled schemas are platform-agnostic, so we can depend on
-# glib-2.0-native for the native tool and run the postinst script when the
-# rootfs builds to save a little time on first boot.
-
-# TODO use a trigger so that this runs once per package operation run
-
-GSETTINGS_PACKAGE ?= "${PN}"
-
-python __anonymous() {
- pkg = d.getVar("GSETTINGS_PACKAGE")
- if pkg:
- d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native")
- d.appendVar("RDEPENDS:" + pkg, " ${MLPREFIX}glib-2.0-utils")
- d.appendVar("FILES:" + pkg, " ${datadir}/glib-2.0/schemas")
-}
-
-gsettings_postinstrm () {
- glib-compile-schemas $D${datadir}/glib-2.0/schemas
-}
-
-python populate_packages:append () {
- pkg = d.getVar('GSETTINGS_PACKAGE')
- if pkg:
- bb.note("adding gsettings postinst scripts to %s" % pkg)
-
- postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('gsettings_postinstrm')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- bb.note("adding gsettings postrm scripts to %s" % pkg)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('gsettings_postinstrm')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
diff --git a/poky/meta/classes/gtk-doc.bbclass b/poky/meta/classes/gtk-doc.bbclass
deleted file mode 100644
index 07b46ac..0000000
--- a/poky/meta/classes/gtk-doc.bbclass
+++ /dev/null
@@ -1,83 +0,0 @@
-# Helper class to pull in the right gtk-doc dependencies and configure
-# gtk-doc to enable or disable documentation building (which requries the
-# use of usermode qemu).
-
-# This variable is set to True if api-documentation is in
-# DISTRO_FEATURES and qemu-usermode is in MACHINE_FEATURES, and False otherwise.
-#
-# It should be used in recipes to determine whether gtk-doc based documentation should be built,
-# so that qemu use can be avoided when necessary.
-GTKDOC_ENABLED:class-native = "False"
-GTKDOC_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', \
- bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}"
-
-# meson: default option name to enable/disable gtk-doc. This matches most
-# project's configuration. In doubts - check meson_options.txt in project's
-# source path.
-GTKDOC_MESON_OPTION ?= 'docs'
-GTKDOC_MESON_ENABLE_FLAG ?= 'true'
-GTKDOC_MESON_DISABLE_FLAG ?= 'false'
-
-# Auto enable/disable based on GTKDOC_ENABLED
-EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GTKDOC_ENABLED', 'True', '--enable-gtk-doc --enable-gtk-doc-html --disable-gtk-doc-pdf', \
- '--disable-gtk-doc', d)} "
-EXTRA_OEMESON:prepend:class-target = "-D${GTKDOC_MESON_OPTION}=${@bb.utils.contains('GTKDOC_ENABLED', 'True', '${GTKDOC_MESON_ENABLE_FLAG}', '${GTKDOC_MESON_DISABLE_FLAG}', d)} "
-
-# When building native recipes, disable gtkdoc, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-EXTRA_OECONF:prepend:class-native = "--disable-gtk-doc "
-EXTRA_OECONF:prepend:class-nativesdk = "--disable-gtk-doc "
-EXTRA_OEMESON:prepend:class-native = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
-EXTRA_OEMESON:prepend:class-nativesdk = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
-
-# Even though gtkdoc is disabled on -native, gtk-doc package is still
-# needed for m4 macros.
-DEPENDS:append = " gtk-doc-native"
-
-# The documentation directory, where the infrastructure will be copied.
-# gtkdocize has a default of "." so to handle out-of-tree builds set this to $S.
-GTKDOC_DOCDIR ?= "${S}"
-
-export STAGING_DIR_HOST
-
-inherit python3native pkgconfig qemu
-DEPENDS:append = "${@' qemu-native' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
-
-do_configure:prepend () {
- # Need to use ||true as this is only needed if configure.ac both exists
- # and uses GTK_DOC_CHECK.
- gtkdocize --srcdir ${S} --docdir ${GTKDOC_DOCDIR} || true
-}
-
-do_compile:prepend:class-target () {
- if [ ${GTKDOC_ENABLED} = True ]; then
- # Write out a qemu wrapper that will be given to gtkdoc-scangobj so that it
- # can run target helper binaries through that.
- qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
- cat > ${B}/gtkdoc-qemuwrapper << EOF
-#!/bin/sh
-# Use a modules directory which doesn't exist so we don't load random things
-# which may then get deleted (or their dependencies) and potentially segfault
-export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
-
-GIR_EXTRA_LIBS_PATH=\`find ${B} -name *.so -printf "%h\n"|sort|uniq| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH
-GIR_EXTRA_LIBS_PATH=\`find ${B} -name .libs| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH
-
-# meson sets this wrongly (only to libs in build-dir), qemu_wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
-unset LD_LIBRARY_PATH
-
-if [ -d ".libs" ]; then
- $qemu_binary ".libs/\$@"
-else
- $qemu_binary "\$@"
-fi
-
-if [ \$? -ne 0 ]; then
- echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help."
- echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )"
- exit 1
-fi
-EOF
- chmod +x ${B}/gtkdoc-qemuwrapper
- fi
-}
diff --git a/poky/meta/classes/gtk-icon-cache.bbclass b/poky/meta/classes/gtk-icon-cache.bbclass
deleted file mode 100644
index 6808339..0000000
--- a/poky/meta/classes/gtk-icon-cache.bbclass
+++ /dev/null
@@ -1,89 +0,0 @@
-FILES:${PN} += "${datadir}/icons/hicolor"
-
-GTKIC_VERSION ??= '3'
-
-GTKPN = "${@ 'gtk4' if d.getVar('GTKIC_VERSION') == '4' else 'gtk+3' }"
-GTKIC_CMD = "${@ 'gtk-update-icon-cache-3.0.0' if d.getVar('GTKIC_VERSION') == '4' else 'gtk4-update-icon-cache' }"
-
-#gtk+3/gtk4 require GTK3DISTROFEATURES, DEPENDS on it make all the
-#recipes inherit this class require GTK3DISTROFEATURES
-inherit features_check
-ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
-
-DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
- ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
- ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
- ${GTKPN}-native \
-"
-
-PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native"
-
-gtk_icon_cache_postinst() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
- mlprefix=${MLPREFIX} \
- libdir_native=${libdir_native}
-else
-
- # Update the pixbuf loaders in case they haven't been registered yet
- ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
-
- for icondir in /usr/share/icons/* ; do
- if [ -d $icondir ] ; then
- ${GTKIC_CMD} -fqt $icondir
- fi
- done
-fi
-}
-
-gtk_icon_cache_postrm() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
- mlprefix=${MLPREFIX} \
- libdir=${libdir}
-else
- for icondir in /usr/share/icons/* ; do
- if [ -d $icondir ] ; then
- ${GTKIC_CMD} -qt $icondir
- fi
- done
-fi
-}
-
-python populate_packages:append () {
- packages = d.getVar('PACKAGES').split()
- pkgdest = d.getVar('PKGDEST')
-
- for pkg in packages:
- icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir'))
- if not os.path.exists(icon_dir):
- continue
-
- bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
- rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
- d.appendVar('RDEPENDS:%s' % pkg, rdepends)
-
- #gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3/gtk4
- bb.note("adding gdk-pixbuf dependency to %s" % pkg)
- rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf"
- d.appendVar('RDEPENDS:%s' % pkg, rdepends)
-
- bb.note("adding %s dependency to %s" % (d.getVar('GTKPN'), pkg))
- rdepends = ' ' + d.getVar('MLPREFIX', False) + d.getVar('GTKPN')
- d.appendVar('RDEPENDS:%s' % pkg, rdepends)
-
- bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
-
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('gtk_icon_cache_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg)
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('gtk_icon_cache_postrm')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
diff --git a/poky/meta/classes/gtk-immodules-cache.bbclass b/poky/meta/classes/gtk-immodules-cache.bbclass
deleted file mode 100644
index 2107517..0000000
--- a/poky/meta/classes/gtk-immodules-cache.bbclass
+++ /dev/null
@@ -1,76 +0,0 @@
-# This class will update the inputmethod module cache for virtual keyboards
-#
-# Usage: Set GTKIMMODULES_PACKAGES to the packages that needs to update the inputmethod modules
-
-PACKAGE_WRITE_DEPS += "qemu-native"
-
-inherit qemu
-
-GTKIMMODULES_PACKAGES ?= "${PN}"
-
-gtk_immodule_cache_postinst() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_gtk_immodules_cache ${PKG} \
- mlprefix=${MLPREFIX} \
- binprefix=${MLPREFIX} \
- libdir=${libdir} \
- libexecdir=${libexecdir} \
- base_libdir=${base_libdir} \
- bindir=${bindir}
-else
- if [ ! -z `which gtk-query-immodules-2.0` ]; then
- gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache
- fi
- if [ ! -z `which gtk-query-immodules-3.0` ]; then
- mkdir -p ${libdir}/gtk-3.0/3.0.0
- gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache
- fi
-fi
-}
-
-gtk_immodule_cache_postrm() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_gtk_immodules_cache ${PKG} \
- mlprefix=${MLPREFIX} \
- binprefix=${MLPREFIX} \
- libdir=${libdir} \
- libexecdir=${libexecdir} \
- base_libdir=${base_libdir} \
- bindir=${bindir}
-else
- if [ ! -z `which gtk-query-immodules-2.0` ]; then
- gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache
- fi
- if [ ! -z `which gtk-query-immodules-3.0` ]; then
- gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache
- fi
-fi
-}
-
-python populate_packages:append () {
- gtkimmodules_pkgs = d.getVar('GTKIMMODULES_PACKAGES').split()
-
- for pkg in gtkimmodules_pkgs:
- bb.note("adding gtk-immodule-cache postinst and postrm scripts to %s" % pkg)
-
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('gtk_immodule_cache_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg)
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('gtk_immodule_cache_postrm')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
-python __anonymous() {
- if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
- gtkimmodules_check = d.getVar('GTKIMMODULES_PACKAGES', False)
- if not gtkimmodules_check:
- bb_filename = d.getVar('FILE', False)
- bb.fatal("ERROR: %s inherits gtk-immodules-cache but doesn't set GTKIMMODULES_PACKAGES" % bb_filename)
-}
-
diff --git a/poky/meta/classes/icecc.bbclass b/poky/meta/classes/icecc.bbclass
index 9b912a3..a11e781 100644
--- a/poky/meta/classes/icecc.bbclass
+++ b/poky/meta/classes/icecc.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# IceCream distributed compiling support
#
# Stages directories with symlinks from gcc/g++ to icecc, for both
diff --git a/poky/meta/classes/image-artifact-names.bbclass b/poky/meta/classes/image-artifact-names.bbclass
deleted file mode 100644
index f5769e5..0000000
--- a/poky/meta/classes/image-artifact-names.bbclass
+++ /dev/null
@@ -1,22 +0,0 @@
-##################################################################
-# Specific image creation and rootfs population info.
-##################################################################
-
-IMAGE_BASENAME ?= "${PN}"
-IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
-IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
-IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
-IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
-
-# IMAGE_NAME is the base name for everything produced when building images.
-# The actual image that contains the rootfs has an additional suffix (.rootfs
-# by default) followed by additional suffices which describe the format (.ext4,
-# .ext4.xz, etc.).
-IMAGE_NAME_SUFFIX ??= ".rootfs"
-
-python () {
- if bb.data.inherits_class('deploy', d) and d.getVar("IMAGE_VERSION_SUFFIX") == "-${DATETIME}":
- import datetime
- d.setVar("IMAGE_VERSION_SUFFIX", "-" + datetime.datetime.fromtimestamp(int(d.getVar("SOURCE_DATE_EPOCH")), datetime.timezone.utc).strftime('%Y%m%d%H%M%S'))
- d.setVarFlag("IMAGE_VERSION_SUFFIX", "vardepvalue", "")
-}
diff --git a/poky/meta/classes/image-buildinfo.bbclass b/poky/meta/classes/image-buildinfo.bbclass
index ef790bb..206cc9d 100644
--- a/poky/meta/classes/image-buildinfo.bbclass
+++ b/poky/meta/classes/image-buildinfo.bbclass
@@ -4,7 +4,7 @@
# Copyright (C) 2014 Intel Corporation
# Author: Alejandro Enedino Hernandez Samaniego <alejandro.hernandez@intel.com>
#
-# Licensed under the MIT license, see COPYING.MIT for details
+# SPDX-License-Identifier: MIT
#
# Usage: add INHERIT += "image-buildinfo" to your conf file
#
diff --git a/poky/meta/classes/image-combined-dbg.bbclass b/poky/meta/classes/image-combined-dbg.bbclass
deleted file mode 100644
index e5dc61f..0000000
--- a/poky/meta/classes/image-combined-dbg.bbclass
+++ /dev/null
@@ -1,9 +0,0 @@
-IMAGE_PREPROCESS_COMMAND:append = " combine_dbg_image; "
-
-combine_dbg_image () {
- if [ "${IMAGE_GEN_DEBUGFS}" = "1" -a -e ${IMAGE_ROOTFS}-dbg ]; then
- # copy target files into -dbg rootfs, so it can be used for
- # debug purposes directly
- tar -C ${IMAGE_ROOTFS} -cf - . | tar -C ${IMAGE_ROOTFS}-dbg -xf -
- fi
-}
diff --git a/poky/meta/classes/image-container.bbclass b/poky/meta/classes/image-container.bbclass
deleted file mode 100644
index 3d19935..0000000
--- a/poky/meta/classes/image-container.bbclass
+++ /dev/null
@@ -1,21 +0,0 @@
-ROOTFS_BOOTSTRAP_INSTALL = ""
-IMAGE_TYPES_MASKED += "container"
-IMAGE_TYPEDEP:container = "tar.bz2"
-
-python __anonymous() {
- if "container" in d.getVar("IMAGE_FSTYPES") and \
- d.getVar("IMAGE_CONTAINER_NO_DUMMY") != "1" and \
- "linux-dummy" not in d.getVar("PREFERRED_PROVIDER_virtual/kernel"):
- msg = '"container" is in IMAGE_FSTYPES, but ' \
- 'PREFERRED_PROVIDER_virtual/kernel is not "linux-dummy". ' \
- 'Unless a particular kernel is needed, using linux-dummy will ' \
- 'prevent a kernel from being built, which can reduce ' \
- 'build times. If you don\'t want to use "linux-dummy", set ' \
- '"IMAGE_CONTAINER_NO_DUMMY" to "1".'
-
- # Raising skip recipe was Paul's clever idea. It causes the error to
- # only be shown for the recipes actually requested to build, rather
- # than bb.fatal which would appear for all recipes inheriting the
- # class.
- raise bb.parse.SkipRecipe(msg)
-}
diff --git a/poky/meta/classes/image-live.bbclass b/poky/meta/classes/image-live.bbclass
deleted file mode 100644
index 2c94819..0000000
--- a/poky/meta/classes/image-live.bbclass
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright (C) 2004, Advanced Micro Devices, Inc. All Rights Reserved
-# Released under the MIT license (see packages/COPYING)
-
-# Creates a bootable image using syslinux, your kernel and an optional
-# initrd
-
-#
-# End result is two things:
-#
-# 1. A .hddimg file which is an msdos filesystem containing syslinux, a kernel,
-# an initrd and a rootfs image. These can be written to harddisks directly and
-# also booted on USB flash disks (write them there with dd).
-#
-# 2. A CD .iso image
-
-# Boot process is that the initrd will boot and process which label was selected
-# in syslinux. Actions based on the label are then performed (e.g. installing to
-# an hdd)
-
-# External variables (also used by syslinux.bbclass)
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${HDDIMG_ID} - FAT image volume-id
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-
-inherit live-vm-common image-artifact-names
-
-do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
- mtools-native:do_populate_sysroot \
- cdrtools-native:do_populate_sysroot \
- virtual/kernel:do_deploy \
- ${MLPREFIX}syslinux:do_populate_sysroot \
- syslinux-native:do_populate_sysroot \
- ${@'%s:do_image_%s' % (d.getVar('PN'), d.getVar('LIVE_ROOTFS_TYPE').replace('-', '_')) if d.getVar('ROOTFS') else ''} \
- "
-
-
-LABELS_LIVE ?= "boot install"
-ROOT_LIVE ?= "root=/dev/ram0"
-INITRD_IMAGE_LIVE ?= "${MLPREFIX}core-image-minimal-initramfs"
-INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.${INITRAMFS_FSTYPES}"
-
-LIVE_ROOTFS_TYPE ?= "ext4"
-ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${LIVE_ROOTFS_TYPE}"
-
-IMAGE_TYPEDEP:live = "${LIVE_ROOTFS_TYPE}"
-IMAGE_TYPEDEP:iso = "${LIVE_ROOTFS_TYPE}"
-IMAGE_TYPEDEP:hddimg = "${LIVE_ROOTFS_TYPE}"
-IMAGE_TYPES_MASKED += "live hddimg iso"
-
-python() {
- image_b = d.getVar('IMAGE_BASENAME')
- initrd_i = d.getVar('INITRD_IMAGE_LIVE')
- if image_b == initrd_i:
- bb.error('INITRD_IMAGE_LIVE %s cannot use image live, hddimg or iso.' % initrd_i)
- bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.')
- elif initrd_i:
- d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i)
-}
-
-HDDDIR = "${S}/hddimg"
-ISODIR = "${S}/iso"
-EFIIMGDIR = "${S}/efi_img"
-COMPACT_ISODIR = "${S}/iso.z"
-
-ISOLINUXDIR ?= "/isolinux"
-ISO_BOOTIMG = "isolinux/isolinux.bin"
-ISO_BOOTCAT = "isolinux/boot.cat"
-MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
-
-BOOTIMG_VOLUME_ID ?= "boot"
-BOOTIMG_EXTRA_SPACE ?= "512"
-
-populate_live() {
- populate_kernel $1
- if [ -s "${ROOTFS}" ]; then
- install -m 0644 ${ROOTFS} $1/rootfs.img
- fi
-}
-
-build_iso() {
- # Only create an ISO if we have an INITRD and the live or iso image type was selected
- if [ -z "${INITRD}" ] || [ "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso', '1', '0', d)}" != "1" ]; then
- bbnote "ISO image will not be created."
- return
- fi
- # ${INITRD} is a list of multiple filesystem images
- for fs in ${INITRD}
- do
- if [ ! -s "$fs" ]; then
- bbwarn "ISO image will not be created. $fs is invalid."
- return
- fi
- done
-
- populate_live ${ISODIR}
-
- if [ "${PCBIOS}" = "1" ]; then
- syslinux_iso_populate ${ISODIR}
- fi
- if [ "${EFI}" = "1" ]; then
- efi_iso_populate ${ISODIR}
- build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img
- fi
-
- # EFI only
- if [ "${PCBIOS}" != "1" ] && [ "${EFI}" = "1" ] ; then
- # Work around bug in isohybrid where it requires isolinux.bin
- # In the boot catalog, even though it is not used
- mkdir -p ${ISODIR}/${ISOLINUXDIR}
- install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR}
- fi
-
- # We used to have support for zisofs; this is a relic of that
- mkisofs_compress_opts="-r"
-
- # Check the size of ${ISODIR}/rootfs.img, use mkisofs -iso-level 3
- # when it exceeds 3.8GB, the specification is 4G - 1 bytes, we need
- # leave a few space for other files.
- mkisofs_iso_level=""
-
- if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
- rootfs_img_size=`stat -c '%s' ${ISODIR}/rootfs.img`
- # 4080218931 = 3.8 * 1024 * 1024 * 1024
- if [ $rootfs_img_size -gt 4080218931 ]; then
- bbnote "${ISODIR}/rootfs.img execeeds 3.8GB, using '-iso-level 3' for mkisofs"
- mkisofs_iso_level="-iso-level 3"
- fi
- fi
-
- if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then
- # PCBIOS only media
- mkisofs -V ${BOOTIMG_VOLUME_ID} \
- -o ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso \
- -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \
- $mkisofs_compress_opts \
- ${MKISOFS_OPTIONS} $mkisofs_iso_level ${ISODIR}
- else
- # EFI only OR EFI+PCBIOS
- mkisofs -A ${BOOTIMG_VOLUME_ID} -V ${BOOTIMG_VOLUME_ID} \
- -o ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso \
- -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \
- $mkisofs_compress_opts ${MKISOFS_OPTIONS} $mkisofs_iso_level \
- -eltorito-alt-boot -eltorito-platform efi \
- -b efi.img -no-emul-boot \
- ${ISODIR}
- isohybrid_args="-u"
- fi
-
- isohybrid $isohybrid_args ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso
-}
-
-build_fat_img() {
- FATSOURCEDIR=$1
- FATIMG=$2
-
- # Calculate the size required for the final image including the
- # data and filesystem overhead.
- # Sectors: 512 bytes
- # Blocks: 1024 bytes
-
- # Determine the sector count just for the data
- SECTORS=$(expr $(du --apparent-size -ks ${FATSOURCEDIR} | cut -f 1) \* 2)
-
- # Account for the filesystem overhead. This includes directory
- # entries in the clusters as well as the FAT itself.
- # Assumptions:
- # FAT32 (12 or 16 may be selected by mkdosfs, but the extra
- # padding will be minimal on those smaller images and not
- # worth the logic here to caclulate the smaller FAT sizes)
- # < 16 entries per directory
- # 8.3 filenames only
-
- # 32 bytes per dir entry
- DIR_BYTES=$(expr $(find ${FATSOURCEDIR} | tail -n +2 | wc -l) \* 32)
- # 32 bytes for every end-of-directory dir entry
- DIR_BYTES=$(expr $DIR_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 32))
- # 4 bytes per FAT entry per sector of data
- FAT_BYTES=$(expr $SECTORS \* 4)
- # 4 bytes per FAT entry per end-of-cluster list
- FAT_BYTES=$(expr $FAT_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 4))
-
- # Use a ceiling function to determine FS overhead in sectors
- DIR_SECTORS=$(expr $(expr $DIR_BYTES + 511) / 512)
- # There are two FATs on the image
- FAT_SECTORS=$(expr $(expr $(expr $FAT_BYTES + 511) / 512) \* 2)
- SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS))
-
- # Determine the final size in blocks accounting for some padding
- BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE})
-
- # mkdosfs will sometimes use FAT16 when it is not appropriate,
- # resulting in a boot failure from SYSLINUX. Use FAT32 for
- # images larger than 512MB, otherwise let mkdosfs decide.
- if [ $(expr $BLOCKS / 1024) -gt 512 ]; then
- FATSIZE="-F 32"
- fi
-
- # mkdosfs will fail if ${FATIMG} exists. Since we are creating an
- # new image, it is safe to delete any previous image.
- if [ -e ${FATIMG} ]; then
- rm ${FATIMG}
- fi
-
- if [ -z "${HDDIMG_ID}" ]; then
- mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} ${MKDOSFS_EXTRAOPTS} -C ${FATIMG} \
- ${BLOCKS}
- else
- mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} ${MKDOSFS_EXTRAOPTS} -C ${FATIMG} \
- ${BLOCKS} -i ${HDDIMG_ID}
- fi
-
- # Copy FATSOURCEDIR recursively into the image file directly
- mcopy -i ${FATIMG} -s ${FATSOURCEDIR}/* ::/
-}
-
-build_hddimg() {
- # Create an HDD image
- if [ "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live hddimg', '1', '0', d)}" = "1" ] ; then
- populate_live ${HDDDIR}
-
- if [ "${PCBIOS}" = "1" ]; then
- syslinux_hddimg_populate ${HDDDIR}
- fi
- if [ "${EFI}" = "1" ]; then
- efi_hddimg_populate ${HDDDIR}
- fi
-
- # Check the size of ${HDDDIR}/rootfs.img, error out if it
- # exceeds 4GB, it is the single file's max size of FAT fs.
- if [ -f ${HDDDIR}/rootfs.img ]; then
- rootfs_img_size=`stat -c '%s' ${HDDDIR}/rootfs.img`
- max_size=`expr 4 \* 1024 \* 1024 \* 1024`
- if [ $rootfs_img_size -ge $max_size ]; then
- bberror "${HDDDIR}/rootfs.img rootfs size is greather than or equal to 4GB,"
- bberror "and this doesn't work on a FAT filesystem. You can either:"
- bberror "1) Reduce the size of rootfs.img, or,"
- bbfatal "2) Use wic, vmdk,vhd, vhdx or vdi instead of hddimg\n"
- fi
- fi
-
- build_fat_img ${HDDDIR} ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg
-
- if [ "${PCBIOS}" = "1" ]; then
- syslinux_hddimg_install
- fi
-
- chmod 644 ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg
- fi
-}
-
-python do_bootimg() {
- set_live_vm_vars(d, 'LIVE')
- if d.getVar("PCBIOS") == "1":
- bb.build.exec_func('build_syslinux_cfg', d)
- if d.getVar("EFI") == "1":
- bb.build.exec_func('build_efi_cfg', d)
- bb.build.exec_func('build_hddimg', d)
- bb.build.exec_func('build_iso', d)
- bb.build.exec_func('create_symlinks', d)
-}
-do_bootimg[subimages] = "hddimg iso"
-do_bootimg[imgsuffix] = "."
-
-addtask bootimg before do_image_complete after do_rootfs
diff --git a/poky/meta/classes/image-postinst-intercepts.bbclass b/poky/meta/classes/image-postinst-intercepts.bbclass
deleted file mode 100644
index ed30bbd..0000000
--- a/poky/meta/classes/image-postinst-intercepts.bbclass
+++ /dev/null
@@ -1,23 +0,0 @@
-# Gather existing and candidate postinst intercepts from BBPATH
-POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts"
-POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}"
-
-python find_intercepts() {
- intercepts = {}
- search_paths = []
- paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':')
- overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + ['']
- search_paths = [os.path.join(p, op) for p in paths for op in overrides]
- searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True)
- files, chksums = [], []
- for pathname, candidates in searched:
- if os.path.isfile(pathname):
- files.append(pathname)
- chksums.append('%s:True' % pathname)
- chksums.extend('%s:False' % c for c in candidates[:-1])
-
- d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums))
- d.setVar('POSTINST_INTERCEPTS', ' '.join(files))
-}
-find_intercepts[eventmask] += "bb.event.RecipePreFinalise"
-addhandler find_intercepts
diff --git a/poky/meta/classes/image.bbclass b/poky/meta/classes/image.bbclass
deleted file mode 100644
index 2139a7e..0000000
--- a/poky/meta/classes/image.bbclass
+++ /dev/null
@@ -1,679 +0,0 @@
-
-IMAGE_CLASSES ??= ""
-
-# rootfs bootstrap install
-# warning - image-container resets this
-ROOTFS_BOOTSTRAP_INSTALL = "run-postinsts"
-
-# Handle inherits of any of the image classes we need
-IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
-# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
-# in the non-Linux SDK_OS case, such as mingw32
-IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
-IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
-IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
-IMGCLASSES += "image_types_wic"
-IMGCLASSES += "rootfs-postcommands"
-IMGCLASSES += "image-postinst-intercepts"
-IMGCLASSES += "overlayfs-etc"
-inherit ${IMGCLASSES}
-
-TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
-TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
-POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_sysroot_relativelinks; "
-
-LICENSE ?= "MIT"
-PACKAGES = ""
-DEPENDS += "${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross depmodwrapper-cross cross-localedef-native"
-RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL} ${IMAGE_INSTALL_DEBUGFS}"
-RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}"
-PATH:prepend = "${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-# IMAGE_FEATURES may contain any available package group
-IMAGE_FEATURES ?= ""
-IMAGE_FEATURES[type] = "list"
-IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-delayed-postinsts stateless-rootfs empty-root-password allow-empty-password allow-root-login post-install-logging overlayfs-etc"
-
-# Generate companion debugfs?
-IMAGE_GEN_DEBUGFS ?= "0"
-
-# These packages will be installed as additional into debug rootfs
-IMAGE_INSTALL_DEBUGFS ?= ""
-
-# These packages will be removed from a read-only rootfs after all other
-# packages have been installed
-ROOTFS_RO_UNNEEDED ??= "update-rc.d base-passwd shadow ${VIRTUAL-RUNTIME_update-alternatives} ${ROOTFS_BOOTSTRAP_INSTALL}"
-
-# packages to install from features
-FEATURE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
-FEATURE_INSTALL[vardepvalue] = "${FEATURE_INSTALL}"
-FEATURE_INSTALL_OPTIONAL = "${@' '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
-FEATURE_INSTALL_OPTIONAL[vardepvalue] = "${FEATURE_INSTALL_OPTIONAL}"
-
-# Define some very basic feature package groups
-FEATURE_PACKAGES_package-management = "${ROOTFS_PKGMANAGE}"
-SPLASH ?= "${@bb.utils.contains("MACHINE_FEATURES", "screen", "psplash", "", d)}"
-FEATURE_PACKAGES_splash = "${SPLASH}"
-
-IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
-
-def check_image_features(d):
- valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems') or "").split()
- valid_features += d.getVarFlags('COMPLEMENTARY_GLOB').keys()
- for var in d:
- if var.startswith("FEATURE_PACKAGES_"):
- valid_features.append(var[17:])
- valid_features.sort()
-
- features = set(oe.data.typed_value('IMAGE_FEATURES', d))
- for feature in features:
- if feature not in valid_features:
- if bb.utils.contains('EXTRA_IMAGE_FEATURES', feature, True, False, d):
- raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES (added via EXTRA_IMAGE_FEATURES) is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
- else:
- raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
-
-IMAGE_INSTALL ?= ""
-IMAGE_INSTALL[type] = "list"
-export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${ROOTFS_BOOTSTRAP_INSTALL} ${FEATURE_INSTALL}"
-PACKAGE_INSTALL_ATTEMPTONLY ?= "${FEATURE_INSTALL_OPTIONAL}"
-
-IMGDEPLOYDIR = "${WORKDIR}/deploy-${PN}-image-complete"
-
-# Images are generally built explicitly, do not need to be part of world.
-EXCLUDE_FROM_WORLD = "1"
-
-USE_DEVFS ?= "1"
-USE_DEPMOD ?= "1"
-
-PID = "${@os.getpid()}"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-LDCONFIGDEPEND ?= "ldconfig-native:do_populate_sysroot"
-LDCONFIGDEPEND:libc-musl = ""
-
-# This is needed to have depmod data in PKGDATA_DIR,
-# but if you're building small initramfs image
-# e.g. to include it in your kernel, you probably
-# don't want this dependency, which is causing dependency loop
-KERNELDEPMODDEPEND ?= "virtual/kernel:do_packagedata"
-
-do_rootfs[depends] += " \
- makedevs-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot ${LDCONFIGDEPEND} \
- virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot \
- ${KERNELDEPMODDEPEND} \
-"
-do_rootfs[recrdeptask] += "do_packagedata"
-
-def rootfs_command_variables(d):
- return ['ROOTFS_POSTPROCESS_COMMAND','ROOTFS_PREPROCESS_COMMAND','ROOTFS_POSTINSTALL_COMMAND','ROOTFS_POSTUNINSTALL_COMMAND','OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','IMAGE_POSTPROCESS_COMMAND',
- 'IMAGE_PREPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS','DEB_PREPROCESS_COMMANDS','DEB_POSTPROCESS_COMMANDS']
-
-python () {
- variables = rootfs_command_variables(d)
- for var in variables:
- if d.getVar(var, False):
- d.setVarFlag(var, 'func', '1')
-}
-
-def rootfs_variables(d):
- from oe.rootfs import variable_depends
- variables = ['IMAGE_DEVICE_TABLE','IMAGE_DEVICE_TABLES','BUILD_IMAGES_FROM_FEEDS','IMAGE_TYPES_MASKED','IMAGE_ROOTFS_ALIGNMENT','IMAGE_OVERHEAD_FACTOR','IMAGE_ROOTFS_SIZE','IMAGE_ROOTFS_EXTRA_SPACE',
- 'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS', 'IMAGE_LINGUAS_COMPLEMENTARY', 'IMAGE_LOCALES_ARCHIVE',
- 'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS',
- 'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
- 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'REPRODUCIBLE_TIMESTAMP_ROOTFS', 'IMAGE_INSTALL_DEBUGFS']
- variables.extend(rootfs_command_variables(d))
- variables.extend(variable_depends(d))
- return " ".join(variables)
-
-do_rootfs[vardeps] += "${@rootfs_variables(d)}"
-
-# This is needed to have kernel image in DEPLOY_DIR.
-# This follows many common usecases and user expectations.
-# But if you are building an image which doesn't need the kernel image at all,
-# you can unset this variable manually.
-KERNEL_DEPLOY_DEPEND ?= "virtual/kernel:do_deploy"
-do_build[depends] += "${KERNEL_DEPLOY_DEPEND}"
-
-
-python () {
- def extraimage_getdepends(task):
- deps = ""
- for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
- if ":" in dep:
- deps += " %s " % (dep)
- else:
- deps += " %s:%s" % (dep, task)
- return deps
-
- d.appendVarFlag('do_image_complete', 'depends', extraimage_getdepends('do_populate_sysroot'))
-
- deps = " " + imagetypes_getdepends(d)
- d.appendVarFlag('do_rootfs', 'depends', deps)
-
- #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
- #Check for replaces image features
- features = set(oe.data.typed_value('IMAGE_FEATURES', d))
- remain_features = features.copy()
- for feature in features:
- replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split())
- remain_features -= replaces
-
- #Check for conflict image features
- for feature in remain_features:
- conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split())
- temp = conflicts & remain_features
- if temp:
- bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp))))
-
- d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
-
- check_image_features(d)
-}
-
-IMAGE_POSTPROCESS_COMMAND ?= ""
-
-# some default locales
-IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
-
-LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
-
-# per default create a locale archive
-IMAGE_LOCALES_ARCHIVE ?= '1'
-
-# Prefer image, but use the fallback files for lookups if the image ones
-# aren't yet available.
-PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
-
-PSEUDO_IGNORE_PATHS .= ",${WORKDIR}/intercept_scripts,${WORKDIR}/oe-rootfs-repo,${WORKDIR}/sstate-build-image_complete"
-
-PACKAGE_EXCLUDE ??= ""
-PACKAGE_EXCLUDE[type] = "list"
-
-fakeroot python do_rootfs () {
- from oe.rootfs import create_rootfs
- from oe.manifest import create_manifest
- import logging
-
- logger = d.getVar('BB_TASK_LOGGER', False)
- if logger:
- logcatcher = bb.utils.LogCatcher()
- logger.addHandler(logcatcher)
- else:
- logcatcher = None
-
- # NOTE: if you add, remove or significantly refactor the stages of this
- # process then you should recalculate the weightings here. This is quite
- # easy to do - just change the MultiStageProgressReporter line temporarily
- # to pass debug=True as the last parameter and you'll get a printout of
- # the weightings as well as a map to the lines where next_stage() was
- # called. Of course this isn't critical, but it helps to keep the progress
- # reporting accurate.
- stage_weights = [1, 203, 354, 186, 65, 4228, 1, 353, 49, 330, 382, 23, 1]
- progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights)
- progress_reporter.next_stage()
-
- # Handle package exclusions
- excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
- inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
- inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
-
- d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
- d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
-
- for pkg in excl_pkgs:
- if pkg in inst_pkgs:
- bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
- inst_pkgs.remove(pkg)
-
- if pkg in inst_attempt_pkgs:
- bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
- inst_attempt_pkgs.remove(pkg)
-
- d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
- d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
-
- # Ensure we handle package name remapping
- # We have to delay the runtime_mapping_rename until just before rootfs runs
- # otherwise, the multilib renaming could step in and squash any fixups that
- # may have occurred.
- pn = d.getVar('PN')
- runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
- runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
- runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
-
- # Generate the initial manifest
- create_manifest(d)
-
- progress_reporter.next_stage()
-
- # generate rootfs
- d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
- create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
-
- progress_reporter.finish()
-}
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${S}"
-do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
-addtask rootfs after do_prepare_recipe_sysroot
-
-fakeroot python do_image () {
- from oe.utils import execute_pre_post_process
-
- d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
- pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
-
- execute_pre_post_process(d, pre_process_cmds)
-}
-do_image[dirs] = "${TOPDIR}"
-addtask do_image after do_rootfs
-
-fakeroot python do_image_complete () {
- from oe.utils import execute_pre_post_process
-
- post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")
-
- execute_pre_post_process(d, post_process_cmds)
-}
-do_image_complete[dirs] = "${TOPDIR}"
-SSTATETASKS += "do_image_complete"
-SSTATE_SKIP_CREATION:task-image-complete = '1'
-do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
-do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-do_image_complete[stamp-extra-info] = "${MACHINE_ARCH}"
-addtask do_image_complete after do_image before do_build
-python do_image_complete_setscene () {
- sstate_setscene(d)
-}
-addtask do_image_complete_setscene
-
-# Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
-#
-# IMAGE_QA_COMMANDS += " \
-# image_check_everything_ok \
-# "
-# This task runs all functions in IMAGE_QA_COMMANDS after the rootfs
-# construction has completed in order to validate the resulting image.
-#
-# The functions should use ${IMAGE_ROOTFS} to find the unpacked rootfs
-# directory, which if QA passes will be the basis for the images.
-fakeroot python do_image_qa () {
- from oe.utils import ImageQAFailed
-
- qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
- qamsg = ""
-
- for cmd in qa_cmds:
- try:
- bb.build.exec_func(cmd, d)
- except oe.utils.ImageQAFailed as e:
- qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
- except Exception as e:
- qamsg = qamsg + '\tImage QA function %s failed\n' % cmd
-
- if qamsg:
- imgname = d.getVar('IMAGE_NAME')
- bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
-}
-addtask do_image_qa after do_rootfs before do_image
-
-SSTATETASKS += "do_image_qa"
-SSTATE_SKIP_CREATION:task-image-qa = '1'
-do_image_qa[sstate-inputdirs] = ""
-do_image_qa[sstate-outputdirs] = ""
-python do_image_qa_setscene () {
- sstate_setscene(d)
-}
-addtask do_image_qa_setscene
-
-def setup_debugfs_variables(d):
- d.appendVar('IMAGE_ROOTFS', '-dbg')
- if d.getVar('IMAGE_LINK_NAME'):
- d.appendVar('IMAGE_LINK_NAME', '-dbg')
- d.appendVar('IMAGE_NAME','-dbg')
- d.setVar('IMAGE_BUILDING_DEBUGFS', 'true')
- debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS')
- if debugfs_image_fstypes:
- d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes)
-
-python setup_debugfs () {
- setup_debugfs_variables(d)
-}
-
-python () {
- vardeps = set()
- # We allow CONVERSIONTYPES to have duplicates. That avoids breaking
- # derived distros when OE-core or some other layer independently adds
- # the same type. There is still only one command for each type, but
- # presumably the commands will do the same when the type is the same,
- # even when added in different places.
- #
- # Without de-duplication, gen_conversion_cmds() below
- # would create the same compression command multiple times.
- ctypes = set(d.getVar('CONVERSIONTYPES').split())
- old_overrides = d.getVar('OVERRIDES', False)
-
- def _image_base_type(type):
- basetype = type
- for ctype in ctypes:
- if type.endswith("." + ctype):
- basetype = type[:-len("." + ctype)]
- break
-
- if basetype != type:
- # New base type itself might be generated by a conversion command.
- basetype = _image_base_type(basetype)
-
- return basetype
-
- basetypes = {}
- alltypes = d.getVar('IMAGE_FSTYPES').split()
- typedeps = {}
-
- if d.getVar('IMAGE_GEN_DEBUGFS') == "1":
- debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split()
- for t in debugfs_fstypes:
- alltypes.append("debugfs_" + t)
-
- def _add_type(t):
- baset = _image_base_type(t)
- input_t = t
- if baset not in basetypes:
- basetypes[baset]= []
- if t not in basetypes[baset]:
- basetypes[baset].append(t)
- debug = ""
- if t.startswith("debugfs_"):
- t = t[8:]
- debug = "debugfs_"
- deps = (d.getVar('IMAGE_TYPEDEP:' + t) or "").split()
- vardeps.add('IMAGE_TYPEDEP:' + t)
- if baset not in typedeps:
- typedeps[baset] = set()
- deps = [debug + dep for dep in deps]
- for dep in deps:
- if dep not in alltypes:
- alltypes.append(dep)
- _add_type(dep)
- basedep = _image_base_type(dep)
- typedeps[baset].add(basedep)
-
- if baset != input_t:
- _add_type(baset)
-
- for t in alltypes[:]:
- _add_type(t)
-
- d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps))
-
- maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split()
- maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")]
-
- for t in basetypes:
- vardeps = set()
- cmds = []
- subimages = []
- realt = t
-
- if t in maskedtypes:
- continue
-
- localdata = bb.data.createCopy(d)
- debug = ""
- if t.startswith("debugfs_"):
- setup_debugfs_variables(localdata)
- debug = "setup_debugfs "
- realt = t[8:]
- localdata.setVar('OVERRIDES', '%s:%s' % (realt, old_overrides))
- localdata.setVar('type', realt)
- # Delete DATETIME so we don't expand any references to it now
- # This means the task's hash can be stable rather than having hardcoded
- # date/time values. It will get expanded at execution time.
- # Similarly TMPDIR since otherwise we see QA stamp comparision problems
- # Expand PV else it can trigger get_srcrev which can fail due to these variables being unset
- localdata.setVar('PV', d.getVar('PV'))
- localdata.delVar('DATETIME')
- localdata.delVar('DATE')
- localdata.delVar('TMPDIR')
- localdata.delVar('IMAGE_VERSION_SUFFIX')
- vardepsexclude = (d.getVarFlag('IMAGE_CMD:' + realt, 'vardepsexclude', True) or '').split()
- for dep in vardepsexclude:
- localdata.delVar(dep)
-
- image_cmd = localdata.getVar("IMAGE_CMD")
- vardeps.add('IMAGE_CMD:' + realt)
- if image_cmd:
- cmds.append("\t" + image_cmd)
- else:
- bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
- cmds.append(localdata.expand("\tcd ${IMGDEPLOYDIR}"))
-
- # Since a copy of IMAGE_CMD:xxx will be inlined within do_image_xxx,
- # prevent a redundant copy of IMAGE_CMD:xxx being emitted as a function.
- d.delVarFlag('IMAGE_CMD:' + realt, 'func')
-
- rm_tmp_images = set()
- def gen_conversion_cmds(bt):
- for ctype in sorted(ctypes):
- if bt.endswith("." + ctype):
- type = bt[0:-len(ctype) - 1]
- if type.startswith("debugfs_"):
- type = type[8:]
- # Create input image first.
- gen_conversion_cmds(type)
- localdata.setVar('type', type)
- cmd = "\t" + localdata.getVar("CONVERSION_CMD:" + ctype)
- if cmd not in cmds:
- cmds.append(cmd)
- vardeps.add('CONVERSION_CMD:' + ctype)
- subimage = type + "." + ctype
- if subimage not in subimages:
- subimages.append(subimage)
- if type not in alltypes:
- rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
-
- for bt in basetypes[t]:
- gen_conversion_cmds(bt)
-
- localdata.setVar('type', realt)
- if t not in alltypes:
- rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
- else:
- subimages.append(realt)
-
- # Clean up after applying all conversion commands. Some of them might
- # use the same input, therefore we cannot delete sooner without applying
- # some complex dependency analysis.
- for image in sorted(rm_tmp_images):
- cmds.append("\trm " + image)
-
- after = 'do_image'
- for dep in typedeps[t]:
- after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")
-
- task = "do_image_%s" % t.replace("-", "_").replace(".", "_")
-
- d.setVar(task, '\n'.join(cmds))
- d.setVarFlag(task, 'func', '1')
- d.setVarFlag(task, 'fakeroot', '1')
-
- d.appendVarFlag(task, 'prefuncs', ' ' + debug + ' set_image_size')
- d.prependVarFlag(task, 'postfuncs', 'create_symlinks ')
- d.appendVarFlag(task, 'subimages', ' ' + ' '.join(subimages))
- d.appendVarFlag(task, 'vardeps', ' ' + ' '.join(vardeps))
- d.appendVarFlag(task, 'vardepsexclude', ' DATETIME DATE ' + ' '.join(vardepsexclude))
-
- bb.debug(2, "Adding task %s before %s, after %s" % (task, 'do_image_complete', after))
- bb.build.addtask(task, 'do_image_complete', after, d)
-}
-
-#
-# Compute the rootfs size
-#
-def get_rootfs_size(d):
- import subprocess, oe.utils
-
- rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
- overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
- rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
- rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
- rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
- image_fstypes = d.getVar('IMAGE_FSTYPES') or ''
- initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
- initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
-
- size_kb = oe.utils.directory_size(d.getVar("IMAGE_ROOTFS")) / 1024
-
- base_size = size_kb * overhead_factor
- bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor))
- base_size2 = max(base_size, rootfs_req_size) + rootfs_extra_space
- bb.debug(1, '%f = max(%f, %d)[%f] + %d' % (base_size2, base_size, rootfs_req_size, max(base_size, rootfs_req_size), rootfs_extra_space))
-
- base_size = base_size2
- if base_size != int(base_size):
- base_size = int(base_size + 1)
- else:
- base_size = int(base_size)
- bb.debug(1, '%f = int(%f)' % (base_size, base_size2))
-
- base_size_saved = base_size
- base_size += rootfs_alignment - 1
- base_size -= base_size % rootfs_alignment
- bb.debug(1, '%d = aligned(%d)' % (base_size, base_size_saved))
-
- # Do not check image size of the debugfs image. This is not supposed
- # to be deployed, etc. so it doesn't make sense to limit the size
- # of the debug.
- if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true":
- bb.debug(1, 'returning debugfs size %d' % (base_size))
- return base_size
-
- # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
- if rootfs_maxsize:
- rootfs_maxsize_int = int(rootfs_maxsize)
- if base_size > rootfs_maxsize_int:
- bb.fatal("The rootfs size %d(K) exceeds IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
- (base_size, rootfs_maxsize_int))
-
- # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
- if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize:
- initramfs_maxsize_int = int(initramfs_maxsize)
- if base_size > initramfs_maxsize_int:
- bb.error("The initramfs size %d(K) exceeds INITRAMFS_MAXSIZE: %d(K)" % \
- (base_size, initramfs_maxsize_int))
- bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
- bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n")
-
- bb.debug(1, 'returning %d' % (base_size))
- return base_size
-
-python set_image_size () {
- rootfs_size = get_rootfs_size(d)
- d.setVar('ROOTFS_SIZE', str(rootfs_size))
- d.setVarFlag('ROOTFS_SIZE', 'export', '1')
-}
-
-#
-# Create symlinks to the newly created image
-#
-python create_symlinks() {
-
- deploy_dir = d.getVar('IMGDEPLOYDIR')
- img_name = d.getVar('IMAGE_NAME')
- link_name = d.getVar('IMAGE_LINK_NAME')
- manifest_name = d.getVar('IMAGE_MANIFEST')
- taskname = d.getVar("BB_CURRENTTASK")
- subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
- imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix') or d.expand("${IMAGE_NAME_SUFFIX}.")
-
- if not link_name:
- return
- for type in subimages:
- dst = os.path.join(deploy_dir, link_name + "." + type)
- src = img_name + imgsuffix + type
- if os.path.exists(os.path.join(deploy_dir, src)):
- bb.note("Creating symlink: %s -> %s" % (dst, src))
- if os.path.islink(dst):
- os.remove(dst)
- os.symlink(src, dst)
- else:
- bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src))
-}
-
-MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|${sysconfdir}|${nonarch_base_libdir}/udev|/lib/modules/[^/]*/modules.*|"
-MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
-MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
-
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_install[noexec] = "1"
-deltask do_populate_lic
-deltask do_populate_sysroot
-do_package[noexec] = "1"
-deltask do_package_qa
-deltask do_packagedata
-deltask do_package_write_ipk
-deltask do_package_write_deb
-deltask do_package_write_rpm
-
-# Prepare the root links to point to the /usr counterparts.
-create_merged_usr_symlinks() {
- root="$1"
- install -d $root${base_bindir} $root${base_sbindir} $root${base_libdir}
- ln -rs $root${base_bindir} $root/bin
- ln -rs $root${base_sbindir} $root/sbin
- ln -rs $root${base_libdir} $root/${baselib}
-
- if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
- install -d $root${nonarch_base_libdir}
- ln -rs $root${nonarch_base_libdir} $root/lib
- fi
-
- # create base links for multilibs
- multi_libdirs="${@d.getVar('MULTILIB_VARIANTS')}"
- for d in $multi_libdirs; do
- install -d $root${exec_prefix}/$d
- ln -rs $root${exec_prefix}/$d $root/$d
- done
-}
-
-create_merged_usr_symlinks_rootfs() {
- create_merged_usr_symlinks ${IMAGE_ROOTFS}
-}
-
-create_merged_usr_symlinks_sdk() {
- create_merged_usr_symlinks ${SDK_OUTPUT}${SDKTARGETSYSROOT}
-}
-
-ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_rootfs; ', '',d)}"
-POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}"
-
-reproducible_final_image_task () {
- if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
- REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct 2>/dev/null` || true
- if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
- REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
- fi
- fi
- # Set mtime of all files to a reproducible value
- bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
- find ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS
-}
-
-systemd_preset_all () {
- if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then
- systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all
- fi
-}
-
-IMAGE_PREPROCESS_COMMAND:append = " ${@ 'systemd_preset_all;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''} reproducible_final_image_task; "
-
-CVE_PRODUCT = ""
diff --git a/poky/meta/classes/image_types.bbclass b/poky/meta/classes/image_types.bbclass
deleted file mode 100644
index 0ffea91..0000000
--- a/poky/meta/classes/image_types.bbclass
+++ /dev/null
@@ -1,349 +0,0 @@
-# The default aligment of the size of the rootfs is set to 1KiB. In case
-# you're using the SD card emulation of a QEMU system simulator you may
-# set this value to 2048 (2MiB alignment).
-IMAGE_ROOTFS_ALIGNMENT ?= "1"
-
-def imagetypes_getdepends(d):
- def adddep(depstr, deps):
- for d in (depstr or "").split():
- # Add task dependency if not already present
- if ":" not in d:
- d += ":do_populate_sysroot"
- deps.add(d)
-
- # Take a type in the form of foo.bar.car and split it into the items
- # needed for the image deps "foo", and the conversion deps ["bar", "car"]
- def split_types(typestring):
- types = typestring.split(".")
- return types[0], types[1:]
-
- fstypes = set((d.getVar('IMAGE_FSTYPES') or "").split())
- fstypes |= set((d.getVar('IMAGE_FSTYPES_DEBUGFS') or "").split())
-
- deprecated = set()
- deps = set()
- for typestring in fstypes:
- basetype, resttypes = split_types(typestring)
-
- var = "IMAGE_DEPENDS_%s" % basetype
- if d.getVar(var) is not None:
- deprecated.add(var)
-
- for typedepends in (d.getVar("IMAGE_TYPEDEP:%s" % basetype) or "").split():
- base, rest = split_types(typedepends)
- resttypes += rest
-
- var = "IMAGE_DEPENDS_%s" % base
- if d.getVar(var) is not None:
- deprecated.add(var)
-
- for ctype in resttypes:
- adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
- adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype), deps)
-
- if deprecated:
- bb.fatal('Deprecated variable(s) found: "%s". '
- 'Use do_image_<type>[depends] += "<recipe>:<task>" instead' % ', '.join(deprecated))
-
- # Sort the set so that ordering is consistant
- return " ".join(sorted(deps))
-
-XZ_COMPRESSION_LEVEL ?= "-9"
-XZ_INTEGRITY_CHECK ?= "crc32"
-
-ZIP_COMPRESSION_LEVEL ?= "-9"
-
-ZSTD_COMPRESSION_LEVEL ?= "-3"
-
-JFFS2_SUM_EXTRA_ARGS ?= ""
-IMAGE_CMD:jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.jffs2 ${EXTRA_IMAGECMD}"
-
-IMAGE_CMD:cramfs = "mkfs.cramfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cramfs ${EXTRA_IMAGECMD}"
-
-oe_mkext234fs () {
- fstype=$1
- extra_imagecmd=""
-
- if [ $# -gt 1 ]; then
- shift
- extra_imagecmd=$@
- fi
-
- # If generating an empty image the size of the sparse block should be large
- # enough to allocate an ext4 filesystem using 4096 bytes per inode, this is
- # about 60K, so dd needs a minimum count of 60, with bs=1024 (bytes per IO)
- eval local COUNT=\"0\"
- eval local MIN_COUNT=\"60\"
- if [ $ROOTFS_SIZE -lt $MIN_COUNT ]; then
- eval COUNT=\"$MIN_COUNT\"
- fi
- # Create a sparse image block
- bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
- dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
- bbdebug 1 "Actual Rootfs size: `du -s ${IMAGE_ROOTFS}`"
- bbdebug 1 "Actual Partition size: `stat -c '%s' ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
- bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
- mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
- # Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
- fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype || [ $? -le 3 ]
-}
-
-IMAGE_CMD:ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}"
-IMAGE_CMD:ext3 = "oe_mkext234fs ext3 ${EXTRA_IMAGECMD}"
-IMAGE_CMD:ext4 = "oe_mkext234fs ext4 ${EXTRA_IMAGECMD}"
-
-MIN_BTRFS_SIZE ?= "16384"
-IMAGE_CMD:btrfs () {
- size=${ROOTFS_SIZE}
- if [ ${size} -lt ${MIN_BTRFS_SIZE} ] ; then
- size=${MIN_BTRFS_SIZE}
- bbwarn "Rootfs size is too small for BTRFS. Filesystem will be extended to ${size}K"
- fi
- dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.btrfs seek=${size} count=0 bs=1024
- mkfs.btrfs ${EXTRA_IMAGECMD} -r ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.btrfs
-}
-
-IMAGE_CMD:squashfs = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs ${EXTRA_IMAGECMD} -noappend"
-IMAGE_CMD:squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz ${EXTRA_IMAGECMD} -noappend -comp xz"
-IMAGE_CMD:squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
-IMAGE_CMD:squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4"
-IMAGE_CMD:squashfs-zst = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-zst ${EXTRA_IMAGECMD} -noappend -comp zstd"
-
-IMAGE_CMD:erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}"
-IMAGE_CMD:erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}"
-IMAGE_CMD:erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}"
-
-
-IMAGE_CMD_TAR ?= "tar"
-# ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs
-IMAGE_CMD:tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]"
-
-do_image_cpio[cleandirs] += "${WORKDIR}/cpio_append"
-IMAGE_CMD:cpio () {
- (cd ${IMAGE_ROOTFS} && find . | sort | cpio --reproducible -o -H newc >${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio)
- # We only need the /init symlink if we're building the real
- # image. The -dbg image doesn't need it! By being clever
- # about this we also avoid 'touch' below failing, as it
- # might be trying to touch /sbin/init on the host since both
- # the normal and the -dbg image share the same WORKDIR
- if [ "${IMAGE_BUILDING_DEBUGFS}" != "true" ]; then
- if [ ! -L ${IMAGE_ROOTFS}/init ] && [ ! -e ${IMAGE_ROOTFS}/init ]; then
- if [ -L ${IMAGE_ROOTFS}/sbin/init ] || [ -e ${IMAGE_ROOTFS}/sbin/init ]; then
- ln -sf /sbin/init ${WORKDIR}/cpio_append/init
- else
- touch ${WORKDIR}/cpio_append/init
- fi
- (cd ${WORKDIR}/cpio_append && echo ./init | cpio -oA -H newc -F ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio)
- fi
- fi
-}
-
-UBI_VOLNAME ?= "${MACHINE}-rootfs"
-UBI_VOLTYPE ?= "dynamic"
-UBI_IMGTYPE ?= "ubifs"
-
-write_ubi_config() {
- if [ -z "$1" ]; then
- local vname=""
- else
- local vname="_$1"
- fi
-
- cat <<EOF > ubinize${vname}-${IMAGE_NAME}.cfg
-[ubifs]
-mode=ubi
-image=${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.${UBI_IMGTYPE}
-vol_id=0
-vol_type=${UBI_VOLTYPE}
-vol_name=${UBI_VOLNAME}
-vol_flags=autoresize
-EOF
-}
-
-multiubi_mkfs() {
- local mkubifs_args="$1"
- local ubinize_args="$2"
-
- # Added prompt error message for ubi and ubifs image creation.
- if [ -z "$mkubifs_args" ] || [ -z "$ubinize_args" ]; then
- bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see http://www.linux-mtd.infradead.org/faq/ubifs.html for details"
- fi
-
- write_ubi_config "$3"
-
- if [ -n "$vname" ]; then
- mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ${mkubifs_args}
- fi
- ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ubinize${vname}-${IMAGE_NAME}.cfg
-
- # Cleanup cfg file
- mv ubinize${vname}-${IMAGE_NAME}.cfg ${IMGDEPLOYDIR}/
-
- # Create own symlinks for 'named' volumes
- if [ -n "$vname" ]; then
- cd ${IMGDEPLOYDIR}
- if [ -e ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ]; then
- ln -sf ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs \
- ${IMAGE_LINK_NAME}${vname}.ubifs
- fi
- if [ -e ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi ]; then
- ln -sf ${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi \
- ${IMAGE_LINK_NAME}${vname}.ubi
- fi
- cd -
- fi
-}
-
-IMAGE_CMD:multiubi () {
- # Split MKUBIFS_ARGS_<name> and UBINIZE_ARGS_<name>
- for name in ${MULTIUBI_BUILD}; do
- eval local mkubifs_args=\"\$MKUBIFS_ARGS_${name}\"
- eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\"
-
- multiubi_mkfs "${mkubifs_args}" "${ubinize_args}" "${name}"
- done
-}
-
-IMAGE_CMD:ubi () {
- multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}"
-}
-IMAGE_TYPEDEP:ubi = "${UBI_IMGTYPE}"
-
-IMAGE_CMD:ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}"
-
-MIN_F2FS_SIZE ?= "524288"
-IMAGE_CMD:f2fs () {
- # We need to add additional smarts here form devices smaller than 1.5G
- # Need to scale appropriately between 40M -> 1.5G as the "overprovision
- # ratio" goes down as the device gets bigger (70% -> 4.5%), below about
- # 500M the standard IMAGE_OVERHEAD_FACTOR does not work, so add additional
- # space here when under 500M
- size=${ROOTFS_SIZE}
- if [ ${size} -lt ${MIN_F2FS_SIZE} ] ; then
- size=${MIN_F2FS_SIZE}
- bbwarn "Rootfs size is too small for F2FS. Filesystem will be extended to ${size}K"
- fi
- dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.f2fs seek=${size} count=0 bs=1024
- mkfs.f2fs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.f2fs
- sload.f2fs -f ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.f2fs
-}
-
-EXTRA_IMAGECMD = ""
-
-inherit siteinfo kernel-arch image-artifact-names
-
-JFFS2_ENDIANNESS ?= "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}"
-JFFS2_ERASEBLOCK ?= "0x40000"
-EXTRA_IMAGECMD:jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers"
-
-# Change these if you want default mkfs behavior (i.e. create minimal inode number)
-EXTRA_IMAGECMD:ext2 ?= "-i 4096"
-EXTRA_IMAGECMD:ext3 ?= "-i 4096"
-EXTRA_IMAGECMD:ext4 ?= "-i 4096"
-EXTRA_IMAGECMD:btrfs ?= "-n 4096 --shrink"
-EXTRA_IMAGECMD:f2fs ?= ""
-
-do_image_cpio[depends] += "cpio-native:do_populate_sysroot"
-do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
-do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
-do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
-do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
-do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
-do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_xz[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_lz4[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_squashfs_zst[depends] += "squashfs-tools-native:do_populate_sysroot"
-do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
-do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot"
-do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot"
-do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot"
-do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot"
-
-# This variable is available to request which values are suitable for IMAGE_FSTYPES
-IMAGE_TYPES = " \
- jffs2 jffs2.sum \
- cramfs \
- ext2 ext2.gz ext2.bz2 ext2.lzma \
- ext3 ext3.gz \
- ext4 ext4.gz \
- btrfs \
- squashfs squashfs-xz squashfs-lzo squashfs-lz4 squashfs-zst \
- ubi ubifs multiubi \
- tar tar.gz tar.bz2 tar.xz tar.lz4 tar.zst \
- cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 cpio.zst \
- wic wic.gz wic.bz2 wic.lzma wic.zst \
- container \
- f2fs \
- erofs erofs-lz4 erofs-lz4hc \
-"
-# These image types are x86 specific as they need syslinux
-IMAGE_TYPES:append:x86 = " hddimg iso"
-IMAGE_TYPES:append:x86-64 = " hddimg iso"
-
-# Compression is a special case of conversion. The old variable
-# names are still supported for backward-compatibility. When defining
-# new compression or conversion commands, use CONVERSIONTYPES and
-# CONVERSION_CMD/DEPENDS.
-COMPRESSIONTYPES ?= ""
-
-CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip zst sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vhd vhdx vdi qcow2 base64 gzsync zsync ${COMPRESSIONTYPES}"
-CONVERSION_CMD:lzma = "lzma -k -f -7 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:gz = "gzip -f -9 -n -c --rsyncable ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
-CONVERSION_CMD:bz2 = "pbzip2 -f -k ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:xz = "xz -f -k -c ${XZ_COMPRESSION_LEVEL} ${XZ_DEFAULTS} --check=${XZ_INTEGRITY_CHECK} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.xz"
-CONVERSION_CMD:lz4 = "lz4 -9 -z -l ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.lz4"
-CONVERSION_CMD:lzo = "lzop -9 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:zip = "zip ${ZIP_COMPRESSION_LEVEL} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.zip ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:zst = "zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.zst"
-CONVERSION_CMD:sum = "sumtool -i ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} -o ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sum ${JFFS2_SUM_EXTRA_ARGS}"
-CONVERSION_CMD:md5sum = "md5sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.md5sum"
-CONVERSION_CMD:sha1sum = "sha1sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha1sum"
-CONVERSION_CMD:sha224sum = "sha224sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha224sum"
-CONVERSION_CMD:sha256sum = "sha256sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha256sum"
-CONVERSION_CMD:sha384sum = "sha384sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha384sum"
-CONVERSION_CMD:sha512sum = "sha512sum ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sha512sum"
-CONVERSION_CMD:bmap = "bmaptool create ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} -o ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.bmap"
-CONVERSION_CMD:u-boot = "mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C none -n ${IMAGE_NAME} -d ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.u-boot"
-CONVERSION_CMD:vmdk = "qemu-img convert -O vmdk ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vmdk"
-CONVERSION_CMD:vhdx = "qemu-img convert -O vhdx -o subformat=dynamic ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vhdx"
-CONVERSION_CMD:vhd = "qemu-img convert -O vpc -o subformat=fixed ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vhd"
-CONVERSION_CMD:vdi = "qemu-img convert -O vdi ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi"
-CONVERSION_CMD:qcow2 = "qemu-img convert -O qcow2 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qcow2"
-CONVERSION_CMD:base64 = "base64 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.base64"
-CONVERSION_CMD:zsync = "zsyncmake_curl ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD:gzsync = "zsyncmake_curl -z ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_DEPENDS_lzma = "xz-native"
-CONVERSION_DEPENDS_gz = "pigz-native"
-CONVERSION_DEPENDS_bz2 = "pbzip2-native"
-CONVERSION_DEPENDS_xz = "xz-native"
-CONVERSION_DEPENDS_lz4 = "lz4-native"
-CONVERSION_DEPENDS_lzo = "lzop-native"
-CONVERSION_DEPENDS_zip = "zip-native"
-CONVERSION_DEPENDS_zst = "zstd-native"
-CONVERSION_DEPENDS_sum = "mtd-utils-native"
-CONVERSION_DEPENDS_bmap = "bmap-tools-native"
-CONVERSION_DEPENDS_u-boot = "u-boot-tools-native"
-CONVERSION_DEPENDS_vmdk = "qemu-system-native"
-CONVERSION_DEPENDS_vdi = "qemu-system-native"
-CONVERSION_DEPENDS_qcow2 = "qemu-system-native"
-CONVERSION_DEPENDS_base64 = "coreutils-native"
-CONVERSION_DEPENDS_vhdx = "qemu-system-native"
-CONVERSION_DEPENDS_vhd = "qemu-system-native"
-CONVERSION_DEPENDS_zsync = "zsync-curl-native"
-CONVERSION_DEPENDS_gzsync = "zsync-curl-native"
-
-RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4"
-RUNNABLE_MACHINE_PATTERNS ?= "qemu"
-
-DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
-
-# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
-# images that will not be built at do_rootfs time: vmdk, vhd, vhdx, vdi, qcow2, hddimg, iso, etc.
-IMAGE_TYPES_MASKED ?= ""
-
-# bmap requires python3 to be in the PATH
-EXTRANATIVEPATH += "${@'python3-native' if d.getVar('IMAGE_FSTYPES').find('.bmap') else ''}"
diff --git a/poky/meta/classes/image_types_wic.bbclass b/poky/meta/classes/image_types_wic.bbclass
deleted file mode 100644
index 8497916..0000000
--- a/poky/meta/classes/image_types_wic.bbclass
+++ /dev/null
@@ -1,184 +0,0 @@
-# The WICVARS variable is used to define list of bitbake variables used in wic code
-# variables from this list is written to <image>.env file
-WICVARS ?= "\
- APPEND \
- ASSUME_PROVIDED \
- BBLAYERS \
- DEPLOY_DIR_IMAGE \
- FAKEROOTCMD \
- HOSTTOOLS_DIR \
- IMAGE_BASENAME \
- IMAGE_BOOT_FILES \
- IMAGE_EFI_BOOT_FILES \
- IMAGE_LINK_NAME \
- IMAGE_ROOTFS \
- IMGDEPLOYDIR \
- INITRAMFS_FSTYPES \
- INITRAMFS_IMAGE \
- INITRAMFS_IMAGE_BUNDLE \
- INITRAMFS_LINK_NAME \
- INITRD \
- INITRD_LIVE \
- ISODIR \
- KERNEL_IMAGETYPE \
- MACHINE \
- PSEUDO_IGNORE_PATHS \
- RECIPE_SYSROOT_NATIVE \
- ROOTFS_SIZE \
- STAGING_DATADIR \
- STAGING_DIR \
- STAGING_DIR_HOST \
- STAGING_LIBDIR \
- TARGET_SYS \
-"
-
-inherit ${@bb.utils.contains('INITRAMFS_IMAGE_BUNDLE', '1', 'kernel-artifact-names', '', d)}
-
-WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
-WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
-WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/wic' % p for p in '${BBPATH}'.split(':'))}:${@':'.join('%s/scripts/lib/wic/canned-wks' % l for l in '${BBPATH}:${COREBASE}'.split(':'))}"
-WKS_FULL_PATH = "${@wks_search(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) or ''}"
-
-def wks_search(files, search_path):
- for f in files:
- if os.path.isabs(f):
- if os.path.exists(f):
- return f
- else:
- searched = bb.utils.which(search_path, f)
- if searched:
- return searched
-
-WIC_CREATE_EXTRA_ARGS ?= ""
-
-IMAGE_CMD:wic () {
- out="${IMGDEPLOYDIR}/${IMAGE_NAME}"
- build_wic="${WORKDIR}/build-wic"
- tmp_wic="${WORKDIR}/tmp-wic"
- wks="${WKS_FULL_PATH}"
- if [ -e "$tmp_wic" ]; then
- # Ensure we don't have any junk leftover from a previously interrupted
- # do_image_wic execution
- rm -rf "$tmp_wic"
- fi
- if [ -z "$wks" ]; then
- bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
- fi
- BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" -w "$tmp_wic" ${WIC_CREATE_EXTRA_ARGS}
- mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
-}
-IMAGE_CMD:wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
-do_image_wic[cleandirs] = "${WORKDIR}/build-wic"
-
-PSEUDO_IGNORE_PATHS .= ",${WORKDIR}/build-wic"
-
-# Rebuild when the wks file or vars in WICVARS change
-USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
-WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
-do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
-do_image_wic[depends] += "${@' '.join('%s-native:do_populate_sysroot' % r for r in ('parted', 'gptfdisk', 'dosfstools', 'mtools'))}"
-
-# We ensure all artfacts are deployed (e.g virtual/bootloader)
-do_image_wic[recrdeptask] += "do_deploy"
-do_image_wic[deptask] += "do_image_complete"
-
-WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', 'i686' ], "syslinux-native", "",d)}'
-WKS_FILE_DEPENDS_DEFAULT += "bmap-tools-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native"
-# Unified kernel images need objcopy
-WKS_FILE_DEPENDS_DEFAULT += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
-WKS_FILE_DEPENDS_BOOTLOADERS = ""
-WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release"
-WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux grub-efi systemd-boot os-release"
-WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi"
-
-WKS_FILE_DEPENDS ??= "${WKS_FILE_DEPENDS_DEFAULT} ${WKS_FILE_DEPENDS_BOOTLOADERS}"
-
-DEPENDS += "${@ '${WKS_FILE_DEPENDS}' if d.getVar('USING_WIC') else '' }"
-
-python do_write_wks_template () {
- """Write out expanded template contents to WKS_FULL_PATH."""
- import re
-
- template_body = d.getVar('_WKS_TEMPLATE')
-
- # Remove any remnant variable references left behind by the expansion
- # due to undefined variables
- expand_var_regexp = re.compile(r"\${[^{}@\n\t :]+}")
- while True:
- new_body = re.sub(expand_var_regexp, '', template_body)
- if new_body == template_body:
- break
- else:
- template_body = new_body
-
- wks_file = d.getVar('WKS_FULL_PATH')
- with open(wks_file, 'w') as f:
- f.write(template_body)
- f.close()
- # Copy the finalized wks file to the deploy directory for later use
- depdir = d.getVar('IMGDEPLOYDIR')
- basename = d.getVar('IMAGE_BASENAME')
- bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file)))
-}
-
-do_flush_pseudodb() {
- ${FAKEROOTENV} ${FAKEROOTCMD} -S
-}
-
-python () {
- if d.getVar('USING_WIC'):
- wks_file_u = d.getVar('WKS_FULL_PATH', False)
- wks_file = d.expand(wks_file_u)
- base, ext = os.path.splitext(wks_file)
- if ext == '.in' and os.path.exists(wks_file):
- wks_out_file = os.path.join(d.getVar('WORKDIR'), os.path.basename(base))
- d.setVar('WKS_FULL_PATH', wks_out_file)
- d.setVar('WKS_TEMPLATE_PATH', wks_file_u)
- d.setVar('WKS_FILE_CHECKSUM', '${WKS_TEMPLATE_PATH}:True')
-
- # We need to re-parse each time the file changes, and bitbake
- # needs to be told about that explicitly.
- bb.parse.mark_dependency(d, wks_file)
-
- try:
- with open(wks_file, 'r') as f:
- body = f.read()
- except (IOError, OSError) as exc:
- pass
- else:
- # Previously, I used expandWithRefs to get the dependency list
- # and add it to WICVARS, but there's no point re-parsing the
- # file in process_wks_template as well, so just put it in
- # a variable and let the metadata deal with the deps.
- d.setVar('_WKS_TEMPLATE', body)
- bb.build.addtask('do_write_wks_template', 'do_image_wic', 'do_image', d)
- bb.build.addtask('do_image_wic', 'do_image_complete', None, d)
-}
-
-#
-# Write environment variables used by wic
-# to tmp/sysroots/<machine>/imgdata/<image>.env
-#
-python do_rootfs_wicenv () {
- wicvars = d.getVar('WICVARS')
- if not wicvars:
- return
-
- stdir = d.getVar('STAGING_DIR')
- outdir = os.path.join(stdir, d.getVar('MACHINE'), 'imgdata')
- bb.utils.mkdirhier(outdir)
- basename = d.getVar('IMAGE_BASENAME')
- with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
- for var in wicvars.split():
- value = d.getVar(var)
- if value:
- envf.write('%s="%s"\n' % (var, value.strip()))
- envf.close()
- # Copy .env file to deploy directory for later use with stand alone wic
- depdir = d.getVar('IMGDEPLOYDIR')
- bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
-}
-addtask do_flush_pseudodb after do_rootfs before do_image do_image_qa
-addtask do_rootfs_wicenv after do_image before do_image_wic
-do_rootfs_wicenv[vardeps] += "${WICVARS}"
-do_rootfs_wicenv[prefuncs] = 'set_image_size'
diff --git a/poky/meta/classes/insane.bbclass b/poky/meta/classes/insane.bbclass
deleted file mode 100644
index c8b434b..0000000
--- a/poky/meta/classes/insane.bbclass
+++ /dev/null
@@ -1,1447 +0,0 @@
-# BB Class inspired by ebuild.sh
-#
-# This class will test files after installation for certain
-# security issues and other kind of issues.
-#
-# Checks we do:
-# -Check the ownership and permissions
-# -Check the RUNTIME path for the $TMPDIR
-# -Check if .la files wrongly point to workdir
-# -Check if .pc files wrongly point to workdir
-# -Check if packages contains .debug directories or .so files
-# where they should be in -dev or -dbg
-# -Check if config.log contains traces to broken autoconf tests
-# -Check invalid characters (non-utf8) on some package metadata
-# -Ensure that binaries in base_[bindir|sbindir|libdir] do not link
-# into exec_prefix
-# -Check that scripts in base_[bindir|sbindir|libdir] do not reference
-# files under exec_prefix
-# -Check if the package name is upper case
-
-# Elect whether a given type of error is a warning or error, they may
-# have been set by other files.
-WARN_QA ?= " libdir xorg-driver-abi buildpaths \
- textrel incompatible-license files-invalid \
- infodir build-deps src-uri-bad symlink-to-sysroot multilib \
- invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
- mime mime-xdg unlisted-pkg-lics unhandled-features-check \
- missing-update-alternatives native-last missing-ptest \
- license-exists license-no-generic license-syntax license-format \
- license-incompatible license-file-missing obsolete-license \
- "
-ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
- perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
- split-strip packages-list pkgv-undefined var-undefined \
- version-going-backwards expanded-d invalid-chars \
- license-checksum dev-elf file-rdeps configure-unsafe \
- configure-gettext perllocalpod shebang-size \
- already-stripped installed-vs-shipped ldflags compile-host-path \
- install-host-path pn-overrides unknown-configure-option \
- useless-rpaths rpaths staticdev empty-dirs \
- "
-# Add usrmerge QA check based on distro feature
-ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
-
-FAKEROOT_QA = "host-user-contaminated"
-FAKEROOT_QA[doc] = "QA tests which need to run under fakeroot. If any \
-enabled tests are listed here, the do_package_qa task will run under fakeroot."
-
-ALL_QA = "${WARN_QA} ${ERROR_QA}"
-
-UNKNOWN_CONFIGURE_OPT_IGNORE ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static"
-
-# This is a list of directories that are expected to be empty.
-QA_EMPTY_DIRS ?= " \
- /dev/pts \
- /media \
- /proc \
- /run \
- /tmp \
- ${localstatedir}/run \
- ${localstatedir}/volatile \
-"
-# It is possible to specify why a directory is expected to be empty by defining
-# QA_EMPTY_DIRS_RECOMMENDATION:<path>, which will then be included in the error
-# message if the directory is not empty. If it is not specified for a directory,
-# then "but it is expected to be empty" will be used.
-
-def package_qa_clean_path(path, d, pkg=None):
- """
- Remove redundant paths from the path for display. If pkg isn't set then
- TMPDIR is stripped, otherwise PKGDEST/pkg is stripped.
- """
- if pkg:
- path = path.replace(os.path.join(d.getVar("PKGDEST"), pkg), "/")
- return path.replace(d.getVar("TMPDIR"), "/").replace("//", "/")
-
-QAPATHTEST[shebang-size] = "package_qa_check_shebang_size"
-def package_qa_check_shebang_size(path, name, d, elf, messages):
- import stat
- if os.path.islink(path) or stat.S_ISFIFO(os.stat(path).st_mode) or elf:
- return
-
- try:
- with open(path, 'rb') as f:
- stanza = f.readline(130)
- except IOError:
- return
-
- if stanza.startswith(b'#!'):
- #Shebang not found
- try:
- stanza = stanza.decode("utf-8")
- except UnicodeDecodeError:
- #If it is not a text file, it is not a script
- return
-
- if len(stanza) > 129:
- oe.qa.add_message(messages, "shebang-size", "%s: %s maximum shebang size exceeded, the maximum size is 128." % (name, package_qa_clean_path(path, d)))
- return
-
-QAPATHTEST[libexec] = "package_qa_check_libexec"
-def package_qa_check_libexec(path,name, d, elf, messages):
-
- # Skip the case where the default is explicitly /usr/libexec
- libexec = d.getVar('libexecdir')
- if libexec == "/usr/libexec":
- return True
-
- if 'libexec' in path.split(os.path.sep):
- oe.qa.add_message(messages, "libexec", "%s: %s is using libexec please relocate to %s" % (name, package_qa_clean_path(path, d), libexec))
- return False
-
- return True
-
-QAPATHTEST[rpaths] = "package_qa_check_rpath"
-def package_qa_check_rpath(file,name, d, elf, messages):
- """
- Check for dangerous RPATHs
- """
- if not elf:
- return
-
- if os.path.islink(file):
- return
-
- bad_dirs = [d.getVar('BASE_WORKDIR'), d.getVar('STAGING_DIR_TARGET')]
-
- phdrs = elf.run_objdump("-p", d)
-
- import re
- rpath_re = re.compile(r"\s+RPATH\s+(.*)")
- for line in phdrs.split("\n"):
- m = rpath_re.match(line)
- if m:
- rpath = m.group(1)
- for dir in bad_dirs:
- if dir in rpath:
- oe.qa.add_message(messages, "rpaths", "package %s contains bad RPATH %s in file %s" % (name, rpath, file))
-
-QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
-def package_qa_check_useless_rpaths(file, name, d, elf, messages):
- """
- Check for RPATHs that are useless but not dangerous
- """
- def rpath_eq(a, b):
- return os.path.normpath(a) == os.path.normpath(b)
-
- if not elf:
- return
-
- if os.path.islink(file):
- return
-
- libdir = d.getVar("libdir")
- base_libdir = d.getVar("base_libdir")
-
- phdrs = elf.run_objdump("-p", d)
-
- import re
- rpath_re = re.compile(r"\s+RPATH\s+(.*)")
- for line in phdrs.split("\n"):
- m = rpath_re.match(line)
- if m:
- rpath = m.group(1)
- if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir):
- # The dynamic linker searches both these places anyway. There is no point in
- # looking there again.
- oe.qa.add_message(messages, "useless-rpaths", "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d, name), rpath))
-
-QAPATHTEST[dev-so] = "package_qa_check_dev"
-def package_qa_check_dev(path, name, d, elf, messages):
- """
- Check for ".so" library symlinks in non-dev packages
- """
-
- if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-ptest") and not name.startswith("nativesdk-") and path.endswith(".so") and os.path.islink(path):
- oe.qa.add_message(messages, "dev-so", "non -dev/-dbg/nativesdk- package %s contains symlink .so '%s'" % \
- (name, package_qa_clean_path(path, d, name)))
-
-QAPATHTEST[dev-elf] = "package_qa_check_dev_elf"
-def package_qa_check_dev_elf(path, name, d, elf, messages):
- """
- Check that -dev doesn't contain real shared libraries. The test has to
- check that the file is not a link and is an ELF object as some recipes
- install link-time .so files that are linker scripts.
- """
- if name.endswith("-dev") and path.endswith(".so") and not os.path.islink(path) and elf:
- oe.qa.add_message(messages, "dev-elf", "-dev package %s contains non-symlink .so '%s'" % \
- (name, package_qa_clean_path(path, d, name)))
-
-QAPATHTEST[staticdev] = "package_qa_check_staticdev"
-def package_qa_check_staticdev(path, name, d, elf, messages):
- """
- Check for ".a" library in non-staticdev packages
- There are a number of exceptions to this rule, -pic packages can contain
- static libraries, the _nonshared.a belong with their -dev packages and
- libgcc.a, libgcov.a will be skipped in their packages
- """
-
- if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a") and not '/usr/lib/debug-static/' in path and not '/.debug-static/' in path:
- oe.qa.add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \
- (name, package_qa_clean_path(path,d, name)))
-
-QAPATHTEST[mime] = "package_qa_check_mime"
-def package_qa_check_mime(path, name, d, elf, messages):
- """
- Check if package installs mime types to /usr/share/mime/packages
- while no inheriting mime.bbclass
- """
-
- if d.getVar("datadir") + "/mime/packages" in path and path.endswith('.xml') and not bb.data.inherits_class("mime", d):
- oe.qa.add_message(messages, "mime", "package contains mime types but does not inherit mime: %s path '%s'" % \
- (name, package_qa_clean_path(path,d)))
-
-QAPATHTEST[mime-xdg] = "package_qa_check_mime_xdg"
-def package_qa_check_mime_xdg(path, name, d, elf, messages):
- """
- Check if package installs desktop file containing MimeType and requires
- mime-types.bbclass to create /usr/share/applications/mimeinfo.cache
- """
-
- if d.getVar("datadir") + "/applications" in path and path.endswith('.desktop') and not bb.data.inherits_class("mime-xdg", d):
- mime_type_found = False
- try:
- with open(path, 'r') as f:
- for line in f.read().split('\n'):
- if 'MimeType' in line:
- mime_type_found = True
- break;
- except:
- # At least libreoffice installs symlinks with absolute paths that are dangling here.
- # We could implement some magic but for few (one) recipes it is not worth the effort so just warn:
- wstr = "%s cannot open %s - is it a symlink with absolute path?\n" % (name, package_qa_clean_path(path,d))
- wstr += "Please check if (linked) file contains key 'MimeType'.\n"
- pkgname = name
- if name == d.getVar('PN'):
- pkgname = '${PN}'
- wstr += "If yes: add \'inhert mime-xdg\' and \'MIME_XDG_PACKAGES += \"%s\"\' / if no add \'INSANE_SKIP:%s += \"mime-xdg\"\' to recipe." % (pkgname, pkgname)
- oe.qa.add_message(messages, "mime-xdg", wstr)
- if mime_type_found:
- oe.qa.add_message(messages, "mime-xdg", "package contains desktop file with key 'MimeType' but does not inhert mime-xdg: %s path '%s'" % \
- (name, package_qa_clean_path(path,d)))
-
-def package_qa_check_libdir(d):
- """
- Check for wrong library installation paths. For instance, catch
- recipes installing /lib/bar.so when ${base_libdir}="lib32" or
- installing in /usr/lib64 when ${libdir}="/usr/lib"
- """
- import re
-
- pkgdest = d.getVar('PKGDEST')
- base_libdir = d.getVar("base_libdir") + os.sep
- libdir = d.getVar("libdir") + os.sep
- libexecdir = d.getVar("libexecdir") + os.sep
- exec_prefix = d.getVar("exec_prefix") + os.sep
-
- messages = []
-
- # The re's are purposely fuzzy, as some there are some .so.x.y.z files
- # that don't follow the standard naming convention. It checks later
- # that they are actual ELF files
- lib_re = re.compile(r"^/lib.+\.so(\..+)?$")
- exec_re = re.compile(r"^%s.*/lib.+\.so(\..+)?$" % exec_prefix)
-
- for root, dirs, files in os.walk(pkgdest):
- if root == pkgdest:
- # Skip subdirectories for any packages with libdir in INSANE_SKIP
- skippackages = []
- for package in dirs:
- if 'libdir' in (d.getVar('INSANE_SKIP:' + package) or "").split():
- bb.note("Package %s skipping libdir QA test" % (package))
- skippackages.append(package)
- elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-file-directory' and package.endswith("-dbg"):
- bb.note("Package %s skipping libdir QA test for PACKAGE_DEBUG_SPLIT_STYLE equals debug-file-directory" % (package))
- skippackages.append(package)
- for package in skippackages:
- dirs.remove(package)
- for file in files:
- full_path = os.path.join(root, file)
- rel_path = os.path.relpath(full_path, pkgdest)
- if os.sep in rel_path:
- package, rel_path = rel_path.split(os.sep, 1)
- rel_path = os.sep + rel_path
- if lib_re.match(rel_path):
- if base_libdir not in rel_path:
- # make sure it's an actual ELF file
- elf = oe.qa.ELFFile(full_path)
- try:
- elf.open()
- messages.append("%s: found library in wrong location: %s" % (package, rel_path))
- except (oe.qa.NotELFFileError):
- pass
- if exec_re.match(rel_path):
- if libdir not in rel_path and libexecdir not in rel_path:
- # make sure it's an actual ELF file
- elf = oe.qa.ELFFile(full_path)
- try:
- elf.open()
- messages.append("%s: found library in wrong location: %s" % (package, rel_path))
- except (oe.qa.NotELFFileError):
- pass
-
- if messages:
- oe.qa.handle_error("libdir", "\n".join(messages), d)
-
-QAPATHTEST[debug-files] = "package_qa_check_dbg"
-def package_qa_check_dbg(path, name, d, elf, messages):
- """
- Check for ".debug" files or directories outside of the dbg package
- """
-
- if not "-dbg" in name and not "-ptest" in name:
- if '.debug' in path.split(os.path.sep):
- oe.qa.add_message(messages, "debug-files", "non debug package contains .debug directory: %s path %s" % \
- (name, package_qa_clean_path(path,d)))
-
-QAPATHTEST[arch] = "package_qa_check_arch"
-def package_qa_check_arch(path,name,d, elf, messages):
- """
- Check if archs are compatible
- """
- import re, oe.elf
-
- if not elf:
- return
-
- target_os = d.getVar('HOST_OS')
- target_arch = d.getVar('HOST_ARCH')
- provides = d.getVar('PROVIDES')
- bpn = d.getVar('BPN')
-
- if target_arch == "allarch":
- pn = d.getVar('PN')
- oe.qa.add_message(messages, "arch", pn + ": Recipe inherits the allarch class, but has packaged architecture-specific binaries")
- return
-
- # FIXME: Cross package confuse this check, so just skip them
- for s in ['cross', 'nativesdk', 'cross-canadian']:
- if bb.data.inherits_class(s, d):
- return
-
- # avoid following links to /usr/bin (e.g. on udev builds)
- # we will check the files pointed to anyway...
- if os.path.islink(path):
- return
-
- #if this will throw an exception, then fix the dict above
- (machine, osabi, abiversion, littleendian, bits) \
- = oe.elf.machine_dict(d)[target_os][target_arch]
-
- # Check the architecture and endiannes of the binary
- is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \
- (target_os == "linux-gnux32" or target_os == "linux-muslx32" or \
- target_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE')))
- is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF")
- if not ((machine == elf.machine()) or is_32 or is_bpf):
- oe.qa.add_message(messages, "arch", "Architecture did not match (%s, expected %s) in %s" % \
- (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path, d, name)))
- elif not ((bits == elf.abiSize()) or is_32 or is_bpf):
- oe.qa.add_message(messages, "arch", "Bit size did not match (%d, expected %d) in %s" % \
- (elf.abiSize(), bits, package_qa_clean_path(path, d, name)))
- elif not ((littleendian == elf.isLittleEndian()) or is_bpf):
- oe.qa.add_message(messages, "arch", "Endiannes did not match (%d, expected %d) in %s" % \
- (elf.isLittleEndian(), littleendian, package_qa_clean_path(path,d, name)))
-
-QAPATHTEST[desktop] = "package_qa_check_desktop"
-def package_qa_check_desktop(path, name, d, elf, messages):
- """
- Run all desktop files through desktop-file-validate.
- """
- if path.endswith(".desktop"):
- desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE'),'desktop-file-validate')
- output = os.popen("%s %s" % (desktop_file_validate, path))
- # This only produces output on errors
- for l in output:
- oe.qa.add_message(messages, "desktop", "Desktop file issue: " + l.strip())
-
-QAPATHTEST[textrel] = "package_qa_textrel"
-def package_qa_textrel(path, name, d, elf, messages):
- """
- Check if the binary contains relocations in .text
- """
-
- if not elf:
- return
-
- if os.path.islink(path):
- return
-
- phdrs = elf.run_objdump("-p", d)
- sane = True
-
- import re
- textrel_re = re.compile(r"\s+TEXTREL\s+")
- for line in phdrs.split("\n"):
- if textrel_re.match(line):
- sane = False
- break
-
- if not sane:
- path = package_qa_clean_path(path, d, name)
- oe.qa.add_message(messages, "textrel", "%s: ELF binary %s has relocations in .text" % (name, path))
-
-QAPATHTEST[ldflags] = "package_qa_hash_style"
-def package_qa_hash_style(path, name, d, elf, messages):
- """
- Check if the binary has the right hash style...
- """
-
- if not elf:
- return
-
- if os.path.islink(path):
- return
-
- gnu_hash = "--hash-style=gnu" in d.getVar('LDFLAGS')
- if not gnu_hash:
- gnu_hash = "--hash-style=both" in d.getVar('LDFLAGS')
- if not gnu_hash:
- return
-
- sane = False
- has_syms = False
-
- phdrs = elf.run_objdump("-p", d)
-
- # If this binary has symbols, we expect it to have GNU_HASH too.
- for line in phdrs.split("\n"):
- if "SYMTAB" in line:
- has_syms = True
- if "GNU_HASH" in line or "MIPS_XHASH" in line:
- sane = True
- if ("[mips32]" in line or "[mips64]" in line) and d.getVar('TCLIBC') == "musl":
- sane = True
- if has_syms and not sane:
- path = package_qa_clean_path(path, d, name)
- oe.qa.add_message(messages, "ldflags", "File %s in package %s doesn't have GNU_HASH (didn't pass LDFLAGS?)" % (path, name))
-
-
-QAPATHTEST[buildpaths] = "package_qa_check_buildpaths"
-def package_qa_check_buildpaths(path, name, d, elf, messages):
- """
- Check for build paths inside target files and error if paths are not
- explicitly ignored.
- """
- import stat
-
- # Ignore symlinks/devs/fifos
- mode = os.lstat(path).st_mode
- if stat.S_ISLNK(mode) or stat.S_ISBLK(mode) or stat.S_ISFIFO(mode) or stat.S_ISCHR(mode) or stat.S_ISSOCK(mode):
- return
-
- tmpdir = bytes(d.getVar('TMPDIR'), encoding="utf-8")
- with open(path, 'rb') as f:
- file_content = f.read()
- if tmpdir in file_content:
- trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "")
- oe.qa.add_message(messages, "buildpaths", "File %s in package %s contains reference to TMPDIR" % (trimmed, name))
-
-
-QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi"
-def package_qa_check_xorg_driver_abi(path, name, d, elf, messages):
- """
- Check that all packages containing Xorg drivers have ABI dependencies
- """
-
- # Skip dev, dbg or nativesdk packages
- if name.endswith("-dev") or name.endswith("-dbg") or name.startswith("nativesdk-"):
- return
-
- driverdir = d.expand("${libdir}/xorg/modules/drivers/")
- if driverdir in path and path.endswith(".so"):
- mlprefix = d.getVar('MLPREFIX') or ''
- for rdep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + name) or ""):
- if rdep.startswith("%sxorg-abi-" % mlprefix):
- return
- oe.qa.add_message(messages, "xorg-driver-abi", "Package %s contains Xorg driver (%s) but no xorg-abi- dependencies" % (name, os.path.basename(path)))
-
-QAPATHTEST[infodir] = "package_qa_check_infodir"
-def package_qa_check_infodir(path, name, d, elf, messages):
- """
- Check that /usr/share/info/dir isn't shipped in a particular package
- """
- infodir = d.expand("${infodir}/dir")
-
- if infodir in path:
- oe.qa.add_message(messages, "infodir", "The /usr/share/info/dir file is not meant to be shipped in a particular package.")
-
-QAPATHTEST[symlink-to-sysroot] = "package_qa_check_symlink_to_sysroot"
-def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
- """
- Check that the package doesn't contain any absolute symlinks to the sysroot.
- """
- if os.path.islink(path):
- target = os.readlink(path)
- if os.path.isabs(target):
- tmpdir = d.getVar('TMPDIR')
- if target.startswith(tmpdir):
- trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "")
- oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name))
-
-# Check license variables
-do_populate_lic[postfuncs] += "populate_lic_qa_checksum"
-python populate_lic_qa_checksum() {
- """
- Check for changes in the license files.
- """
-
- lic_files = d.getVar('LIC_FILES_CHKSUM') or ''
- lic = d.getVar('LICENSE')
- pn = d.getVar('PN')
-
- if lic == "CLOSED":
- return
-
- if not lic_files and d.getVar('SRC_URI'):
- oe.qa.handle_error("license-checksum", pn + ": Recipe file fetches files and does not have license file information (LIC_FILES_CHKSUM)", d)
-
- srcdir = d.getVar('S')
- corebase_licensefile = d.getVar('COREBASE') + "/LICENSE"
- for url in lic_files.split():
- try:
- (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
- except bb.fetch.MalformedUrl:
- oe.qa.handle_error("license-checksum", pn + ": LIC_FILES_CHKSUM contains an invalid URL: " + url, d)
- continue
- srclicfile = os.path.join(srcdir, path)
- if not os.path.isfile(srclicfile):
- oe.qa.handle_error("license-checksum", pn + ": LIC_FILES_CHKSUM points to an invalid file: " + srclicfile, d)
- continue
-
- if (srclicfile == corebase_licensefile):
- bb.warn("${COREBASE}/LICENSE is not a valid license file, please use '${COMMON_LICENSE_DIR}/MIT' for a MIT License file in LIC_FILES_CHKSUM. This will become an error in the future")
-
- recipemd5 = parm.get('md5', '')
- beginline, endline = 0, 0
- if 'beginline' in parm:
- beginline = int(parm['beginline'])
- if 'endline' in parm:
- endline = int(parm['endline'])
-
- if (not beginline) and (not endline):
- md5chksum = bb.utils.md5_file(srclicfile)
- with open(srclicfile, 'r', errors='replace') as f:
- license = f.read().splitlines()
- else:
- with open(srclicfile, 'rb') as f:
- import hashlib
- lineno = 0
- license = []
- m = hashlib.new('MD5', usedforsecurity=False)
- for line in f:
- lineno += 1
- if (lineno >= beginline):
- if ((lineno <= endline) or not endline):
- m.update(line)
- license.append(line.decode('utf-8', errors='replace').rstrip())
- else:
- break
- md5chksum = m.hexdigest()
- if recipemd5 == md5chksum:
- bb.note (pn + ": md5 checksum matched for ", url)
- else:
- if recipemd5:
- msg = pn + ": The LIC_FILES_CHKSUM does not match for " + url
- msg = msg + "\n" + pn + ": The new md5 checksum is " + md5chksum
- max_lines = int(d.getVar('QA_MAX_LICENSE_LINES') or 20)
- if not license or license[-1] != '':
- # Ensure that our license text ends with a line break
- # (will be added with join() below).
- license.append('')
- remove = len(license) - max_lines
- if remove > 0:
- start = max_lines // 2
- end = start + remove - 1
- del license[start:end]
- license.insert(start, '...')
- msg = msg + "\n" + pn + ": Here is the selected license text:" + \
- "\n" + \
- "{:v^70}".format(" beginline=%d " % beginline if beginline else "") + \
- "\n" + "\n".join(license) + \
- "{:^^70}".format(" endline=%d " % endline if endline else "")
- if beginline:
- if endline:
- srcfiledesc = "%s (lines %d through to %d)" % (srclicfile, beginline, endline)
- else:
- srcfiledesc = "%s (beginning on line %d)" % (srclicfile, beginline)
- elif endline:
- srcfiledesc = "%s (ending on line %d)" % (srclicfile, endline)
- else:
- srcfiledesc = srclicfile
- msg = msg + "\n" + pn + ": Check if the license information has changed in %s to verify that the LICENSE value \"%s\" remains valid" % (srcfiledesc, lic)
-
- else:
- msg = pn + ": LIC_FILES_CHKSUM is not specified for " + url
- msg = msg + "\n" + pn + ": The md5 checksum is " + md5chksum
- oe.qa.handle_error("license-checksum", msg, d)
-
- oe.qa.exit_if_errors(d)
-}
-
-def qa_check_staged(path,d):
- """
- Check staged la and pc files for common problems like references to the work
- directory.
-
- As this is run after every stage we should be able to find the one
- responsible for the errors easily even if we look at every .pc and .la file.
- """
-
- tmpdir = d.getVar('TMPDIR')
- workdir = os.path.join(tmpdir, "work")
- recipesysroot = d.getVar("RECIPE_SYSROOT")
-
- if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d):
- pkgconfigcheck = workdir
- else:
- pkgconfigcheck = tmpdir
-
- skip = (d.getVar('INSANE_SKIP') or "").split()
- skip_la = False
- if 'la' in skip:
- bb.note("Recipe %s skipping qa checking: la" % d.getVar('PN'))
- skip_la = True
-
- skip_pkgconfig = False
- if 'pkgconfig' in skip:
- bb.note("Recipe %s skipping qa checking: pkgconfig" % d.getVar('PN'))
- skip_pkgconfig = True
-
- skip_shebang_size = False
- if 'shebang-size' in skip:
- bb.note("Recipe %s skipping qa checkking: shebang-size" % d.getVar('PN'))
- skip_shebang_size = True
-
- # find all .la and .pc files
- # read the content
- # and check for stuff that looks wrong
- for root, dirs, files in os.walk(path):
- for file in files:
- path = os.path.join(root,file)
- if file.endswith(".la") and not skip_la:
- with open(path) as f:
- file_content = f.read()
- file_content = file_content.replace(recipesysroot, "")
- if workdir in file_content:
- error_msg = "%s failed sanity test (workdir) in path %s" % (file,root)
- oe.qa.handle_error("la", error_msg, d)
- elif file.endswith(".pc") and not skip_pkgconfig:
- with open(path) as f:
- file_content = f.read()
- file_content = file_content.replace(recipesysroot, "")
- if pkgconfigcheck in file_content:
- error_msg = "%s failed sanity test (tmpdir) in path %s" % (file,root)
- oe.qa.handle_error("pkgconfig", error_msg, d)
-
- if not skip_shebang_size:
- errors = {}
- package_qa_check_shebang_size(path, "", d, None, errors)
- for e in errors:
- oe.qa.handle_error(e, errors[e], d)
-
-
-# Run all package-wide warnfuncs and errorfuncs
-def package_qa_package(warnfuncs, errorfuncs, package, d):
- warnings = {}
- errors = {}
-
- for func in warnfuncs:
- func(package, d, warnings)
- for func in errorfuncs:
- func(package, d, errors)
-
- for w in warnings:
- oe.qa.handle_error(w, warnings[w], d)
- for e in errors:
- oe.qa.handle_error(e, errors[e], d)
-
- return len(errors) == 0
-
-# Run all recipe-wide warnfuncs and errorfuncs
-def package_qa_recipe(warnfuncs, errorfuncs, pn, d):
- warnings = {}
- errors = {}
-
- for func in warnfuncs:
- func(pn, d, warnings)
- for func in errorfuncs:
- func(pn, d, errors)
-
- for w in warnings:
- oe.qa.handle_error(w, warnings[w], d)
- for e in errors:
- oe.qa.handle_error(e, errors[e], d)
-
- return len(errors) == 0
-
-def prepopulate_objdump_p(elf, d):
- output = elf.run_objdump("-p", d)
- return (elf.name, output)
-
-# Walk over all files in a directory and call func
-def package_qa_walk(warnfuncs, errorfuncs, package, d):
- #if this will throw an exception, then fix the dict above
- target_os = d.getVar('HOST_OS')
- target_arch = d.getVar('HOST_ARCH')
-
- warnings = {}
- errors = {}
- elves = {}
- for path in pkgfiles[package]:
- elf = None
- if os.path.isfile(path):
- elf = oe.qa.ELFFile(path)
- try:
- elf.open()
- elf.close()
- except oe.qa.NotELFFileError:
- elf = None
- if elf:
- elves[path] = elf
-
- results = oe.utils.multiprocess_launch(prepopulate_objdump_p, elves.values(), d, extraargs=(d,))
- for item in results:
- elves[item[0]].set_objdump("-p", item[1])
-
- for path in pkgfiles[package]:
- if path in elves:
- elves[path].open()
- for func in warnfuncs:
- func(path, package, d, elves.get(path), warnings)
- for func in errorfuncs:
- func(path, package, d, elves.get(path), errors)
- if path in elves:
- elves[path].close()
-
- for w in warnings:
- oe.qa.handle_error(w, warnings[w], d)
- for e in errors:
- oe.qa.handle_error(e, errors[e], d)
-
-def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
- # Don't do this check for kernel/module recipes, there aren't too many debug/development
- # packages and you can get false positives e.g. on kernel-module-lirc-dev
- if bb.data.inherits_class("kernel", d) or bb.data.inherits_class("module-base", d):
- return
-
- if not "-dbg" in pkg and not "packagegroup-" in pkg and not "-image" in pkg:
- localdata = bb.data.createCopy(d)
- localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES') + ':' + pkg)
-
- # Now check the RDEPENDS
- rdepends = bb.utils.explode_deps(localdata.getVar('RDEPENDS') or "")
-
- # Now do the sanity check!!!
- if "build-deps" not in skip:
- for rdepend in rdepends:
- if "-dbg" in rdepend and "debug-deps" not in skip:
- error_msg = "%s rdepends on %s" % (pkg,rdepend)
- oe.qa.handle_error("debug-deps", error_msg, d)
- if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip:
- error_msg = "%s rdepends on %s" % (pkg, rdepend)
- oe.qa.handle_error("dev-deps", error_msg, d)
- if rdepend not in packages:
- rdep_data = oe.packagedata.read_subpkgdata(rdepend, d)
- if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
- continue
- if not rdep_data or not 'PN' in rdep_data:
- pkgdata_dir = d.getVar("PKGDATA_DIR")
- try:
- possibles = os.listdir("%s/runtime-rprovides/%s/" % (pkgdata_dir, rdepend))
- except OSError:
- possibles = []
- for p in possibles:
- rdep_data = oe.packagedata.read_subpkgdata(p, d)
- if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
- break
- if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
- continue
- if rdep_data and 'PN' in rdep_data:
- error_msg = "%s rdepends on %s, but it isn't a build dependency, missing %s in DEPENDS or PACKAGECONFIG?" % (pkg, rdepend, rdep_data['PN'])
- else:
- error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend)
- oe.qa.handle_error("build-deps", error_msg, d)
-
- if "file-rdeps" not in skip:
- ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)'])
- if bb.data.inherits_class('nativesdk', d):
- ignored_file_rdeps |= set(['/bin/bash', '/usr/bin/perl', 'perl'])
- # For Saving the FILERDEPENDS
- filerdepends = {}
- rdep_data = oe.packagedata.read_subpkgdata(pkg, d)
- for key in rdep_data:
- if key.startswith("FILERDEPENDS:"):
- for subkey in bb.utils.explode_deps(rdep_data[key]):
- if subkey not in ignored_file_rdeps and \
- not subkey.startswith('perl('):
- # We already know it starts with FILERDEPENDS_
- filerdepends[subkey] = key[13:]
-
- if filerdepends:
- done = rdepends[:]
- # Add the rprovides of itself
- if pkg not in done:
- done.insert(0, pkg)
-
- # The python is not a package, but python-core provides it, so
- # skip checking /usr/bin/python if python is in the rdeps, in
- # case there is a RDEPENDS:pkg = "python" in the recipe.
- for py in [ d.getVar('MLPREFIX') + "python", "python" ]:
- if py in done:
- filerdepends.pop("/usr/bin/python",None)
- done.remove(py)
- for rdep in done:
- # The file dependencies may contain package names, e.g.,
- # perl
- filerdepends.pop(rdep,None)
-
- # For Saving the FILERPROVIDES, RPROVIDES and FILES_INFO
- rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
- for key in rdep_data:
- if key.startswith("FILERPROVIDES:") or key.startswith("RPROVIDES:"):
- for subkey in bb.utils.explode_deps(rdep_data[key]):
- filerdepends.pop(subkey,None)
- # Add the files list to the rprovides
- if key.startswith("FILES_INFO:"):
- # Use eval() to make it as a dict
- for subkey in eval(rdep_data[key]):
- filerdepends.pop(subkey,None)
- if not filerdepends:
- # Break if all the file rdepends are met
- break
- if filerdepends:
- for key in filerdepends:
- error_msg = "%s contained in package %s requires %s, but no providers found in RDEPENDS:%s?" % \
- (filerdepends[key].replace(":%s" % pkg, "").replace("@underscore@", "_"), pkg, key, pkg)
- oe.qa.handle_error("file-rdeps", error_msg, d)
-package_qa_check_rdepends[vardepsexclude] = "OVERRIDES"
-
-def package_qa_check_deps(pkg, pkgdest, d):
-
- localdata = bb.data.createCopy(d)
- localdata.setVar('OVERRIDES', pkg)
-
- def check_valid_deps(var):
- try:
- rvar = bb.utils.explode_dep_versions2(localdata.getVar(var) or "")
- except ValueError as e:
- bb.fatal("%s:%s: %s" % (var, pkg, e))
- for dep in rvar:
- for v in rvar[dep]:
- if v and not v.startswith(('< ', '= ', '> ', '<= ', '>=')):
- error_msg = "%s:%s is invalid: %s (%s) only comparisons <, =, >, <=, and >= are allowed" % (var, pkg, dep, v)
- oe.qa.handle_error("dep-cmp", error_msg, d)
-
- check_valid_deps('RDEPENDS')
- check_valid_deps('RRECOMMENDS')
- check_valid_deps('RSUGGESTS')
- check_valid_deps('RPROVIDES')
- check_valid_deps('RREPLACES')
- check_valid_deps('RCONFLICTS')
-
-QAPKGTEST[usrmerge] = "package_qa_check_usrmerge"
-def package_qa_check_usrmerge(pkg, d, messages):
-
- pkgdest = d.getVar('PKGDEST')
- pkg_dir = pkgdest + os.sep + pkg + os.sep
- merged_dirs = ['bin', 'sbin', 'lib'] + d.getVar('MULTILIB_VARIANTS').split()
- for f in merged_dirs:
- if os.path.exists(pkg_dir + f) and not os.path.islink(pkg_dir + f):
- msg = "%s package is not obeying usrmerge distro feature. /%s should be relocated to /usr." % (pkg, f)
- oe.qa.add_message(messages, "usrmerge", msg)
- return False
- return True
-
-QAPKGTEST[perllocalpod] = "package_qa_check_perllocalpod"
-def package_qa_check_perllocalpod(pkg, d, messages):
- """
- Check that the recipe didn't ship a perlocal.pod file, which shouldn't be
- installed in a distribution package. cpan.bbclass sets NO_PERLLOCAL=1 to
- handle this for most recipes.
- """
- import glob
- pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
- podpath = oe.path.join(pkgd, d.getVar("libdir"), "perl*", "*", "*", "perllocal.pod")
-
- matches = glob.glob(podpath)
- if matches:
- matches = [package_qa_clean_path(path, d, pkg) for path in matches]
- msg = "%s contains perllocal.pod (%s), should not be installed" % (pkg, " ".join(matches))
- oe.qa.add_message(messages, "perllocalpod", msg)
-
-QAPKGTEST[expanded-d] = "package_qa_check_expanded_d"
-def package_qa_check_expanded_d(package, d, messages):
- """
- Check for the expanded D (${D}) value in pkg_* and FILES
- variables, warn the user to use it correctly.
- """
- sane = True
- expanded_d = d.getVar('D')
-
- for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
- bbvar = d.getVar(var + ":" + package) or ""
- if expanded_d in bbvar:
- if var == 'FILES':
- oe.qa.add_message(messages, "expanded-d", "FILES in %s recipe should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference" % package)
- sane = False
- else:
- oe.qa.add_message(messages, "expanded-d", "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, package))
- sane = False
- return sane
-
-QAPKGTEST[unlisted-pkg-lics] = "package_qa_check_unlisted_pkg_lics"
-def package_qa_check_unlisted_pkg_lics(package, d, messages):
- """
- Check that all licenses for a package are among the licenses for the recipe.
- """
- pkg_lics = d.getVar('LICENSE:' + package)
- if not pkg_lics:
- return True
-
- recipe_lics_set = oe.license.list_licenses(d.getVar('LICENSE'))
- package_lics = oe.license.list_licenses(pkg_lics)
- unlisted = package_lics - recipe_lics_set
- if unlisted:
- oe.qa.add_message(messages, "unlisted-pkg-lics",
- "LICENSE:%s includes licenses (%s) that are not "
- "listed in LICENSE" % (package, ' '.join(unlisted)))
- return False
- obsolete = set(oe.license.obsolete_license_list()) & package_lics - recipe_lics_set
- if obsolete:
- oe.qa.add_message(messages, "obsolete-license",
- "LICENSE:%s includes obsolete licenses %s" % (package, ' '.join(obsolete)))
- return False
- return True
-
-QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
-def package_qa_check_empty_dirs(pkg, d, messages):
- """
- Check for the existence of files in directories that are expected to be
- empty.
- """
-
- pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
- for dir in (d.getVar('QA_EMPTY_DIRS') or "").split():
- empty_dir = oe.path.join(pkgd, dir)
- if os.path.exists(empty_dir) and os.listdir(empty_dir):
- recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or
- "but it is expected to be empty")
- msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
- oe.qa.add_message(messages, "empty-dirs", msg)
-
-def package_qa_check_encoding(keys, encode, d):
- def check_encoding(key, enc):
- sane = True
- value = d.getVar(key)
- if value:
- try:
- s = value.encode(enc)
- except UnicodeDecodeError as e:
- error_msg = "%s has non %s characters" % (key,enc)
- sane = False
- oe.qa.handle_error("invalid-chars", error_msg, d)
- return sane
-
- for key in keys:
- sane = check_encoding(key, encode)
- if not sane:
- break
-
-HOST_USER_UID := "${@os.getuid()}"
-HOST_USER_GID := "${@os.getgid()}"
-
-QAPATHTEST[host-user-contaminated] = "package_qa_check_host_user"
-def package_qa_check_host_user(path, name, d, elf, messages):
- """Check for paths outside of /home which are owned by the user running bitbake."""
-
- if not os.path.lexists(path):
- return
-
- dest = d.getVar('PKGDEST')
- pn = d.getVar('PN')
- home = os.path.join(dest, name, 'home')
- if path == home or path.startswith(home + os.sep):
- return
-
- try:
- stat = os.lstat(path)
- except OSError as exc:
- import errno
- if exc.errno != errno.ENOENT:
- raise
- else:
- check_uid = int(d.getVar('HOST_USER_UID'))
- if stat.st_uid == check_uid:
- oe.qa.add_message(messages, "host-user-contaminated", "%s: %s is owned by uid %d, which is the same as the user running bitbake. This may be due to host contamination" % (pn, package_qa_clean_path(path, d, name), check_uid))
- return False
-
- check_gid = int(d.getVar('HOST_USER_GID'))
- if stat.st_gid == check_gid:
- oe.qa.add_message(messages, "host-user-contaminated", "%s: %s is owned by gid %d, which is the same as the user running bitbake. This may be due to host contamination" % (pn, package_qa_clean_path(path, d, name), check_gid))
- return False
- return True
-
-QARECIPETEST[unhandled-features-check] = "package_qa_check_unhandled_features_check"
-def package_qa_check_unhandled_features_check(pn, d, messages):
- if not bb.data.inherits_class('features_check', d):
- var_set = False
- for kind in ['DISTRO', 'MACHINE', 'COMBINED']:
- for var in ['ANY_OF_' + kind + '_FEATURES', 'REQUIRED_' + kind + '_FEATURES', 'CONFLICT_' + kind + '_FEATURES']:
- if d.getVar(var) is not None or d.hasOverrides(var):
- var_set = True
- if var_set:
- oe.qa.handle_error("unhandled-features-check", "%s: recipe doesn't inherit features_check" % pn, d)
-
-QARECIPETEST[missing-update-alternatives] = "package_qa_check_missing_update_alternatives"
-def package_qa_check_missing_update_alternatives(pn, d, messages):
- # Look at all packages and find out if any of those sets ALTERNATIVE variable
- # without inheriting update-alternatives class
- for pkg in (d.getVar('PACKAGES') or '').split():
- if d.getVar('ALTERNATIVE:%s' % pkg) and not bb.data.inherits_class('update-alternatives', d):
- oe.qa.handle_error("missing-update-alternatives", "%s: recipe defines ALTERNATIVE:%s but doesn't inherit update-alternatives. This might fail during do_rootfs later!" % (pn, pkg), d)
-
-# The PACKAGE FUNC to scan each package
-python do_package_qa () {
- import subprocess
- import oe.packagedata
-
- bb.note("DO PACKAGE QA")
-
- main_lic = d.getVar('LICENSE')
-
- # Check for obsolete license references in main LICENSE (packages are checked below for any changes)
- main_licenses = oe.license.list_licenses(d.getVar('LICENSE'))
- obsolete = set(oe.license.obsolete_license_list()) & main_licenses
- if obsolete:
- oe.qa.handle_error("obsolete-license", "Recipe LICENSE includes obsolete licenses %s" % ' '.join(obsolete), d)
-
- bb.build.exec_func("read_subpackage_metadata", d)
-
- # Check non UTF-8 characters on recipe's metadata
- package_qa_check_encoding(['DESCRIPTION', 'SUMMARY', 'LICENSE', 'SECTION'], 'utf-8', d)
-
- logdir = d.getVar('T')
- pn = d.getVar('PN')
-
- # Scan the packages...
- pkgdest = d.getVar('PKGDEST')
- packages = set((d.getVar('PACKAGES') or '').split())
-
- global pkgfiles
- pkgfiles = {}
- for pkg in packages:
- pkgfiles[pkg] = []
- pkgdir = os.path.join(pkgdest, pkg)
- for walkroot, dirs, files in os.walk(pkgdir):
- # Don't walk into top-level CONTROL or DEBIAN directories as these
- # are temporary directories created by do_package.
- if walkroot == pkgdir:
- for control in ("CONTROL", "DEBIAN"):
- if control in dirs:
- dirs.remove(control)
- for file in files:
- pkgfiles[pkg].append(os.path.join(walkroot, file))
-
- # no packages should be scanned
- if not packages:
- return
-
- import re
- # The package name matches the [a-z0-9.+-]+ regular expression
- pkgname_pattern = re.compile(r"^[a-z0-9.+-]+$")
-
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- taskdeps = set()
- for dep in taskdepdata:
- taskdeps.add(taskdepdata[dep][0])
-
- def parse_test_matrix(matrix_name):
- testmatrix = d.getVarFlags(matrix_name) or {}
- g = globals()
- warnchecks = []
- for w in (d.getVar("WARN_QA") or "").split():
- if w in skip:
- continue
- if w in testmatrix and testmatrix[w] in g:
- warnchecks.append(g[testmatrix[w]])
-
- errorchecks = []
- for e in (d.getVar("ERROR_QA") or "").split():
- if e in skip:
- continue
- if e in testmatrix and testmatrix[e] in g:
- errorchecks.append(g[testmatrix[e]])
- return warnchecks, errorchecks
-
- for package in packages:
- skip = set((d.getVar('INSANE_SKIP') or "").split() +
- (d.getVar('INSANE_SKIP:' + package) or "").split())
- if skip:
- bb.note("Package %s skipping QA tests: %s" % (package, str(skip)))
-
- bb.note("Checking Package: %s" % package)
- # Check package name
- if not pkgname_pattern.match(package):
- oe.qa.handle_error("pkgname",
- "%s doesn't match the [a-z0-9.+-]+ regex" % package, d)
-
- warn_checks, error_checks = parse_test_matrix("QAPATHTEST")
- package_qa_walk(warn_checks, error_checks, package, d)
-
- warn_checks, error_checks = parse_test_matrix("QAPKGTEST")
- package_qa_package(warn_checks, error_checks, package, d)
-
- package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d)
- package_qa_check_deps(package, pkgdest, d)
-
- warn_checks, error_checks = parse_test_matrix("QARECIPETEST")
- package_qa_recipe(warn_checks, error_checks, pn, d)
-
- if 'libdir' in d.getVar("ALL_QA").split():
- package_qa_check_libdir(d)
-
- oe.qa.exit_if_errors(d)
-}
-
-# binutils is used for most checks, so need to set as dependency
-# POPULATESYSROOTDEPS is defined in staging class.
-do_package_qa[depends] += "${POPULATESYSROOTDEPS}"
-do_package_qa[vardeps] = "${@bb.utils.contains('ERROR_QA', 'empty-dirs', 'QA_EMPTY_DIRS', '', d)}"
-do_package_qa[vardepsexclude] = "BB_TASKDEPDATA"
-do_package_qa[rdeptask] = "do_packagedata"
-addtask do_package_qa after do_packagedata do_package before do_build
-
-# Add the package specific INSANE_SKIPs to the sstate dependencies
-python() {
- pkgs = (d.getVar('PACKAGES') or '').split()
- for pkg in pkgs:
- d.appendVarFlag("do_package_qa", "vardeps", " INSANE_SKIP:{}".format(pkg))
-}
-
-SSTATETASKS += "do_package_qa"
-do_package_qa[sstate-inputdirs] = ""
-do_package_qa[sstate-outputdirs] = ""
-python do_package_qa_setscene () {
- sstate_setscene(d)
-}
-addtask do_package_qa_setscene
-
-python do_qa_sysroot() {
- bb.note("QA checking do_populate_sysroot")
- sysroot_destdir = d.expand('${SYSROOT_DESTDIR}')
- for sysroot_dir in d.expand('${SYSROOT_DIRS}').split():
- qa_check_staged(sysroot_destdir + sysroot_dir, d)
- oe.qa.exit_with_message_if_errors("do_populate_sysroot for this recipe installed files with QA issues", d)
-}
-do_populate_sysroot[postfuncs] += "do_qa_sysroot"
-
-python do_qa_patch() {
- import subprocess
-
- ###########################################################################
- # Check patch.log for fuzz warnings
- #
- # Further information on why we check for patch fuzz warnings:
- # http://lists.openembedded.org/pipermail/openembedded-core/2018-March/148675.html
- # https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450
- ###########################################################################
-
- logdir = d.getVar('T')
- patchlog = os.path.join(logdir,"log.do_patch")
-
- if os.path.exists(patchlog):
- fuzzheader = '--- Patch fuzz start ---'
- fuzzfooter = '--- Patch fuzz end ---'
- statement = "grep -e '%s' %s > /dev/null" % (fuzzheader, patchlog)
- if subprocess.call(statement, shell=True) == 0:
- msg = "Fuzz detected:\n\n"
- fuzzmsg = ""
- inFuzzInfo = False
- f = open(patchlog, "r")
- for line in f:
- if fuzzheader in line:
- inFuzzInfo = True
- fuzzmsg = ""
- elif fuzzfooter in line:
- fuzzmsg = fuzzmsg.replace('\n\n', '\n')
- msg += fuzzmsg
- msg += "\n"
- inFuzzInfo = False
- elif inFuzzInfo and not 'Now at patch' in line:
- fuzzmsg += line
- f.close()
- msg += "The context lines in the patches can be updated with devtool:\n"
- msg += "\n"
- msg += " devtool modify %s\n" % d.getVar('PN')
- msg += " devtool finish --force-patch-refresh %s <layer_path>\n\n" % d.getVar('PN')
- msg += "Don't forget to review changes done by devtool!\n"
- if bb.utils.filter('ERROR_QA', 'patch-fuzz', d):
- bb.error(msg)
- elif bb.utils.filter('WARN_QA', 'patch-fuzz', d):
- bb.warn(msg)
- msg = "Patch log indicates that patches do not apply cleanly."
- oe.qa.handle_error("patch-fuzz", msg, d)
-
- # Check if the patch contains a correctly formatted and spelled Upstream-Status
- import re
- from oe import patch
-
- for url in patch.src_patches(d):
- (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url)
-
- # skip patches not in oe-core
- if '/meta/' not in fullpath:
- continue
-
- kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE)
- strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport|Inactive-Upstream)( .+)?$", re.MULTILINE)
- guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status"
-
- with open(fullpath, encoding='utf-8', errors='ignore') as f:
- file_content = f.read()
- match_kinda = kinda_status_re.search(file_content)
- match_strict = strict_status_re.search(file_content)
-
- if not match_strict:
- if match_kinda:
- bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)))
- else:
- bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines))
-}
-
-python do_qa_configure() {
- import subprocess
-
- ###########################################################################
- # Check config.log for cross compile issues
- ###########################################################################
-
- configs = []
- workdir = d.getVar('WORKDIR')
-
- skip = (d.getVar('INSANE_SKIP') or "").split()
- skip_configure_unsafe = False
- if 'configure-unsafe' in skip:
- bb.note("Recipe %s skipping qa checking: configure-unsafe" % d.getVar('PN'))
- skip_configure_unsafe = True
-
- if bb.data.inherits_class('autotools', d) and not skip_configure_unsafe:
- bb.note("Checking autotools environment for common misconfiguration")
- for root, dirs, files in os.walk(workdir):
- statement = "grep -q -F -e 'is unsafe for cross-compilation' %s" % \
- os.path.join(root,"config.log")
- if "config.log" in files:
- if subprocess.call(statement, shell=True) == 0:
- error_msg = """This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities.
-Rerun configure task after fixing this."""
- oe.qa.handle_error("configure-unsafe", error_msg, d)
-
- if "configure.ac" in files:
- configs.append(os.path.join(root,"configure.ac"))
- if "configure.in" in files:
- configs.append(os.path.join(root, "configure.in"))
-
- ###########################################################################
- # Check gettext configuration and dependencies are correct
- ###########################################################################
-
- skip_configure_gettext = False
- if 'configure-gettext' in skip:
- bb.note("Recipe %s skipping qa checking: configure-gettext" % d.getVar('PN'))
- skip_configure_gettext = True
-
- cnf = d.getVar('EXTRA_OECONF') or ""
- if not ("gettext" in d.getVar('P') or "gcc-runtime" in d.getVar('P') or \
- "--disable-nls" in cnf or skip_configure_gettext):
- ml = d.getVar("MLPREFIX") or ""
- if bb.data.inherits_class('cross-canadian', d):
- gt = "nativesdk-gettext"
- else:
- gt = "gettext-native"
- deps = bb.utils.explode_deps(d.getVar('DEPENDS') or "")
- if gt not in deps:
- for config in configs:
- gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config
- if subprocess.call(gnu, shell=True) == 0:
- error_msg = "AM_GNU_GETTEXT used but no inherit gettext"
- oe.qa.handle_error("configure-gettext", error_msg, d)
-
- ###########################################################################
- # Check unrecognised configure options (with a white list)
- ###########################################################################
- if bb.data.inherits_class("autotools", d):
- bb.note("Checking configure output for unrecognised options")
- try:
- if bb.data.inherits_class("autotools", d):
- flag = "WARNING: unrecognized options:"
- log = os.path.join(d.getVar('B'), 'config.log')
- output = subprocess.check_output(['grep', '-F', flag, log]).decode("utf-8").replace(', ', ' ').replace('"', '')
- options = set()
- for line in output.splitlines():
- options |= set(line.partition(flag)[2].split())
- ignore_opts = set(d.getVar("UNKNOWN_CONFIGURE_OPT_IGNORE").split())
- options -= ignore_opts
- if options:
- pn = d.getVar('PN')
- error_msg = pn + ": configure was passed unrecognised options: " + " ".join(options)
- oe.qa.handle_error("unknown-configure-option", error_msg, d)
- except subprocess.CalledProcessError:
- pass
-
- # Check invalid PACKAGECONFIG
- pkgconfig = (d.getVar("PACKAGECONFIG") or "").split()
- if pkgconfig:
- pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
- for pconfig in pkgconfig:
- if pconfig not in pkgconfigflags:
- pn = d.getVar('PN')
- error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig)
- oe.qa.handle_error("invalid-packageconfig", error_msg, d)
-
- oe.qa.exit_if_errors(d)
-}
-
-def unpack_check_src_uri(pn, d):
- import re
-
- skip = (d.getVar('INSANE_SKIP') or "").split()
- if 'src-uri-bad' in skip:
- bb.note("Recipe %s skipping qa checking: src-uri-bad" % d.getVar('PN'))
- return
-
- if "${PN}" in d.getVar("SRC_URI", False):
- oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses PN not BPN" % pn, d)
-
- for url in d.getVar("SRC_URI").split():
- # Search for github and gitlab URLs that pull unstable archives (comment for future greppers)
- if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url):
- oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d)
-
-python do_qa_unpack() {
- src_uri = d.getVar('SRC_URI')
- s_dir = d.getVar('S')
- if src_uri and not os.path.exists(s_dir):
- bb.warn('%s: the directory %s (%s) pointed to by the S variable doesn\'t exist - please set S within the recipe to point to where the source has been unpacked to' % (d.getVar('PN'), d.getVar('S', False), s_dir))
-
- unpack_check_src_uri(d.getVar('PN'), d)
-}
-
-# Check for patch fuzz
-do_patch[postfuncs] += "do_qa_patch "
-
-# Check broken config.log files, for packages requiring Gettext which
-# don't have it in DEPENDS.
-#addtask qa_configure after do_configure before do_compile
-do_configure[postfuncs] += "do_qa_configure "
-
-# Check does S exist.
-do_unpack[postfuncs] += "do_qa_unpack"
-
-python () {
- import re
-
- tests = d.getVar('ALL_QA').split()
- if "desktop" in tests:
- d.appendVar("PACKAGE_DEPENDS", " desktop-file-utils-native")
-
- ###########################################################################
- # Check various variables
- ###########################################################################
-
- # Checking ${FILESEXTRAPATHS}
- extrapaths = (d.getVar("FILESEXTRAPATHS") or "")
- if '__default' not in extrapaths.split(":"):
- msg = "FILESEXTRAPATHS-variable, must always use :prepend (or :append)\n"
- msg += "type of assignment, and don't forget the colon.\n"
- msg += "Please assign it with the format of:\n"
- msg += " FILESEXTRAPATHS:append := \":${THISDIR}/Your_Files_Path\" or\n"
- msg += " FILESEXTRAPATHS:prepend := \"${THISDIR}/Your_Files_Path:\"\n"
- msg += "in your bbappend file\n\n"
- msg += "Your incorrect assignment is:\n"
- msg += "%s\n" % extrapaths
- bb.warn(msg)
-
- overrides = d.getVar('OVERRIDES').split(':')
- pn = d.getVar('PN')
- if pn in overrides:
- msg = 'Recipe %s has PN of "%s" which is in OVERRIDES, this can result in unexpected behaviour.' % (d.getVar("FILE"), pn)
- oe.qa.handle_error("pn-overrides", msg, d)
- prog = re.compile(r'[A-Z]')
- if prog.search(pn):
- oe.qa.handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d)
-
- # Some people mistakenly use DEPENDS:${PN} instead of DEPENDS and wonder
- # why it doesn't work.
- if (d.getVar(d.expand('DEPENDS:${PN}'))):
- oe.qa.handle_error("pkgvarcheck", "recipe uses DEPENDS:${PN}, should use DEPENDS", d)
-
- issues = []
- if (d.getVar('PACKAGES') or "").split():
- for dep in (d.getVar('QADEPENDS') or "").split():
- d.appendVarFlag('do_package_qa', 'depends', " %s:do_populate_sysroot" % dep)
- for var in 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RCONFLICTS', 'RPROVIDES', 'RREPLACES', 'FILES', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'ALLOW_EMPTY':
- if d.getVar(var, False):
- issues.append(var)
-
- fakeroot_tests = d.getVar('FAKEROOT_QA').split()
- if set(tests) & set(fakeroot_tests):
- d.setVarFlag('do_package_qa', 'fakeroot', '1')
- d.appendVarFlag('do_package_qa', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
- else:
- d.setVarFlag('do_package_qa', 'rdeptask', '')
- for i in issues:
- oe.qa.handle_error("pkgvarcheck", "%s: Variable %s is set as not being package specific, please fix this." % (d.getVar("FILE"), i), d)
-
- if 'native-last' not in (d.getVar('INSANE_SKIP') or "").split():
- for native_class in ['native', 'nativesdk']:
- if bb.data.inherits_class(native_class, d):
-
- inherited_classes = d.getVar('__inherit_cache', False) or []
- needle = os.path.join('classes', native_class)
-
- bbclassextend = (d.getVar('BBCLASSEXTEND') or '').split()
- # BBCLASSEXTEND items are always added in the end
- skip_classes = bbclassextend
- if bb.data.inherits_class('native', d) or 'native' in bbclassextend:
- # native also inherits nopackages and relocatable bbclasses
- skip_classes.extend(['nopackages', 'relocatable'])
-
- broken_order = []
- for class_item in reversed(inherited_classes):
- if needle not in class_item:
- for extend_item in skip_classes:
- if os.path.join('classes', '%s.bbclass' % extend_item) in class_item:
- break
- else:
- pn = d.getVar('PN')
- broken_order.append(os.path.basename(class_item))
- else:
- break
- if broken_order:
- oe.qa.handle_error("native-last", "%s: native/nativesdk class is not inherited last, this can result in unexpected behaviour. "
- "Classes inherited after native/nativesdk: %s" % (pn, " ".join(broken_order)), d)
-
- oe.qa.exit_if_errors(d)
-}
diff --git a/poky/meta/classes/kernel-arch.bbclass b/poky/meta/classes/kernel-arch.bbclass
deleted file mode 100644
index 348a3ad..0000000
--- a/poky/meta/classes/kernel-arch.bbclass
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# set the ARCH environment variable for kernel compilation (including
-# modules). return value must match one of the architecture directories
-# in the kernel source "arch" directory
-#
-
-valid_archs = "alpha cris ia64 \
- i386 x86 \
- m68knommu m68k ppc powerpc powerpc64 ppc64 \
- sparc sparc64 \
- arm aarch64 \
- m32r mips \
- sh sh64 um h8300 \
- parisc s390 v850 \
- avr32 blackfin \
- microblaze \
- nios2 arc riscv xtensa"
-
-def map_kernel_arch(a, d):
- import re
-
- valid_archs = d.getVar('valid_archs').split()
-
- if re.match('(i.86|athlon|x86.64)$', a): return 'x86'
- elif re.match('arceb$', a): return 'arc'
- elif re.match('armeb$', a): return 'arm'
- elif re.match('aarch64$', a): return 'arm64'
- elif re.match('aarch64_be$', a): return 'arm64'
- elif re.match('aarch64_ilp32$', a): return 'arm64'
- elif re.match('aarch64_be_ilp32$', a): return 'arm64'
- elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a): return 'mips'
- elif re.match('mcf', a): return 'm68k'
- elif re.match('riscv(32|64|)(eb|)$', a): return 'riscv'
- elif re.match('p(pc|owerpc)(|64)', a): return 'powerpc'
- elif re.match('sh(3|4)$', a): return 'sh'
- elif re.match('bfin', a): return 'blackfin'
- elif re.match('microblazee[bl]', a): return 'microblaze'
- elif a in valid_archs: return a
- else:
- if not d.getVar("TARGET_OS").startswith("linux"):
- return a
- bb.error("cannot map '%s' to a linux kernel architecture" % a)
-
-export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
-
-def map_uboot_arch(a, d):
- import re
-
- if re.match('p(pc|owerpc)(|64)', a): return 'ppc'
- elif re.match('i.86$', a): return 'x86'
- return a
-
-export UBOOT_ARCH = "${@map_uboot_arch(d.getVar('ARCH'), d)}"
-
-# Set TARGET_??_KERNEL_ARCH in the machine .conf to set architecture
-# specific options necessary for building the kernel and modules.
-TARGET_CC_KERNEL_ARCH ?= ""
-HOST_CC_KERNEL_ARCH ?= "${TARGET_CC_KERNEL_ARCH}"
-TARGET_LD_KERNEL_ARCH ?= ""
-HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}"
-TARGET_AR_KERNEL_ARCH ?= ""
-HOST_AR_KERNEL_ARCH ?= "${TARGET_AR_KERNEL_ARCH}"
-
-KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH}"
-KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
-KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
-TOOLCHAIN = "gcc"
-
diff --git a/poky/meta/classes/kernel-artifact-names.bbclass b/poky/meta/classes/kernel-artifact-names.bbclass
deleted file mode 100644
index e77107c..0000000
--- a/poky/meta/classes/kernel-artifact-names.bbclass
+++ /dev/null
@@ -1,31 +0,0 @@
-##################################################################
-# Specific kernel creation info
-# for recipes/bbclasses which need to reuse some of the kernel
-# artifacts, but aren't kernel recipes themselves
-##################################################################
-
-inherit image-artifact-names
-
-KERNEL_ARTIFACT_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
-KERNEL_ARTIFACT_LINK_NAME ?= "${MACHINE}"
-KERNEL_ARTIFACT_BIN_EXT ?= ".bin"
-
-KERNEL_IMAGE_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-KERNEL_IMAGE_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-KERNEL_IMAGE_BIN_EXT ?= "${KERNEL_ARTIFACT_BIN_EXT}"
-KERNEL_IMAGETYPE_SYMLINK ?= "1"
-
-KERNEL_DTB_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-KERNEL_DTB_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-KERNEL_DTB_BIN_EXT ?= "${KERNEL_ARTIFACT_BIN_EXT}"
-
-KERNEL_FIT_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-KERNEL_FIT_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-KERNEL_FIT_BIN_EXT ?= "${KERNEL_ARTIFACT_BIN_EXT}"
-
-MODULE_TARBALL_NAME ?= "${KERNEL_ARTIFACT_NAME}"
-MODULE_TARBALL_LINK_NAME ?= "${KERNEL_ARTIFACT_LINK_NAME}"
-MODULE_TARBALL_DEPLOY ?= "1"
-
-INITRAMFS_NAME ?= "initramfs-${KERNEL_ARTIFACT_NAME}"
-INITRAMFS_LINK_NAME ?= "initramfs-${KERNEL_ARTIFACT_LINK_NAME}"
diff --git a/poky/meta/classes/kernel-devicetree.bbclass b/poky/meta/classes/kernel-devicetree.bbclass
deleted file mode 100644
index b4338da..0000000
--- a/poky/meta/classes/kernel-devicetree.bbclass
+++ /dev/null
@@ -1,113 +0,0 @@
-# Support for device tree generation
-python () {
- if not bb.data.inherits_class('nopackages', d):
- d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
- if d.getVar('KERNEL_DEVICETREE_BUNDLE') == '1':
- d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
-}
-
-FILES:${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
-FILES:${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
-
-# Generate kernel+devicetree bundle
-KERNEL_DEVICETREE_BUNDLE ?= "0"
-
-# dtc flags passed via DTC_FLAGS env variable
-KERNEL_DTC_FLAGS ?= ""
-
-normalize_dtb () {
- dtb="$1"
- if echo $dtb | grep -q '/dts/'; then
- bbwarn "$dtb contains the full path to the the dts file, but only the dtb name should be used."
- dtb=`basename $dtb | sed 's,\.dts$,.dtb,g'`
- fi
- echo "$dtb"
-}
-
-get_real_dtb_path_in_kernel () {
- dtb="$1"
- dtb_path="${B}/arch/${ARCH}/boot/dts/$dtb"
- if [ ! -e "$dtb_path" ]; then
- dtb_path="${B}/arch/${ARCH}/boot/$dtb"
- fi
- echo "$dtb_path"
-}
-
-do_configure:append() {
- if [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
- if echo ${KERNEL_IMAGETYPE_FOR_MAKE} | grep -q 'zImage'; then
- case "${ARCH}" in
- "arm")
- config="${B}/.config"
- if ! grep -q 'CONFIG_ARM_APPENDED_DTB=y' $config; then
- bbwarn 'CONFIG_ARM_APPENDED_DTB is NOT enabled in the kernel. Enabling it to allow the kernel to boot with the Device Tree appended!'
- sed -i "/CONFIG_ARM_APPENDED_DTB[ =]/d" $config
- echo "CONFIG_ARM_APPENDED_DTB=y" >> $config
- echo "# CONFIG_ARM_ATAG_DTB_COMPAT is not set" >> $config
- fi
- ;;
- *)
- bberror "KERNEL_DEVICETREE_BUNDLE is not supported for ${ARCH}. Currently it is only supported for 'ARM'."
- esac
- else
- bberror 'The KERNEL_DEVICETREE_BUNDLE requires the KERNEL_IMAGETYPE to contain zImage.'
- fi
- fi
-}
-
-do_compile:append() {
- if [ -n "${KERNEL_DTC_FLAGS}" ]; then
- export DTC_FLAGS="${KERNEL_DTC_FLAGS}"
- fi
-
- for dtbf in ${KERNEL_DEVICETREE}; do
- dtb=`normalize_dtb "$dtbf"`
- oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
- done
-}
-
-do_install:append() {
- for dtbf in ${KERNEL_DEVICETREE}; do
- dtb=`normalize_dtb "$dtbf"`
- dtb_ext=${dtb##*.}
- dtb_base_name=`basename $dtb .$dtb_ext`
- dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
- install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
- done
-}
-
-do_deploy:append() {
- for dtbf in ${KERNEL_DEVICETREE}; do
- dtb=`normalize_dtb "$dtbf"`
- dtb_ext=${dtb##*.}
- dtb_base_name=`basename $dtb .$dtb_ext`
- install -d $deployDir
- install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
- if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
- ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext
- fi
- if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then
- ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext
- fi
- for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
- if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
- cat ${D}/${KERNEL_IMAGEDEST}/$type \
- $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \
- > $deployDir/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
- if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
- ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \
- $deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
- fi
- if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
- cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
- $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \
- > $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
- if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
- ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \
- $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
- fi
- fi
- fi
- done
- done
-}
diff --git a/poky/meta/classes/kernel-fitimage.bbclass b/poky/meta/classes/kernel-fitimage.bbclass
deleted file mode 100644
index 7531645..0000000
--- a/poky/meta/classes/kernel-fitimage.bbclass
+++ /dev/null
@@ -1,797 +0,0 @@
-inherit kernel-uboot kernel-artifact-names uboot-sign
-
-def get_fit_replacement_type(d):
- kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""
- replacementtype = ""
- if 'fitImage' in kerneltypes.split():
- uarch = d.getVar("UBOOT_ARCH")
- if uarch == "arm64":
- replacementtype = "Image"
- elif uarch == "riscv":
- replacementtype = "Image"
- elif uarch == "mips":
- replacementtype = "vmlinuz.bin"
- elif uarch == "x86":
- replacementtype = "bzImage"
- elif uarch == "microblaze":
- replacementtype = "linux.bin"
- else:
- replacementtype = "zImage"
- return replacementtype
-
-KERNEL_IMAGETYPE_REPLACEMENT ?= "${@get_fit_replacement_type(d)}"
-DEPENDS:append = " ${@'u-boot-tools-native dtc-native' if 'fitImage' in (d.getVar('KERNEL_IMAGETYPES') or '').split() else ''}"
-
-python __anonymous () {
- # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
- # to kernel.bbclass . We have to override it, since we pack zImage
- # (at least for now) into the fitImage .
- typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
- if 'fitImage' in typeformake.split():
- d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', d.getVar('KERNEL_IMAGETYPE_REPLACEMENT')))
-
- image = d.getVar('INITRAMFS_IMAGE')
- if image:
- d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
-
- ubootenv = d.getVar('UBOOT_ENV')
- if ubootenv:
- d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/bootloader:do_populate_sysroot')
-
- #check if there are any dtb providers
- providerdtb = d.getVar("PREFERRED_PROVIDER_virtual/dtb")
- if providerdtb:
- d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/dtb:do_populate_sysroot')
- d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' virtual/dtb:do_populate_sysroot')
- d.setVar('EXTERNAL_KERNEL_DEVICETREE', "${RECIPE_SYSROOT}/boot/devicetree")
-
- # Verified boot will sign the fitImage and append the public key to
- # U-Boot dtb. We ensure the U-Boot dtb is deployed before assembling
- # the fitImage:
- if d.getVar('UBOOT_SIGN_ENABLE') == "1" and d.getVar('UBOOT_DTB_BINARY'):
- uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
- d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
- if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
- d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
-}
-
-
-# Description string
-FIT_DESC ?= "Kernel fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
-
-# Sign individual images as well
-FIT_SIGN_INDIVIDUAL ?= "0"
-
-FIT_CONF_PREFIX ?= "conf-"
-FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name"
-
-FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
-
-# Keys used to sign individually image nodes.
-# The keys to sign image nodes must be different from those used to sign
-# configuration nodes, otherwise the "required" property, from
-# UBOOT_DTB_BINARY, will be set to "conf", because "conf" prevails on "image".
-# Then the images signature checking will not be mandatory and no error will be
-# raised in case of failure.
-# UBOOT_SIGN_IMG_KEYNAME = "dev2" # keys name in keydir (eg. "dev2.crt", "dev2.key")
-
-#
-# Emit the fitImage ITS header
-#
-# $1 ... .its filename
-fitimage_emit_fit_header() {
- cat << EOF >> $1
-/dts-v1/;
-
-/ {
- description = "${FIT_DESC}";
- #address-cells = <1>;
-EOF
-}
-
-#
-# Emit the fitImage section bits
-#
-# $1 ... .its filename
-# $2 ... Section bit type: imagestart - image section start
-# confstart - configuration section start
-# sectend - section end
-# fitend - fitimage end
-#
-fitimage_emit_section_maint() {
- case $2 in
- imagestart)
- cat << EOF >> $1
-
- images {
-EOF
- ;;
- confstart)
- cat << EOF >> $1
-
- configurations {
-EOF
- ;;
- sectend)
- cat << EOF >> $1
- };
-EOF
- ;;
- fitend)
- cat << EOF >> $1
-};
-EOF
- ;;
- esac
-}
-
-#
-# Emit the fitImage ITS kernel section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to kernel image
-# $4 ... Compression type
-fitimage_emit_section_kernel() {
-
- kernel_csum="${FIT_HASH_ALG}"
- kernel_sign_algo="${FIT_SIGN_ALG}"
- kernel_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-
- ENTRYPOINT="${UBOOT_ENTRYPOINT}"
- if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
- ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
- awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
- fi
-
- cat << EOF >> $1
- kernel-$2 {
- description = "Linux kernel";
- data = /incbin/("$3");
- type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
- arch = "${UBOOT_ARCH}";
- os = "linux";
- compression = "$4";
- load = <${UBOOT_LOADADDRESS}>;
- entry = <$ENTRYPOINT>;
- hash-1 {
- algo = "$kernel_csum";
- };
- };
-EOF
-
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$kernel_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
- signature-1 {
- algo = "$kernel_csum,$kernel_sign_algo";
- key-name-hint = "$kernel_sign_keyname";
- };
- };
-EOF
- fi
-}
-
-#
-# Emit the fitImage ITS DTB section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to DTB image
-fitimage_emit_section_dtb() {
-
- dtb_csum="${FIT_HASH_ALG}"
- dtb_sign_algo="${FIT_SIGN_ALG}"
- dtb_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-
- dtb_loadline=""
- dtb_ext=${DTB##*.}
- if [ "${dtb_ext}" = "dtbo" ]; then
- if [ -n "${UBOOT_DTBO_LOADADDRESS}" ]; then
- dtb_loadline="load = <${UBOOT_DTBO_LOADADDRESS}>;"
- fi
- elif [ -n "${UBOOT_DTB_LOADADDRESS}" ]; then
- dtb_loadline="load = <${UBOOT_DTB_LOADADDRESS}>;"
- fi
- cat << EOF >> $1
- fdt-$2 {
- description = "Flattened Device Tree blob";
- data = /incbin/("$3");
- type = "flat_dt";
- arch = "${UBOOT_ARCH}";
- compression = "none";
- $dtb_loadline
- hash-1 {
- algo = "$dtb_csum";
- };
- };
-EOF
-
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$dtb_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
- signature-1 {
- algo = "$dtb_csum,$dtb_sign_algo";
- key-name-hint = "$dtb_sign_keyname";
- };
- };
-EOF
- fi
-}
-
-#
-# Emit the fitImage ITS u-boot script section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to boot script image
-fitimage_emit_section_boot_script() {
-
- bootscr_csum="${FIT_HASH_ALG}"
- bootscr_sign_algo="${FIT_SIGN_ALG}"
- bootscr_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
-
- cat << EOF >> $1
- bootscr-$2 {
- description = "U-boot script";
- data = /incbin/("$3");
- type = "script";
- arch = "${UBOOT_ARCH}";
- compression = "none";
- hash-1 {
- algo = "$bootscr_csum";
- };
- };
-EOF
-
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$bootscr_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
- signature-1 {
- algo = "$bootscr_csum,$bootscr_sign_algo";
- key-name-hint = "$bootscr_sign_keyname";
- };
- };
-EOF
- fi
-}
-
-#
-# Emit the fitImage ITS setup section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to setup image
-fitimage_emit_section_setup() {
-
- setup_csum="${FIT_HASH_ALG}"
-
- cat << EOF >> $1
- setup-$2 {
- description = "Linux setup.bin";
- data = /incbin/("$3");
- type = "x86_setup";
- arch = "${UBOOT_ARCH}";
- os = "linux";
- compression = "none";
- load = <0x00090000>;
- entry = <0x00090000>;
- hash-1 {
- algo = "$setup_csum";
- };
- };
-EOF
-}
-
-#
-# Emit the fitImage ITS ramdisk section
-#
-# $1 ... .its filename
-# $2 ... Image counter
-# $3 ... Path to ramdisk image
-fitimage_emit_section_ramdisk() {
-
- ramdisk_csum="${FIT_HASH_ALG}"
- ramdisk_sign_algo="${FIT_SIGN_ALG}"
- ramdisk_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
- ramdisk_loadline=""
- ramdisk_entryline=""
-
- if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
- ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
- fi
- if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
- ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
- fi
-
- cat << EOF >> $1
- ramdisk-$2 {
- description = "${INITRAMFS_IMAGE}";
- data = /incbin/("$3");
- type = "ramdisk";
- arch = "${UBOOT_ARCH}";
- os = "linux";
- compression = "none";
- $ramdisk_loadline
- $ramdisk_entryline
- hash-1 {
- algo = "$ramdisk_csum";
- };
- };
-EOF
-
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$ramdisk_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
- signature-1 {
- algo = "$ramdisk_csum,$ramdisk_sign_algo";
- key-name-hint = "$ramdisk_sign_keyname";
- };
- };
-EOF
- fi
-}
-
-#
-# Emit the fitImage ITS configuration section
-#
-# $1 ... .its filename
-# $2 ... Linux kernel ID
-# $3 ... DTB image name
-# $4 ... ramdisk ID
-# $5 ... u-boot script ID
-# $6 ... config ID
-# $7 ... default flag
-fitimage_emit_section_config() {
-
- conf_csum="${FIT_HASH_ALG}"
- conf_sign_algo="${FIT_SIGN_ALG}"
- conf_padding_algo="${FIT_PAD_ALG}"
- if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
- conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
- fi
-
- its_file="$1"
- kernel_id="$2"
- dtb_image="$3"
- ramdisk_id="$4"
- bootscr_id="$5"
- config_id="$6"
- default_flag="$7"
-
- # Test if we have any DTBs at all
- sep=""
- conf_desc=""
- conf_node="${FIT_CONF_PREFIX}"
- kernel_line=""
- fdt_line=""
- ramdisk_line=""
- bootscr_line=""
- setup_line=""
- default_line=""
-
- # conf node name is selected based on dtb ID if it is present,
- # otherwise its selected based on kernel ID
- if [ -n "$dtb_image" ]; then
- conf_node=$conf_node$dtb_image
- else
- conf_node=$conf_node$kernel_id
- fi
-
- if [ -n "$kernel_id" ]; then
- conf_desc="Linux kernel"
- sep=", "
- kernel_line="kernel = \"kernel-$kernel_id\";"
- fi
-
- if [ -n "$dtb_image" ]; then
- conf_desc="$conf_desc${sep}FDT blob"
- sep=", "
- fdt_line="fdt = \"fdt-$dtb_image\";"
- fi
-
- if [ -n "$ramdisk_id" ]; then
- conf_desc="$conf_desc${sep}ramdisk"
- sep=", "
- ramdisk_line="ramdisk = \"ramdisk-$ramdisk_id\";"
- fi
-
- if [ -n "$bootscr_id" ]; then
- conf_desc="$conf_desc${sep}u-boot script"
- sep=", "
- bootscr_line="bootscr = \"bootscr-$bootscr_id\";"
- fi
-
- if [ -n "$config_id" ]; then
- conf_desc="$conf_desc${sep}setup"
- setup_line="setup = \"setup-$config_id\";"
- fi
-
- if [ "$default_flag" = "1" ]; then
- # default node is selected based on dtb ID if it is present,
- # otherwise its selected based on kernel ID
- if [ -n "$dtb_image" ]; then
- default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
- else
- default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
- fi
- fi
-
- cat << EOF >> $its_file
- $default_line
- $conf_node {
- description = "$default_flag $conf_desc";
- $kernel_line
- $fdt_line
- $ramdisk_line
- $bootscr_line
- $setup_line
- hash-1 {
- algo = "$conf_csum";
- };
-EOF
-
- if [ -n "$conf_sign_keyname" ] ; then
-
- sign_line="sign-images = "
- sep=""
-
- if [ -n "$kernel_id" ]; then
- sign_line="$sign_line${sep}\"kernel\""
- sep=", "
- fi
-
- if [ -n "$dtb_image" ]; then
- sign_line="$sign_line${sep}\"fdt\""
- sep=", "
- fi
-
- if [ -n "$ramdisk_id" ]; then
- sign_line="$sign_line${sep}\"ramdisk\""
- sep=", "
- fi
-
- if [ -n "$bootscr_id" ]; then
- sign_line="$sign_line${sep}\"bootscr\""
- sep=", "
- fi
-
- if [ -n "$config_id" ]; then
- sign_line="$sign_line${sep}\"setup\""
- fi
-
- sign_line="$sign_line;"
-
- cat << EOF >> $its_file
- signature-1 {
- algo = "$conf_csum,$conf_sign_algo";
- key-name-hint = "$conf_sign_keyname";
- padding = "$conf_padding_algo";
- $sign_line
- };
-EOF
- fi
-
- cat << EOF >> $its_file
- };
-EOF
-}
-
-#
-# Assemble fitImage
-#
-# $1 ... .its filename
-# $2 ... fitImage name
-# $3 ... include ramdisk
-fitimage_assemble() {
- kernelcount=1
- dtbcount=""
- DTBS=""
- ramdiskcount=$3
- setupcount=""
- bootscr_id=""
- rm -f $1 arch/${ARCH}/boot/$2
-
- if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then
- bbfatal "Keys used to sign images and configuration nodes must be different."
- fi
-
- fitimage_emit_fit_header $1
-
- #
- # Step 1: Prepare a kernel image section.
- #
- fitimage_emit_section_maint $1 imagestart
-
- uboot_prep_kimage
- fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
-
- #
- # Step 2: Prepare a DTB image section
- #
-
- if [ -n "${KERNEL_DEVICETREE}" ]; then
- dtbcount=1
- for DTB in ${KERNEL_DEVICETREE}; do
- if echo $DTB | grep -q '/dts/'; then
- bbwarn "$DTB contains the full path to the the dts file, but only the dtb name should be used."
- DTB=`basename $DTB | sed 's,\.dts$,.dtb,g'`
- fi
-
- # Skip ${DTB} if it's also provided in ${EXTERNAL_KERNEL_DEVICETREE}
- if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -s ${EXTERNAL_KERNEL_DEVICETREE}/${DTB} ]; then
- continue
- fi
-
- DTB_PATH="arch/${ARCH}/boot/dts/$DTB"
- if [ ! -e "$DTB_PATH" ]; then
- DTB_PATH="arch/${ARCH}/boot/$DTB"
- fi
-
- DTB=$(echo "$DTB" | tr '/' '_')
- DTBS="$DTBS $DTB"
- fitimage_emit_section_dtb $1 $DTB $DTB_PATH
- done
- fi
-
- if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
- dtbcount=1
- for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
- DTB=$(echo "$DTB" | tr '/' '_')
- DTBS="$DTBS $DTB"
- fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB"
- done
- fi
-
- #
- # Step 3: Prepare a u-boot script section
- #
-
- if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
- if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
- cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
- bootscr_id="${UBOOT_ENV_BINARY}"
- fitimage_emit_section_boot_script $1 "$bootscr_id" ${UBOOT_ENV_BINARY}
- else
- bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
- fi
- fi
-
- #
- # Step 4: Prepare a setup section. (For x86)
- #
- if [ -e arch/${ARCH}/boot/setup.bin ]; then
- setupcount=1
- fitimage_emit_section_setup $1 $setupcount arch/${ARCH}/boot/setup.bin
- fi
-
- #
- # Step 5: Prepare a ramdisk section.
- #
- if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- # Find and use the first initramfs image archive type we find
- found=
- for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
- initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
- if [ -e "$initramfs_path" ]; then
- bbnote "Found initramfs image: $initramfs_path"
- found=true
- fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
- break
- else
- bbnote "Did not find initramfs image: $initramfs_path"
- fi
- done
-
- if [ -z "$found" ]; then
- bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
- fi
- fi
-
- fitimage_emit_section_maint $1 sectend
-
- # Force the first Kernel and DTB in the default config
- kernelcount=1
- if [ -n "$dtbcount" ]; then
- dtbcount=1
- fi
-
- #
- # Step 6: Prepare a configurations section
- #
- fitimage_emit_section_maint $1 confstart
-
- # kernel-fitimage.bbclass currently only supports a single kernel (no less or
- # more) to be added to the FIT image along with 0 or more device trees and
- # 0 or 1 ramdisk.
- # It is also possible to include an initramfs bundle (kernel and rootfs in one binary)
- # When the initramfs bundle is used ramdisk is disabled.
- # If a device tree is to be part of the FIT image, then select
- # the default configuration to be used is based on the dtbcount. If there is
- # no dtb present than select the default configuation to be based on
- # the kernelcount.
- if [ -n "$DTBS" ]; then
- i=1
- for DTB in ${DTBS}; do
- dtb_ext=${DTB##*.}
- if [ "$dtb_ext" = "dtbo" ]; then
- fitimage_emit_section_config $1 "" "$DTB" "" "$bootscr_id" "" "`expr $i = $dtbcount`"
- else
- fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`"
- fi
- i=`expr $i + 1`
- done
- else
- defaultconfigcount=1
- fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id" "$setupcount" $defaultconfigcount
- fi
-
- fitimage_emit_section_maint $1 sectend
-
- fitimage_emit_section_maint $1 fitend
-
- #
- # Step 7: Assemble the image
- #
- ${UBOOT_MKIMAGE} \
- ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
- -f $1 \
- arch/${ARCH}/boot/$2
-
- #
- # Step 8: Sign the image and add public key to U-Boot dtb
- #
- if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
- add_key_to_u_boot=""
- if [ -n "${UBOOT_DTB_BINARY}" ]; then
- # The u-boot.dtb is a symlink to UBOOT_DTB_IMAGE, so we need copy
- # both of them, and don't dereference the symlink.
- cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
- add_key_to_u_boot="-K ${B}/${UBOOT_DTB_BINARY}"
- fi
- ${UBOOT_MKIMAGE_SIGN} \
- ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
- -F -k "${UBOOT_SIGN_KEYDIR}" \
- $add_key_to_u_boot \
- -r arch/${ARCH}/boot/$2 \
- ${UBOOT_MKIMAGE_SIGN_ARGS}
- fi
-}
-
-do_assemble_fitimage() {
- if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
- cd ${B}
- fitimage_assemble fit-image.its fitImage ""
- fi
-}
-
-addtask assemble_fitimage before do_install after do_compile
-
-do_assemble_fitimage_initramfs() {
- if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
- test -n "${INITRAMFS_IMAGE}" ; then
- cd ${B}
- if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
- fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage ""
- else
- fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
- fi
- fi
-}
-
-addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs
-
-do_kernel_generate_rsa_keys() {
- if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
- bbwarn "FIT_GENERATE_KEYS is set to 1 even though UBOOT_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used."
- fi
-
- if [ "${UBOOT_SIGN_ENABLE}" = "1" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
-
- # Generate keys to sign configuration nodes, only if they don't already exist
- if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key ] || \
- [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt ]; then
-
- # make directory if it does not already exist
- mkdir -p "${UBOOT_SIGN_KEYDIR}"
-
- bbnote "Generating RSA private key for signing fitImage"
- openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
- "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
- "${FIT_SIGN_NUMBITS}"
-
- bbnote "Generating certificate for signing fitImage"
- openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
- -key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
- -out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt
- fi
-
- # Generate keys to sign image nodes, only if they don't already exist
- if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key ] || \
- [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".crt ]; then
-
- # make directory if it does not already exist
- mkdir -p "${UBOOT_SIGN_KEYDIR}"
-
- bbnote "Generating RSA private key for signing fitImage"
- openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
- "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key \
- "${FIT_SIGN_NUMBITS}"
-
- bbnote "Generating certificate for signing fitImage"
- openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
- -key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key \
- -out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".crt
- fi
- fi
-}
-
-addtask kernel_generate_rsa_keys before do_assemble_fitimage after do_compile
-
-kernel_do_deploy[vardepsexclude] = "DATETIME"
-kernel_do_deploy:append() {
- # Update deploy directory
- if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
-
- if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- bbnote "Copying fit-image.its source file..."
- install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
- ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
- fi
-
- bbnote "Copying linux.bin file..."
- install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
- ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
- fi
- fi
-
- if [ -n "${INITRAMFS_IMAGE}" ]; then
- bbnote "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
- install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
- ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
- fi
-
- if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- bbnote "Copying fitImage-${INITRAMFS_IMAGE} file..."
- install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}"
- if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
- ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
- fi
- fi
- fi
- fi
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -o "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
- [ -n "${UBOOT_DTB_BINARY}" ] ; then
- # UBOOT_DTB_IMAGE is a realfile, but we can't use
- # ${UBOOT_DTB_IMAGE} since it contains ${PV} which is aimed
- # for u-boot, but we are in kernel env now.
- install -m 0644 ${B}/u-boot-${MACHINE}*.dtb "$deployDir/"
- fi
- if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${UBOOT_BINARY}" -a -n "${SPL_DTB_BINARY}" ] ; then
- # If we're also creating and/or signing the uboot fit, now we need to
- # deploy it, it's its file, as well as u-boot-spl.dtb
- install -m 0644 ${B}/u-boot-spl-${MACHINE}*.dtb "$deployDir/"
- bbnote "Copying u-boot-fitImage file..."
- install -m 0644 ${B}/u-boot-fitImage-* "$deployDir/"
- bbnote "Copying u-boot-its file..."
- install -m 0644 ${B}/u-boot-its-* "$deployDir/"
- fi
-}
-
-# The function below performs the following in case of initramfs bundles:
-# - Removes do_assemble_fitimage. FIT generation is done through
-# do_assemble_fitimage_initramfs. do_assemble_fitimage is not needed
-# and should not be part of the tasks to be executed.
-# - Since do_kernel_generate_rsa_keys is inserted by default
-# between do_compile and do_assemble_fitimage, this is
-# not suitable in case of initramfs bundles. do_kernel_generate_rsa_keys
-# should be between do_bundle_initramfs and do_assemble_fitimage_initramfs.
-python () {
- if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
- bb.build.deltask('do_assemble_fitimage', d)
- bb.build.deltask('kernel_generate_rsa_keys', d)
- bb.build.addtask('kernel_generate_rsa_keys', 'do_assemble_fitimage_initramfs', 'do_bundle_initramfs', d)
-}
diff --git a/poky/meta/classes/kernel-grub.bbclass b/poky/meta/classes/kernel-grub.bbclass
deleted file mode 100644
index 44b2015..0000000
--- a/poky/meta/classes/kernel-grub.bbclass
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# While installing a rpm to update kernel on a deployed target, it will update
-# the boot area and the boot menu with the kernel as the priority but allow
-# you to fall back to the original kernel as well.
-#
-# - In kernel-image's preinstall scriptlet, it backs up original kernel to avoid
-# probable confliction with the new one.
-#
-# - In kernel-image's postinstall scriptlet, it modifies grub's config file to
-# updates the new kernel as the boot priority.
-#
-
-python __anonymous () {
- import re
-
- preinst = '''
- # Parsing confliction
- [ -f "$D/boot/grub/menu.list" ] && grubcfg="$D/boot/grub/menu.list"
- [ -f "$D/boot/grub/grub.cfg" ] && grubcfg="$D/boot/grub/grub.cfg"
- if [ -n "$grubcfg" ]; then
- # Dereference symlink to avoid confliction with new kernel name.
- if grep -q "/KERNEL_IMAGETYPE \+root=" $grubcfg; then
- if [ -L "$D/boot/KERNEL_IMAGETYPE" ]; then
- kimage=`realpath $D/boot/KERNEL_IMAGETYPE 2>/dev/null`
- if [ -f "$D$kimage" ]; then
- sed -i "s:KERNEL_IMAGETYPE \+root=:${kimage##*/} root=:" $grubcfg
- fi
- fi
- fi
-
- # Rename old kernel if it conflicts with new kernel name.
- if grep -q "/KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=" $grubcfg; then
- if [ -f "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" ]; then
- timestamp=`date +%s`
- kimage="$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}-$timestamp-back"
- sed -i "s:KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
- mv "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" "$kimage"
- fi
- fi
- fi
-'''
-
- postinst = '''
- get_new_grub_cfg() {
- grubcfg="$1"
- old_image="$2"
- title="Update KERNEL_IMAGETYPE-${KERNEL_VERSION}-${PV}"
- if [ "${grubcfg##*/}" = "grub.cfg" ]; then
- rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \
- sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
-
- echo "menuentry \"$title\" {"
- echo " set root=(hd0,1)"
- echo "$rootfs"
- echo "}"
- elif [ "${grubcfg##*/}" = "menu.list" ]; then
- rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \
- sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
-
- echo "default 0"
- echo "timeout 30"
- echo "title $title"
- echo "root (hd0,0)"
- echo "$rootfs"
- fi
- }
-
- get_old_grub_cfg() {
- grubcfg="$1"
- if [ "${grubcfg##*/}" = "grub.cfg" ]; then
- cat "$grubcfg"
- elif [ "${grubcfg##*/}" = "menu.list" ]; then
- sed -e '/^default/d' -e '/^timeout/d' "$grubcfg"
- fi
- }
-
- if [ -f "$D/boot/grub/grub.cfg" ]; then
- grubcfg="$D/boot/grub/grub.cfg"
- old_image=`grep ' *linux \+[^ ]\+ \+root=' -m 1 "$grubcfg" | awk '{print $2}'`
- elif [ -f "$D/boot/grub/menu.list" ]; then
- grubcfg="$D/boot/grub/menu.list"
- old_image=`grep '^kernel \+[^ ]\+ \+root=' -m 1 "$grubcfg" | awk '{print $2}'`
- fi
-
- # Don't update grubcfg at first install while old bzImage doesn't exist.
- if [ -f "$D/boot/${old_image##*/}" ]; then
- grubcfgtmp="$grubcfg.tmp"
- get_new_grub_cfg "$grubcfg" "$old_image" > $grubcfgtmp
- get_old_grub_cfg "$grubcfg" >> $grubcfgtmp
- mv $grubcfgtmp $grubcfg
- echo "Caution! Update kernel may affect kernel-module!"
- fi
-'''
-
- imagetypes = d.getVar('KERNEL_IMAGETYPES')
- imagetypes = re.sub(r'\.gz$', '', imagetypes)
-
- for type in imagetypes.split():
- typelower = type.lower()
- preinst_append = preinst.replace('KERNEL_IMAGETYPE', type)
- postinst_prepend = postinst.replace('KERNEL_IMAGETYPE', type)
- d.setVar('pkg_preinst:kernel-image-' + typelower + ':append', preinst_append)
- d.setVar('pkg_postinst:kernel-image-' + typelower + ':prepend', postinst_prepend)
-}
-
diff --git a/poky/meta/classes/kernel-module-split.bbclass b/poky/meta/classes/kernel-module-split.bbclass
deleted file mode 100644
index a29c294..0000000
--- a/poky/meta/classes/kernel-module-split.bbclass
+++ /dev/null
@@ -1,191 +0,0 @@
-pkg_postinst:modules () {
-if [ -z "$D" ]; then
- depmod -a ${KERNEL_VERSION}
-else
- # image.bbclass will call depmodwrapper after everything is installed,
- # no need to do it here as well
- :
-fi
-}
-
-pkg_postrm:modules () {
-if [ -z "$D" ]; then
- depmod -a ${KERNEL_VERSION}
-else
- depmodwrapper -a -b $D ${KERNEL_VERSION}
-fi
-}
-
-autoload_postinst_fragment() {
-if [ x"$D" = "x" ]; then
- modprobe %s || true
-fi
-}
-
-PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross"
-
-do_install:append() {
- install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/
-}
-
-KERNEL_SPLIT_MODULES ?= "1"
-PACKAGESPLITFUNCS:prepend = "split_kernel_module_packages "
-
-KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-modules"
-
-KERNEL_MODULE_PACKAGE_PREFIX ?= ""
-KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}"
-KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1"
-
-python split_kernel_module_packages () {
- import re
-
- modinfoexp = re.compile("([^=]+)=(.*)")
-
- def extract_modinfo(file):
- import tempfile, subprocess
- tempfile.tempdir = d.getVar("WORKDIR")
- compressed = re.match( r'.*\.(gz|xz|zst)$', file)
- tf = tempfile.mkstemp()
- tmpfile = tf[1]
- if compressed:
- tmpkofile = tmpfile + ".ko"
- if compressed.group(1) == 'gz':
- cmd = "gunzip -dc %s > %s" % (file, tmpkofile)
- subprocess.check_call(cmd, shell=True)
- elif compressed.group(1) == 'xz':
- cmd = "xz -dc %s > %s" % (file, tmpkofile)
- subprocess.check_call(cmd, shell=True)
- elif compressed.group(1) == 'zst':
- cmd = "zstd -dc %s > %s" % (file, tmpkofile)
- subprocess.check_call(cmd, shell=True)
- else:
- msg = "Cannot decompress '%s'" % file
- raise msg
- cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", tmpkofile, tmpfile)
- else:
- cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile)
- subprocess.check_call(cmd, shell=True)
- # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'ö')
- f = open(tmpfile, errors='replace')
- l = f.read().split("\000")
- f.close()
- os.close(tf[0])
- os.unlink(tmpfile)
- if compressed:
- os.unlink(tmpkofile)
- vals = {}
- for i in l:
- m = modinfoexp.match(i)
- if not m:
- continue
- vals[m.group(1)] = m.group(2)
- return vals
-
- def frob_metadata(file, pkg, pattern, format, basename):
- vals = extract_modinfo(file)
-
- dvar = d.getVar('PKGD')
-
- # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
- # appropriate modprobe commands to the postinst
- autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split()
- autoload = d.getVar('module_autoload_%s' % basename)
- if autoload and autoload == basename:
- bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename)
- if autoload and basename not in autoloadlist:
- bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename))
- if basename in autoloadlist:
- name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
- f = open(name, 'w')
- if autoload:
- for m in autoload.split():
- f.write('%s\n' % m)
- else:
- f.write('%s\n' % basename)
- f.close()
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- bb.fatal("pkg_postinst:%s not defined" % pkg)
- postinst += d.getVar('autoload_postinst_fragment') % (autoload or basename)
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- # Write out any modconf fragment
- modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()
- modconf = d.getVar('module_conf_%s' % basename)
- if modconf and basename in modconflist:
- name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
- f = open(name, 'w')
- f.write("%s\n" % modconf)
- f.close()
- elif modconf:
- bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
-
- files = d.getVar('FILES:%s' % pkg)
- files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
- d.setVar('FILES:%s' % pkg, files)
-
- conffiles = d.getVar('CONFFILES:%s' % pkg)
- conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename)
- d.setVar('CONFFILES:%s' % pkg, conffiles)
-
- if "description" in vals:
- old_desc = d.getVar('DESCRIPTION:' + pkg) or ""
- d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"])
-
- rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
- modinfo_deps = []
- if "depends" in vals and vals["depends"] != "":
- for dep in vals["depends"].split(","):
- on = legitimize_package_name(dep)
- dependency_pkg = format % on
- modinfo_deps.append(dependency_pkg)
- for dep in modinfo_deps:
- if not dep in rdepends:
- rdepends[dep] = []
- d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False))
-
- # Avoid automatic -dev recommendations for modules ending with -dev.
- d.setVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs', 1)
-
- # Provide virtual package without postfix
- providevirt = d.getVar('KERNEL_MODULE_PROVIDE_VIRTUAL')
- if providevirt == "1":
- postfix = format.split('%s')[1]
- d.setVar('RPROVIDES:' + pkg, pkg.replace(postfix, ''))
-
- kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
- kernel_version = d.getVar("KERNEL_VERSION")
-
- metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE')
- splitmods = d.getVar('KERNEL_SPLIT_MODULES')
- postinst = d.getVar('pkg_postinst:modules')
- postrm = d.getVar('pkg_postrm:modules')
-
- if splitmods != '1':
- etcdir = d.getVar('sysconfdir')
- d.appendVar('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ %s/modules/' % (etcdir, etcdir, d.getVar("nonarch_base_libdir")))
- d.appendVar('pkg_postinst:%s' % metapkg, postinst)
- d.prependVar('pkg_postrm:%s' % metapkg, postrm);
- return
-
- module_regex = r'^(.*)\.k?o(?:\.(gz|xz|zst))?$'
-
- module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
- module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
- module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix
-
- modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
- if modules:
- d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
-
- # If modules-load.d and modprobe.d are empty at this point, remove them to
- # avoid warnings. removedirs only raises an OSError if an empty
- # directory cannot be removed.
- dvar = d.getVar('PKGD')
- for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]:
- if len(os.listdir(dir)) == 0:
- os.rmdir(dir)
-}
-
-do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()))}'
diff --git a/poky/meta/classes/kernel-uboot.bbclass b/poky/meta/classes/kernel-uboot.bbclass
deleted file mode 100644
index 1bc98e0..0000000
--- a/poky/meta/classes/kernel-uboot.bbclass
+++ /dev/null
@@ -1,43 +0,0 @@
-# fitImage kernel compression algorithm
-FIT_KERNEL_COMP_ALG ?= "gzip"
-FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
-
-# Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
-UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
-
-uboot_prep_kimage() {
- if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
- vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
- linux_suffix=""
- linux_comp="none"
- elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then
- rm -f linux.bin
- cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin
- vmlinux_path=""
- linux_suffix=""
- linux_comp="none"
- else
- vmlinux_path="vmlinux"
- # Use vmlinux.initramfs for linux.bin when INITRAMFS_IMAGE_BUNDLE set
- # As per the implementation in kernel.bbclass.
- # See do_bundle_initramfs function
- if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e vmlinux.initramfs ]; then
- vmlinux_path="vmlinux.initramfs"
- fi
- linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}"
- linux_comp="${FIT_KERNEL_COMP_ALG}"
- fi
-
- [ -n "${vmlinux_path}" ] && ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
-
- if [ "${linux_comp}" != "none" ] ; then
- if [ "${linux_comp}" = "gzip" ] ; then
- gzip -9 linux.bin
- elif [ "${linux_comp}" = "lzo" ] ; then
- lzop -9 linux.bin
- fi
- mv -f "linux.bin${linux_suffix}" linux.bin
- fi
-
- echo "${linux_comp}"
-}
diff --git a/poky/meta/classes/kernel-uimage.bbclass b/poky/meta/classes/kernel-uimage.bbclass
deleted file mode 100644
index 2e661ea..0000000
--- a/poky/meta/classes/kernel-uimage.bbclass
+++ /dev/null
@@ -1,35 +0,0 @@
-inherit kernel-uboot
-
-python __anonymous () {
- if "uImage" in d.getVar('KERNEL_IMAGETYPES'):
- depends = d.getVar("DEPENDS")
- depends = "%s u-boot-tools-native" % depends
- d.setVar("DEPENDS", depends)
-
- # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
- # to kernel.bbclass . We override the variable here, since we need
- # to build uImage using the kernel build system if and only if
- # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
- # the uImage .
- if d.getVar("KEEPUIMAGE") != 'yes':
- typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
- if "uImage" in typeformake.split():
- d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux'))
-
- # Enable building of uImage with mkimage
- bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d)
-}
-
-do_uboot_mkimage[dirs] += "${B}"
-do_uboot_mkimage() {
- uboot_prep_kimage
-
- ENTRYPOINT=${UBOOT_ENTRYPOINT}
- if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
- ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \
- awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
- fi
-
- uboot-mkimage -A ${UBOOT_ARCH} -O linux -T ${UBOOT_MKIMAGE_KERNEL_TYPE} -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
- rm -f linux.bin
-}
diff --git a/poky/meta/classes/kernel-yocto.bbclass b/poky/meta/classes/kernel-yocto.bbclass
deleted file mode 100644
index ce1446f..0000000
--- a/poky/meta/classes/kernel-yocto.bbclass
+++ /dev/null
@@ -1,726 +0,0 @@
-# remove tasks that modify the source tree in case externalsrc is inherited
-SRCTREECOVEREDTASKS += "do_validate_branches do_kernel_configcheck do_kernel_checkout do_fetch do_unpack do_patch"
-PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe"
-PATCH_GIT_USER_NAME ?= "OpenEmbedded"
-
-# The distro or local.conf should set this, but if nobody cares...
-LINUX_KERNEL_TYPE ??= "standard"
-
-# KMETA ?= ""
-KBRANCH ?= "master"
-KMACHINE ?= "${MACHINE}"
-SRCREV_FORMAT ?= "meta_machine"
-
-# LEVELS:
-# 0: no reporting
-# 1: report options that are specified, but not in the final config
-# 2: report options that are not hardware related, but set by a BSP
-KCONF_AUDIT_LEVEL ?= "1"
-KCONF_BSP_AUDIT_LEVEL ?= "0"
-KMETA_AUDIT ?= "yes"
-KMETA_AUDIT_WERROR ?= ""
-
-# returns local (absolute) path names for all valid patches in the
-# src_uri
-def find_patches(d,subdir):
- patches = src_patches(d)
- patch_list=[]
- for p in patches:
- _, _, local, _, _, parm = bb.fetch.decodeurl(p)
- # if patchdir has been passed, we won't be able to apply it so skip
- # the patch for now, and special processing happens later
- patchdir = ''
- if "patchdir" in parm:
- patchdir = parm["patchdir"]
- if subdir:
- if subdir == patchdir:
- patch_list.append(local)
- else:
- # skip the patch if a patchdir was supplied, it won't be handled
- # properly
- if not patchdir:
- patch_list.append(local)
-
- return patch_list
-
-# returns all the elements from the src uri that are .scc files
-def find_sccs(d):
- sources=src_patches(d, True)
- sources_list=[]
- for s in sources:
- base, ext = os.path.splitext(os.path.basename(s))
- if ext and ext in [".scc", ".cfg"]:
- sources_list.append(s)
- elif base and 'defconfig' in base:
- sources_list.append(s)
-
- return sources_list
-
-# check the SRC_URI for "kmeta" type'd git repositories. Return the name of
-# the repository as it will be found in WORKDIR
-def find_kernel_feature_dirs(d):
- feature_dirs=[]
- fetch = bb.fetch2.Fetch([], d)
- for url in fetch.urls:
- urldata = fetch.ud[url]
- parm = urldata.parm
- type=""
- if "type" in parm:
- type = parm["type"]
- if "destsuffix" in parm:
- destdir = parm["destsuffix"]
- if type == "kmeta":
- feature_dirs.append(destdir)
-
- return feature_dirs
-
-# find the master/machine source branch. In the same way that the fetcher proceses
-# git repositories in the SRC_URI we take the first repo found, first branch.
-def get_machine_branch(d, default):
- fetch = bb.fetch2.Fetch([], d)
- for url in fetch.urls:
- urldata = fetch.ud[url]
- parm = urldata.parm
- if "branch" in parm:
- branches = urldata.parm.get("branch").split(',')
- btype = urldata.parm.get("type")
- if btype != "kmeta":
- return branches[0]
-
- return default
-
-# returns a list of all directories that are on FILESEXTRAPATHS (and
-# hence available to the build) that contain .scc or .cfg files
-def get_dirs_with_fragments(d):
- extrapaths = []
- extrafiles = []
- extrapathsvalue = (d.getVar("FILESEXTRAPATHS") or "")
- # Remove default flag which was used for checking
- extrapathsvalue = extrapathsvalue.replace("__default:", "")
- extrapaths = extrapathsvalue.split(":")
- for path in extrapaths:
- if path + ":True" not in extrafiles:
- extrafiles.append(path + ":" + str(os.path.exists(path)))
-
- return " ".join(extrafiles)
-
-do_kernel_metadata() {
- set +e
-
- if [ -n "$1" ]; then
- mode="$1"
- else
- mode="patch"
- fi
-
- cd ${S}
- export KMETA=${KMETA}
-
- bbnote "do_kernel_metadata: for summary/debug, set KCONF_AUDIT_LEVEL > 0"
-
- # if kernel tools are available in-tree, they are preferred
- # and are placed on the path before any external tools. Unless
- # the external tools flag is set, in that case we do nothing.
- if [ -f "${S}/scripts/util/configme" ]; then
- if [ -z "${EXTERNAL_KERNEL_TOOLS}" ]; then
- PATH=${S}/scripts/util:${PATH}
- fi
- fi
-
- # In a similar manner to the kernel itself:
- #
- # defconfig: $(obj)/conf
- # ifeq ($(KBUILD_DEFCONFIG),)
- # $< --defconfig $(Kconfig)
- # else
- # @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
- # $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
- # endif
- #
- # If a defconfig is specified via the KBUILD_DEFCONFIG variable, we copy it
- # from the source tree, into a common location and normalized "defconfig" name,
- # where the rest of the process will include and incoroporate it into the build
- #
- # If the fetcher has already placed a defconfig in WORKDIR (from the SRC_URI),
- # we don't overwrite it, but instead warn the user that SRC_URI defconfigs take
- # precendence.
- #
- if [ -n "${KBUILD_DEFCONFIG}" ]; then
- if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
- if [ -f "${WORKDIR}/defconfig" ]; then
- # If the two defconfig's are different, warn that we overwrote the
- # one already placed in WORKDIR
- cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}"
- if [ $? -ne 0 ]; then
- bbdebug 1 "detected SRC_URI or unpatched defconfig in WORKDIR. ${KBUILD_DEFCONFIG} copied over it"
- fi
- cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
- else
- cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
- fi
- in_tree_defconfig="${WORKDIR}/defconfig"
- else
- bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree (${S}/arch/${ARCH}/configs/)"
- fi
- fi
-
- if [ "$mode" = "patch" ]; then
- # was anyone trying to patch the kernel meta data ?, we need to do
- # this here, since the scc commands migrate the .cfg fragments to the
- # kernel source tree, where they'll be used later.
- check_git_config
- patches="${@" ".join(find_patches(d,'kernel-meta'))}"
- for p in $patches; do
- (
- cd ${WORKDIR}/kernel-meta
- git am -s $p
- )
- done
- fi
-
- sccs_from_src_uri="${@" ".join(find_sccs(d))}"
- patches="${@" ".join(find_patches(d,''))}"
- feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}"
-
- # a quick check to make sure we don't have duplicate defconfigs If
- # there's a defconfig in the SRC_URI, did we also have one from the
- # KBUILD_DEFCONFIG processing above ?
- src_uri_defconfig=$(echo $sccs_from_src_uri | awk '(match($0, "defconfig") != 0) { print $0 }' RS=' ')
- # drop and defconfig's from the src_uri variable, we captured it just above here if it existed
- sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '(match($0, "defconfig") == 0) { print $0 }' RS=' ')
-
- if [ -n "$in_tree_defconfig" ]; then
- sccs_defconfig=$in_tree_defconfig
- if [ -n "$src_uri_defconfig" ]; then
- bbwarn "[NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI entry $src_uri_defconfig"
- fi
- else
- # if we didn't have an in-tree one, make our defconfig the one
- # from the src_uri. Note: there may not have been one from the
- # src_uri, so this can be an empty variable.
- sccs_defconfig=$src_uri_defconfig
- fi
- sccs="$sccs_from_src_uri"
-
- # check for feature directories/repos/branches that were part of the
- # SRC_URI. If they were supplied, we convert them into include directives
- # for the update part of the process
- for f in ${feat_dirs}; do
- if [ -d "${WORKDIR}/$f/meta" ]; then
- includes="$includes -I${WORKDIR}/$f/kernel-meta"
- elif [ -d "${WORKDIR}/../oe-local-files/$f" ]; then
- includes="$includes -I${WORKDIR}/../oe-local-files/$f"
- elif [ -d "${WORKDIR}/$f" ]; then
- includes="$includes -I${WORKDIR}/$f"
- fi
- done
- for s in ${sccs} ${patches}; do
- sdir=$(dirname $s)
- includes="$includes -I${sdir}"
- # if a SRC_URI passed patch or .scc has a subdir of "kernel-meta",
- # then we add it to the search path
- if [ -d "${sdir}/kernel-meta" ]; then
- includes="$includes -I${sdir}/kernel-meta"
- fi
- done
-
- # expand kernel features into their full path equivalents
- bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
- if [ -z "$bsp_definition" ]; then
- if [ -z "$sccs_defconfig" ]; then
- bbfatal_log "Could not locate BSP definition for ${KMACHINE}/${LINUX_KERNEL_TYPE} and no defconfig was provided"
- fi
- else
- # if the bsp definition has "define KMETA_EXTERNAL_BSP t",
- # then we need to set a flag that will instruct the next
- # steps to use the BSP as both configuration and patches.
- grep -q KMETA_EXTERNAL_BSP $bsp_definition
- if [ $? -eq 0 ]; then
- KMETA_EXTERNAL_BSPS="t"
- fi
- fi
- meta_dir=$(kgit --meta)
-
- KERNEL_FEATURES_FINAL=""
- if [ -n "${KERNEL_FEATURES}" ]; then
- for feature in ${KERNEL_FEATURES}; do
- feature_found=f
- for d in $includes; do
- path_to_check=$(echo $d | sed 's/^-I//')
- if [ "$feature_found" = "f" ] && [ -e "$path_to_check/$feature" ]; then
- feature_found=t
- fi
- done
- if [ "$feature_found" = "f" ]; then
- if [ -n "${KERNEL_DANGLING_FEATURES_WARN_ONLY}" ]; then
- bbwarn "Feature '$feature' not found, but KERNEL_DANGLING_FEATURES_WARN_ONLY is set"
- bbwarn "This may cause runtime issues, dropping feature and allowing configuration to continue"
- else
- bberror "Feature '$feature' not found, this will cause configuration failures."
- bberror "Check the SRC_URI for meta-data repositories or directories that may be missing"
- bbfatal_log "Set KERNEL_DANGLING_FEATURES_WARN_ONLY to ignore this issue"
- fi
- else
- KERNEL_FEATURES_FINAL="$KERNEL_FEATURES_FINAL $feature"
- fi
- done
- fi
-
- if [ "$mode" = "config" ]; then
- # run1: pull all the configuration fragments, no matter where they come from
- elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
- if [ -n "${elements}" ]; then
- echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
- scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
- if [ $? -ne 0 ]; then
- bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
- fi
- fi
- fi
-
- # if KMETA_EXTERNAL_BSPS has been set, or it has been detected from
- # the bsp definition, then we inject the bsp_definition into the
- # patch phase below. we'll piggy back on the sccs variable.
- if [ -n "${KMETA_EXTERNAL_BSPS}" ]; then
- sccs="${bsp_definition} ${sccs}"
- fi
-
- if [ "$mode" = "patch" ]; then
- # run2: only generate patches for elements that have been passed on the SRC_URI
- elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
- if [ -n "${elements}" ]; then
- scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL
- if [ $? -ne 0 ]; then
- bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
- fi
- fi
- fi
-
- if [ ${KCONF_AUDIT_LEVEL} -gt 0 ]; then
- bbnote "kernel meta data summary for ${KMACHINE} (${LINUX_KERNEL_TYPE}):"
- bbnote "======================================================================"
- if [ -n "${KMETA_EXTERNAL_BSPS}" ]; then
- bbnote "Non kernel-cache (external) bsp"
- fi
- bbnote "BSP entry point / definition: $bsp_definition"
- if [ -n "$in_tree_defconfig" ]; then
- bbnote "KBUILD_DEFCONFIG: ${KBUILD_DEFCONFIG}"
- fi
- bbnote "Fragments from SRC_URI: $sccs_from_src_uri"
- bbnote "KERNEL_FEATURES: $KERNEL_FEATURES_FINAL"
- bbnote "Final scc/cfg list: $sccs_defconfig $bsp_definition $sccs $KERNEL_FEATURES_FINAL"
- fi
-
- set -e
-}
-
-do_patch() {
- set +e
- cd ${S}
-
- check_git_config
- meta_dir=$(kgit --meta)
- (cd ${meta_dir}; ln -sf patch.queue series)
- if [ -f "${meta_dir}/series" ]; then
- kgit_extra_args=""
- if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
- kgit_extra_args="--commit-sha author"
- fi
- kgit-s2q --gen -v $kgit_extra_args --patches .kernel-meta/
- if [ $? -ne 0 ]; then
- bberror "Could not apply patches for ${KMACHINE}."
- bbfatal_log "Patch failures can be resolved in the linux source directory ${S})"
- fi
- fi
-
- if [ -f "${meta_dir}/merge.queue" ]; then
- # we need to merge all these branches
- for b in $(cat ${meta_dir}/merge.queue); do
- git show-ref --verify --quiet refs/heads/${b}
- if [ $? -eq 0 ]; then
- bbnote "Merging branch ${b}"
- git merge -q --no-ff -m "Merge branch ${b}" ${b}
- else
- bbfatal "branch ${b} does not exist, cannot merge"
- fi
- done
- fi
-
- set -e
-}
-
-do_kernel_checkout() {
- set +e
-
- source_dir=`echo ${S} | sed 's%/$%%'`
- source_workdir="${WORKDIR}/git"
- if [ -d "${WORKDIR}/git/" ]; then
- # case: git repository
- # if S is WORKDIR/git, then we shouldn't be moving or deleting the tree.
- if [ "${source_dir}" != "${source_workdir}" ]; then
- if [ -d "${source_workdir}/.git" ]; then
- # regular git repository with .git
- rm -rf ${S}
- mv ${WORKDIR}/git ${S}
- else
- # create source for bare cloned git repository
- git clone ${WORKDIR}/git ${S}
- rm -rf ${WORKDIR}/git
- fi
- fi
- cd ${S}
-
- # convert any remote branches to local tracking ones
- for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
- b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
- git show-ref --quiet --verify -- "refs/heads/$b"
- if [ $? -ne 0 ]; then
- git branch $b $i > /dev/null
- fi
- done
-
- # Create a working tree copy of the kernel by checking out a branch
- machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
-
- # checkout and clobber any unimportant files
- git checkout -f ${machine_branch}
- else
- # case: we have no git repository at all.
- # To support low bandwidth options for building the kernel, we'll just
- # convert the tree to a git repo and let the rest of the process work unchanged
-
- # if ${S} hasn't been set to the proper subdirectory a default of "linux" is
- # used, but we can't initialize that empty directory. So check it and throw a
- # clear error
-
- cd ${S}
- if [ ! -f "Makefile" ]; then
- bberror "S is not set to the linux source directory. Check "
- bbfatal "the recipe and set S to the proper extracted subdirectory"
- fi
- rm -f .gitignore
- git init
- check_git_config
- git add .
- git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
- git clean -d -f
- fi
-
- set -e
-}
-do_kernel_checkout[dirs] = "${S} ${WORKDIR}"
-
-addtask kernel_checkout before do_kernel_metadata after do_symlink_kernsrc
-addtask kernel_metadata after do_validate_branches do_unpack before do_patch
-do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot"
-do_kernel_metadata[file-checksums] = " ${@get_dirs_with_fragments(d)}"
-do_validate_branches[depends] = "kern-tools-native:do_populate_sysroot"
-
-do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot"
-do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}gcc:do_populate_sysroot"
-do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
-do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
-do_kernel_configme[dirs] += "${S} ${B}"
-do_kernel_configme() {
- do_kernel_metadata config
-
- # translate the kconfig_mode into something that merge_config.sh
- # understands
- case ${KCONFIG_MODE} in
- *allnoconfig)
- config_flags="-n"
- ;;
- *alldefconfig)
- config_flags=""
- ;;
- *)
- if [ -f ${WORKDIR}/defconfig ]; then
- config_flags="-n"
- fi
- ;;
- esac
-
- cd ${S}
-
- meta_dir=$(kgit --meta)
- configs="$(scc --configs -o ${meta_dir})"
- if [ $? -ne 0 ]; then
- bberror "${configs}"
- bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
- fi
-
- CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
- if [ $? -ne 0 -o ! -f ${B}/.config ]; then
- bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}"
- if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then
- bbfatal_log "`cat ${meta_dir}/cfg/merge_config_build.log`"
- else
- bbfatal_log "Details can be found at: ${S}/${meta_dir}/cfg/merge_config_build.log"
- fi
- fi
-
- if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
- echo "# Global settings from linux recipe" >> ${B}/.config
- echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
- fi
-}
-
-addtask kernel_configme before do_configure after do_patch
-addtask config_analysis
-
-do_config_analysis[depends] = "virtual/kernel:do_configure"
-do_config_analysis[depends] += "kern-tools-native:do_populate_sysroot"
-
-CONFIG_AUDIT_FILE ?= "${WORKDIR}/config-audit.txt"
-CONFIG_ANALYSIS_FILE ?= "${WORKDIR}/config-analysis.txt"
-
-python do_config_analysis() {
- import re, string, sys, subprocess
-
- s = d.getVar('S')
-
- env = os.environ.copy()
- env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
- env['LD'] = d.getVar('KERNEL_LD')
- env['CC'] = d.getVar('KERNEL_CC')
- env['ARCH'] = d.getVar('ARCH')
- env['srctree'] = s
-
- # read specific symbols from the kernel recipe or from local.conf
- # i.e.: CONFIG_ANALYSIS:pn-linux-yocto-dev = 'NF_CONNTRACK LOCALVERSION'
- config = d.getVar( 'CONFIG_ANALYSIS' )
- if not config:
- config = [ "" ]
- else:
- config = config.split()
-
- for c in config:
- for action in ["analysis","audit"]:
- if action == "analysis":
- try:
- analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--blame', c], cwd=s, env=env ).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
- outfile = d.getVar( 'CONFIG_ANALYSIS_FILE' )
-
- if action == "audit":
- try:
- analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--summary', '--extended', '--sanity', c], cwd=s, env=env ).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
- outfile = d.getVar( 'CONFIG_AUDIT_FILE' )
-
- if c:
- outdir = os.path.dirname( outfile )
- outname = os.path.basename( outfile )
- outfile = outdir + '/'+ c + '-' + outname
-
- if config and os.path.isfile(outfile):
- os.remove(outfile)
-
- with open(outfile, 'w+') as f:
- f.write( analysis )
-
- bb.warn( "Configuration {} executed, see: {} for details".format(action,outfile ))
- if c:
- bb.warn( analysis )
-}
-
-python do_kernel_configcheck() {
- import re, string, sys, subprocess
-
- s = d.getVar('S')
-
- # if KMETA isn't set globally by a recipe using this routine, use kgit to
- # locate or create the meta directory. Otherwise, kconf_check is not
- # passed a valid meta-series for processing
- kmeta = d.getVar("KMETA")
- if not kmeta or not os.path.exists('{}/{}'.format(s,kmeta)):
- kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip()
-
- env = os.environ.copy()
- env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
- env['LD'] = d.getVar('KERNEL_LD')
- env['CC'] = d.getVar('KERNEL_CC')
- env['ARCH'] = d.getVar('ARCH')
- env['srctree'] = s
-
- try:
- configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.fatal( "Cannot gather config fragments for audit: %s" % e.output.decode("utf-8") )
-
- config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0)
- bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0)
- kmeta_audit_werror = d.getVar("KMETA_AUDIT_WERROR") or ""
- warnings_detected = False
-
- # if config check visibility is "1", that's the lowest level of audit. So
- # we add the --classify option to the run, since classification will
- # streamline the output to only report options that could be boot issues,
- # or are otherwise required for proper operation.
- extra_params = ""
- if config_check_visibility == 1:
- extra_params = "--classify"
-
- # category #1: mismatches
- try:
- analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--mismatches', extra_params], cwd=s, env=env ).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
- if analysis:
- outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta )
- if os.path.isfile(outfile):
- os.remove(outfile)
- with open(outfile, 'w+') as f:
- f.write( analysis )
-
- if config_check_visibility and os.stat(outfile).st_size > 0:
- with open (outfile, "r") as myfile:
- results = myfile.read()
- bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results)
- warnings_detected = True
-
- # category #2: invalid fragment elements
- extra_params = ""
- if bsp_check_visibility > 1:
- extra_params = "--strict"
- try:
- analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--invalid', extra_params], cwd=s, env=env ).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
- if analysis:
- outfile = "{}/{}/cfg/invalid.txt".format(s,kmeta)
- if os.path.isfile(outfile):
- os.remove(outfile)
- with open(outfile, 'w+') as f:
- f.write( analysis )
-
- if bsp_check_visibility and os.stat(outfile).st_size > 0:
- with open (outfile, "r") as myfile:
- results = myfile.read()
- bb.warn( "[kernel config]: This BSP contains fragments with warnings:\n\n%s" % results)
- warnings_detected = True
-
- # category #3: redefined options (this is pretty verbose and is debug only)
- try:
- analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--sanity'], cwd=s, env=env ).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
-
- if analysis:
- outfile = "{}/{}/cfg/redefinition.txt".format(s,kmeta)
- if os.path.isfile(outfile):
- os.remove(outfile)
- with open(outfile, 'w+') as f:
- f.write( analysis )
-
- # if the audit level is greater than two, we report if a fragment has overriden
- # a value from a base fragment. This is really only used for new kernel introduction
- if bsp_check_visibility > 2 and os.stat(outfile).st_size > 0:
- with open (outfile, "r") as myfile:
- results = myfile.read()
- bb.warn( "[kernel config]: This BSP has configuration options defined in more than one config, with differing values:\n\n%s" % results)
- warnings_detected = True
-
- if warnings_detected and kmeta_audit_werror:
- bb.fatal( "configuration warnings detected, werror is set, promoting to fatal" )
-}
-
-# Ensure that the branches (BSP and meta) are on the locations specified by
-# their SRCREV values. If they are NOT on the right commits, the branches
-# are corrected to the proper commit.
-do_validate_branches() {
- set +e
- cd ${S}
-
- machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
- machine_srcrev="${SRCREV_machine}"
-
- # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
- # check and we can exit early
- if [ "${machine_srcrev}" = "AUTOINC" ]; then
- linux_yocto_dev='${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "1", "", d)}'
- if [ -n "$linux_yocto_dev" ]; then
- git checkout -q -f ${machine_branch}
- ver=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//)
- patchlevel=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
- sublevel=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
- kver="$ver.$patchlevel"
- bbnote "dev kernel: performing version -> branch -> SRCREV validation"
- bbnote "dev kernel: recipe version ${LINUX_VERSION}, src version: $kver"
- echo "${LINUX_VERSION}" | grep -q $kver
- if [ $? -ne 0 ]; then
- version="$(echo ${LINUX_VERSION} | sed 's/\+.*$//g')"
- versioned_branch="v$version/$machine_branch"
-
- machine_branch=$versioned_branch
- force_srcrev="$(git rev-parse $machine_branch 2> /dev/null)"
- if [ $? -ne 0 ]; then
- bbfatal "kernel version mismatch detected, and no valid branch $machine_branch detected"
- fi
-
- bbnote "dev kernel: adjusting branch to $machine_branch, srcrev to: $force_srcrev"
- fi
- else
- bbnote "SRCREV validation is not required for AUTOREV"
- fi
- elif [ "${machine_srcrev}" = "" ]; then
- if [ "${SRCREV}" != "AUTOINC" ] && [ "${SRCREV}" != "INVALID" ]; then
- # SRCREV_machine_<MACHINE> was not set. This means that a custom recipe
- # that doesn't use the SRCREV_FORMAT "machine_meta" is being built. In
- # this case, we need to reset to the give SRCREV before heading to patching
- bbnote "custom recipe is being built, forcing SRCREV to ${SRCREV}"
- force_srcrev="${SRCREV}"
- fi
- else
- git cat-file -t ${machine_srcrev} > /dev/null
- if [ $? -ne 0 ]; then
- bberror "${machine_srcrev} is not a valid commit ID."
- bbfatal_log "The kernel source tree may be out of sync"
- fi
- force_srcrev=${machine_srcrev}
- fi
-
- git checkout -q -f ${machine_branch}
- if [ -n "${force_srcrev}" ]; then
- # see if the branch we are about to patch has been properly reset to the defined
- # SRCREV .. if not, we reset it.
- branch_head=`git rev-parse HEAD`
- if [ "${force_srcrev}" != "${branch_head}" ]; then
- current_branch=`git rev-parse --abbrev-ref HEAD`
- git branch "$current_branch-orig"
- git reset --hard ${force_srcrev}
- # We've checked out HEAD, make sure we cleanup kgit-s2q fence post check
- # so the patches are applied as expected otherwise no patching
- # would be done in some corner cases.
- kgit-s2q --clean
- fi
- fi
-
- set -e
-}
-
-OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
-KBUILD_OUTPUT = "${B}"
-
-python () {
- # If diffconfig is available, ensure it runs after kernel_configme
- if 'do_diffconfig' in d:
- bb.build.addtask('do_diffconfig', None, 'do_kernel_configme', d)
-
- externalsrc = d.getVar('EXTERNALSRC')
- if externalsrc:
- # If we deltask do_patch, do_kernel_configme is left without
- # dependencies and runs too early
- d.setVarFlag('do_kernel_configme', 'deps', (d.getVarFlag('do_kernel_configme', 'deps', False) or []) + ['do_unpack'])
-}
-
-# extra tasks
-addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
-addtask validate_branches before do_patch after do_kernel_checkout
-addtask kernel_configcheck after do_configure before do_compile
diff --git a/poky/meta/classes/kernel.bbclass b/poky/meta/classes/kernel.bbclass
deleted file mode 100644
index 61b3e8c..0000000
--- a/poky/meta/classes/kernel.bbclass
+++ /dev/null
@@ -1,815 +0,0 @@
-inherit linux-kernel-base kernel-module-split
-
-COMPATIBLE_HOST = ".*-linux"
-
-KERNEL_PACKAGE_NAME ??= "kernel"
-KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else d.getVar("KERNEL_PACKAGE_NAME") }"
-
-PROVIDES += "virtual/kernel"
-DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native"
-DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}"
-DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}"
-DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.zst", "zstd-native", "", d)}"
-PACKAGE_WRITE_DEPS += "depmodwrapper-cross"
-
-do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot gzip-native:do_populate_sysroot"
-do_clean[depends] += "make-mod-scripts:do_clean"
-
-CVE_PRODUCT ?= "linux_kernel"
-
-S = "${STAGING_KERNEL_DIR}"
-B = "${WORKDIR}/build"
-KBUILD_OUTPUT = "${B}"
-OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
-
-# we include gcc above, we dont need virtual/libc
-INHIBIT_DEFAULT_DEPS = "1"
-
-KERNEL_IMAGETYPE ?= "zImage"
-INITRAMFS_IMAGE ?= ""
-INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}"
-INITRAMFS_TASK ?= ""
-INITRAMFS_IMAGE_BUNDLE ?= ""
-INITRAMFS_DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR_IMAGE}"
-INITRAMFS_MULTICONFIG ?= ""
-
-# KERNEL_VERSION is extracted from source code. It is evaluated as
-# None for the first parsing, since the code has not been fetched.
-# After the code is fetched, it will be evaluated as real version
-# number and cause kernel to be rebuilt. To avoid this, make
-# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on
-# LINUX_VERSION which is a constant.
-KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION') or ""}"
-KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
-KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
-
-python __anonymous () {
- pn = d.getVar("PN")
- kpn = d.getVar("KERNEL_PACKAGE_NAME")
-
- # XXX Remove this after bug 11905 is resolved
- # FILES:${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly
- if kpn == pn:
- bb.warn("Some packages (E.g. *-dev) might be missing due to "
- "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)")
-
- # The default kernel recipe builds in a shared location defined by
- # bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
- # Set these variables to directories under ${WORKDIR} in alternate
- # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
- # may build in parallel with the default kernel without clobbering.
- if kpn != "kernel":
- workdir = d.getVar("WORKDIR")
- sourceDir = os.path.join(workdir, 'kernel-source')
- artifactsDir = os.path.join(workdir, 'kernel-build-artifacts')
- d.setVar("STAGING_KERNEL_DIR", sourceDir)
- d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir)
-
- # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
- type = d.getVar('KERNEL_IMAGETYPE') or ""
- alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
- types = d.getVar('KERNEL_IMAGETYPES') or ""
- if type not in types.split():
- types = (type + ' ' + types).strip()
- if alttype not in types.split():
- types = (alttype + ' ' + types).strip()
- d.setVar('KERNEL_IMAGETYPES', types)
-
- # KERNEL_IMAGETYPES may contain a mixture of image types supported directly
- # by the kernel build system and types which are created by post-processing
- # the output of the kernel build system (e.g. compressing vmlinux ->
- # vmlinux.gz in kernel_do_transform_kernel()).
- # KERNEL_IMAGETYPE_FOR_MAKE should contain only image types supported
- # directly by the kernel build system.
- if not d.getVar('KERNEL_IMAGETYPE_FOR_MAKE'):
- typeformake = set()
- for type in types.split():
- if type == 'vmlinux.gz':
- type = 'vmlinux'
- typeformake.add(type)
-
- d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', ' '.join(sorted(typeformake)))
-
- kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
- imagedest = d.getVar('KERNEL_IMAGEDEST')
-
- for type in types.split():
- if bb.data.inherits_class('nopackages', d):
- continue
- typelower = type.lower()
- d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
- d.setVar('FILES:' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
- d.appendVar('RDEPENDS:%s-image' % kname, ' %s-image-%s (= ${EXTENDPKGV})' % (kname, typelower))
- splitmods = d.getVar("KERNEL_SPLIT_MODULES")
- if splitmods != '1':
- d.appendVar('RDEPENDS:%s-image' % kname, ' %s-modules (= ${EXTENDPKGV})' % kname)
- d.appendVar('RDEPENDS:%s-image-%s' % (kname, typelower), ' %s-modules-${KERNEL_VERSION_PKG_NAME} (= ${EXTENDPKGV})' % kname)
- d.setVar('PKG:%s-modules' % kname, '%s-modules-${KERNEL_VERSION_PKG_NAME}' % kname)
- d.appendVar('RPROVIDES:%s-modules' % kname, '%s-modules-${KERNEL_VERSION_PKG_NAME}' % kname)
-
- d.setVar('PKG:%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
- d.setVar('ALLOW_EMPTY:%s-image-%s' % (kname, typelower), '1')
- d.prependVar('pkg_postinst:%s-image-%s' % (kname,typelower), """set +e
-if [ -n "$D" ]; then
- ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
-else
- ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
- install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s
- fi
-fi
-set -e
-""" % (type, type, type, type, type, type, type))
- d.setVar('pkg_postrm:%s-image-%s' % (kname,typelower), """set +e
-if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then
- rm -f ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
-fi
-set -e
-""" % (type, type, type))
-
-
- image = d.getVar('INITRAMFS_IMAGE')
- # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,
- # the do_bundle_initramfs does nothing, but the INITRAMFS_IMAGE is built
- # standalone for use by wic and other tools.
- if image:
- if d.getVar('INITRAMFS_MULTICONFIG'):
- d.appendVarFlag('do_bundle_initramfs', 'mcdepends', ' mc::${INITRAMFS_MULTICONFIG}:${INITRAMFS_IMAGE}:do_image_complete')
- else:
- d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
- if image and bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')):
- bb.build.addtask('do_transform_bundled_initramfs', 'do_deploy', 'do_bundle_initramfs', d)
-
- # NOTE: setting INITRAMFS_TASK is for backward compatibility
- # The preferred method is to set INITRAMFS_IMAGE, because
- # this INITRAMFS_TASK has circular dependency problems
- # if the initramfs requires kernel modules
- image_task = d.getVar('INITRAMFS_TASK')
- if image_task:
- d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
-}
-
-# Here we pull in all various kernel image types which we support.
-#
-# In case you're wondering why kernel.bbclass inherits the other image
-# types instead of the other way around, the reason for that is to
-# maintain compatibility with various currently existing meta-layers.
-# By pulling in the various kernel image types here, we retain the
-# original behavior of kernel.bbclass, so no meta-layers should get
-# broken.
-#
-# KERNEL_CLASSES by default pulls in kernel-uimage.bbclass, since this
-# used to be the default behavior when only uImage was supported. This
-# variable can be appended by users who implement support for new kernel
-# image types.
-
-KERNEL_CLASSES ?= " kernel-uimage "
-inherit ${KERNEL_CLASSES}
-
-# Old style kernels may set ${S} = ${WORKDIR}/git for example
-# We need to move these over to STAGING_KERNEL_DIR. We can't just
-# create the symlink in advance as the git fetcher can't cope with
-# the symlink.
-do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
-do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
-python do_symlink_kernsrc () {
- s = d.getVar("S")
- if s[-1] == '/':
- # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail
- s=s[:-1]
- kernsrc = d.getVar("STAGING_KERNEL_DIR")
- if s != kernsrc:
- bb.utils.mkdirhier(kernsrc)
- bb.utils.remove(kernsrc, recurse=True)
- if d.getVar("EXTERNALSRC"):
- # With EXTERNALSRC S will not be wiped so we can symlink to it
- os.symlink(s, kernsrc)
- else:
- import shutil
- shutil.move(s, kernsrc)
- os.symlink(kernsrc, s)
-}
-# do_patch is normally ordered before do_configure, but
-# externalsrc.bbclass deletes do_patch, breaking the dependency of
-# do_configure on do_symlink_kernsrc.
-addtask symlink_kernsrc before do_patch do_configure after do_unpack
-
-inherit kernel-arch deploy
-
-PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*"
-PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
-PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
-
-export OS = "${TARGET_OS}"
-export CROSS_COMPILE = "${TARGET_PREFIX}"
-export KBUILD_BUILD_VERSION = "1"
-export KBUILD_BUILD_USER ?= "oe-user"
-export KBUILD_BUILD_HOST ?= "oe-host"
-
-KERNEL_RELEASE ?= "${KERNEL_VERSION}"
-
-# The directory where built kernel lies in the kernel tree
-KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
-KERNEL_IMAGEDEST ?= "boot"
-
-#
-# configuration
-#
-export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE") or "ttyS0"}"
-
-KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}"
-
-# kernels are generally machine specific
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# U-Boot support
-UBOOT_ENTRYPOINT ?= "20008000"
-UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
-
-# Some Linux kernel configurations need additional parameters on the command line
-KERNEL_EXTRA_ARGS ?= ""
-
-EXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
-EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}" PAHOLE=false"
-
-KERNEL_ALT_IMAGETYPE ??= ""
-
-copy_initramfs() {
- echo "Copying initramfs into ./usr ..."
- # In case the directory is not created yet from the first pass compile:
- mkdir -p ${B}/usr
- # Find and use the first initramfs image archive type we find
- rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
- for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst; do
- if [ -e "${INITRAMFS_DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then
- cp ${INITRAMFS_DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/.
- case $img in
- *gz)
- echo "gzip decompressing image"
- gunzip -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
- break
- ;;
- *lz4)
- echo "lz4 decompressing image"
- lz4 -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
- break
- ;;
- *lzo)
- echo "lzo decompressing image"
- lzop -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
- break
- ;;
- *lzma)
- echo "lzma decompressing image"
- lzma -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
- break
- ;;
- *xz)
- echo "xz decompressing image"
- xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
- break
- ;;
- *zst)
- echo "zst decompressing image"
- zstd -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img
- break
- ;;
- esac
- break
- fi
- done
- # Verify that the above loop found a initramfs, fail otherwise
- [ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${INITRAMFS_DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz|.zst) for bundling; INITRAMFS_IMAGE_NAME might be wrong."
-}
-
-do_bundle_initramfs () {
- if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
- echo "Creating a kernel image with a bundled initramfs..."
- copy_initramfs
- # Backing up kernel image relies on its type(regular file or symbolic link)
- tmp_path=""
- for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
- if [ -h ${KERNEL_OUTPUT_DIR}/$imageType ] ; then
- linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$imageType`
- realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$imageType`
- mv -f $realpath $realpath.bak
- tmp_path=$tmp_path" "$imageType"#"$linkpath"#"$realpath
- elif [ -f ${KERNEL_OUTPUT_DIR}/$imageType ]; then
- mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.bak
- tmp_path=$tmp_path" "$imageType"##"
- fi
- done
- use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
- kernel_do_compile
- # Restoring kernel image
- for tp in $tmp_path ; do
- imageType=`echo $tp|cut -d "#" -f 1`
- linkpath=`echo $tp|cut -d "#" -f 2`
- realpath=`echo $tp|cut -d "#" -f 3`
- if [ -n "$realpath" ]; then
- mv -f $realpath $realpath.initramfs
- mv -f $realpath.bak $realpath
- ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$imageType.initramfs
- else
- mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.initramfs
- mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType
- fi
- done
- fi
-}
-do_bundle_initramfs[dirs] = "${B}"
-
-kernel_do_transform_bundled_initramfs() {
- # vmlinux.gz is not built by kernel
- if (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux\.gz"); then
- gzip -9cn < ${KERNEL_OUTPUT_DIR}/vmlinux.initramfs > ${KERNEL_OUTPUT_DIR}/vmlinux.gz.initramfs
- fi
-}
-do_transform_bundled_initramfs[dirs] = "${B}"
-
-python do_devshell:prepend () {
- os.environ["LDFLAGS"] = ''
-}
-
-addtask bundle_initramfs after do_install before do_deploy
-
-KERNEL_DEBUG_TIMESTAMPS ??= "0"
-
-kernel_do_compile() {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
-
- # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
- export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig"
- export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig"
- export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR"
- export PKG_CONFIG_SYSROOT_DIR=""
-
- if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
- # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
- # be set....
- if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
- # The source directory is not necessarily a git repository, so we
- # specify the git-dir to ensure that git does not query a
- # repository in any parent directory.
- SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"`
- fi
-
- ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH`
- export KBUILD_BUILD_TIMESTAMP="$ts"
- export KCONFIG_NOTIMESTAMP=1
- bbnote "KBUILD_BUILD_TIMESTAMP: $ts"
- fi
- # The $use_alternate_initrd is only set from
- # do_bundle_initramfs() This variable is specifically for the
- # case where we are making a second pass at the kernel
- # compilation and we want to force the kernel build to use a
- # different initramfs image. The way to do that in the kernel
- # is to specify:
- # make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
- if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then
- # The old style way of copying an prebuilt image and building it
- # is turned on via INTIRAMFS_TASK != ""
- copy_initramfs
- use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
- fi
- for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
- oe_runmake ${typeformake} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
- done
-}
-
-kernel_do_transform_kernel() {
- # vmlinux.gz is not built by kernel
- if (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux\.gz"); then
- mkdir -p "${KERNEL_OUTPUT_DIR}"
- gzip -9cn < ${B}/vmlinux > "${KERNEL_OUTPUT_DIR}/vmlinux.gz"
- fi
-}
-do_transform_kernel[dirs] = "${B}"
-addtask transform_kernel after do_compile before do_install
-
-do_compile_kernelmodules() {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
- if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
- # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
- # be set....
- if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
- # The source directory is not necessarily a git repository, so we
- # specify the git-dir to ensure that git does not query a
- # repository in any parent directory.
- SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"`
- fi
-
- ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH`
- export KBUILD_BUILD_TIMESTAMP="$ts"
- export KCONFIG_NOTIMESTAMP=1
- bbnote "KBUILD_BUILD_TIMESTAMP: $ts"
- fi
- if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
- oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
-
- # Module.symvers gets updated during the
- # building of the kernel modules. We need to
- # update this in the shared workdir since some
- # external kernel modules has a dependency on
- # other kernel modules and will look at this
- # file to do symbol lookups
- cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/
- # 5.10+ kernels have module.lds that we need to copy for external module builds
- if [ -e "${B}/scripts/module.lds" ]; then
- install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds
- fi
- else
- bbnote "no modules to compile"
- fi
-}
-addtask compile_kernelmodules after do_compile before do_strip
-
-kernel_do_install() {
- #
- # First install the modules
- #
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
- if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
- oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
- rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
- rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
- # If the kernel/ directory is empty remove it to prevent QA issues
- rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel"
- else
- bbnote "no modules to install"
- fi
-
- #
- # Install various kernel output (zImage, map file, config, module support files)
- #
- install -d ${D}/${KERNEL_IMAGEDEST}
-
- #
- # When including an initramfs bundle inside a FIT image, the fitImage is created after the install task
- # by do_assemble_fitimage_initramfs.
- # This happens after the generation of the initramfs bundle (done by do_bundle_initramfs).
- # So, at the level of the install task we should not try to install the fitImage. fitImage is still not
- # generated yet.
- # After the generation of the fitImage, the deploy task copies the fitImage from the build directory to
- # the deploy folder.
- #
-
- for imageType in ${KERNEL_IMAGETYPES} ; do
- if [ $imageType != "fitImage" ] || [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ] ; then
- install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType ${D}/${KERNEL_IMAGEDEST}/$imageType-${KERNEL_VERSION}
- fi
- done
-
- install -m 0644 System.map ${D}/${KERNEL_IMAGEDEST}/System.map-${KERNEL_VERSION}
- install -m 0644 .config ${D}/${KERNEL_IMAGEDEST}/config-${KERNEL_VERSION}
- install -m 0644 vmlinux ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION}
- [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
- install -d ${D}${sysconfdir}/modules-load.d
- install -d ${D}${sysconfdir}/modprobe.d
-}
-
-# Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile
-do_kernel_version_sanity_check() {
- if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then
- exit 0
- fi
-
- # The Makefile determines the kernel version shown at runtime
- # Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile
- VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//)
- PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
- SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//)
- EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//)
-
- # Build a string for regex and a plain version string
- reg="^${VERSION}\.${PATCHLEVEL}"
- vers="${VERSION}.${PATCHLEVEL}"
- if [ -n "${SUBLEVEL}" ]; then
- # Ignoring a SUBLEVEL of zero is fine
- if [ "${SUBLEVEL}" = "0" ]; then
- reg="${reg}(\.${SUBLEVEL})?"
- else
- reg="${reg}\.${SUBLEVEL}"
- vers="${vers}.${SUBLEVEL}"
- fi
- fi
- vers="${vers}${EXTRAVERSION}"
- reg="${reg}${EXTRAVERSION}"
-
- if [ -z `echo ${PV} | grep -E "${reg}"` ]; then
- bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source or set KERNEL_VERSION_SANITY_SKIP=\"1\" in your recipe."
- fi
- exit 0
-}
-
-addtask shared_workdir after do_compile before do_compile_kernelmodules
-addtask shared_workdir_setscene
-
-do_shared_workdir_setscene () {
- exit 1
-}
-
-emit_depmod_pkgdata() {
- # Stash data for depmod
- install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/
- echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion
- cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION}
-}
-
-PACKAGEFUNCS += "emit_depmod_pkgdata"
-
-do_shared_workdir[cleandirs] += " ${STAGING_KERNEL_BUILDDIR}"
-do_shared_workdir () {
- cd ${B}
-
- kerneldir=${STAGING_KERNEL_BUILDDIR}
- install -d $kerneldir
-
- #
- # Store the kernel version in sysroots for module-base.bbclass
- #
-
- echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion
-
- # Copy files required for module builds
- cp System.map $kerneldir/System.map-${KERNEL_VERSION}
- [ -e Module.symvers ] && cp Module.symvers $kerneldir/
- cp .config $kerneldir/
- mkdir -p $kerneldir/include/config
- cp include/config/kernel.release $kerneldir/include/config/kernel.release
- if [ -e certs/signing_key.x509 ]; then
- # The signing_key.* files are stored in the certs/ dir in
- # newer Linux kernels
- mkdir -p $kerneldir/certs
- cp certs/signing_key.* $kerneldir/certs/
- elif [ -e signing_key.priv ]; then
- cp signing_key.* $kerneldir/
- fi
-
- # We can also copy over all the generated files and avoid special cases
- # like version.h, but we've opted to keep this small until file creep starts
- # to happen
- if [ -e include/linux/version.h ]; then
- mkdir -p $kerneldir/include/linux
- cp include/linux/version.h $kerneldir/include/linux/version.h
- fi
-
- # As of Linux kernel version 3.0.1, the clean target removes
- # arch/powerpc/lib/crtsavres.o which is present in
- # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
- if [ ${ARCH} = "powerpc" ]; then
- if [ -e arch/powerpc/lib/crtsavres.o ]; then
- mkdir -p $kerneldir/arch/powerpc/lib/
- cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
- fi
- fi
-
- if [ -d include/generated ]; then
- mkdir -p $kerneldir/include/generated/
- cp -fR include/generated/* $kerneldir/include/generated/
- fi
-
- if [ -d arch/${ARCH}/include/generated ]; then
- mkdir -p $kerneldir/arch/${ARCH}/include/generated/
- cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/
- fi
-
- if (grep -q -i -e '^CONFIG_UNWINDER_ORC=y$' $kerneldir/.config); then
- # With CONFIG_UNWINDER_ORC (the default in 4.14), objtool is required for
- # out-of-tree modules to be able to generate object files.
- if [ -x tools/objtool/objtool ]; then
- mkdir -p ${kerneldir}/tools/objtool
- cp tools/objtool/objtool ${kerneldir}/tools/objtool/
- fi
- fi
-}
-
-# We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware
-sysroot_stage_all () {
- :
-}
-
-KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} CC="${KERNEL_CC}" LD="${KERNEL_LD}" O=${B} olddefconfig || oe_runmake -C ${S} O=${B} CC="${KERNEL_CC}" LD="${KERNEL_LD}" oldnoconfig"
-
-python check_oldest_kernel() {
- oldest_kernel = d.getVar('OLDEST_KERNEL')
- kernel_version = d.getVar('KERNEL_VERSION')
- tclibc = d.getVar('TCLIBC')
- if tclibc == 'glibc':
- kernel_version = kernel_version.split('-', 1)[0]
- if oldest_kernel and kernel_version:
- if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0:
- bb.warn('%s: OLDEST_KERNEL is "%s" but the version of the kernel you are building is "%s" - therefore %s as built may not be compatible with this kernel. Either set OLDEST_KERNEL to an older version, or build a newer kernel.' % (d.getVar('PN'), oldest_kernel, kernel_version, tclibc))
-}
-
-check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION"
-do_configure[prefuncs] += "check_oldest_kernel"
-
-kernel_do_configure() {
- # fixes extra + in /lib/modules/2.6.37+
- # $ scripts/setlocalversion . => +
- # $ make kernelversion => 2.6.37
- # $ make kernelrelease => 2.6.37+
- touch ${B}/.scmversion ${S}/.scmversion
-
- if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
- mv "${S}/.config" "${B}/.config"
- fi
-
- # Copy defconfig to .config if .config does not exist. This allows
- # recipes to manage the .config themselves in do_configure:prepend().
- if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
- cp "${WORKDIR}/defconfig" "${B}/.config"
- fi
-
- ${KERNEL_CONFIG_COMMAND}
-}
-
-do_savedefconfig() {
- bbplain "Saving defconfig to:\n${B}/defconfig"
- oe_runmake -C ${B} LD='${KERNEL_LD}' savedefconfig
-}
-do_savedefconfig[nostamp] = "1"
-addtask savedefconfig after do_configure
-
-inherit cml1
-
-KCONFIG_CONFIG_COMMAND:append = " PAHOLE=false LD='${KERNEL_LD}' HOSTLDFLAGS='${BUILD_LDFLAGS}'"
-
-EXPORT_FUNCTIONS do_compile do_transform_kernel do_transform_bundled_initramfs do_install do_configure
-
-# kernel-base becomes kernel-${KERNEL_VERSION}
-# kernel-image becomes kernel-image-${KERNEL_VERSION}
-PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules ${KERNEL_PACKAGE_NAME}-dbg"
-FILES:${PN} = ""
-FILES:${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo"
-FILES:${KERNEL_PACKAGE_NAME}-image = ""
-FILES:${KERNEL_PACKAGE_NAME}-dev = "/${KERNEL_IMAGEDEST}/System.map* /${KERNEL_IMAGEDEST}/Module.symvers* /${KERNEL_IMAGEDEST}/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
-FILES:${KERNEL_PACKAGE_NAME}-vmlinux = "/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION_NAME}"
-FILES:${KERNEL_PACKAGE_NAME}-modules = ""
-FILES:${KERNEL_PACKAGE_NAME}-dbg = "/usr/lib/debug /usr/src/debug"
-RDEPENDS:${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base (= ${EXTENDPKGV})"
-# Allow machines to override this dependency if kernel image files are
-# not wanted in images as standard
-RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image (= ${EXTENDPKGV})"
-PKG:${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-RDEPENDS:${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
-PKG:${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-RPROVIDES:${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME} = "1"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-base = "1"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-image = "1"
-ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-modules = "1"
-DESCRIPTION:${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
-
-pkg_postinst:${KERNEL_PACKAGE_NAME}-base () {
- if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
- mkdir -p $D/lib/modules/${KERNEL_VERSION}
- fi
- if [ -n "$D" ]; then
- depmodwrapper -a -b $D ${KERNEL_VERSION}
- else
- depmod -a ${KERNEL_VERSION}
- fi
-}
-
-PACKAGESPLITFUNCS:prepend = "split_kernel_packages "
-
-python split_kernel_packages () {
- do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex=r'^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
-}
-
-# Many scripts want to look in arch/$arch/boot for the bootable
-# image. This poses a problem for vmlinux and vmlinuz based
-# booting. This task arranges to have vmlinux and vmlinuz appear
-# in the normalized directory location.
-do_kernel_link_images() {
- if [ ! -d "${B}/arch/${ARCH}/boot" ]; then
- mkdir ${B}/arch/${ARCH}/boot
- fi
- cd ${B}/arch/${ARCH}/boot
- ln -sf ../../../vmlinux
- if [ -f ../../../vmlinuz ]; then
- ln -sf ../../../vmlinuz
- fi
- if [ -f ../../../vmlinuz.bin ]; then
- ln -sf ../../../vmlinuz.bin
- fi
- if [ -f ../../../vmlinux.64 ]; then
- ln -sf ../../../vmlinux.64
- fi
-}
-addtask kernel_link_images after do_compile before do_strip
-
-python do_strip() {
- import shutil
-
- strip = d.getVar('STRIP')
- extra_sections = d.getVar('KERNEL_IMAGE_STRIP_EXTRA_SECTIONS')
- kernel_image = d.getVar('B') + "/" + d.getVar('KERNEL_OUTPUT_DIR') + "/vmlinux"
-
- if (extra_sections and kernel_image.find(d.getVar('KERNEL_IMAGEDEST') + '/vmlinux') != -1):
- kernel_image_stripped = kernel_image + ".stripped"
- shutil.copy2(kernel_image, kernel_image_stripped)
- oe.package.runstrip((kernel_image_stripped, 8, strip, extra_sections))
- bb.debug(1, "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections: " + \
- extra_sections)
-}
-do_strip[dirs] = "${B}"
-
-addtask strip before do_sizecheck after do_kernel_link_images
-
-# Support checking the kernel size since some kernels need to reside in partitions
-# with a fixed length or there is a limit in transferring the kernel to memory.
-# If more than one image type is enabled, warn on any that don't fit but only fail
-# if none fit.
-do_sizecheck() {
- if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
- invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'`
- if [ -n "$invalid" ]; then
- die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integer (The unit is Kbytes)"
- fi
- at_least_one_fits=
- for imageType in ${KERNEL_IMAGETYPES} ; do
- size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$imageType | awk '{print $1}'`
- if [ $size -gt ${KERNEL_IMAGE_MAXSIZE} ]; then
- bbwarn "This kernel $imageType (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device."
- else
- at_least_one_fits=y
- fi
- done
- if [ -z "$at_least_one_fits" ]; then
- die "All kernel images are too big for your device. Please reduce the size of the kernel by making more of it modular."
- fi
- fi
-}
-do_sizecheck[dirs] = "${B}"
-
-addtask sizecheck before do_install after do_strip
-
-inherit kernel-artifact-names
-
-kernel_do_deploy() {
- deployDir="${DEPLOYDIR}"
- if [ -n "${KERNEL_DEPLOYSUBDIR}" ]; then
- deployDir="${DEPLOYDIR}/${KERNEL_DEPLOYSUBDIR}"
- mkdir "$deployDir"
- fi
-
- for imageType in ${KERNEL_IMAGETYPES} ; do
- baseName=$imageType-${KERNEL_IMAGE_NAME}
-
- if [ -s ${KERNEL_OUTPUT_DIR}/$imageType.stripped ] ; then
- install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.stripped $deployDir/$baseName${KERNEL_IMAGE_BIN_EXT}
- else
- install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType $deployDir/$baseName${KERNEL_IMAGE_BIN_EXT}
- fi
- if [ -n "${KERNEL_IMAGE_LINK_NAME}" ] ; then
- ln -sf $baseName${KERNEL_IMAGE_BIN_EXT} $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
- fi
- if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
- ln -sf $baseName${KERNEL_IMAGE_BIN_EXT} $deployDir/$imageType
- fi
- done
-
- if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
- mkdir -p ${D}${root_prefix}/lib
- if [ -n "${SOURCE_DATE_EPOCH}" ]; then
- TAR_ARGS="--sort=name --clamp-mtime --mtime=@${SOURCE_DATE_EPOCH}"
- else
- TAR_ARGS=""
- fi
- TAR_ARGS="$TAR_ARGS --owner=0 --group=0"
- tar $TAR_ARGS -cv -C ${D}${root_prefix} lib | gzip -9n > $deployDir/modules-${MODULE_TARBALL_NAME}.tgz
-
- if [ -n "${MODULE_TARBALL_LINK_NAME}" ] ; then
- ln -sf modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz
- fi
- fi
-
- if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
- for imageType in ${KERNEL_IMAGETYPES} ; do
- if [ "$imageType" = "fitImage" ] ; then
- continue
- fi
- initramfsBaseName=$imageType-${INITRAMFS_NAME}
- install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.initramfs $deployDir/$initramfsBaseName${KERNEL_IMAGE_BIN_EXT}
- if [ -n "${INITRAMFS_LINK_NAME}" ] ; then
- ln -sf $initramfsBaseName${KERNEL_IMAGE_BIN_EXT} $deployDir/$imageType-${INITRAMFS_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
- fi
- done
- fi
-}
-
-# We deploy to filenames that include PKGV and PKGR, read the saved data to
-# ensure we get the right values for both
-do_deploy[prefuncs] += "read_subpackage_metadata"
-
-addtask deploy after do_populate_sysroot do_packagedata
-
-EXPORT_FUNCTIONS do_deploy
-
-# Add using Device Tree support
-inherit kernel-devicetree
diff --git a/poky/meta/classes/kernelsrc.bbclass b/poky/meta/classes/kernelsrc.bbclass
deleted file mode 100644
index a951ba3..0000000
--- a/poky/meta/classes/kernelsrc.bbclass
+++ /dev/null
@@ -1,10 +0,0 @@
-S = "${STAGING_KERNEL_DIR}"
-deltask do_fetch
-deltask do_unpack
-do_patch[depends] += "virtual/kernel:do_shared_workdir"
-do_patch[noexec] = "1"
-do_package[depends] += "virtual/kernel:do_populate_sysroot"
-KERNEL_VERSION = "${@get_kernelversion_file("${STAGING_KERNEL_BUILDDIR}")}"
-
-inherit linux-kernel-base
-
diff --git a/poky/meta/classes/lib_package.bbclass b/poky/meta/classes/lib_package.bbclass
deleted file mode 100644
index 8849f59..0000000
--- a/poky/meta/classes/lib_package.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# ${PN}-bin is defined in bitbake.conf
-#
-# We need to allow the other packages to be greedy with what they
-# want out of /usr/bin and /usr/sbin before ${PN}-bin gets greedy.
-#
-PACKAGE_BEFORE_PN = "${PN}-bin"
diff --git a/poky/meta/classes/libc-package.bbclass b/poky/meta/classes/libc-package.bbclass
deleted file mode 100644
index 13ef8cd..0000000
--- a/poky/meta/classes/libc-package.bbclass
+++ /dev/null
@@ -1,384 +0,0 @@
-#
-# This class knows how to package up [e]glibc. Its shared since prebuild binary toolchains
-# may need packaging and its pointless to duplicate this code.
-#
-# Caller should set GLIBC_INTERNAL_USE_BINARY_LOCALE to one of:
-# "compile" - Use QEMU to generate the binary locale files
-# "precompiled" - The binary locale files are pregenerated and already present
-# "ondevice" - The device will build the locale files upon first boot through the postinst
-
-GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice"
-
-GLIBC_SPLIT_LC_PACKAGES ?= "0"
-
-python __anonymous () {
- enabled = d.getVar("ENABLE_BINARY_LOCALE_GENERATION")
-
- pn = d.getVar("PN")
- if pn.endswith("-initial"):
- enabled = False
-
- if enabled and int(enabled):
- import re
-
- target_arch = d.getVar("TARGET_ARCH")
- binary_arches = d.getVar("BINARY_LOCALE_ARCHES") or ""
- use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF") or ""
-
- for regexp in binary_arches.split(" "):
- r = re.compile(regexp)
-
- if r.match(target_arch):
- depends = d.getVar("DEPENDS")
- if use_cross_localedef == "1" :
- depends = "%s cross-localedef-native" % depends
- else:
- depends = "%s qemu-native" % depends
- d.setVar("DEPENDS", depends)
- d.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile")
- break
-}
-
-# try to fix disable charsets/locales/locale-code compile fail
-PACKAGE_NO_GCONV ?= "0"
-
-OVERRIDES:append = ":${TARGET_ARCH}-${TARGET_OS}"
-
-locale_base_postinst_ontarget() {
-localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s %s
-}
-
-locale_base_postrm() {
-#!/bin/sh
-localedef --delete-from-archive --inputfile=${datadir}/locales/%s --charmap=%s %s
-}
-
-LOCALETREESRC ?= "${PKGD}"
-
-do_prep_locale_tree() {
- treedir=${WORKDIR}/locale-tree
- rm -rf $treedir
- mkdir -p $treedir/${base_bindir} $treedir/${base_libdir} $treedir/${datadir} $treedir/${localedir}
- tar -cf - -C ${LOCALETREESRC}${datadir} -p i18n | tar -xf - -C $treedir/${datadir}
- # unzip to avoid parsing errors
- for i in $treedir/${datadir}/i18n/charmaps/*gz; do
- gunzip $i
- done
- # The extract pattern "./l*.so*" is carefully selected so that it will
- # match ld*.so and lib*.so*, but not any files in the gconv directory
- # (if it exists). This makes sure we only unpack the files we need.
- # This is important in case usrmerge is set in DISTRO_FEATURES, which
- # means ${base_libdir} == ${libdir}.
- tar -cf - -C ${LOCALETREESRC}${base_libdir} -p . | tar -xf - -C $treedir/${base_libdir} --wildcards './l*.so*'
- if [ -f ${STAGING_LIBDIR_NATIVE}/libgcc_s.* ]; then
- tar -cf - -C ${STAGING_LIBDIR_NATIVE} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir}
- fi
- install -m 0755 ${LOCALETREESRC}${bindir}/localedef $treedir/${base_bindir}
-}
-
-do_collect_bins_from_locale_tree() {
- treedir=${WORKDIR}/locale-tree
-
- parent=$(dirname ${localedir})
- mkdir -p ${PKGD}/$parent
- tar -cf - -C $treedir/$parent -p $(basename ${localedir}) | tar -xf - -C ${PKGD}$parent
-
- # Finalize tree by chaning all duplicate files into hard links
- cross-localedef-hardlink -c -v ${WORKDIR}/locale-tree
-}
-
-inherit qemu
-
-python package_do_split_gconvs () {
- import re
- if (d.getVar('PACKAGE_NO_GCONV') == '1'):
- bb.note("package requested not splitting gconvs")
- return
-
- if not d.getVar('PACKAGES'):
- return
-
- mlprefix = d.getVar("MLPREFIX") or ""
-
- bpn = d.getVar('BPN')
- libdir = d.getVar('libdir')
- if not libdir:
- bb.error("libdir not defined")
- return
- datadir = d.getVar('datadir')
- if not datadir:
- bb.error("datadir not defined")
- return
-
- gconv_libdir = oe.path.join(libdir, "gconv")
- charmap_dir = oe.path.join(datadir, "i18n", "charmaps")
- locales_dir = oe.path.join(datadir, "i18n", "locales")
- binary_locales_dir = d.getVar('localedir')
-
- def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group):
- deps = []
- f = open(fn, "rb")
- c_re = re.compile(r'^copy "(.*)"')
- i_re = re.compile(r'^include "(\w+)".*')
- for l in f.readlines():
- l = l.decode("latin-1")
- m = c_re.match(l) or i_re.match(l)
- if m:
- dp = legitimize_package_name('%s%s-gconv-%s' % (mlprefix, bpn, m.group(1)))
- if not dp in deps:
- deps.append(dp)
- f.close()
- if deps != []:
- d.setVar('RDEPENDS:%s' % pkg, " ".join(deps))
- if bpn != 'glibc':
- d.setVar('RPROVIDES:%s' % pkg, pkg.replace(bpn, 'glibc'))
-
- do_split_packages(d, gconv_libdir, file_regex=r'^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \
- description='gconv module for character set %s', hook=calc_gconv_deps, \
- extra_depends=bpn+'-gconv')
-
- def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group):
- deps = []
- f = open(fn, "rb")
- c_re = re.compile(r'^copy "(.*)"')
- i_re = re.compile(r'^include "(\w+)".*')
- for l in f.readlines():
- l = l.decode("latin-1")
- m = c_re.match(l) or i_re.match(l)
- if m:
- dp = legitimize_package_name('%s%s-charmap-%s' % (mlprefix, bpn, m.group(1)))
- if not dp in deps:
- deps.append(dp)
- f.close()
- if deps != []:
- d.setVar('RDEPENDS:%s' % pkg, " ".join(deps))
- if bpn != 'glibc':
- d.setVar('RPROVIDES:%s' % pkg, pkg.replace(bpn, 'glibc'))
-
- do_split_packages(d, charmap_dir, file_regex=r'^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \
- description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='')
-
- def calc_locale_deps(fn, pkg, file_regex, output_pattern, group):
- deps = []
- f = open(fn, "rb")
- c_re = re.compile(r'^copy "(.*)"')
- i_re = re.compile(r'^include "(\w+)".*')
- for l in f.readlines():
- l = l.decode("latin-1")
- m = c_re.match(l) or i_re.match(l)
- if m:
- dp = legitimize_package_name(mlprefix+bpn+'-localedata-%s' % m.group(1))
- if not dp in deps:
- deps.append(dp)
- f.close()
- if deps != []:
- d.setVar('RDEPENDS:%s' % pkg, " ".join(deps))
- if bpn != 'glibc':
- d.setVar('RPROVIDES:%s' % pkg, pkg.replace(bpn, 'glibc'))
-
- do_split_packages(d, locales_dir, file_regex=r'(.*)', output_pattern=bpn+'-localedata-%s', \
- description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
- d.setVar('PACKAGES', d.getVar('PACKAGES', False) + ' ' + d.getVar('MLPREFIX', False) + bpn + '-gconv')
-
- use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE")
-
- dot_re = re.compile(r"(.*)\.(.*)")
-
- # Read in supported locales and associated encodings
- supported = {}
- with open(oe.path.join(d.getVar('WORKDIR'), "SUPPORTED")) as f:
- for line in f.readlines():
- try:
- locale, charset = line.rstrip().split()
- except ValueError:
- continue
- supported[locale] = charset
-
- # GLIBC_GENERATE_LOCALES var specifies which locales to be generated. empty or "all" means all locales
- to_generate = d.getVar('GLIBC_GENERATE_LOCALES')
- if not to_generate or to_generate == 'all':
- to_generate = sorted(supported.keys())
- else:
- to_generate = to_generate.split()
- for locale in to_generate:
- if locale not in supported:
- if '.' in locale:
- charset = locale.split('.')[1]
- else:
- charset = 'UTF-8'
- bb.warn("Unsupported locale '%s', assuming encoding '%s'" % (locale, charset))
- supported[locale] = charset
-
- def output_locale_source(name, pkgname, locale, encoding):
- d.setVar('RDEPENDS:%s' % pkgname, '%slocaledef %s-localedata-%s %s-charmap-%s' % \
- (mlprefix, mlprefix+bpn, legitimize_package_name(locale), mlprefix+bpn, legitimize_package_name(encoding)))
- d.setVar('pkg_postinst_ontarget:%s' % pkgname, d.getVar('locale_base_postinst_ontarget') \
- % (locale, encoding, locale))
- d.setVar('pkg_postrm:%s' % pkgname, d.getVar('locale_base_postrm') % \
- (locale, encoding, locale))
-
- def output_locale_binary_rdepends(name, pkgname, locale, encoding):
- dep = legitimize_package_name('%s-binary-localedata-%s' % (bpn, name))
- lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES')
- if lcsplit and int(lcsplit):
- d.appendVar('PACKAGES', ' ' + dep)
- d.setVar('ALLOW_EMPTY:%s' % dep, '1')
- d.setVar('RDEPENDS:%s' % pkgname, mlprefix + dep)
-
- commands = {}
-
- def output_locale_binary(name, pkgname, locale, encoding):
- treedir = oe.path.join(d.getVar("WORKDIR"), "locale-tree")
- ldlibdir = oe.path.join(treedir, d.getVar("base_libdir"))
- path = d.getVar("PATH")
- i18npath = oe.path.join(treedir, datadir, "i18n")
- gconvpath = oe.path.join(treedir, "iconvdata")
- outputpath = oe.path.join(treedir, binary_locales_dir)
-
- use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF") or "0"
- if use_cross_localedef == "1":
- target_arch = d.getVar('TARGET_ARCH')
- locale_arch_options = { \
- "arc": " --uint32-align=4 --little-endian ", \
- "arceb": " --uint32-align=4 --big-endian ", \
- "arm": " --uint32-align=4 --little-endian ", \
- "armeb": " --uint32-align=4 --big-endian ", \
- "aarch64": " --uint32-align=4 --little-endian ", \
- "aarch64_be": " --uint32-align=4 --big-endian ", \
- "sh4": " --uint32-align=4 --big-endian ", \
- "powerpc": " --uint32-align=4 --big-endian ", \
- "powerpc64": " --uint32-align=4 --big-endian ", \
- "powerpc64le": " --uint32-align=4 --little-endian ", \
- "mips": " --uint32-align=4 --big-endian ", \
- "mipsisa32r6": " --uint32-align=4 --big-endian ", \
- "mips64": " --uint32-align=4 --big-endian ", \
- "mipsisa64r6": " --uint32-align=4 --big-endian ", \
- "mipsel": " --uint32-align=4 --little-endian ", \
- "mipsisa32r6el": " --uint32-align=4 --little-endian ", \
- "mips64el":" --uint32-align=4 --little-endian ", \
- "mipsisa64r6el":" --uint32-align=4 --little-endian ", \
- "riscv64": " --uint32-align=4 --little-endian ", \
- "riscv32": " --uint32-align=4 --little-endian ", \
- "i586": " --uint32-align=4 --little-endian ", \
- "i686": " --uint32-align=4 --little-endian ", \
- "x86_64": " --uint32-align=4 --little-endian " }
-
- if target_arch in locale_arch_options:
- localedef_opts = locale_arch_options[target_arch]
- else:
- bb.error("locale_arch_options not found for target_arch=" + target_arch)
- bb.fatal("unknown arch:" + target_arch + " for locale_arch_options")
-
- localedef_opts += " --force --no-hard-links --no-archive --prefix=%s \
- --inputfile=%s/%s/i18n/locales/%s --charmap=%s %s/%s" \
- % (treedir, treedir, datadir, locale, encoding, outputpath, name)
-
- cmd = "PATH=\"%s\" I18NPATH=\"%s\" GCONV_PATH=\"%s\" cross-localedef %s" % \
- (path, i18npath, gconvpath, localedef_opts)
- else: # earlier slower qemu way
- qemu = qemu_target_binary(d)
- localedef_opts = "--force --no-hard-links --no-archive --prefix=%s \
- --inputfile=%s/i18n/locales/%s --charmap=%s %s" \
- % (treedir, datadir, locale, encoding, name)
-
- qemu_options = d.getVar('QEMU_OPTIONS')
-
- cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \
- -E LD_LIBRARY_PATH=%s %s %s${base_bindir}/localedef %s" % \
- (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts)
-
- commands["%s/%s" % (outputpath, name)] = cmd
-
- bb.note("generating locale %s (%s)" % (locale, encoding))
-
- def output_locale(name, locale, encoding):
- pkgname = d.getVar('MLPREFIX', False) + 'locale-base-' + legitimize_package_name(name)
- d.setVar('ALLOW_EMPTY:%s' % pkgname, '1')
- d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES')))
- rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name))
- m = re.match(r"(.*)_(.*)", name)
- if m:
- rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1))
- d.setVar('RPROVIDES:%s' % pkgname, rprovides)
-
- if use_bin == "compile":
- output_locale_binary_rdepends(name, pkgname, locale, encoding)
- output_locale_binary(name, pkgname, locale, encoding)
- elif use_bin == "precompiled":
- output_locale_binary_rdepends(name, pkgname, locale, encoding)
- else:
- output_locale_source(name, pkgname, locale, encoding)
-
- if use_bin == "compile":
- bb.note("preparing tree for binary locale generation")
- bb.build.exec_func("do_prep_locale_tree", d)
-
- utf8_only = int(d.getVar('LOCALE_UTF8_ONLY') or 0)
- utf8_is_default = int(d.getVar('LOCALE_UTF8_IS_DEFAULT') or 0)
-
- encodings = {}
- for locale in to_generate:
- charset = supported[locale]
- if utf8_only and charset != 'UTF-8':
- continue
-
- m = dot_re.match(locale)
- if m:
- base = m.group(1)
- else:
- base = locale
-
- # Non-precompiled locales may be renamed so that the default
- # (non-suffixed) encoding is always UTF-8, i.e., instead of en_US and
- # en_US.UTF-8, we have en_US and en_US.ISO-8859-1. This implicitly
- # contradicts SUPPORTED.
- if use_bin == "precompiled" or not utf8_is_default:
- output_locale(locale, base, charset)
- else:
- if charset == 'UTF-8':
- output_locale(base, base, charset)
- else:
- output_locale('%s.%s' % (base, charset), base, charset)
-
- def metapkg_hook(file, pkg, pattern, format, basename):
- name = basename.split('/', 1)[0]
- metapkg = legitimize_package_name('%s-binary-localedata-%s' % (mlprefix+bpn, name))
- d.appendVar('RDEPENDS:%s' % metapkg, ' ' + pkg)
-
- if use_bin == "compile":
- makefile = oe.path.join(d.getVar("WORKDIR"), "locale-tree", "Makefile")
- with open(makefile, "w") as m:
- m.write("all: %s\n\n" % " ".join(commands.keys()))
- total = len(commands)
- for i, (maketarget, makerecipe) in enumerate(commands.items()):
- m.write(maketarget + ":\n")
- m.write("\t@echo 'Progress %d/%d'\n" % (i, total))
- m.write("\t" + makerecipe + "\n\n")
- d.setVar("EXTRA_OEMAKE", "-C %s ${PARALLEL_MAKE}" % (os.path.dirname(makefile)))
- d.setVarFlag("oe_runmake", "progress", r"outof:Progress\s(\d+)/(\d+)")
- bb.note("Executing binary locale generation makefile")
- bb.build.exec_func("oe_runmake", d)
- bb.note("collecting binary locales from locale tree")
- bb.build.exec_func("do_collect_bins_from_locale_tree", d)
-
- if use_bin in ('compile', 'precompiled'):
- lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES')
- if lcsplit and int(lcsplit):
- do_split_packages(d, binary_locales_dir, file_regex=r'^(.*/LC_\w+)', \
- output_pattern=bpn+'-binary-localedata-%s', \
- description='binary locale definition for %s', recursive=True,
- hook=metapkg_hook, extra_depends='', allow_dirs=True, match_path=True)
- else:
- do_split_packages(d, binary_locales_dir, file_regex=r'(.*)', \
- output_pattern=bpn+'-binary-localedata-%s', \
- description='binary locale definition for %s', extra_depends='', allow_dirs=True)
- else:
- bb.note("generation of binary locales disabled. this may break i18n!")
-
-}
-
-# We want to do this indirection so that we can safely 'return'
-# from the called function even though we're prepending
-python populate_packages:prepend () {
- bb.build.exec_func('package_do_split_gconvs', d)
-}
diff --git a/poky/meta/classes/license.bbclass b/poky/meta/classes/license.bbclass
deleted file mode 100644
index 4ebfc4f..0000000
--- a/poky/meta/classes/license.bbclass
+++ /dev/null
@@ -1,420 +0,0 @@
-# Populates LICENSE_DIRECTORY as set in distro config with the license files as set by
-# LIC_FILES_CHKSUM.
-# TODO:
-# - There is a real issue revolving around license naming standards.
-
-LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses"
-LICSSTATEDIR = "${WORKDIR}/license-destdir/"
-
-# Create extra package with license texts and add it to RRECOMMENDS:${PN}
-LICENSE_CREATE_PACKAGE[type] = "boolean"
-LICENSE_CREATE_PACKAGE ??= "0"
-LICENSE_PACKAGE_SUFFIX ??= "-lic"
-LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/"
-
-addtask populate_lic after do_patch before do_build
-do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
-do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
-
-python do_populate_lic() {
- """
- Populate LICENSE_DIRECTORY with licenses.
- """
- lic_files_paths = find_license_files(d)
-
- # The base directory we wrangle licenses to
- destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('PN'))
- copy_license_files(lic_files_paths, destdir)
- info = get_recipe_info(d)
- with open(os.path.join(destdir, "recipeinfo"), "w") as f:
- for key in sorted(info.keys()):
- f.write("%s: %s\n" % (key, info[key]))
- oe.qa.exit_if_errors(d)
-}
-
-PSEUDO_IGNORE_PATHS .= ",${@','.join(((d.getVar('COMMON_LICENSE_DIR') or '') + ' ' + (d.getVar('LICENSE_PATH') or '') + ' ' + d.getVar('COREBASE') + '/meta/COPYING').split())}"
-# it would be better to copy them in do_install:append, but find_license_filesa is python
-python perform_packagecopy:prepend () {
- enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d)
- if d.getVar('CLASSOVERRIDE') == 'class-target' and enabled:
- lic_files_paths = find_license_files(d)
-
- # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY
- destdir = d.getVar('D') + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY'), d.getVar('PN'))
- copy_license_files(lic_files_paths, destdir)
- add_package_and_files(d)
-}
-perform_packagecopy[vardeps] += "LICENSE_CREATE_PACKAGE"
-
-def get_recipe_info(d):
- info = {}
- info["PV"] = d.getVar("PV")
- info["PR"] = d.getVar("PR")
- info["LICENSE"] = d.getVar("LICENSE")
- return info
-
-def add_package_and_files(d):
- packages = d.getVar('PACKAGES')
- files = d.getVar('LICENSE_FILES_DIRECTORY')
- pn = d.getVar('PN')
- pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX', False))
- if pn_lic in packages.split():
- bb.warn("%s package already existed in %s." % (pn_lic, pn))
- else:
- # first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY
- d.setVar('PACKAGES', "%s %s" % (pn_lic, packages))
- d.setVar('FILES:' + pn_lic, files)
-
-def copy_license_files(lic_files_paths, destdir):
- import shutil
- import errno
-
- bb.utils.mkdirhier(destdir)
- for (basename, path, beginline, endline) in lic_files_paths:
- try:
- src = path
- dst = os.path.join(destdir, basename)
- if os.path.exists(dst):
- os.remove(dst)
- if os.path.islink(src):
- src = os.path.realpath(src)
- canlink = os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev) and beginline is None and endline is None
- if canlink:
- try:
- os.link(src, dst)
- except OSError as err:
- if err.errno == errno.EXDEV:
- # Copy license files if hardlink is not possible even if st_dev is the
- # same on source and destination (docker container with device-mapper?)
- canlink = False
- else:
- raise
- # Only chown if we did hardlink and we're running under pseudo
- if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
- os.chown(dst,0,0)
- if not canlink:
- begin_idx = max(0, int(beginline) - 1) if beginline is not None else None
- end_idx = max(0, int(endline)) if endline is not None else None
- if begin_idx is None and end_idx is None:
- shutil.copyfile(src, dst)
- else:
- with open(src, 'rb') as src_f:
- with open(dst, 'wb') as dst_f:
- dst_f.write(b''.join(src_f.readlines()[begin_idx:end_idx]))
-
- except Exception as e:
- bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e))
-
-def find_license_files(d):
- """
- Creates list of files used in LIC_FILES_CHKSUM and generic LICENSE files.
- """
- import shutil
- import oe.license
- from collections import defaultdict, OrderedDict
-
- # All the license files for the package
- lic_files = d.getVar('LIC_FILES_CHKSUM') or ""
- pn = d.getVar('PN')
- # The license files are located in S/LIC_FILE_CHECKSUM.
- srcdir = d.getVar('S')
- # Directory we store the generic licenses as set in the distro configuration
- generic_directory = d.getVar('COMMON_LICENSE_DIR')
- # List of basename, path tuples
- lic_files_paths = []
- # hash for keep track generic lics mappings
- non_generic_lics = {}
- # Entries from LIC_FILES_CHKSUM
- lic_chksums = {}
- license_source_dirs = []
- license_source_dirs.append(generic_directory)
- try:
- additional_lic_dirs = d.getVar('LICENSE_PATH').split()
- for lic_dir in additional_lic_dirs:
- license_source_dirs.append(lic_dir)
- except:
- pass
-
- class FindVisitor(oe.license.LicenseVisitor):
- def visit_Str(self, node):
- #
- # Until I figure out what to do with
- # the two modifiers I support (or greater = +
- # and "with exceptions" being *
- # we'll just strip out the modifier and put
- # the base license.
- find_license(node.s.replace("+", "").replace("*", ""))
- self.generic_visit(node)
-
- def visit_Constant(self, node):
- find_license(node.value.replace("+", "").replace("*", ""))
- self.generic_visit(node)
-
- def find_license(license_type):
- try:
- bb.utils.mkdirhier(gen_lic_dest)
- except:
- pass
- spdx_generic = None
- license_source = None
- # If the generic does not exist we need to check to see if there is an SPDX mapping to it,
- # unless NO_GENERIC_LICENSE is set.
- for lic_dir in license_source_dirs:
- if not os.path.isfile(os.path.join(lic_dir, license_type)):
- if d.getVarFlag('SPDXLICENSEMAP', license_type) != None:
- # Great, there is an SPDXLICENSEMAP. We can copy!
- bb.debug(1, "We need to use a SPDXLICENSEMAP for %s" % (license_type))
- spdx_generic = d.getVarFlag('SPDXLICENSEMAP', license_type)
- license_source = lic_dir
- break
- elif os.path.isfile(os.path.join(lic_dir, license_type)):
- spdx_generic = license_type
- license_source = lic_dir
- break
-
- non_generic_lic = d.getVarFlag('NO_GENERIC_LICENSE', license_type)
- if spdx_generic and license_source:
- # we really should copy to generic_ + spdx_generic, however, that ends up messing the manifest
- # audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes)
-
- lic_files_paths.append(("generic_" + license_type, os.path.join(license_source, spdx_generic),
- None, None))
-
- # The user may attempt to use NO_GENERIC_LICENSE for a generic license which doesn't make sense
- # and should not be allowed, warn the user in this case.
- if d.getVarFlag('NO_GENERIC_LICENSE', license_type):
- oe.qa.handle_error("license-no-generic",
- "%s: %s is a generic license, please don't use NO_GENERIC_LICENSE for it." % (pn, license_type), d)
-
- elif non_generic_lic and non_generic_lic in lic_chksums:
- # if NO_GENERIC_LICENSE is set, we copy the license files from the fetched source
- # of the package rather than the license_source_dirs.
- lic_files_paths.append(("generic_" + license_type,
- os.path.join(srcdir, non_generic_lic), None, None))
- non_generic_lics[non_generic_lic] = license_type
- else:
- # Explicitly avoid the CLOSED license because this isn't generic
- if license_type != 'CLOSED':
- # And here is where we warn people that their licenses are lousy
- oe.qa.handle_error("license-exists",
- "%s: No generic license file exists for: %s in any provider" % (pn, license_type), d)
- pass
-
- if not generic_directory:
- bb.fatal("COMMON_LICENSE_DIR is unset. Please set this in your distro config")
-
- for url in lic_files.split():
- try:
- (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
- if method != "file" or not path:
- raise bb.fetch.MalformedUrl()
- except bb.fetch.MalformedUrl:
- bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), url))
- # We want the license filename and path
- chksum = parm.get('md5', None)
- beginline = parm.get('beginline')
- endline = parm.get('endline')
- lic_chksums[path] = (chksum, beginline, endline)
-
- v = FindVisitor()
- try:
- v.visit_string(d.getVar('LICENSE'))
- except oe.license.InvalidLicense as exc:
- bb.fatal('%s: %s' % (d.getVar('PF'), exc))
- except SyntaxError:
- oe.qa.handle_error("license-syntax",
- "%s: Failed to parse it's LICENSE field." % (d.getVar('PF')), d)
- # Add files from LIC_FILES_CHKSUM to list of license files
- lic_chksum_paths = defaultdict(OrderedDict)
- for path, data in sorted(lic_chksums.items()):
- lic_chksum_paths[os.path.basename(path)][data] = (os.path.join(srcdir, path), data[1], data[2])
- for basename, files in lic_chksum_paths.items():
- if len(files) == 1:
- # Don't copy again a LICENSE already handled as non-generic
- if basename in non_generic_lics:
- continue
- data = list(files.values())[0]
- lic_files_paths.append(tuple([basename] + list(data)))
- else:
- # If there are multiple different license files with identical
- # basenames we rename them to <file>.0, <file>.1, ...
- for i, data in enumerate(files.values()):
- lic_files_paths.append(tuple(["%s.%d" % (basename, i)] + list(data)))
-
- return lic_files_paths
-
-def return_spdx(d, license):
- """
- This function returns the spdx mapping of a license if it exists.
- """
- return d.getVarFlag('SPDXLICENSEMAP', license)
-
-def canonical_license(d, license):
- """
- Return the canonical (SPDX) form of the license if available (so GPLv3
- becomes GPL-3.0-only) or the passed license if there is no canonical form.
- """
- return d.getVarFlag('SPDXLICENSEMAP', license) or license
-
-def expand_wildcard_licenses(d, wildcard_licenses):
- """
- There are some common wildcard values users may want to use. Support them
- here.
- """
- licenses = set(wildcard_licenses)
- mapping = {
- "AGPL-3.0*" : ["AGPL-3.0-only", "AGPL-3.0-or-later"],
- "GPL-3.0*" : ["GPL-3.0-only", "GPL-3.0-or-later"],
- "LGPL-3.0*" : ["LGPL-3.0-only", "LGPL-3.0-or-later"],
- }
- for k in mapping:
- if k in wildcard_licenses:
- licenses.remove(k)
- for item in mapping[k]:
- licenses.add(item)
-
- for l in licenses:
- if l in oe.license.obsolete_license_list():
- bb.fatal("Error, %s is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE" % l)
- if "*" in l:
- bb.fatal("Error, %s is an invalid license wildcard entry" % l)
-
- return list(licenses)
-
-def incompatible_license_contains(license, truevalue, falsevalue, d):
- license = canonical_license(d, license)
- bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
- bad_licenses = expand_wildcard_licenses(d, bad_licenses)
- return truevalue if license in bad_licenses else falsevalue
-
-def incompatible_pkg_license(d, dont_want_licenses, license):
- # Handles an "or" or two license sets provided by
- # flattened_licenses(), pick one that works if possible.
- def choose_lic_set(a, b):
- return a if all(oe.license.license_ok(canonical_license(d, lic),
- dont_want_licenses) for lic in a) else b
-
- try:
- licenses = oe.license.flattened_licenses(license, choose_lic_set)
- except oe.license.LicenseError as exc:
- bb.fatal('%s: %s' % (d.getVar('P'), exc))
-
- incompatible_lic = []
- for l in licenses:
- license = canonical_license(d, l)
- if not oe.license.license_ok(license, dont_want_licenses):
- incompatible_lic.append(license)
-
- return sorted(incompatible_lic)
-
-def incompatible_license(d, dont_want_licenses, package=None):
- """
- This function checks if a recipe has only incompatible licenses. It also
- take into consideration 'or' operand. dont_want_licenses should be passed
- as canonical (SPDX) names.
- """
- import oe.license
- license = d.getVar("LICENSE:%s" % package) if package else None
- if not license:
- license = d.getVar('LICENSE')
-
- return incompatible_pkg_license(d, dont_want_licenses, license)
-
-def check_license_flags(d):
- """
- This function checks if a recipe has any LICENSE_FLAGS that
- aren't acceptable.
-
- If it does, it returns the all LICENSE_FLAGS missing from the list
- of acceptable license flags, or all of the LICENSE_FLAGS if there
- is no list of acceptable flags.
-
- If everything is is acceptable, it returns None.
- """
-
- def license_flag_matches(flag, acceptlist, pn):
- """
- Return True if flag matches something in acceptlist, None if not.
-
- Before we test a flag against the acceptlist, we append _${PN}
- to it. We then try to match that string against the
- acceptlist. This covers the normal case, where we expect
- LICENSE_FLAGS to be a simple string like 'commercial', which
- the user typically matches exactly in the acceptlist by
- explicitly appending the package name e.g 'commercial_foo'.
- If we fail the match however, we then split the flag across
- '_' and append each fragment and test until we either match or
- run out of fragments.
- """
- flag_pn = ("%s_%s" % (flag, pn))
- for candidate in acceptlist:
- if flag_pn == candidate:
- return True
-
- flag_cur = ""
- flagments = flag_pn.split("_")
- flagments.pop() # we've already tested the full string
- for flagment in flagments:
- if flag_cur:
- flag_cur += "_"
- flag_cur += flagment
- for candidate in acceptlist:
- if flag_cur == candidate:
- return True
- return False
-
- def all_license_flags_match(license_flags, acceptlist):
- """ Return all unmatched flags, None if all flags match """
- pn = d.getVar('PN')
- split_acceptlist = acceptlist.split()
- flags = []
- for flag in license_flags.split():
- if not license_flag_matches(flag, split_acceptlist, pn):
- flags.append(flag)
- return flags if flags else None
-
- license_flags = d.getVar('LICENSE_FLAGS')
- if license_flags:
- acceptlist = d.getVar('LICENSE_FLAGS_ACCEPTED')
- if not acceptlist:
- return license_flags.split()
- unmatched_flags = all_license_flags_match(license_flags, acceptlist)
- if unmatched_flags:
- return unmatched_flags
- return None
-
-def check_license_format(d):
- """
- This function checks if LICENSE is well defined,
- Validate operators in LICENSES.
- No spaces are allowed between LICENSES.
- """
- pn = d.getVar('PN')
- licenses = d.getVar('LICENSE')
- from oe.license import license_operator, license_operator_chars, license_pattern
-
- elements = list(filter(lambda x: x.strip(), license_operator.split(licenses)))
- for pos, element in enumerate(elements):
- if license_pattern.match(element):
- if pos > 0 and license_pattern.match(elements[pos - 1]):
- oe.qa.handle_error('license-format',
- '%s: LICENSE value "%s" has an invalid format - license names ' \
- 'must be separated by the following characters to indicate ' \
- 'the license selection: %s' %
- (pn, licenses, license_operator_chars), d)
- elif not license_operator.match(element):
- oe.qa.handle_error('license-format',
- '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \
- 'in the valid list of separators (%s)' %
- (pn, licenses, element, license_operator_chars), d)
-
-SSTATETASKS += "do_populate_lic"
-do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
-do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
-
-IMAGE_CLASSES:append = " license_image"
-
-python do_populate_lic_setscene () {
- sstate_setscene(d)
-}
-addtask do_populate_lic_setscene
diff --git a/poky/meta/classes/license_image.bbclass b/poky/meta/classes/license_image.bbclass
deleted file mode 100644
index 3213ea7..0000000
--- a/poky/meta/classes/license_image.bbclass
+++ /dev/null
@@ -1,289 +0,0 @@
-ROOTFS_LICENSE_DIR = "${IMAGE_ROOTFS}/usr/share/common-licenses"
-
-# This requires LICENSE_CREATE_PACKAGE=1 to work too
-COMPLEMENTARY_GLOB[lic-pkgs] = "*-lic"
-
-python() {
- if not oe.data.typed_value('LICENSE_CREATE_PACKAGE', d):
- features = set(oe.data.typed_value('IMAGE_FEATURES', d))
- if 'lic-pkgs' in features:
- bb.error("'lic-pkgs' in IMAGE_FEATURES but LICENSE_CREATE_PACKAGE not enabled to generate -lic packages")
-}
-
-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)
- with open(os.path.join(license_image_dir, 'package.manifest'), "w+") as package_manifest:
- package_manifest.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, rootfs=True)
-}
-
-def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
- import re
- import stat
-
- bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
- bad_licenses = expand_wildcard_licenses(d, bad_licenses)
-
- exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split()
- with open(license_manifest, "w") as license_file:
- for pkg in sorted(pkg_dic):
- remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions)
- incompatible_licenses = incompatible_pkg_license(d, remaining_bad_licenses, pkg_dic[pkg]["LICENSE"])
- if incompatible_licenses:
- bb.fatal("Package %s cannot be installed into the image because it has incompatible license(s): %s" %(pkg, ' '.join(incompatible_licenses)))
- else:
- incompatible_licenses = incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"])
- if incompatible_licenses:
- oe.qa.handle_error('license-incompatible', "Including %s with incompatible license(s) %s into the image, because it has been allowed by exception list." %(pkg, ' '.join(incompatible_licenses)), d)
- try:
- (pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \
- oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],
- remaining_bad_licenses, canonical_license, d)
- except oe.license.LicenseError as exc:
- bb.fatal('%s: %s' % (d.getVar('P'), exc))
-
- 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(r'\+', '', lic))
- # add explicity avoid of CLOSED license because isn't generic
- if lic == "CLOSED":
- continue
-
- if not os.path.exists(lic_file):
- oe.qa.handle_error('license-file-missing',
- "The license listed %s was not in the "\
- "licenses collected for recipe %s"
- % (lic, pkg_dic[pkg]["PN"]), d)
- oe.qa.exit_if_errors(d)
-
- # 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 rootfs and copy_lic_manifest == "1":
- rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR')
- 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):
- oe.path.copyhardlink(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:
- pkg_license = os.path.join(pkg_license_dir, lic)
- pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
-
- if re.match(r"^generic_.*$", lic):
- generic_lic = canonical_license(d,
- re.search(r"^generic_(.*)$", lic).group(1))
-
- # Do not copy generic license into package if isn't
- # declared into LICENSES of the package.
- if not re.sub(r'\+$', '', generic_lic) in \
- [re.sub(r'\+', '', lic) for lic in \
- pkg_manifest_licenses]:
- continue
-
- if oe.license.license_ok(generic_lic,
- bad_licenses) == False:
- continue
-
- # Make sure we use only canonical name for the license file
- generic_lic_file = "generic_%s" % generic_lic
- rootfs_license = os.path.join(rootfs_license_dir, generic_lic_file)
- if not os.path.exists(rootfs_license):
- oe.path.copyhardlink(pkg_license, rootfs_license)
-
- if not os.path.exists(pkg_rootfs_license):
- os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license)
- else:
- if (oe.license.license_ok(canonical_license(d,
- lic), bad_licenses) == False or
- os.path.exists(pkg_rootfs_license)):
- continue
-
- oe.path.copyhardlink(pkg_license, pkg_rootfs_license)
- # Fixup file ownership and permissions
- for walkroot, dirs, files in os.walk(rootfs_license_dir):
- for f in files:
- p = os.path.join(walkroot, f)
- os.lchown(p, 0, 0)
- if not os.path.islink(p):
- os.chmod(p, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
- for dir in dirs:
- p = os.path.join(walkroot, dir)
- os.lchown(p, 0, 0)
- os.chmod(p, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
-
-
-
-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, rootfs=False)
-
- link_name = d.getVar('IMAGE_LINK_NAME')
- if link_name:
- lic_manifest_symlink_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
- link_name)
- # remove old symlink
- if os.path.islink(lic_manifest_symlink_dir):
- os.unlink(lic_manifest_symlink_dir)
-
- # create the image dir symlink
- if lic_manifest_dir != lic_manifest_symlink_dir:
- os.symlink(lic_manifest_dir, lic_manifest_symlink_dir)
-
-def get_deployed_dependencies(d):
- """
- Get all the deployed dependencies of an image
- """
-
- deploy = {}
- # Get all the dependencies for the current task (rootfs).
- taskdata = d.getVar("BB_TASKDEPDATA", False)
- pn = d.getVar("PN", True)
- depends = list(set([dep[0] for dep
- in list(taskdata.values())
- if not dep[0].endswith("-native") and not dep[0] == pn]))
-
- # 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)
- oe.qa.exit_if_errors(d)
-}
-
-addtask populate_lic_deploy before do_build after do_image_complete
-do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy"
-
-python license_qa_dead_symlink() {
- import os
-
- for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')):
- for file in files:
- full_path = root + "/" + file
- if os.path.islink(full_path) and not os.path.exists(full_path):
- bb.error("broken symlink: " + full_path)
-}
-IMAGE_QA_COMMANDS += "license_qa_dead_symlink"
diff --git a/poky/meta/classes/linux-dummy.bbclass b/poky/meta/classes/linux-dummy.bbclass
deleted file mode 100644
index 9a06a50..0000000
--- a/poky/meta/classes/linux-dummy.bbclass
+++ /dev/null
@@ -1,26 +0,0 @@
-
-python __anonymous () {
- if d.getVar('PREFERRED_PROVIDER_virtual/kernel') == 'linux-dummy':
- # copy part codes from kernel.bbclass
- kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
-
- # set an empty package of kernel-devicetree
- d.appendVar('PACKAGES', ' %s-devicetree' % kname)
- d.setVar('ALLOW_EMPTY:%s-devicetree' % kname, '1')
-
- # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
- type = d.getVar('KERNEL_IMAGETYPE') or ""
- alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
- types = d.getVar('KERNEL_IMAGETYPES') or ""
- if type not in types.split():
- types = (type + ' ' + types).strip()
- if alttype not in types.split():
- types = (alttype + ' ' + types).strip()
-
- # set empty packages of kernel-image-*
- for type in types.split():
- typelower = type.lower()
- d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
- d.setVar('ALLOW_EMPTY:%s-image-%s' % (kname, typelower), '1')
-}
-
diff --git a/poky/meta/classes/linux-kernel-base.bbclass b/poky/meta/classes/linux-kernel-base.bbclass
deleted file mode 100644
index ba59222..0000000
--- a/poky/meta/classes/linux-kernel-base.bbclass
+++ /dev/null
@@ -1,41 +0,0 @@
-# parse kernel ABI version out of <linux/version.h>
-def get_kernelversion_headers(p):
- import re
-
- fn = p + '/include/linux/utsrelease.h'
- if not os.path.isfile(fn):
- # after 2.6.33-rc1
- fn = p + '/include/generated/utsrelease.h'
- if not os.path.isfile(fn):
- fn = p + '/include/linux/version.h'
-
- try:
- f = open(fn, 'r')
- except IOError:
- return None
-
- l = f.readlines()
- f.close()
- r = re.compile("#define UTS_RELEASE \"(.*)\"")
- for s in l:
- m = r.match(s)
- if m:
- return m.group(1)
- return None
-
-
-def get_kernelversion_file(p):
- fn = p + '/kernel-abiversion'
-
- try:
- with open(fn, 'r') as f:
- return f.readlines()[0].strip()
- except IOError:
- return None
-
-def linux_module_packages(s, d):
- suffix = ""
- return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split()))
-
-# that's all
-
diff --git a/poky/meta/classes/linuxloader.bbclass b/poky/meta/classes/linuxloader.bbclass
deleted file mode 100644
index 4447c88..0000000
--- a/poky/meta/classes/linuxloader.bbclass
+++ /dev/null
@@ -1,76 +0,0 @@
-def get_musl_loader_arch(d):
- import re
- ldso_arch = "NotSupported"
-
- targetarch = d.getVar("TARGET_ARCH")
- if targetarch.startswith("microblaze"):
- ldso_arch = "microblaze${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el', d)}"
- elif targetarch.startswith("mips"):
- ldso_arch = "mips${ABIEXTENSION}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
- elif targetarch == "powerpc":
- ldso_arch = "powerpc${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
- elif targetarch.startswith("powerpc64"):
- ldso_arch = "powerpc64${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'le', d)}"
- elif targetarch == "x86_64":
- ldso_arch = "x86_64"
- elif re.search("i.86", targetarch):
- ldso_arch = "i386"
- elif targetarch.startswith("arm"):
- ldso_arch = "arm${ARMPKGSFX_ENDIAN}${ARMPKGSFX_EABI}"
- elif targetarch.startswith("aarch64"):
- ldso_arch = "aarch64${ARMPKGSFX_ENDIAN_64}"
- elif targetarch.startswith("riscv64"):
- ldso_arch = "riscv64${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
- elif targetarch.startswith("riscv32"):
- ldso_arch = "riscv32${@['', '-sf'][d.getVar('TARGET_FPU') == 'soft']}"
- return ldso_arch
-
-def get_musl_loader(d):
- import re
- return "/lib/ld-musl-" + get_musl_loader_arch(d) + ".so.1"
-
-def get_glibc_loader(d):
- import re
-
- dynamic_loader = "NotSupported"
- targetarch = d.getVar("TARGET_ARCH")
- if targetarch in ["powerpc", "microblaze"]:
- dynamic_loader = "${base_libdir}/ld.so.1"
- elif targetarch in ["mipsisa32r6el", "mipsisa32r6", "mipsisa64r6el", "mipsisa64r6"]:
- dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1"
- elif targetarch.startswith("mips"):
- dynamic_loader = "${base_libdir}/ld.so.1"
- elif targetarch == "powerpc64le":
- dynamic_loader = "${base_libdir}/ld64.so.2"
- elif targetarch == "powerpc64":
- dynamic_loader = "${base_libdir}/ld64.so.1"
- elif targetarch == "x86_64":
- dynamic_loader = "${base_libdir}/ld-linux-x86-64.so.2"
- elif re.search("i.86", targetarch):
- dynamic_loader = "${base_libdir}/ld-linux.so.2"
- elif targetarch == "arm":
- dynamic_loader = "${base_libdir}/ld-linux${@['-armhf', ''][d.getVar('TARGET_FPU') == 'soft']}.so.3"
- elif targetarch.startswith("aarch64"):
- dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1"
- elif targetarch.startswith("riscv64"):
- dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
- elif targetarch.startswith("riscv32"):
- dynamic_loader = "${base_libdir}/ld-linux-riscv32-ilp32${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1"
- return dynamic_loader
-
-def get_linuxloader(d):
- overrides = d.getVar("OVERRIDES").split(":")
-
- if "libc-baremetal" in overrides:
- return "NotSupported"
-
- if "libc-musl" in overrides:
- dynamic_loader = get_musl_loader(d)
- else:
- dynamic_loader = get_glibc_loader(d)
- return dynamic_loader
-
-get_linuxloader[vardepvalue] = "${@get_linuxloader(d)}"
-get_musl_loader[vardepvalue] = "${@get_musl_loader(d)}"
-get_musl_loader_arch[vardepvalue] = "${@get_musl_loader_arch(d)}"
-get_glibc_loader[vardepvalue] = "${@get_glibc_loader(d)}"
diff --git a/poky/meta/classes/live-vm-common.bbclass b/poky/meta/classes/live-vm-common.bbclass
deleted file mode 100644
index 74e7074..0000000
--- a/poky/meta/classes/live-vm-common.bbclass
+++ /dev/null
@@ -1,94 +0,0 @@
-# Some of the vars for vm and live image are conflicted, this function
-# is used for fixing the problem.
-def set_live_vm_vars(d, suffix):
- vars = ['GRUB_CFG', 'SYSLINUX_CFG', 'ROOT', 'LABELS', 'INITRD']
- for var in vars:
- var_with_suffix = var + '_' + suffix
- if d.getVar(var):
- bb.warn('Found potential conflicted var %s, please use %s rather than %s' % \
- (var, var_with_suffix, var))
- elif d.getVar(var_with_suffix):
- d.setVar(var, d.getVar(var_with_suffix))
-
-
-EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
-EFI_PROVIDER ?= "grub-efi"
-EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
-
-MKDOSFS_EXTRAOPTS ??= "-S 512"
-
-# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
-# contain "efi". This way legacy is supported by default if neither is
-# specified, maintaining the original behavior.
-def pcbios(d):
- pcbios = bb.utils.contains("MACHINE_FEATURES", "pcbios", "1", "0", d)
- if pcbios == "0":
- pcbios = bb.utils.contains("MACHINE_FEATURES", "efi", "0", "1", d)
- return pcbios
-
-PCBIOS = "${@pcbios(d)}"
-PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}"
-
-# efi_populate_common DEST BOOTLOADER
-efi_populate_common() {
- # DEST must be the root of the image so that EFIDIR is not
- # nested under a top level directory.
- DEST=$1
-
- install -d ${DEST}${EFIDIR}
-
- install -m 0644 ${DEPLOY_DIR_IMAGE}/$2-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
- EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
- printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
-}
-
-efi_iso_populate() {
- iso_dir=$1
- efi_populate $iso_dir
- # Build a EFI directory to create efi.img
- mkdir -p ${EFIIMGDIR}/${EFIDIR}
- cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
- cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
-
- EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
- printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh
-
- if [ -f "$iso_dir/initrd" ] ; then
- cp $iso_dir/initrd ${EFIIMGDIR}
- fi
-}
-
-efi_hddimg_populate() {
- efi_populate $1
-}
-
-inherit ${EFI_CLASS}
-inherit ${PCBIOS_CLASS}
-
-populate_kernel() {
- dest=$1
- install -d $dest
-
- # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
- bbnote "Trying to install ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} as $dest/${KERNEL_IMAGETYPE}"
- if [ -e ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ]; then
- install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $dest/${KERNEL_IMAGETYPE}
- else
- bbwarn "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} doesn't exist"
- fi
-
- # initrd is made of concatenation of multiple filesystem images
- if [ -n "${INITRD}" ]; then
- rm -f $dest/initrd
- for fs in ${INITRD}
- do
- if [ -s "$fs" ]; then
- cat $fs >> $dest/initrd
- else
- bbfatal "$fs is invalid. initrd image creation failed."
- fi
- done
- chmod 0644 $dest/initrd
- fi
-}
-
diff --git a/poky/meta/classes/logging.bbclass b/poky/meta/classes/logging.bbclass
deleted file mode 100644
index a0c94e9..0000000
--- a/poky/meta/classes/logging.bbclass
+++ /dev/null
@@ -1,101 +0,0 @@
-# The following logging mechanisms are to be used in bash functions of recipes.
-# They are intended to map one to one in intention and output format with the
-# python recipe logging functions of a similar naming convention: bb.plain(),
-# bb.note(), etc.
-
-LOGFIFO = "${T}/fifo.${@os.getpid()}"
-
-# Print the output exactly as it is passed in. Typically used for output of
-# tasks that should be seen on the console. Use sparingly.
-# Output: logs console
-bbplain() {
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bbplain $*" > ${LOGFIFO}
- else
- echo "$*"
- fi
-}
-
-# Notify the user of a noteworthy condition.
-# Output: logs
-bbnote() {
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bbnote $*" > ${LOGFIFO}
- else
- echo "NOTE: $*"
- fi
-}
-
-# Print a warning to the log. Warnings are non-fatal, and do not
-# indicate a build failure.
-# Output: logs console
-bbwarn() {
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bbwarn $*" > ${LOGFIFO}
- else
- echo "WARNING: $*"
- fi
-}
-
-# Print an error to the log. Errors are non-fatal in that the build can
-# continue, but they do indicate a build failure.
-# Output: logs console
-bberror() {
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bberror $*" > ${LOGFIFO}
- else
- echo "ERROR: $*"
- fi
-}
-
-# Print a fatal error to the log. Fatal errors indicate build failure
-# and halt the build, exiting with an error code.
-# Output: logs console
-bbfatal() {
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bbfatal $*" > ${LOGFIFO}
- else
- echo "ERROR: $*"
- fi
- exit 1
-}
-
-# Like bbfatal, except prevents the suppression of the error log by
-# bitbake's UI.
-# Output: logs console
-bbfatal_log() {
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bbfatal_log $*" > ${LOGFIFO}
- else
- echo "ERROR: $*"
- fi
- exit 1
-}
-
-# Print debug messages. These are appropriate for progress checkpoint
-# messages to the logs. Depending on the debug log level, they may also
-# go to the console.
-# Output: logs console
-# Usage: bbdebug 1 "first level debug message"
-# bbdebug 2 "second level debug message"
-bbdebug() {
- USAGE='Usage: bbdebug [123] "message"'
- if [ $# -lt 2 ]; then
- bbfatal "$USAGE"
- fi
-
- # Strip off the debug level and ensure it is an integer
- DBGLVL=$1; shift
- NONDIGITS=$(echo "$DBGLVL" | tr -d "[:digit:]")
- if [ "$NONDIGITS" ]; then
- bbfatal "$USAGE"
- fi
-
- # All debug output is printed to the logs
- if [ -p ${LOGFIFO} ] ; then
- printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO}
- else
- echo "DEBUG: $*"
- fi
-}
-
diff --git a/poky/meta/classes/manpages.bbclass b/poky/meta/classes/manpages.bbclass
deleted file mode 100644
index 5e09c77..0000000
--- a/poky/meta/classes/manpages.bbclass
+++ /dev/null
@@ -1,45 +0,0 @@
-# Inherit this class to enable or disable building and installation of manpages
-# depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building
-# tends to pull in the entire XML stack and other tools, so it's not enabled
-# by default.
-PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
-
-inherit qemu
-
-# usually manual files are packaged to ${PN}-doc except man-pages
-MAN_PKG ?= "${PN}-doc"
-
-# only add man-db to RDEPENDS when manual files are built and installed
-RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
-
-pkg_postinst:${MAN_PKG}:append () {
- # only update manual page index caches when manual files are built and installed
- if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
- if test -n "$D"; then
- if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
- sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
- chown -R root:root $D${mandir}
-
- mkdir -p $D${localstatedir}/cache/man
- cd $D${mandir}
- find . -name index.db | while read index; do
- mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
- mv ${index} $D${localstatedir}/cache/man/${index}
- chown man:man $D${localstatedir}/cache/man/${index}
- done
- cd -
- else
- $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
- fi
- else
- mandb -q
- fi
- fi
-}
-
-pkg_postrm:${MAN_PKG}:append () {
- # only update manual page index caches when manual files are built and installed
- if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
- mandb -q
- fi
-}
diff --git a/poky/meta/classes/mcextend.bbclass b/poky/meta/classes/mcextend.bbclass
index 0f8f962..a489eeb 100644
--- a/poky/meta/classes/mcextend.bbclass
+++ b/poky/meta/classes/mcextend.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
python mcextend_virtclass_handler () {
cls = e.data.getVar("BBEXTENDCURR")
variant = e.data.getVar("BBEXTENDVARIANT")
diff --git a/poky/meta/classes/meson-routines.bbclass b/poky/meta/classes/meson-routines.bbclass
deleted file mode 100644
index be3aeed..0000000
--- a/poky/meta/classes/meson-routines.bbclass
+++ /dev/null
@@ -1,51 +0,0 @@
-inherit siteinfo
-
-def meson_array(var, d):
- items = d.getVar(var).split()
- return repr(items[0] if len(items) == 1 else items)
-
-# Map our ARCH values to what Meson expects:
-# http://mesonbuild.com/Reference-tables.html#cpu-families
-def meson_cpu_family(var, d):
- import re
- arch = d.getVar(var)
- if arch == 'powerpc':
- return 'ppc'
- elif arch == 'powerpc64' or arch == 'powerpc64le':
- return 'ppc64'
- elif arch == 'armeb':
- return 'arm'
- elif arch == 'aarch64_be':
- return 'aarch64'
- elif arch == 'mipsel':
- return 'mips'
- elif arch == 'mips64el':
- return 'mips64'
- elif re.match(r"i[3-6]86", arch):
- return "x86"
- elif arch == "microblazeel":
- return "microblaze"
- else:
- return arch
-
-# Map our OS values to what Meson expects:
-# https://mesonbuild.com/Reference-tables.html#operating-system-names
-def meson_operating_system(var, d):
- os = d.getVar(var)
- if "mingw" in os:
- return "windows"
- # avoid e.g 'linux-gnueabi'
- elif "linux" in os:
- return "linux"
- else:
- return os
-
-def meson_endian(prefix, d):
- arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
- sitedata = siteinfo_data_for_machine(arch, os, d)
- if "endian-little" in sitedata:
- return "little"
- elif "endian-big" in sitedata:
- return "big"
- else:
- bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
diff --git a/poky/meta/classes/meson.bbclass b/poky/meta/classes/meson.bbclass
deleted file mode 100644
index 546cd04..0000000
--- a/poky/meta/classes/meson.bbclass
+++ /dev/null
@@ -1,173 +0,0 @@
-inherit python3native meson-routines qemu
-
-DEPENDS:append = " meson-native ninja-native"
-
-EXEWRAPPER_ENABLED:class-native = "False"
-EXEWRAPPER_ENABLED:class-nativesdk = "False"
-EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}"
-DEPENDS:append = "${@' qemu-native' if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ''}"
-
-# As Meson enforces out-of-tree builds we can just use cleandirs
-B = "${WORKDIR}/build"
-do_configure[cleandirs] = "${B}"
-
-# Where the meson.build build configuration is
-MESON_SOURCEPATH = "${S}"
-
-def noprefix(var, d):
- return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1)
-
-MESON_BUILDTYPE ?= "${@oe.utils.vartrue('DEBUG_BUILD', 'debug', 'plain', d)}"
-MESON_BUILDTYPE[vardeps] += "DEBUG_BUILD"
-MESONOPTS = " --prefix ${prefix} \
- --buildtype ${MESON_BUILDTYPE} \
- --bindir ${@noprefix('bindir', d)} \
- --sbindir ${@noprefix('sbindir', d)} \
- --datadir ${@noprefix('datadir', d)} \
- --libdir ${@noprefix('libdir', d)} \
- --libexecdir ${@noprefix('libexecdir', d)} \
- --includedir ${@noprefix('includedir', d)} \
- --mandir ${@noprefix('mandir', d)} \
- --infodir ${@noprefix('infodir', d)} \
- --sysconfdir ${sysconfdir} \
- --localstatedir ${localstatedir} \
- --sharedstatedir ${sharedstatedir} \
- --wrap-mode nodownload \
- --native-file ${WORKDIR}/meson.native"
-
-EXTRA_OEMESON:append = " ${PACKAGECONFIG_CONFARGS}"
-
-MESON_CROSS_FILE = ""
-MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross"
-MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
-
-# Needed to set up qemu wrapper below
-export STAGING_DIR_HOST
-
-def rust_tool(d, target_var):
- rustc = d.getVar('RUSTC')
- if not rustc:
- return ""
- cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split()
- return "rust = %s" % repr(cmd)
-
-addtask write_config before do_configure
-do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS"
-do_write_config() {
- # This needs to be Py to split the args into single-element lists
- cat >${WORKDIR}/meson.cross <<EOF
-[binaries]
-c = ${@meson_array('CC', d)}
-cpp = ${@meson_array('CXX', d)}
-cython = 'cython3'
-ar = ${@meson_array('AR', d)}
-nm = ${@meson_array('NM', d)}
-strip = ${@meson_array('STRIP', d)}
-readelf = ${@meson_array('READELF', d)}
-objcopy = ${@meson_array('OBJCOPY', d)}
-pkgconfig = 'pkg-config'
-llvm-config = 'llvm-config${LLVMVERSION}'
-cups-config = 'cups-config'
-g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper'
-g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper'
-${@rust_tool(d, "HOST_SYS")}
-${@"exe_wrapper = '${WORKDIR}/meson-qemuwrapper'" if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ""}
-
-[built-in options]
-c_args = ${@meson_array('CFLAGS', d)}
-c_link_args = ${@meson_array('LDFLAGS', d)}
-cpp_args = ${@meson_array('CXXFLAGS', d)}
-cpp_link_args = ${@meson_array('LDFLAGS', d)}
-
-[properties]
-needs_exe_wrapper = true
-
-[host_machine]
-system = '${@meson_operating_system('HOST_OS', d)}'
-cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
-cpu = '${HOST_ARCH}'
-endian = '${@meson_endian('HOST', d)}'
-
-[target_machine]
-system = '${@meson_operating_system('TARGET_OS', d)}'
-cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
-cpu = '${TARGET_ARCH}'
-endian = '${@meson_endian('TARGET', d)}'
-EOF
-
- cat >${WORKDIR}/meson.native <<EOF
-[binaries]
-c = ${@meson_array('BUILD_CC', d)}
-cpp = ${@meson_array('BUILD_CXX', d)}
-cython = 'cython3'
-ar = ${@meson_array('BUILD_AR', d)}
-nm = ${@meson_array('BUILD_NM', d)}
-strip = ${@meson_array('BUILD_STRIP', d)}
-readelf = ${@meson_array('BUILD_READELF', d)}
-objcopy = ${@meson_array('BUILD_OBJCOPY', d)}
-pkgconfig = 'pkg-config-native'
-${@rust_tool(d, "BUILD_SYS")}
-
-[built-in options]
-c_args = ${@meson_array('BUILD_CFLAGS', d)}
-c_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
-cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)}
-cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
-EOF
-}
-
-do_write_config:append:class-target() {
- # Write out a qemu wrapper that will be used as exe_wrapper so that meson
- # can run target helper binaries through that.
- qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
- cat > ${WORKDIR}/meson-qemuwrapper << EOF
-#!/bin/sh
-# Use a modules directory which doesn't exist so we don't load random things
-# which may then get deleted (or their dependencies) and potentially segfault
-export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
-
-# meson sets this wrongly (only to libs in build-dir), qemu_wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
-unset LD_LIBRARY_PATH
-
-$qemu_binary "\$@"
-EOF
- chmod +x ${WORKDIR}/meson-qemuwrapper
-}
-
-# Tell externalsrc that changes to this file require a reconfigure
-CONFIGURE_FILES = "meson.build"
-
-meson_do_configure() {
- # Meson requires this to be 'bfd, 'lld' or 'gold' from 0.53 onwards
- # https://github.com/mesonbuild/meson/commit/ef9aeb188ea2bc7353e59916c18901cde90fa2b3
- unset LD
-
- # Work around "Meson fails if /tmp is mounted with noexec #2972"
- mkdir -p "${B}/meson-private/tmp"
- export TMPDIR="${B}/meson-private/tmp"
- bbnote Executing meson ${EXTRA_OEMESON}...
- if ! meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then
- bbfatal_log meson failed
- fi
-}
-
-python meson_do_qa_configure() {
- import re
- warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)
- with open(d.expand("${B}/meson-logs/meson-log.txt")) as logfile:
- log = logfile.read()
- for (prop, value) in warn_re.findall(log):
- bb.warn("Meson cross property %s used without explicit assignment, defaulting to %s" % (prop, value))
-}
-do_configure[postfuncs] += "meson_do_qa_configure"
-
-do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
-meson_do_compile() {
- ninja -v ${PARALLEL_MAKE}
-}
-
-meson_do_install() {
- DESTDIR='${D}' ninja -v ${PARALLEL_MAKEINST} install
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/metadata_scm.bbclass b/poky/meta/classes/metadata_scm.bbclass
index f646b31..6842119 100644
--- a/poky/meta/classes/metadata_scm.bbclass
+++ b/poky/meta/classes/metadata_scm.bbclass
@@ -1,3 +1,8 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
METADATA_BRANCH := "${@oe.buildcfg.detect_branch(d)}"
METADATA_BRANCH[vardepvalue] = "${METADATA_BRANCH}"
diff --git a/poky/meta/classes/migrate_localcount.bbclass b/poky/meta/classes/migrate_localcount.bbclass
index 810a541..1d00c11 100644
--- a/poky/meta/classes/migrate_localcount.bbclass
+++ b/poky/meta/classes/migrate_localcount.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
PRSERV_DUMPDIR ??= "${LOG_DIR}/db"
LOCALCOUNT_DUMPFILE ??= "${PRSERV_DUMPDIR}/prserv-localcount-exports.inc"
diff --git a/poky/meta/classes/mime-xdg.bbclass b/poky/meta/classes/mime-xdg.bbclass
deleted file mode 100644
index 271f48d..0000000
--- a/poky/meta/classes/mime-xdg.bbclass
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# This class creates mime <-> application associations based on entry
-# 'MimeType' in *.desktop files
-#
-
-DEPENDS += "desktop-file-utils"
-PACKAGE_WRITE_DEPS += "desktop-file-utils-native"
-DESKTOPDIR = "${datadir}/applications"
-
-# There are recipes out there installing their .desktop files as absolute
-# symlinks. For us these are dangling and cannot be introspected for "MimeType"
-# easily. By addding package-names to MIME_XDG_PACKAGES, packager can force
-# proper update-desktop-database handling. Note that all introspection is
-# skipped for MIME_XDG_PACKAGES not empty
-MIME_XDG_PACKAGES ?= ""
-
-mime_xdg_postinst() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_desktop_database ${PKG} \
- mlprefix=${MLPREFIX} \
- desktop_dir=${DESKTOPDIR}
-else
- update-desktop-database $D${DESKTOPDIR}
-fi
-}
-
-mime_xdg_postrm() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_desktop_database ${PKG} \
- mlprefix=${MLPREFIX} \
- desktop_dir=${DESKTOPDIR}
-else
- update-desktop-database $D${DESKTOPDIR}
-fi
-}
-
-python populate_packages:append () {
- packages = d.getVar('PACKAGES').split()
- pkgdest = d.getVar('PKGDEST')
- desktop_base = d.getVar('DESKTOPDIR')
- forced_mime_xdg_pkgs = (d.getVar('MIME_XDG_PACKAGES') or '').split()
-
- for pkg in packages:
- desktops_with_mime_found = pkg in forced_mime_xdg_pkgs
- if d.getVar('MIME_XDG_PACKAGES') == '':
- desktop_dir = '%s/%s%s' % (pkgdest, pkg, desktop_base)
- if os.path.exists(desktop_dir):
- for df in os.listdir(desktop_dir):
- if df.endswith('.desktop'):
- try:
- with open(desktop_dir + '/'+ df, 'r') as f:
- for line in f.read().split('\n'):
- if 'MimeType' in line:
- desktops_with_mime_found = True
- break;
- except:
- bb.warn('Could not open %s. Set MIME_XDG_PACKAGES in recipe or add mime-xdg to INSANE_SKIP.' % desktop_dir + '/'+ df)
- if desktops_with_mime_found:
- break
- if desktops_with_mime_found:
- bb.note("adding mime-xdg postinst and postrm scripts to %s" % pkg)
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('mime_xdg_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
- postrm = d.getVar('pkg_postrm:%s' % pkg)
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('mime_xdg_postrm')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
- bb.note("adding desktop-file-utils dependency to %s" % pkg)
- d.appendVar('RDEPENDS:' + pkg, " " + d.getVar('MLPREFIX')+"desktop-file-utils")
-}
diff --git a/poky/meta/classes/mime.bbclass b/poky/meta/classes/mime.bbclass
deleted file mode 100644
index 8d176a8..0000000
--- a/poky/meta/classes/mime.bbclass
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# This class is used by recipes installing mime types
-#
-
-DEPENDS += "${@bb.utils.contains('BPN', 'shared-mime-info', '', 'shared-mime-info', d)}"
-PACKAGE_WRITE_DEPS += "shared-mime-info-native"
-MIMEDIR = "${datadir}/mime"
-
-mime_postinst() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
- mlprefix=${MLPREFIX} \
- mimedir=${MIMEDIR}
-else
- echo "Updating MIME database... this may take a while."
- update-mime-database $D${MIMEDIR}
-fi
-}
-
-mime_postrm() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
- mlprefix=${MLPREFIX} \
- mimedir=${MIMEDIR}
-else
- echo "Updating MIME database... this may take a while."
- # $D${MIMEDIR}/packages belong to package shared-mime-info-data,
- # packages like libfm-mime depend on shared-mime-info-data.
- # after shared-mime-info-data uninstalled, $D${MIMEDIR}/packages
- # is removed, but update-mime-database need this dir to update
- # database, workaround to create one and remove it later
- if [ ! -d $D${MIMEDIR}/packages ]; then
- mkdir -p $D${MIMEDIR}/packages
- update-mime-database $D${MIMEDIR}
- rmdir --ignore-fail-on-non-empty $D${MIMEDIR}/packages
- else
- update-mime-database $D${MIMEDIR}
-fi
-fi
-}
-
-python populate_packages:append () {
- packages = d.getVar('PACKAGES').split()
- pkgdest = d.getVar('PKGDEST')
- mimedir = d.getVar('MIMEDIR')
-
- for pkg in packages:
- mime_packages_dir = '%s/%s%s/packages' % (pkgdest, pkg, mimedir)
- mimes_types_found = False
- if os.path.exists(mime_packages_dir):
- for f in os.listdir(mime_packages_dir):
- if f.endswith('.xml'):
- mimes_types_found = True
- break
- if mimes_types_found:
- bb.note("adding mime postinst and postrm scripts to %s" % pkg)
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('mime_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
- postrm = d.getVar('pkg_postrm:%s' % pkg)
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('mime_postrm')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
- if pkg != 'shared-mime-info-data':
- bb.note("adding shared-mime-info-data dependency to %s" % pkg)
- d.appendVar('RDEPENDS:' + pkg, " " + d.getVar('MLPREFIX')+"shared-mime-info-data")
-}
diff --git a/poky/meta/classes/mirrors.bbclass b/poky/meta/classes/mirrors.bbclass
deleted file mode 100644
index ffdccff..0000000
--- a/poky/meta/classes/mirrors.bbclass
+++ /dev/null
@@ -1,89 +0,0 @@
-MIRRORS += "\
-${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian/20180310T215105Z/pool \
-${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian-archive/20120328T092752Z/debian/pool \
-${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian-archive/20110127T084257Z/debian/pool \
-${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian-archive/20090802T004153Z/debian/pool \
-${DEBIAN_MIRROR} http://ftp.de.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.au.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.cl.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.hr.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.fi.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.hk.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.hu.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.ie.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.it.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.jp.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.no.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.pl.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.ro.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.si.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.es.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.se.debian.org/debian/pool \
-${DEBIAN_MIRROR} http://ftp.tr.debian.org/debian/pool \
-${GNU_MIRROR} https://mirrors.kernel.org/gnu \
-${KERNELORG_MIRROR} http://www.kernel.org/pub \
-${GNUPG_MIRROR} ftp://ftp.gnupg.org/gcrypt \
-${GNUPG_MIRROR} ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt \
-${GNUPG_MIRROR} ftp://mirrors.dotsrc.org/gcrypt \
-ftp://dante.ctan.org/tex-archive ftp://ftp.fu-berlin.de/tex/CTAN \
-ftp://dante.ctan.org/tex-archive http://sunsite.sut.ac.jp/pub/archives/ctan/ \
-ftp://dante.ctan.org/tex-archive http://ctan.unsw.edu.au/ \
-ftp://ftp.gnutls.org/gcrypt/gnutls ${GNUPG_MIRROR}/gnutls \
-http://ftp.info-zip.org/pub/infozip/src/ ftp://sunsite.icm.edu.pl/pub/unix/archiving/info-zip/src/ \
-http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/ http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/ \
-${APACHE_MIRROR} http://www.us.apache.org/dist \
-${APACHE_MIRROR} http://archive.apache.org/dist \
-http://downloads.sourceforge.net/watchdog/ http://fossies.org/linux/misc/ \
-${SAVANNAH_GNU_MIRROR} http://download-mirror.savannah.gnu.org/releases \
-${SAVANNAH_NONGNU_MIRROR} http://download-mirror.savannah.nongnu.org/releases \
-ftp://sourceware.org/pub http://mirrors.kernel.org/sourceware \
-ftp://sourceware.org/pub http://gd.tuwien.ac.at/gnu/sourceware \
-ftp://sourceware.org/pub http://ftp.gwdg.de/pub/linux/sources.redhat.com/sourceware \
-cvs://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-svn://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-gitsm://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-hg://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-p4://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-osc://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-https?://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-ftp://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
-npm://.*/?.* http://downloads.yoctoproject.org/mirror/sources/ \
-cvs://.*/.* http://sources.openembedded.org/ \
-svn://.*/.* http://sources.openembedded.org/ \
-git://.*/.* http://sources.openembedded.org/ \
-gitsm://.*/.* http://sources.openembedded.org/ \
-hg://.*/.* http://sources.openembedded.org/ \
-bzr://.*/.* http://sources.openembedded.org/ \
-p4://.*/.* http://sources.openembedded.org/ \
-osc://.*/.* http://sources.openembedded.org/ \
-https?://.*/.* http://sources.openembedded.org/ \
-ftp://.*/.* http://sources.openembedded.org/ \
-npm://.*/?.* http://sources.openembedded.org/ \
-${CPAN_MIRROR} http://cpan.metacpan.org/ \
-${CPAN_MIRROR} http://search.cpan.org/CPAN/ \
-https?://downloads.yoctoproject.org/releases/uninative/ https://mirrors.kernel.org/yocto/uninative/ \
-https?://downloads.yoctoproject.org/mirror/sources/ https://mirrors.kernel.org/yocto-sources/ \
-"
-
-# Use MIRRORS to provide git repo fallbacks using the https protocol, for cases
-# where git native protocol fetches may fail due to local firewall rules, etc.
-
-MIRRORS += "\
-git://salsa.debian.org/.* git://salsa.debian.org/PATH;protocol=https \
-git://git.gnome.org/.* git://gitlab.gnome.org/GNOME/PATH;protocol=https \
-git://.*/.* git://HOST/PATH;protocol=https \
-git://.*/.* git://HOST/git/PATH;protocol=https \
-"
-
-# Switch glibc and binutils recipes to use shallow clones as they're large and this
-# improves user experience whilst allowing the flexibility of git urls in the recipes
-BB_GIT_SHALLOW:pn-binutils = "1"
-BB_GIT_SHALLOW:pn-binutils-cross-${TARGET_ARCH} = "1"
-BB_GIT_SHALLOW:pn-binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} = "1"
-BB_GIT_SHALLOW:pn-binutils-cross-testsuite = "1"
-BB_GIT_SHALLOW:pn-binutils-crosssdk-${SDK_SYS} = "1"
-BB_GIT_SHALLOW:pn-glibc = "1"
-PREMIRRORS += "git://sourceware.org/git/glibc.git https://downloads.yoctoproject.org/mirror/sources/ \
- git://sourceware.org/git/binutils-gdb.git https://downloads.yoctoproject.org/mirror/sources/"
diff --git a/poky/meta/classes/module-base.bbclass b/poky/meta/classes/module-base.bbclass
deleted file mode 100644
index 27bd69f..0000000
--- a/poky/meta/classes/module-base.bbclass
+++ /dev/null
@@ -1,21 +0,0 @@
-inherit kernel-arch
-
-# We do the dependency this way because the output is not preserved
-# in sstate, so we must force do_compile to run (once).
-do_configure[depends] += "make-mod-scripts:do_compile"
-
-export OS = "${TARGET_OS}"
-export CROSS_COMPILE = "${TARGET_PREFIX}"
-
-# This points to the build artefacts from the main kernel build
-# such as .config and System.map
-# Confusingly it is not the module build output (which is ${B}) but
-# we didn't pick the name.
-export KBUILD_OUTPUT = "${STAGING_KERNEL_BUILDDIR}"
-
-export KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
-KERNEL_OBJECT_SUFFIX = ".ko"
-
-# kernel modules are generally machine specific
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
diff --git a/poky/meta/classes/module.bbclass b/poky/meta/classes/module.bbclass
deleted file mode 100644
index a09ec3e..0000000
--- a/poky/meta/classes/module.bbclass
+++ /dev/null
@@ -1,74 +0,0 @@
-inherit module-base kernel-module-split pkgconfig
-
-EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
-
-MODULES_INSTALL_TARGET ?= "modules_install"
-MODULES_MODULE_SYMVERS_LOCATION ?= ""
-
-python __anonymous () {
- depends = d.getVar('DEPENDS')
- extra_symbols = []
- for dep in depends.split():
- if dep.startswith("kernel-module-"):
- extra_symbols.append("${STAGING_INCDIR}/" + dep + "/Module.symvers")
- d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
-}
-
-python do_devshell:prepend () {
- os.environ['CFLAGS'] = ''
- os.environ['CPPFLAGS'] = ''
- os.environ['CXXFLAGS'] = ''
- os.environ['LDFLAGS'] = ''
-
- os.environ['KERNEL_PATH'] = d.getVar('STAGING_KERNEL_DIR')
- os.environ['KERNEL_SRC'] = d.getVar('STAGING_KERNEL_DIR')
- os.environ['KERNEL_VERSION'] = d.getVar('KERNEL_VERSION')
- os.environ['CC'] = d.getVar('KERNEL_CC')
- os.environ['LD'] = d.getVar('KERNEL_LD')
- os.environ['AR'] = d.getVar('KERNEL_AR')
- os.environ['O'] = d.getVar('STAGING_KERNEL_BUILDDIR')
- kbuild_extra_symbols = d.getVar('KBUILD_EXTRA_SYMBOLS')
- if kbuild_extra_symbols:
- os.environ['KBUILD_EXTRA_SYMBOLS'] = kbuild_extra_symbols
- else:
- os.environ['KBUILD_EXTRA_SYMBOLS'] = ''
-}
-
-module_do_compile() {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
- KERNEL_VERSION=${KERNEL_VERSION} \
- CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
- AR="${KERNEL_AR}" \
- O=${STAGING_KERNEL_BUILDDIR} \
- KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
- ${MAKE_TARGETS}
-}
-
-module_do_install() {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- oe_runmake DEPMOD=echo MODLIB="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}" \
- INSTALL_FW_PATH="${D}${nonarch_base_libdir}/firmware" \
- CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
- O=${STAGING_KERNEL_BUILDDIR} \
- ${MODULES_INSTALL_TARGET}
-
- if [ ! -e "${B}/${MODULES_MODULE_SYMVERS_LOCATION}/Module.symvers" ] ; then
- bbwarn "Module.symvers not found in ${B}/${MODULES_MODULE_SYMVERS_LOCATION}"
- bbwarn "Please consider setting MODULES_MODULE_SYMVERS_LOCATION to a"
- bbwarn "directory below B to get correct inter-module dependencies"
- else
- install -Dm0644 "${B}/${MODULES_MODULE_SYMVERS_LOCATION}"/Module.symvers ${D}${includedir}/${BPN}/Module.symvers
- # Module.symvers contains absolute path to the build directory.
- # While it doesn't actually seem to matter which path is specified,
- # clear them out to avoid confusion
- sed -e 's:${B}/::g' -i ${D}${includedir}/${BPN}/Module.symvers
- fi
-}
-
-EXPORT_FUNCTIONS do_compile do_install
-
-# add all splitted modules to PN RDEPENDS, PN can be empty now
-KERNEL_MODULES_META_PACKAGE = "${PN}"
-FILES:${PN} = ""
-ALLOW_EMPTY:${PN} = "1"
diff --git a/poky/meta/classes/multilib.bbclass b/poky/meta/classes/multilib.bbclass
index 5859ca8..10a4ef9 100644
--- a/poky/meta/classes/multilib.bbclass
+++ b/poky/meta/classes/multilib.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
python multilib_virtclass_handler () {
cls = e.data.getVar("BBEXTENDCURR")
variant = e.data.getVar("BBEXTENDVARIANT")
diff --git a/poky/meta/classes/multilib_global.bbclass b/poky/meta/classes/multilib_global.bbclass
index e06307d..dcd89b2 100644
--- a/poky/meta/classes/multilib_global.bbclass
+++ b/poky/meta/classes/multilib_global.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
def preferred_ml_updates(d):
# If any of PREFERRED_PROVIDER, PREFERRED_RPROVIDER, REQUIRED_VERSION
# or PREFERRED_VERSION are set, we need to mirror these variables in
diff --git a/poky/meta/classes/multilib_header.bbclass b/poky/meta/classes/multilib_header.bbclass
deleted file mode 100644
index efbc24f..0000000
--- a/poky/meta/classes/multilib_header.bbclass
+++ /dev/null
@@ -1,52 +0,0 @@
-inherit siteinfo
-
-# If applicable on the architecture, this routine will rename the header and
-# add a unique identifier to the name for the ABI/bitsize that is being used.
-# A wrapper will be generated for the architecture that knows how to call
-# all of the ABI variants for that given architecture.
-#
-oe_multilib_header() {
-
- case ${HOST_OS} in
- *-musl*)
- return
- ;;
- *)
- esac
- # For MIPS: "n32" is a special case, which needs to be
- # distinct from both 64-bit and 32-bit.
- case ${TARGET_ARCH} in
- mips*) case "${MIPSPKGSFX_ABI}" in
- "-n32")
- ident=n32
- ;;
- *)
- ident=${SITEINFO_BITS}
- ;;
- esac
- ;;
- *) ident=${SITEINFO_BITS}
- esac
- for each_header in "$@" ; do
- if [ ! -f "${D}/${includedir}/$each_header" ]; then
- bberror "oe_multilib_header: Unable to find header $each_header."
- continue
- fi
- stem=$(echo $each_header | sed 's#\.h$##')
- # if mips64/n32 set ident to n32
- mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h
-
- sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header
- done
-}
-
-# Dependencies on arch variables like MIPSPKGSFX_ABI can be problematic.
-# We don't need multilib headers for native builds so brute force things.
-oe_multilib_header:class-native () {
- return
-}
-
-# Nor do we need multilib headers for nativesdk builds.
-oe_multilib_header:class-nativesdk () {
- return
-}
diff --git a/poky/meta/classes/multilib_script.bbclass b/poky/meta/classes/multilib_script.bbclass
deleted file mode 100644
index 4159734..0000000
--- a/poky/meta/classes/multilib_script.bbclass
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
-# MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
-# to indicate which script files to process from which packages.
-#
-
-inherit update-alternatives
-
-MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
-
-PACKAGE_PREPROCESS_FUNCS += "multilibscript_rename"
-
-multilibscript_rename() {
- :
-}
-
-python () {
- # Do nothing if multilib isn't being used
- if not d.getVar("MULTILIB_VARIANTS"):
- return
- # Do nothing for native/cross
- if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
- return
-
- for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split():
- pkg, script = entry.split(":")
- epkg = d.expand(pkg)
- scriptname = os.path.basename(script)
- d.appendVar("ALTERNATIVE:" + epkg, " " + scriptname + " ")
- d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
- d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
- d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
- d.appendVar("FILES:" + epkg, " " + script + "-${MULTILIB_SUFFIX}")
-}
diff --git a/poky/meta/classes/native.bbclass b/poky/meta/classes/native.bbclass
deleted file mode 100644
index 5a273cd..0000000
--- a/poky/meta/classes/native.bbclass
+++ /dev/null
@@ -1,230 +0,0 @@
-# We want native packages to be relocatable
-inherit relocatable
-
-# Native packages are built indirectly via dependency,
-# no need for them to be a direct target of 'world'
-EXCLUDE_FROM_WORLD = "1"
-
-PACKAGE_ARCH = "${BUILD_ARCH}"
-
-# used by cmake class
-OECMAKE_RPATH = "${libdir}"
-OECMAKE_RPATH:class-native = "${libdir}"
-
-TARGET_ARCH = "${BUILD_ARCH}"
-TARGET_OS = "${BUILD_OS}"
-TARGET_VENDOR = "${BUILD_VENDOR}"
-TARGET_PREFIX = "${BUILD_PREFIX}"
-TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
-TARGET_LD_ARCH = "${BUILD_LD_ARCH}"
-TARGET_AS_ARCH = "${BUILD_AS_ARCH}"
-TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}"
-TARGET_CFLAGS = "${BUILD_CFLAGS}"
-TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}"
-TARGET_LDFLAGS = "${BUILD_LDFLAGS}"
-TARGET_FPU = ""
-TUNE_FEATURES = ""
-ABIEXTENSION = ""
-
-HOST_ARCH = "${BUILD_ARCH}"
-HOST_OS = "${BUILD_OS}"
-HOST_VENDOR = "${BUILD_VENDOR}"
-HOST_PREFIX = "${BUILD_PREFIX}"
-HOST_CC_ARCH = "${BUILD_CC_ARCH}"
-HOST_LD_ARCH = "${BUILD_LD_ARCH}"
-HOST_AS_ARCH = "${BUILD_AS_ARCH}"
-
-CPPFLAGS = "${BUILD_CPPFLAGS}"
-CFLAGS = "${BUILD_CFLAGS}"
-CXXFLAGS = "${BUILD_CXXFLAGS}"
-LDFLAGS = "${BUILD_LDFLAGS}"
-
-STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}"
-STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}"
-
-# native pkg doesn't need the TOOLCHAIN_OPTIONS.
-TOOLCHAIN_OPTIONS = ""
-
-# Don't build ptest natively
-PTEST_ENABLED = "0"
-
-# Don't use site files for native builds
-export CONFIG_SITE = "${COREBASE}/meta/site/native"
-
-# set the compiler as well. It could have been set to something else
-export CC = "${BUILD_CC}"
-export CXX = "${BUILD_CXX}"
-export FC = "${BUILD_FC}"
-export CPP = "${BUILD_CPP}"
-export LD = "${BUILD_LD}"
-export CCLD = "${BUILD_CCLD}"
-export AR = "${BUILD_AR}"
-export AS = "${BUILD_AS}"
-export RANLIB = "${BUILD_RANLIB}"
-export STRIP = "${BUILD_STRIP}"
-export NM = "${BUILD_NM}"
-
-# Path prefixes
-base_prefix = "${STAGING_DIR_NATIVE}"
-prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-
-bindir = "${STAGING_BINDIR_NATIVE}"
-sbindir = "${STAGING_SBINDIR_NATIVE}"
-base_libdir = "${STAGING_LIBDIR_NATIVE}"
-libdir = "${STAGING_LIBDIR_NATIVE}"
-includedir = "${STAGING_INCDIR_NATIVE}"
-sysconfdir = "${STAGING_ETCDIR_NATIVE}"
-datadir = "${STAGING_DATADIR_NATIVE}"
-
-baselib = "lib"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
-
-NATIVE_PACKAGE_PATH_SUFFIX ?= ""
-bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-sbindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-base_libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
-
-do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
-do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
-
-# Since we actually install these into situ there is no staging prefix
-STAGING_DIR_HOST = ""
-STAGING_DIR_TARGET = ""
-PKG_CONFIG_DIR = "${libdir}/pkgconfig"
-
-EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
-PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
-PKG_CONFIG_SYSROOT_DIR = ""
-PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1"
-PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
-
-# we dont want libc-*libc to kick in for native recipes
-LIBCOVERRIDE = ""
-CLASSOVERRIDE = "class-native"
-MACHINEOVERRIDES = ""
-MACHINE_FEATURES = ""
-
-PATH:prepend = "${COREBASE}/scripts/native-intercept:"
-
-# This class encodes staging paths into its scripts data so can only be
-# reused if we manipulate the paths.
-SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
-
-# No strip sysroot when DEBUG_BUILD is enabled
-INHIBIT_SYSROOT_STRIP ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '', d)}"
-
-python native_virtclass_handler () {
- pn = e.data.getVar("PN")
- if not pn.endswith("-native"):
- return
- bpn = e.data.getVar("BPN")
-
- # Set features here to prevent appends and distro features backfill
- # from modifying native distro features
- features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
- filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
- d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
-
- classextend = e.data.getVar('BBCLASSEXTEND') or ""
- if "native" not in classextend:
- return
-
- def map_dependencies(varname, d, suffix = "", selfref=True):
- if suffix:
- varname = varname + ":" + suffix
- deps = d.getVar(varname)
- if not deps:
- return
- deps = bb.utils.explode_deps(deps)
- newdeps = []
- for dep in deps:
- if dep == pn:
- if not selfref:
- continue
- newdeps.append(dep)
- elif "-cross-" in dep:
- newdeps.append(dep.replace("-cross", "-native"))
- elif not dep.endswith("-native"):
- # Replace ${PN} with ${BPN} in the dependency to make sure
- # dependencies on, e.g., ${PN}-foo become ${BPN}-foo-native
- # rather than ${BPN}-native-foo-native.
- newdeps.append(dep.replace(pn, bpn) + "-native")
- else:
- newdeps.append(dep)
- d.setVar(varname, " ".join(newdeps), parsing=True)
-
- map_dependencies("DEPENDS", e.data, selfref=False)
- for pkg in e.data.getVar("PACKAGES", False).split():
- map_dependencies("RDEPENDS", e.data, pkg)
- map_dependencies("RRECOMMENDS", e.data, pkg)
- map_dependencies("RSUGGESTS", e.data, pkg)
- map_dependencies("RPROVIDES", e.data, pkg)
- map_dependencies("RREPLACES", e.data, pkg)
- map_dependencies("PACKAGES", e.data)
-
- provides = e.data.getVar("PROVIDES")
- nprovides = []
- for prov in provides.split():
- if prov.find(pn) != -1:
- nprovides.append(prov)
- elif not prov.endswith("-native"):
- nprovides.append(prov + "-native")
- else:
- nprovides.append(prov)
- e.data.setVar("PROVIDES", ' '.join(nprovides))
-
-
-}
-
-addhandler native_virtclass_handler
-native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-python do_addto_recipe_sysroot () {
- bb.build.exec_func("extend_recipe_sysroot", d)
-}
-addtask addto_recipe_sysroot after do_populate_sysroot
-do_addto_recipe_sysroot[deptask] = "do_populate_sysroot"
-
-inherit nopackages
-
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "no"
-
-RECIPERDEPTASK = "do_populate_sysroot"
-do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}"
-
-#
-# Native task outputs are directly run on the target (host) system after being
-# built. Even if the output of this recipe doesn't change, a change in one of
-# its dependencies may cause a change in the output it generates (e.g. rpm
-# output depends on the output of its dependent zstd library).
-#
-# This can cause poor interactions with hash equivalence, since this recipes
-# output-changing dependency is "hidden" and downstream task only see that this
-# recipe has the same outhash and therefore is equivalent. This can result in
-# different output in different cases.
-#
-# To resolve this, unhide the output-changing dependency by adding its unihash
-# to this tasks outhash calculation. Unfortunately, don't know specifically
-# know which dependencies are output-changing, so we have to add all of them.
-#
-python native_add_do_populate_sysroot_deps () {
- current_task = "do_" + d.getVar("BB_CURRENTTASK")
- if current_task != "do_populate_sysroot":
- return
-
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- pn = d.getVar("PN")
- deps = {
- dep[0]:dep[6] for dep in taskdepdata.values() if
- dep[1] == current_task and dep[0] != pn
- }
-
- d.setVar("HASHEQUIV_EXTRA_SIGDATA", "\n".join("%s: %s" % (k, deps[k]) for k in sorted(deps.keys())))
-}
-SSTATECREATEFUNCS += "native_add_do_populate_sysroot_deps"
diff --git a/poky/meta/classes/nativesdk.bbclass b/poky/meta/classes/nativesdk.bbclass
deleted file mode 100644
index f8e9607..0000000
--- a/poky/meta/classes/nativesdk.bbclass
+++ /dev/null
@@ -1,117 +0,0 @@
-# SDK packages are built either explicitly by the user,
-# or indirectly via dependency. No need to be in 'world'.
-EXCLUDE_FROM_WORLD = "1"
-
-STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}"
-
-# libc for the SDK can be different to that of the target
-NATIVESDKLIBC ?= "libc-glibc"
-LIBCOVERRIDE = ":${NATIVESDKLIBC}"
-CLASSOVERRIDE = "class-nativesdk"
-MACHINEOVERRIDES = ""
-MACHINE_FEATURES = ""
-
-MULTILIBS = ""
-
-# we need consistent staging dir whether or not multilib is enabled
-STAGING_DIR_HOST = "${WORKDIR}/recipe-sysroot"
-STAGING_DIR_TARGET = "${WORKDIR}/recipe-sysroot"
-RECIPE_SYSROOT = "${WORKDIR}/recipe-sysroot"
-
-#
-# Update PACKAGE_ARCH and PACKAGE_ARCHS
-#
-PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}"
-PACKAGE_ARCHS = "${SDK_PACKAGE_ARCHS}"
-
-#
-# We need chrpath >= 0.14 to ensure we can deal with 32 and 64 bit
-# binaries
-#
-DEPENDS:append = " chrpath-replacement-native"
-EXTRANATIVEPATH += "chrpath-native"
-
-PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
-
-HOST_ARCH = "${SDK_ARCH}"
-HOST_VENDOR = "${SDK_VENDOR}"
-HOST_OS = "${SDK_OS}"
-HOST_PREFIX = "${SDK_PREFIX}"
-HOST_CC_ARCH = "${SDK_CC_ARCH}"
-HOST_LD_ARCH = "${SDK_LD_ARCH}"
-HOST_AS_ARCH = "${SDK_AS_ARCH}"
-#HOST_SYS = "${HOST_ARCH}${TARGET_VENDOR}-${HOST_OS}"
-
-TARGET_ARCH = "${SDK_ARCH}"
-TARGET_VENDOR = "${SDK_VENDOR}"
-TARGET_OS = "${SDK_OS}"
-TARGET_PREFIX = "${SDK_PREFIX}"
-TARGET_CC_ARCH = "${SDK_CC_ARCH}"
-TARGET_LD_ARCH = "${SDK_LD_ARCH}"
-TARGET_AS_ARCH = "${SDK_AS_ARCH}"
-TARGET_CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
-TARGET_CFLAGS = "${BUILDSDK_CFLAGS}"
-TARGET_CXXFLAGS = "${BUILDSDK_CXXFLAGS}"
-TARGET_LDFLAGS = "${BUILDSDK_LDFLAGS}"
-TARGET_FPU = ""
-EXTRA_OECONF_GCC_FLOAT = ""
-
-CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
-CFLAGS = "${BUILDSDK_CFLAGS}"
-CXXFLAGS = "${BUILDSDK_CXXFLAGS}"
-LDFLAGS = "${BUILDSDK_LDFLAGS}"
-
-# Change to place files in SDKPATH
-base_prefix = "${SDKPATHNATIVE}"
-prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
-baselib = "lib"
-sbindir = "${bindir}"
-
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
-
-python nativesdk_virtclass_handler () {
- pn = e.data.getVar("PN")
- if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")):
- return
-
- # Set features here to prevent appends and distro features backfill
- # from modifying nativesdk distro features
- features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split())
- filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split())
- d.setVar("DISTRO_FEATURES", " ".join(sorted(features | filtered)))
-
- e.data.setVar("MLPREFIX", "nativesdk-")
- e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", ""))
-}
-
-python () {
- pn = d.getVar("PN")
- if not pn.startswith("nativesdk-"):
- return
-
- import oe.classextend
-
- clsextend = oe.classextend.NativesdkClassExtender("nativesdk", d)
- clsextend.rename_packages()
- clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split())
-
- clsextend.map_depends_variable("DEPENDS")
- clsextend.map_packagevars()
- clsextend.map_variable("PROVIDES")
- clsextend.map_regexp_variable("PACKAGES_DYNAMIC")
- d.setVar("LIBCEXTENSION", "")
- d.setVar("ABIEXTENSION", "")
-}
-
-addhandler nativesdk_virtclass_handler
-nativesdk_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-do_packagedata[stamp-extra-info] = ""
-
-USE_NLS = "${SDKUSE_NLS}"
-
-OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}"
-
-PATH:prepend = "${COREBASE}/scripts/nativesdk-intercept:"
diff --git a/poky/meta/classes/nopackages.bbclass b/poky/meta/classes/nopackages.bbclass
deleted file mode 100644
index 7a4f632..0000000
--- a/poky/meta/classes/nopackages.bbclass
+++ /dev/null
@@ -1,13 +0,0 @@
-deltask do_package
-deltask do_package_write_rpm
-deltask do_package_write_ipk
-deltask do_package_write_deb
-deltask do_package_write_tar
-deltask do_package_qa
-deltask do_packagedata
-deltask do_package_setscene
-deltask do_package_write_rpm_setscene
-deltask do_package_write_ipk_setscene
-deltask do_package_write_deb_setscene
-deltask do_package_qa_setscene
-deltask do_packagedata_setscene
diff --git a/poky/meta/classes/npm.bbclass b/poky/meta/classes/npm.bbclass
deleted file mode 100644
index deea53c..0000000
--- a/poky/meta/classes/npm.bbclass
+++ /dev/null
@@ -1,340 +0,0 @@
-# Copyright (C) 2020 Savoir-Faire Linux
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# This bbclass builds and installs an npm package to the target. The package
-# sources files should be fetched in the calling recipe by using the SRC_URI
-# variable. The ${S} variable should be updated depending of your fetcher.
-#
-# Usage:
-# SRC_URI = "..."
-# inherit npm
-#
-# Optional variables:
-# NPM_ARCH:
-# Override the auto generated npm architecture.
-#
-# NPM_INSTALL_DEV:
-# Set to 1 to also install devDependencies.
-
-inherit python3native
-
-DEPENDS:prepend = "nodejs-native nodejs-oe-cache-native "
-RDEPENDS:${PN}:append:class-target = " nodejs"
-
-EXTRA_OENPM = ""
-
-NPM_INSTALL_DEV ?= "0"
-
-NPM_NODEDIR ?= "${RECIPE_SYSROOT_NATIVE}${prefix_native}"
-
-def npm_target_arch_map(target_arch):
- """Maps arch names to npm arch names"""
- import re
- if re.match("p(pc|owerpc)(|64)", target_arch):
- return "ppc"
- elif re.match("i.86$", target_arch):
- return "ia32"
- elif re.match("x86_64$", target_arch):
- return "x64"
- elif re.match("arm64$", target_arch):
- return "arm"
- return target_arch
-
-NPM_ARCH ?= "${@npm_target_arch_map(d.getVar("TARGET_ARCH"))}"
-
-NPM_PACKAGE = "${WORKDIR}/npm-package"
-NPM_CACHE = "${WORKDIR}/npm-cache"
-NPM_BUILD = "${WORKDIR}/npm-build"
-NPM_REGISTRY = "${WORKDIR}/npm-registry"
-
-def npm_global_configs(d):
- """Get the npm global configuration"""
- configs = []
- # Ensure no network access is done
- configs.append(("offline", "true"))
- configs.append(("proxy", "http://invalid"))
- configs.append(("funds", False))
- configs.append(("audit", False))
- # Configure the cache directory
- configs.append(("cache", d.getVar("NPM_CACHE")))
- return configs
-
-## 'npm pack' runs 'prepare' and 'prepack' scripts. Support for
-## 'ignore-scripts' which prevents this behavior has been removed
-## from nodejs 16. Use simple 'tar' instead of.
-def npm_pack(env, srcdir, workdir):
- """Emulate 'npm pack' on a specified directory"""
- import subprocess
- import os
- import json
-
- src = os.path.join(srcdir, 'package.json')
- with open(src) as f:
- j = json.load(f)
-
- # base does not really matter and is for documentation purposes
- # only. But the 'version' part must exist because other parts of
- # the bbclass rely on it.
- base = j['name'].split('/')[-1]
- tarball = os.path.join(workdir, "%s-%s.tgz" % (base, j['version']));
-
- # TODO: real 'npm pack' does not include directories while 'tar'
- # does. But this does not seem to matter...
- subprocess.run(['tar', 'czf', tarball,
- '--exclude', './node-modules',
- '--exclude-vcs',
- '--transform', 's,^\./,package/,',
- '--mtime', '1985-10-26T08:15:00.000Z',
- '.'],
- check = True, cwd = srcdir)
-
- return (tarball, j)
-
-python npm_do_configure() {
- """
- Step one: configure the npm cache and the main npm package
-
- Every dependencies have been fetched and patched in the source directory.
- They have to be packed (this remove unneeded files) and added to the npm
- cache to be available for the next step.
-
- The main package and its associated manifest file and shrinkwrap file have
- to be configured to take into account these cached dependencies.
- """
- import base64
- import copy
- import json
- import re
- import shlex
- import stat
- import tempfile
- from bb.fetch2.npm import NpmEnvironment
- from bb.fetch2.npm import npm_unpack
- from bb.fetch2.npmsw import foreach_dependencies
- from bb.progress import OutOfProgressHandler
- from oe.npm_registry import NpmRegistry
-
- bb.utils.remove(d.getVar("NPM_CACHE"), recurse=True)
- bb.utils.remove(d.getVar("NPM_PACKAGE"), recurse=True)
-
- env = NpmEnvironment(d, configs=npm_global_configs(d))
- registry = NpmRegistry(d.getVar('NPM_REGISTRY'), d.getVar('NPM_CACHE'))
-
- def _npm_cache_add(tarball, pkg):
- """Add tarball to local registry and register it in the
- cache"""
- registry.add_pkg(tarball, pkg)
-
- def _npm_integrity(tarball):
- """Return the npm integrity of a specified tarball"""
- sha512 = bb.utils.sha512_file(tarball)
- return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode()
-
- def _npmsw_dependency_dict(orig, deptree):
- """
- Return the sub dictionary in the 'orig' dictionary corresponding to the
- 'deptree' dependency tree. This function follows the shrinkwrap file
- format.
- """
- ptr = orig
- for dep in deptree:
- if "dependencies" not in ptr:
- ptr["dependencies"] = {}
- ptr = ptr["dependencies"]
- if dep not in ptr:
- ptr[dep] = {}
- ptr = ptr[dep]
- return ptr
-
- # Manage the manifest file and shrinkwrap files
- orig_manifest_file = d.expand("${S}/package.json")
- orig_shrinkwrap_file = d.expand("${S}/npm-shrinkwrap.json")
- cached_manifest_file = d.expand("${NPM_PACKAGE}/package.json")
- cached_shrinkwrap_file = d.expand("${NPM_PACKAGE}/npm-shrinkwrap.json")
-
- with open(orig_manifest_file, "r") as f:
- orig_manifest = json.load(f)
-
- cached_manifest = copy.deepcopy(orig_manifest)
- cached_manifest.pop("dependencies", None)
- cached_manifest.pop("devDependencies", None)
-
- has_shrinkwrap_file = True
-
- try:
- with open(orig_shrinkwrap_file, "r") as f:
- orig_shrinkwrap = json.load(f)
- except IOError:
- has_shrinkwrap_file = False
-
- if has_shrinkwrap_file:
- cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap)
- cached_shrinkwrap.pop("dependencies", None)
-
- # Manage the dependencies
- progress = OutOfProgressHandler(d, r"^(\d+)/(\d+)$")
- progress_total = 1 # also count the main package
- progress_done = 0
-
- def _count_dependency(name, params, deptree):
- nonlocal progress_total
- progress_total += 1
-
- def _cache_dependency(name, params, deptree):
- destsubdirs = [os.path.join("node_modules", dep) for dep in deptree]
- destsuffix = os.path.join(*destsubdirs)
- with tempfile.TemporaryDirectory() as tmpdir:
- # Add the dependency to the npm cache
- destdir = os.path.join(d.getVar("S"), destsuffix)
- (tarball, pkg) = npm_pack(env, destdir, tmpdir)
- _npm_cache_add(tarball, pkg)
- # Add its signature to the cached shrinkwrap
- dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
- dep["version"] = pkg['version']
- dep["integrity"] = _npm_integrity(tarball)
- if params.get("dev", False):
- dep["dev"] = True
- # Display progress
- nonlocal progress_done
- progress_done += 1
- progress.write("%d/%d" % (progress_done, progress_total))
-
- dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False)
-
- if has_shrinkwrap_file:
- foreach_dependencies(orig_shrinkwrap, _count_dependency, dev)
- foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev)
-
- # Configure the main package
- with tempfile.TemporaryDirectory() as tmpdir:
- (tarball, _) = npm_pack(env, d.getVar("S"), tmpdir)
- npm_unpack(tarball, d.getVar("NPM_PACKAGE"), d)
-
- # Configure the cached manifest file and cached shrinkwrap file
- def _update_manifest(depkey):
- for name in orig_manifest.get(depkey, {}):
- version = cached_shrinkwrap["dependencies"][name]["version"]
- if depkey not in cached_manifest:
- cached_manifest[depkey] = {}
- cached_manifest[depkey][name] = version
-
- if has_shrinkwrap_file:
- _update_manifest("dependencies")
-
- if dev:
- if has_shrinkwrap_file:
- _update_manifest("devDependencies")
-
- os.chmod(cached_manifest_file, os.stat(cached_manifest_file).st_mode | stat.S_IWUSR)
- with open(cached_manifest_file, "w") as f:
- json.dump(cached_manifest, f, indent=2)
-
- if has_shrinkwrap_file:
- with open(cached_shrinkwrap_file, "w") as f:
- json.dump(cached_shrinkwrap, f, indent=2)
-}
-
-python npm_do_compile() {
- """
- Step two: install the npm package
-
- Use the configured main package and the cached dependencies to run the
- installation process. The installation is done in a directory which is
- not the destination directory yet.
-
- A combination of 'npm pack' and 'npm install' is used to ensure that the
- installed files are actual copies instead of symbolic links (which is the
- default npm behavior).
- """
- import shlex
- import tempfile
- from bb.fetch2.npm import NpmEnvironment
-
- bb.utils.remove(d.getVar("NPM_BUILD"), recurse=True)
-
- with tempfile.TemporaryDirectory() as tmpdir:
- args = []
- configs = npm_global_configs(d)
-
- if bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False):
- configs.append(("also", "development"))
- else:
- configs.append(("only", "production"))
-
- # Report as many logs as possible for debugging purpose
- configs.append(("loglevel", "silly"))
-
- # Configure the installation to be done globally in the build directory
- configs.append(("global", "true"))
- configs.append(("prefix", d.getVar("NPM_BUILD")))
-
- # Add node-gyp configuration
- configs.append(("arch", d.getVar("NPM_ARCH")))
- configs.append(("release", "true"))
- configs.append(("nodedir", d.getVar("NPM_NODEDIR")))
- configs.append(("python", d.getVar("PYTHON")))
-
- env = NpmEnvironment(d, configs)
-
- # Add node-pre-gyp configuration
- args.append(("target_arch", d.getVar("NPM_ARCH")))
- args.append(("build-from-source", "true"))
-
- # Pack and install the main package
- (tarball, _) = npm_pack(env, d.getVar("NPM_PACKAGE"), tmpdir)
- cmd = "npm install %s %s" % (shlex.quote(tarball), d.getVar("EXTRA_OENPM"))
- env.run(cmd, args=args)
-}
-
-npm_do_install() {
- # Step three: final install
- #
- # The previous installation have to be filtered to remove some extra files.
-
- rm -rf ${D}
-
- # Copy the entire lib and bin directories
- install -d ${D}/${nonarch_libdir}
- cp --no-preserve=ownership --recursive ${NPM_BUILD}/lib/. ${D}/${nonarch_libdir}
-
- if [ -d "${NPM_BUILD}/bin" ]
- then
- install -d ${D}/${bindir}
- cp --no-preserve=ownership --recursive ${NPM_BUILD}/bin/. ${D}/${bindir}
- fi
-
- # If the package (or its dependencies) uses node-gyp to build native addons,
- # object files, static libraries or other temporary files can be hidden in
- # the lib directory. To reduce the package size and to avoid QA issues
- # (staticdev with static library files) these files must be removed.
- local GYP_REGEX=".*/build/Release/[^/]*.node"
-
- # Remove any node-gyp directory in ${D} to remove temporary build files
- for GYP_D_FILE in $(find ${D} -regex "${GYP_REGEX}")
- do
- local GYP_D_DIR=${GYP_D_FILE%/Release/*}
-
- rm --recursive --force ${GYP_D_DIR}
- done
-
- # Copy only the node-gyp release files
- for GYP_B_FILE in $(find ${NPM_BUILD} -regex "${GYP_REGEX}")
- do
- local GYP_D_FILE=${D}/${prefix}/${GYP_B_FILE#${NPM_BUILD}}
-
- install -d ${GYP_D_FILE%/*}
- install -m 755 ${GYP_B_FILE} ${GYP_D_FILE}
- done
-
- # Remove the shrinkwrap file which does not need to be packed
- rm -f ${D}/${nonarch_libdir}/node_modules/*/npm-shrinkwrap.json
- rm -f ${D}/${nonarch_libdir}/node_modules/@*/*/npm-shrinkwrap.json
-}
-
-FILES:${PN} += " \
- ${bindir} \
- ${nonarch_libdir} \
-"
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/oelint.bbclass b/poky/meta/classes/oelint.bbclass
index 2589d34..458a25e 100644
--- a/poky/meta/classes/oelint.bbclass
+++ b/poky/meta/classes/oelint.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
addtask lint before do_build
do_lint[nostamp] = "1"
python do_lint() {
diff --git a/poky/meta/classes/overlayfs-etc.bbclass b/poky/meta/classes/overlayfs-etc.bbclass
index 91afee6..d0bc3ec 100644
--- a/poky/meta/classes/overlayfs-etc.bbclass
+++ b/poky/meta/classes/overlayfs-etc.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Class for setting up /etc in overlayfs
#
# In order to have /etc directory in overlayfs a special handling at early boot stage is required
diff --git a/poky/meta/classes/overlayfs.bbclass b/poky/meta/classes/overlayfs.bbclass
index f7069ed..bdc6dd9 100644
--- a/poky/meta/classes/overlayfs.bbclass
+++ b/poky/meta/classes/overlayfs.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Class for generation of overlayfs mount units
#
# It's often desired in Embedded System design to have a read-only rootfs.
diff --git a/poky/meta/classes/own-mirrors.bbclass b/poky/meta/classes/own-mirrors.bbclass
index ef97274..2f24ff1 100644
--- a/poky/meta/classes/own-mirrors.bbclass
+++ b/poky/meta/classes/own-mirrors.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
PREMIRRORS:prepend = " \
cvs://.*/.* ${SOURCE_MIRROR_URL} \
svn://.*/.* ${SOURCE_MIRROR_URL} \
diff --git a/poky/meta/classes/package.bbclass b/poky/meta/classes/package.bbclass
deleted file mode 100644
index 97e97d2..0000000
--- a/poky/meta/classes/package.bbclass
+++ /dev/null
@@ -1,2552 +0,0 @@
-#
-# Packaging process
-#
-# Executive summary: This class iterates over the functions listed in PACKAGEFUNCS
-# Taking D and splitting it up into the packages listed in PACKAGES, placing the
-# resulting output in PKGDEST.
-#
-# There are the following default steps but PACKAGEFUNCS can be extended:
-#
-# a) package_convert_pr_autoinc - convert AUTOINC in PKGV to ${PRSERV_PV_AUTOINC}
-#
-# b) perform_packagecopy - Copy D into PKGD
-#
-# c) package_do_split_locales - Split out the locale files, updates FILES and PACKAGES
-#
-# d) split_and_strip_files - split the files into runtime and debug and strip them.
-# Debug files include debug info split, and associated sources that end up in -dbg packages
-#
-# e) fixup_perms - Fix up permissions in the package before we split it.
-#
-# f) populate_packages - Split the files in PKGD into separate packages in PKGDEST/<pkgname>
-# Also triggers the binary stripping code to put files in -dbg packages.
-#
-# g) package_do_filedeps - Collect perfile run-time dependency metadata
-# The data is stores in FILER{PROVIDES,DEPENDS}_file_pkg variables with
-# a list of affected files in FILER{PROVIDES,DEPENDS}FLIST_pkg
-#
-# h) package_do_shlibs - Look at the shared libraries generated and autotmatically add any
-# dependencies found. Also stores the package name so anyone else using this library
-# knows which package to depend on.
-#
-# i) package_do_pkgconfig - Keep track of which packages need and provide which .pc files
-#
-# j) read_shlibdeps - Reads the stored shlibs information into the metadata
-#
-# k) package_depchains - Adds automatic dependencies to -dbg and -dev packages
-#
-# l) emit_pkgdata - saves the packaging data into PKGDATA_DIR for use in later
-# packaging steps
-
-inherit packagedata
-inherit chrpath
-inherit package_pkgdata
-inherit insane
-
-PKGD = "${WORKDIR}/package"
-PKGDEST = "${WORKDIR}/packages-split"
-
-LOCALE_SECTION ?= ''
-
-ALL_MULTILIB_PACKAGE_ARCHS = "${@all_multilib_tune_values(d, 'PACKAGE_ARCHS')}"
-
-# rpm is used for the per-file dependency identification
-# dwarfsrcfiles is used to determine the list of debug source files
-PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
-
-
-# If your postinstall can execute at rootfs creation time rather than on
-# target but depends on a native/cross tool in order to execute, you need to
-# list that tool in PACKAGE_WRITE_DEPS. Target package dependencies belong
-# in the package dependencies as normal, this is just for native/cross support
-# tools at rootfs build time.
-PACKAGE_WRITE_DEPS ??= ""
-
-def legitimize_package_name(s):
- """
- Make sure package names are legitimate strings
- """
- import re
-
- def fixutf(m):
- cp = m.group(1)
- if cp:
- return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape')
-
- # Handle unicode codepoints encoded as <U0123>, as in glibc locale files.
- s = re.sub(r'<U([0-9A-Fa-f]{1,4})>', fixutf, s)
-
- # Remaining package name validity fixes
- return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
-
-def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None, allow_links=False, summary=None):
- """
- Used in .bb files to split up dynamically generated subpackages of a
- given package, usually plugins or modules.
-
- Arguments:
- root -- the path in which to search
- file_regex -- regular expression to match searched files. Use
- parentheses () to mark the part of this expression
- that should be used to derive the module name (to be
- substituted where %s is used in other function
- arguments as noted below)
- output_pattern -- pattern to use for the package names. Must include %s.
- description -- description to set for each package. Must include %s.
- postinst -- postinstall script to use for all packages (as a
- string)
- recursive -- True to perform a recursive search - default False
- hook -- a hook function to be called for every match. The
- function will be called with the following arguments
- (in the order listed):
- f: full path to the file/directory match
- pkg: the package name
- file_regex: as above
- output_pattern: as above
- modulename: the module name derived using file_regex
- extra_depends -- extra runtime dependencies (RDEPENDS) to be set for
- all packages. The default value of None causes a
- dependency on the main package (${PN}) - if you do
- not want this, pass '' for this parameter.
- aux_files_pattern -- extra item(s) to be added to FILES for each
- package. Can be a single string item or a list of
- strings for multiple items. Must include %s.
- postrm -- postrm script to use for all packages (as a string)
- allow_dirs -- True allow directories to be matched - default False
- prepend -- if True, prepend created packages to PACKAGES instead
- of the default False which appends them
- match_path -- match file_regex on the whole relative path to the
- root rather than just the file name
- aux_files_pattern_verbatim -- extra item(s) to be added to FILES for
- each package, using the actual derived module name
- rather than converting it to something legal for a
- package name. Can be a single string item or a list
- of strings for multiple items. Must include %s.
- allow_links -- True to allow symlinks to be matched - default False
- summary -- Summary to set for each package. Must include %s;
- defaults to description if not set.
-
- """
-
- dvar = d.getVar('PKGD')
- root = d.expand(root)
- output_pattern = d.expand(output_pattern)
- extra_depends = d.expand(extra_depends)
-
- # If the root directory doesn't exist, don't error out later but silently do
- # no splitting.
- if not os.path.exists(dvar + root):
- return []
-
- ml = d.getVar("MLPREFIX")
- if ml:
- if not output_pattern.startswith(ml):
- output_pattern = ml + output_pattern
-
- newdeps = []
- for dep in (extra_depends or "").split():
- if dep.startswith(ml):
- newdeps.append(dep)
- else:
- newdeps.append(ml + dep)
- if newdeps:
- extra_depends = " ".join(newdeps)
-
-
- packages = d.getVar('PACKAGES').split()
- split_packages = set()
-
- if postinst:
- postinst = '#!/bin/sh\n' + postinst + '\n'
- if postrm:
- postrm = '#!/bin/sh\n' + postrm + '\n'
- if not recursive:
- objs = os.listdir(dvar + root)
- else:
- objs = []
- for walkroot, dirs, files in os.walk(dvar + root):
- for file in files:
- relpath = os.path.join(walkroot, file).replace(dvar + root + '/', '', 1)
- if relpath:
- objs.append(relpath)
-
- if extra_depends == None:
- extra_depends = d.getVar("PN")
-
- if not summary:
- summary = description
-
- for o in sorted(objs):
- import re, stat
- if match_path:
- m = re.match(file_regex, o)
- else:
- m = re.match(file_regex, os.path.basename(o))
-
- if not m:
- continue
- f = os.path.join(dvar + root, o)
- mode = os.lstat(f).st_mode
- if not (stat.S_ISREG(mode) or (allow_links and stat.S_ISLNK(mode)) or (allow_dirs and stat.S_ISDIR(mode))):
- continue
- on = legitimize_package_name(m.group(1))
- pkg = output_pattern % on
- split_packages.add(pkg)
- if not pkg in packages:
- if prepend:
- packages = [pkg] + packages
- else:
- packages.append(pkg)
- oldfiles = d.getVar('FILES:' + pkg)
- newfile = os.path.join(root, o)
- # These names will be passed through glob() so if the filename actually
- # contains * or ? (rare, but possible) we need to handle that specially
- newfile = newfile.replace('*', '[*]')
- newfile = newfile.replace('?', '[?]')
- if not oldfiles:
- the_files = [newfile]
- if aux_files_pattern:
- if type(aux_files_pattern) is list:
- for fp in aux_files_pattern:
- the_files.append(fp % on)
- else:
- the_files.append(aux_files_pattern % on)
- if aux_files_pattern_verbatim:
- if type(aux_files_pattern_verbatim) is list:
- for fp in aux_files_pattern_verbatim:
- the_files.append(fp % m.group(1))
- else:
- the_files.append(aux_files_pattern_verbatim % m.group(1))
- d.setVar('FILES:' + pkg, " ".join(the_files))
- else:
- d.setVar('FILES:' + pkg, oldfiles + " " + newfile)
- if extra_depends != '':
- d.appendVar('RDEPENDS:' + pkg, ' ' + extra_depends)
- if not d.getVar('DESCRIPTION:' + pkg):
- d.setVar('DESCRIPTION:' + pkg, description % on)
- if not d.getVar('SUMMARY:' + pkg):
- d.setVar('SUMMARY:' + pkg, summary % on)
- if postinst:
- d.setVar('pkg_postinst:' + pkg, postinst)
- if postrm:
- d.setVar('pkg_postrm:' + pkg, postrm)
- if callable(hook):
- hook(f, pkg, file_regex, output_pattern, m.group(1))
-
- d.setVar('PACKAGES', ' '.join(packages))
- return list(split_packages)
-
-PACKAGE_DEPENDS += "file-native"
-
-python () {
- if d.getVar('PACKAGES') != '':
- deps = ""
- for dep in (d.getVar('PACKAGE_DEPENDS') or "").split():
- deps += " %s:do_populate_sysroot" % dep
- if d.getVar('PACKAGE_MINIDEBUGINFO') == '1':
- deps += ' xz-native:do_populate_sysroot'
- d.appendVarFlag('do_package', 'depends', deps)
-
- # shlibs requires any DEPENDS to have already packaged for the *.list files
- d.appendVarFlag('do_package', 'deptask', " do_packagedata")
-}
-
-# Get a list of files from file vars by searching files under current working directory
-# The list contains symlinks, directories and normal files.
-def files_from_filevars(filevars):
- import os,glob
- cpath = oe.cachedpath.CachedPath()
- files = []
- for f in filevars:
- if os.path.isabs(f):
- f = '.' + f
- if not f.startswith("./"):
- f = './' + f
- globbed = glob.glob(f)
- if globbed:
- if [ f ] != globbed:
- files += globbed
- continue
- files.append(f)
-
- symlink_paths = []
- for ind, f in enumerate(files):
- # Handle directory symlinks. Truncate path to the lowest level symlink
- parent = ''
- for dirname in f.split('/')[:-1]:
- parent = os.path.join(parent, dirname)
- if dirname == '.':
- continue
- if cpath.islink(parent):
- bb.warn("FILES contains file '%s' which resides under a "
- "directory symlink. Please fix the recipe and use the "
- "real path for the file." % f[1:])
- symlink_paths.append(f)
- files[ind] = parent
- f = parent
- break
-
- if not cpath.islink(f):
- if cpath.isdir(f):
- newfiles = [ os.path.join(f,x) for x in os.listdir(f) ]
- if newfiles:
- files += newfiles
-
- return files, symlink_paths
-
-# Called in package_<rpm,ipk,deb>.bbclass to get the correct list of configuration files
-def get_conffiles(pkg, d):
- pkgdest = d.getVar('PKGDEST')
- root = os.path.join(pkgdest, pkg)
- cwd = os.getcwd()
- os.chdir(root)
-
- conffiles = d.getVar('CONFFILES:%s' % pkg);
- if conffiles == None:
- conffiles = d.getVar('CONFFILES')
- if conffiles == None:
- conffiles = ""
- conffiles = conffiles.split()
- conf_orig_list = files_from_filevars(conffiles)[0]
-
- # Remove links and directories from conf_orig_list to get conf_list which only contains normal files
- conf_list = []
- for f in conf_orig_list:
- if os.path.isdir(f):
- continue
- if os.path.islink(f):
- continue
- if not os.path.exists(f):
- continue
- conf_list.append(f)
-
- # Remove the leading './'
- for i in range(0, len(conf_list)):
- conf_list[i] = conf_list[i][1:]
-
- os.chdir(cwd)
- return conf_list
-
-def checkbuildpath(file, d):
- tmpdir = d.getVar('TMPDIR')
- with open(file) as f:
- file_content = f.read()
- if tmpdir in file_content:
- return True
-
- return False
-
-def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
- debugfiles = {}
-
- for line in dwarfsrcfiles_output.splitlines():
- if line.startswith("\t"):
- debugfiles[os.path.normpath(line.split()[0])] = ""
-
- return debugfiles.keys()
-
-def source_info(file, d, fatal=True):
- 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 "")
- if fatal:
- bb.fatal(msg)
- bb.note(msg)
-
- debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
-
- return list(debugsources)
-
-def splitdebuginfo(file, dvar, dv, 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.
- #
- # return a mapping of files:debugsources
-
- import stat
- import subprocess
-
- src = file[len(dvar):]
- dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"]
- debugfile = dvar + dest
- sources = []
-
- if file.endswith(".ko") and file.find("/lib/modules/") != -1:
- if oe.package.is_kernel_module_signed(file):
- bb.debug(1, "Skip strip on signed module %s" % file)
- return (file, sources)
-
- # 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")
-
- newmode = None
- if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
- origmode = os.stat(file)[stat.ST_MODE]
- newmode = origmode | stat.S_IWRITE | stat.S_IREAD
- os.chmod(file, newmode)
-
- # We need to extract the debug src information here...
- if dv["srcdir"]:
- sources = source_info(file, d)
-
- bb.utils.mkdirhier(os.path.dirname(debugfile))
-
- subprocess.check_output([objcopy, '--only-keep-debug', file, debugfile], stderr=subprocess.STDOUT)
-
- # Set the debuglink to have the view of the file path on the target
- subprocess.check_output([objcopy, '--add-gnu-debuglink', debugfile, file], stderr=subprocess.STDOUT)
-
- if newmode:
- os.chmod(file, origmode)
-
- return (file, sources)
-
-def splitstaticdebuginfo(file, dvar, dv, d):
- # Unlike the function above, there is no way to split a static library
- # two components. So to get similar results we will copy the unmodified
- # static library (containing the debug symbols) into a new directory.
- # We will then strip (preserving symbols) the static library in the
- # typical location.
- #
- # return a mapping of files:debugsources
-
- import stat
-
- src = file[len(dvar):]
- dest = dv["staticlibdir"] + os.path.dirname(src) + dv["staticdir"] + "/" + os.path.basename(src) + dv["staticappend"]
- debugfile = dvar + dest
- sources = []
-
- # Copy the file...
- bb.utils.mkdirhier(os.path.dirname(debugfile))
- #bb.note("Copy %s -> %s" % (file, debugfile))
-
- dvar = d.getVar('PKGD')
-
- newmode = None
- if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
- origmode = os.stat(file)[stat.ST_MODE]
- newmode = origmode | stat.S_IWRITE | stat.S_IREAD
- os.chmod(file, newmode)
-
- # We need to extract the debug src information here...
- if dv["srcdir"]:
- sources = source_info(file, d)
-
- bb.utils.mkdirhier(os.path.dirname(debugfile))
-
- # Copy the unmodified item to the debug directory
- shutil.copy2(file, debugfile)
-
- if newmode:
- os.chmod(file, origmode)
-
- return (file, sources)
-
-def inject_minidebuginfo(file, dvar, dv, d):
- # Extract just the symbols from debuginfo into minidebuginfo,
- # compress it with xz and inject it back into the binary in a .gnu_debugdata section.
- # https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html
-
- import subprocess
-
- readelf = d.getVar('READELF')
- nm = d.getVar('NM')
- objcopy = d.getVar('OBJCOPY')
-
- minidebuginfodir = d.expand('${WORKDIR}/minidebuginfo')
-
- src = file[len(dvar):]
- dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"]
- debugfile = dvar + dest
- minidebugfile = minidebuginfodir + src + '.minidebug'
- bb.utils.mkdirhier(os.path.dirname(minidebugfile))
-
- # If we didn't produce debuginfo for any reason, we can't produce minidebuginfo either
- # so skip it.
- if not os.path.exists(debugfile):
- bb.debug(1, 'ELF file {} has no debuginfo, skipping minidebuginfo injection'.format(file))
- return
-
- # Find non-allocated PROGBITS, NOTE, and NOBITS sections in the debuginfo.
- # We will exclude all of these from minidebuginfo to save space.
- remove_section_names = []
- for line in subprocess.check_output([readelf, '-W', '-S', debugfile], universal_newlines=True).splitlines():
- fields = line.split()
- if len(fields) < 8:
- continue
- name = fields[0]
- type = fields[1]
- flags = fields[7]
- # .debug_ sections will be removed by objcopy -S so no need to explicitly remove them
- if name.startswith('.debug_'):
- continue
- if 'A' not in flags and type in ['PROGBITS', 'NOTE', 'NOBITS']:
- remove_section_names.append(name)
-
- # List dynamic symbols in the binary. We can exclude these from minidebuginfo
- # because they are always present in the binary.
- dynsyms = set()
- for line in subprocess.check_output([nm, '-D', file, '--format=posix', '--defined-only'], universal_newlines=True).splitlines():
- dynsyms.add(line.split()[0])
-
- # Find all function symbols from debuginfo which aren't in the dynamic symbols table.
- # These are the ones we want to keep in minidebuginfo.
- keep_symbols_file = minidebugfile + '.symlist'
- found_any_symbols = False
- with open(keep_symbols_file, 'w') as f:
- for line in subprocess.check_output([nm, debugfile, '--format=sysv', '--defined-only'], universal_newlines=True).splitlines():
- fields = line.split('|')
- if len(fields) < 7:
- continue
- name = fields[0].strip()
- type = fields[3].strip()
- if type == 'FUNC' and name not in dynsyms:
- f.write('{}\n'.format(name))
- found_any_symbols = True
-
- if not found_any_symbols:
- bb.debug(1, 'ELF file {} contains no symbols, skipping minidebuginfo injection'.format(file))
- return
-
- bb.utils.remove(minidebugfile)
- bb.utils.remove(minidebugfile + '.xz')
-
- subprocess.check_call([objcopy, '-S'] +
- ['--remove-section={}'.format(s) for s in remove_section_names] +
- ['--keep-symbols={}'.format(keep_symbols_file), debugfile, minidebugfile])
-
- subprocess.check_call(['xz', '--keep', minidebugfile])
-
- subprocess.check_call([objcopy, '--add-section', '.gnu_debugdata={}.xz'.format(minidebugfile), file])
-
-def copydebugsources(debugsrcdir, sources, d):
- # The debug src information written out to sourcefile is further processed
- # and copied to the destination here.
-
- import stat
- import subprocess
-
- if debugsrcdir and sources:
- sourcefile = d.expand("${WORKDIR}/debugsources.list")
- bb.utils.remove(sourcefile)
-
- # filenames are null-separated - this is an artefact of the previous use
- # of rpm's debugedit, which was writing them out that way, and the code elsewhere
- # is still assuming that.
- debuglistoutput = '\0'.join(sources) + '\0'
- with open(sourcefile, 'a') as sf:
- sf.write(debuglistoutput)
-
- dvar = d.getVar('PKGD')
- strip = d.getVar("STRIP")
- objcopy = d.getVar("OBJCOPY")
- workdir = d.getVar("WORKDIR")
- sdir = d.getVar("S")
- sparentdir = os.path.dirname(os.path.dirname(sdir))
- sbasedir = os.path.basename(os.path.dirname(sdir)) + "/" + os.path.basename(sdir)
- workparentdir = os.path.dirname(os.path.dirname(workdir))
- workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
-
- # If S isnt based on WORKDIR we can infer our sources are located elsewhere,
- # e.g. using externalsrc; use S as base for our dirs
- if workdir in sdir or 'work-shared' in sdir:
- basedir = workbasedir
- parentdir = workparentdir
- else:
- basedir = sbasedir
- parentdir = sparentdir
-
- # If build path exists in sourcefile, it means toolchain did not use
- # -fdebug-prefix-map to compile
- if checkbuildpath(sourcefile, d):
- localsrc_prefix = parentdir + "/"
- else:
- localsrc_prefix = "/usr/src/debug/"
-
- nosuchdir = []
- basepath = dvar
- for p in debugsrcdir.split("/"):
- basepath = basepath + "/" + p
- if not cpath.exists(basepath):
- nosuchdir.append(basepath)
- bb.utils.mkdirhier(basepath)
- cpath.updatecache(basepath)
-
- # Ignore files from the recipe sysroots (target and native)
- processdebugsrc = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((<internal>|<built-in>)$|/.*recipe-sysroot.*/)' | "
- # We need to ignore files that are not actually ours
- # we do this by only paying attention to items from this package
- processdebugsrc += "fgrep -zw '%s' | "
- # Remove prefix in the source paths
- processdebugsrc += "sed 's#%s##g' | "
- processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
-
- cmd = processdebugsrc % (sourcefile, basedir, localsrc_prefix, parentdir, dvar, debugsrcdir)
- 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')" % \
- (dvar, debugsrcdir, dvar, debugsrcdir, parentdir, dvar, debugsrcdir)
- subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-
- # debugsources.list may be polluted from the host if we used externalsrc,
- # cpio uses copy-pass and may have just created a directory structure
- # matching the one from the host, if thats the case move those files to
- # debugsrcdir to avoid host contamination.
- # Empty dir structure will be deleted in the next step.
-
- # Same check as above for externalsrc
- if workdir not in sdir:
- if os.path.exists(dvar + debugsrcdir + sdir):
- cmd = "mv %s%s%s/* %s%s" % (dvar, debugsrcdir, sdir, dvar,debugsrcdir)
- 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)
- subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
- # Also remove debugsrcdir if its empty
- for p in nosuchdir[::-1]:
- if os.path.exists(p) and not os.listdir(p):
- os.rmdir(p)
-
-#
-# Package data handling routines
-#
-
-def get_package_mapping (pkg, basepkg, d, depversions=None):
- import oe.packagedata
-
- data = oe.packagedata.read_subpkgdata(pkg, d)
- key = "PKG:%s" % pkg
-
- if key in data:
- if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]:
- bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key]))
- # Have to avoid undoing the write_extra_pkgs(global_variants...)
- if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \
- and data[key] == basepkg:
- return pkg
- if depversions == []:
- # Avoid returning a mapping if the renamed package rprovides its original name
- rprovkey = "RPROVIDES:%s" % pkg
- if rprovkey in data:
- if pkg in bb.utils.explode_dep_versions2(data[rprovkey]):
- bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg))
- return pkg
- # Do map to rewritten package name
- return data[key]
-
- return pkg
-
-def get_package_additional_metadata (pkg_type, d):
- base_key = "PACKAGE_ADD_METADATA"
- for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key):
- if d.getVar(key, False) is None:
- continue
- d.setVarFlag(key, "type", "list")
- if d.getVarFlag(key, "separator") is None:
- d.setVarFlag(key, "separator", "\\n")
- metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)]
- return "\n".join(metadata_fields).strip()
-
-def runtime_mapping_rename (varname, pkg, d):
- #bb.note("%s before: %s" % (varname, d.getVar(varname)))
-
- new_depends = {}
- deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
- for depend, depversions in deps.items():
- new_depend = get_package_mapping(depend, pkg, d, depversions)
- if depend != new_depend:
- bb.note("package name mapping done: %s -> %s" % (depend, new_depend))
- new_depends[new_depend] = deps[depend]
-
- d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False))
-
- #bb.note("%s after: %s" % (varname, d.getVar(varname)))
-
-#
-# Used by do_packagedata (and possibly other routines post do_package)
-#
-
-PRSERV_ACTIVE = "${@bool(d.getVar("PRSERV_HOST"))}"
-PRSERV_ACTIVE[vardepvalue] = "${PRSERV_ACTIVE}"
-package_get_auto_pr[vardepsexclude] = "BB_TASKDEPDATA"
-package_get_auto_pr[vardeps] += "PRSERV_ACTIVE"
-python package_get_auto_pr() {
- import oe.prservice
-
- def get_do_package_hash(pn):
- if d.getVar("BB_RUNTASK") != "do_package":
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- for dep in taskdepdata:
- if taskdepdata[dep][1] == "do_package" and taskdepdata[dep][0] == pn:
- return taskdepdata[dep][6]
- return None
-
- # Support per recipe PRSERV_HOST
- pn = d.getVar('PN')
- host = d.getVar("PRSERV_HOST_" + pn)
- if not (host is None):
- d.setVar("PRSERV_HOST", host)
-
- pkgv = d.getVar("PKGV")
-
- # PR Server not active, handle AUTOINC
- if not d.getVar('PRSERV_HOST'):
- d.setVar("PRSERV_PV_AUTOINC", "0")
- return
-
- auto_pr = None
- pv = d.getVar("PV")
- version = d.getVar("PRAUTOINX")
- pkgarch = d.getVar("PACKAGE_ARCH")
- checksum = get_do_package_hash(pn)
-
- # If do_package isn't in the dependencies, we can't get the checksum...
- if not checksum:
- bb.warn('Task %s requested do_package unihash, but it was not available.' % d.getVar('BB_RUNTASK'))
- #taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- #for dep in taskdepdata:
- # bb.warn('%s:%s = %s' % (taskdepdata[dep][0], taskdepdata[dep][1], taskdepdata[dep][6]))
- return
-
- if d.getVar('PRSERV_LOCKDOWN'):
- auto_pr = d.getVar('PRAUTO_' + version + '_' + pkgarch) or d.getVar('PRAUTO_' + version) or None
- if auto_pr is None:
- bb.fatal("Can NOT get PRAUTO from lockdown exported file")
- d.setVar('PRAUTO',str(auto_pr))
- return
-
- try:
- conn = oe.prservice.prserv_make_conn(d)
- if conn is not None:
- if "AUTOINC" in pkgv:
- srcpv = bb.fetch2.get_srcrev(d)
- base_ver = "AUTOINC-%s" % version[:version.find(srcpv)]
- value = conn.getPR(base_ver, pkgarch, srcpv)
- d.setVar("PRSERV_PV_AUTOINC", str(value))
-
- auto_pr = conn.getPR(version, pkgarch, checksum)
- conn.close()
- except Exception as e:
- bb.fatal("Can NOT get PRAUTO, exception %s" % str(e))
- if auto_pr is None:
- bb.fatal("Can NOT get PRAUTO from remote PR service")
- d.setVar('PRAUTO',str(auto_pr))
-}
-
-#
-# Package functions suitable for inclusion in PACKAGEFUNCS
-#
-
-python package_convert_pr_autoinc() {
- pkgv = d.getVar("PKGV")
-
- # Adjust pkgv as necessary...
- if 'AUTOINC' in pkgv:
- d.setVar("PKGV", pkgv.replace("AUTOINC", "${PRSERV_PV_AUTOINC}"))
-
- # Change PRSERV_PV_AUTOINC and EXTENDPRAUTO usage to special values
- d.setVar('PRSERV_PV_AUTOINC', '@PRSERV_PV_AUTOINC@')
- d.setVar('EXTENDPRAUTO', '@EXTENDPRAUTO@')
-}
-
-LOCALEBASEPN ??= "${PN}"
-
-python package_do_split_locales() {
- if (d.getVar('PACKAGE_NO_LOCALE') == '1'):
- bb.debug(1, "package requested not splitting locales")
- return
-
- packages = (d.getVar('PACKAGES') or "").split()
-
- datadir = d.getVar('datadir')
- if not datadir:
- bb.note("datadir not defined")
- return
-
- dvar = d.getVar('PKGD')
- pn = d.getVar('LOCALEBASEPN')
-
- if pn + '-locale' in packages:
- packages.remove(pn + '-locale')
-
- localedir = os.path.join(dvar + datadir, 'locale')
-
- if not cpath.isdir(localedir):
- bb.debug(1, "No locale files in this package")
- return
-
- locales = os.listdir(localedir)
-
- summary = d.getVar('SUMMARY') or pn
- description = d.getVar('DESCRIPTION') or ""
- locale_section = d.getVar('LOCALE_SECTION')
- mlprefix = d.getVar('MLPREFIX') or ""
- for l in sorted(locales):
- ln = legitimize_package_name(l)
- pkg = pn + '-locale-' + ln
- packages.append(pkg)
- d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l))
- d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, ln))
- d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln))
- d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l))
- d.setVar('DESCRIPTION:' + pkg, '%s This package contains language translation files for the %s locale.' % (description, l))
- if locale_section:
- d.setVar('SECTION:' + pkg, locale_section)
-
- d.setVar('PACKAGES', ' '.join(packages))
-
- # Disabled by RP 18/06/07
- # Wildcards aren't supported in debian
- # They break with ipkg since glibc-locale* will mean that
- # glibc-localedata-translit* won't install as a dependency
- # for some other package which breaks meta-toolchain
- # Probably breaks since virtual-locale- isn't provided anywhere
- #rdep = (d.getVar('RDEPENDS:%s' % pn) or "").split()
- #rdep.append('%s-locale*' % pn)
- #d.setVar('RDEPENDS:%s' % pn, ' '.join(rdep))
-}
-
-python perform_packagecopy () {
- import subprocess
- import shutil
-
- dest = d.getVar('D')
- dvar = d.getVar('PKGD')
-
- # Start by package population by taking a copy of the installed
- # files to operate on
- # Preserve sparse files and hard links
- cmd = 'tar --exclude=./sysroot-only -cf - -C %s -p -S . | tar -xf - -C %s' % (dest, dvar)
- 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):
- rpath_replace (dvar, d)
-}
-perform_packagecopy[cleandirs] = "${PKGD}"
-perform_packagecopy[dirs] = "${PKGD}"
-
-# We generate a master list of directories to process, we start by
-# seeding this list with reasonable defaults, then load from
-# the fs-perms.txt files
-python fixup_perms () {
- import pwd, grp
-
- # init using a string with the same format as a line as documented in
- # the fs-perms.txt file
- # <path> <mode> <uid> <gid> <walk> <fmode> <fuid> <fgid>
- # <path> link <link target>
- #
- # __str__ can be used to print out an entry in the input format
- #
- # if fs_perms_entry.path is None:
- # an error occurred
- # if fs_perms_entry.link, you can retrieve:
- # fs_perms_entry.path = path
- # fs_perms_entry.link = target of link
- # if not fs_perms_entry.link, you can retrieve:
- # fs_perms_entry.path = path
- # fs_perms_entry.mode = expected dir mode or None
- # fs_perms_entry.uid = expected uid or -1
- # fs_perms_entry.gid = expected gid or -1
- # fs_perms_entry.walk = 'true' or something else
- # fs_perms_entry.fmode = expected file mode or None
- # fs_perms_entry.fuid = expected file uid or -1
- # fs_perms_entry_fgid = expected file gid or -1
- class fs_perms_entry():
- def __init__(self, line):
- lsplit = line.split()
- if len(lsplit) == 3 and lsplit[1].lower() == "link":
- self._setlink(lsplit[0], lsplit[2])
- elif len(lsplit) == 8:
- self._setdir(lsplit[0], lsplit[1], lsplit[2], lsplit[3], lsplit[4], lsplit[5], lsplit[6], lsplit[7])
- else:
- msg = "Fixup Perms: invalid config line %s" % line
- oe.qa.handle_error("perm-config", msg, d)
- self.path = None
- self.link = None
-
- def _setdir(self, path, mode, uid, gid, walk, fmode, fuid, fgid):
- self.path = os.path.normpath(path)
- self.link = None
- self.mode = self._procmode(mode)
- self.uid = self._procuid(uid)
- self.gid = self._procgid(gid)
- self.walk = walk.lower()
- self.fmode = self._procmode(fmode)
- self.fuid = self._procuid(fuid)
- self.fgid = self._procgid(fgid)
-
- def _setlink(self, path, link):
- self.path = os.path.normpath(path)
- self.link = link
-
- def _procmode(self, mode):
- if not mode or (mode and mode == "-"):
- return None
- else:
- return int(mode,8)
-
- # Note uid/gid -1 has special significance in os.lchown
- def _procuid(self, uid):
- if uid is None or uid == "-":
- return -1
- elif uid.isdigit():
- return int(uid)
- else:
- return pwd.getpwnam(uid).pw_uid
-
- def _procgid(self, gid):
- if gid is None or gid == "-":
- return -1
- elif gid.isdigit():
- return int(gid)
- else:
- return grp.getgrnam(gid).gr_gid
-
- # Use for debugging the entries
- def __str__(self):
- if self.link:
- return "%s link %s" % (self.path, self.link)
- else:
- mode = "-"
- if self.mode:
- mode = "0%o" % self.mode
- fmode = "-"
- if self.fmode:
- fmode = "0%o" % self.fmode
- uid = self._mapugid(self.uid)
- gid = self._mapugid(self.gid)
- fuid = self._mapugid(self.fuid)
- fgid = self._mapugid(self.fgid)
- return "%s %s %s %s %s %s %s %s" % (self.path, mode, uid, gid, self.walk, fmode, fuid, fgid)
-
- def _mapugid(self, id):
- if id is None or id == -1:
- return "-"
- else:
- return "%d" % id
-
- # Fix the permission, owner and group of path
- def fix_perms(path, mode, uid, gid, dir):
- if mode and not os.path.islink(path):
- #bb.note("Fixup Perms: chmod 0%o %s" % (mode, dir))
- os.chmod(path, mode)
- # -1 is a special value that means don't change the uid/gid
- # if they are BOTH -1, don't bother to lchown
- if not (uid == -1 and gid == -1):
- #bb.note("Fixup Perms: lchown %d:%d %s" % (uid, gid, dir))
- os.lchown(path, uid, gid)
-
- # Return a list of configuration files based on either the default
- # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES
- # paths are resolved via BBPATH
- def get_fs_perms_list(d):
- str = ""
- bbpath = d.getVar('BBPATH')
- fs_perms_tables = d.getVar('FILESYSTEM_PERMS_TABLES') or ""
- for conf_file in fs_perms_tables.split():
- confpath = bb.utils.which(bbpath, conf_file)
- if confpath:
- str += " %s" % bb.utils.which(bbpath, conf_file)
- else:
- bb.warn("cannot find %s specified in FILESYSTEM_PERMS_TABLES" % conf_file)
- return str
-
-
-
- dvar = d.getVar('PKGD')
-
- fs_perms_table = {}
- fs_link_table = {}
-
- # By default all of the standard directories specified in
- # bitbake.conf will get 0755 root:root.
- target_path_vars = [ 'base_prefix',
- 'prefix',
- 'exec_prefix',
- 'base_bindir',
- 'base_sbindir',
- 'base_libdir',
- 'datadir',
- 'sysconfdir',
- 'servicedir',
- 'sharedstatedir',
- 'localstatedir',
- 'infodir',
- 'mandir',
- 'docdir',
- 'bindir',
- 'sbindir',
- 'libexecdir',
- 'libdir',
- 'includedir',
- 'oldincludedir' ]
-
- for path in target_path_vars:
- dir = d.getVar(path) or ""
- if dir == "":
- continue
- fs_perms_table[dir] = fs_perms_entry(d.expand("%s 0755 root root false - - -" % (dir)))
-
- # Now we actually load from the configuration files
- for conf in get_fs_perms_list(d).split():
- if not os.path.exists(conf):
- continue
- with open(conf) as f:
- for line in f:
- if line.startswith('#'):
- continue
- lsplit = line.split()
- if len(lsplit) == 0:
- continue
- if len(lsplit) != 8 and not (len(lsplit) == 3 and lsplit[1].lower() == "link"):
- msg = "Fixup perms: %s invalid line: %s" % (conf, line)
- oe.qa.handle_error("perm-line", msg, d)
- continue
- entry = fs_perms_entry(d.expand(line))
- if entry and entry.path:
- if entry.link:
- fs_link_table[entry.path] = entry
- if entry.path in fs_perms_table:
- fs_perms_table.pop(entry.path)
- else:
- fs_perms_table[entry.path] = entry
- if entry.path in fs_link_table:
- fs_link_table.pop(entry.path)
-
- # Debug -- list out in-memory table
- #for dir in fs_perms_table:
- # bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir])))
- #for link in fs_link_table:
- # bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link])))
-
- # We process links first, so we can go back and fixup directory ownership
- # for any newly created directories
- # Process in sorted order so /run gets created before /run/lock, etc.
- for entry in sorted(fs_link_table.values(), key=lambda x: x.link):
- link = entry.link
- dir = entry.path
- origin = dvar + dir
- if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)):
- continue
-
- if link[0] == "/":
- target = dvar + link
- ptarget = link
- else:
- target = os.path.join(os.path.dirname(origin), link)
- ptarget = os.path.join(os.path.dirname(dir), link)
- if os.path.exists(target):
- msg = "Fixup Perms: Unable to correct directory link, target already exists: %s -> %s" % (dir, ptarget)
- oe.qa.handle_error("perm-link", msg, d)
- continue
-
- # Create path to move directory to, move it, and then setup the symlink
- bb.utils.mkdirhier(os.path.dirname(target))
- #bb.note("Fixup Perms: Rename %s -> %s" % (dir, ptarget))
- bb.utils.rename(origin, target)
- #bb.note("Fixup Perms: Link %s -> %s" % (dir, link))
- os.symlink(link, origin)
-
- for dir in fs_perms_table:
- origin = dvar + dir
- if not (cpath.exists(origin) and cpath.isdir(origin)):
- continue
-
- fix_perms(origin, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir)
-
- if fs_perms_table[dir].walk == 'true':
- for root, dirs, files in os.walk(origin):
- for dr in dirs:
- each_dir = os.path.join(root, dr)
- fix_perms(each_dir, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir)
- for f in files:
- each_file = os.path.join(root, f)
- fix_perms(each_file, fs_perms_table[dir].fmode, fs_perms_table[dir].fuid, fs_perms_table[dir].fgid, dir)
-}
-
-def package_debug_vars(d):
- # We default to '.debug' style
- if d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-file-directory':
- # Single debug-file-directory style debug info
- debug_vars = {
- "append": ".debug",
- "staticappend": "",
- "dir": "",
- "staticdir": "",
- "libdir": "/usr/lib/debug",
- "staticlibdir": "/usr/lib/debug-static",
- "srcdir": "/usr/src/debug",
- }
- elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-without-src':
- # Original OE-core, a.k.a. ".debug", style debug info, but without sources in /usr/src/debug
- debug_vars = {
- "append": "",
- "staticappend": "",
- "dir": "/.debug",
- "staticdir": "/.debug-static",
- "libdir": "",
- "staticlibdir": "",
- "srcdir": "",
- }
- elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg':
- debug_vars = {
- "append": "",
- "staticappend": "",
- "dir": "/.debug",
- "staticdir": "/.debug-static",
- "libdir": "",
- "staticlibdir": "",
- "srcdir": "/usr/src/debug",
- }
- else:
- # Original OE-core, a.k.a. ".debug", style debug info
- debug_vars = {
- "append": "",
- "staticappend": "",
- "dir": "/.debug",
- "staticdir": "/.debug-static",
- "libdir": "",
- "staticlibdir": "",
- "srcdir": "/usr/src/debug",
- }
-
- return debug_vars
-
-python split_and_strip_files () {
- import stat, errno
- import subprocess
-
- dvar = d.getVar('PKGD')
- pn = d.getVar('PN')
- hostos = d.getVar('HOST_OS')
-
- oldcwd = os.getcwd()
- os.chdir(dvar)
-
- dv = package_debug_vars(d)
-
- #
- # First lets figure out all of the files we may have to process ... do this only once!
- #
- elffiles = {}
- symlinks = {}
- staticlibs = []
- inodes = {}
- libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
- baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir"))
- 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)
-
- # Skip debug files
- if dv["append"] and file.endswith(dv["append"]):
- continue
- if dv["dir"] and dv["dir"] in os.path.dirname(file[len(dvar):]):
- continue
-
- if file in skipfiles:
- continue
-
- if oe.package.is_static_lib(file):
- staticlibs.append(file)
- continue
-
- try:
- ltarget = cpath.realpath(file, dvar, False)
- s = cpath.lstat(ltarget)
- except OSError as e:
- (err, strerror) = e.args
- if err != errno.ENOENT:
- raise
- # Skip broken symlinks
- continue
- if not s:
- continue
- # 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)) \
- or (f.startswith('vmlinux') or ".ko" in f):
-
- if cpath.islink(file):
- 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)
-
- 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
-
- results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d)
-
- # Sort results by file path. This ensures that the files are always
- # processed in the same order, which is important to make sure builds
- # are reproducible when dealing with hardlinks
- results.sort(key=lambda x: x[0])
-
- 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)
- oe.qa.handle_error("already-stripped", msg, d)
- continue
-
- # 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][1]
- 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.break_hardlinks(file)
- elffiles[file] = elf_file
- # Modified the file so clear the cache
- cpath.updatecache(file)
-
- def strip_pkgd_prefix(f):
- nonlocal dvar
-
- if f.startswith(dvar):
- return f[len(dvar):]
-
- return f
-
- #
- # First lets process debug splitting
- #
- if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'):
- results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, dv, d))
-
- if dv["srcdir"] and not hostos.startswith("mingw"):
- if (d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'):
- results = oe.utils.multiprocess_launch(splitstaticdebuginfo, staticlibs, d, extraargs=(dvar, dv, d))
- else:
- for file in staticlibs:
- results.append( (file,source_info(file, d)) )
-
- d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, s in results})
-
- sources = set()
- for r in results:
- sources.update(r[1])
-
- # Hardlink our debug symbols to the other hardlink copies
- for ref in inodes:
- if len(inodes[ref]) == 1:
- continue
-
- target = inodes[ref][0][len(dvar):]
- for file in inodes[ref][1:]:
- src = file[len(dvar):]
- dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(target) + dv["append"]
- fpath = dvar + dest
- ftarget = dvar + dv["libdir"] + os.path.dirname(target) + dv["dir"] + "/" + os.path.basename(target) + dv["append"]
- bb.utils.mkdirhier(os.path.dirname(fpath))
- # Only one hardlink of separated debug info file in each directory
- if not os.access(fpath, os.R_OK):
- #bb.note("Link %s -> %s" % (fpath, ftarget))
- os.link(ftarget, fpath)
-
- # Create symlinks for all cases we were able to split symbols
- for file in symlinks:
- src = file[len(dvar):]
- dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"]
- fpath = dvar + dest
- # Skip it if the target doesn't exist
- try:
- s = os.stat(fpath)
- except OSError as e:
- (err, strerror) = e.args
- if err != errno.ENOENT:
- raise
- continue
-
- ltarget = symlinks[file]
- lpath = os.path.dirname(ltarget)
- lbase = os.path.basename(ltarget)
- ftarget = ""
- if lpath and lpath != ".":
- ftarget += lpath + dv["dir"] + "/"
- ftarget += lbase + dv["append"]
- if lpath.startswith(".."):
- ftarget = os.path.join("..", ftarget)
- bb.utils.mkdirhier(os.path.dirname(fpath))
- #bb.note("Symlink %s -> %s" % (fpath, ftarget))
- os.symlink(ftarget, fpath)
-
- # Process the dv["srcdir"] if requested...
- # This copies and places the referenced sources for later debugging...
- copydebugsources(dv["srcdir"], sources, d)
- #
- # End of debug splitting
- #
-
- #
- # Now lets go back over things and strip them
- #
- if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1'):
- strip = d.getVar("STRIP")
- sfiles = []
- for file in elffiles:
- elf_file = int(elffiles[file])
- #bb.note("Strip %s" % file)
- sfiles.append((file, elf_file, strip))
- if (d.getVar('PACKAGE_STRIP_STATIC') == '1' or d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'):
- for f in staticlibs:
- sfiles.append((f, 16, strip))
-
- oe.utils.multiprocess_launch(oe.package.runstrip, sfiles, d)
-
- # Build "minidebuginfo" and reinject it back into the stripped binaries
- if d.getVar('PACKAGE_MINIDEBUGINFO') == '1':
- oe.utils.multiprocess_launch(inject_minidebuginfo, list(elffiles), d,
- extraargs=(dvar, dv, d))
-
- #
- # End of strip
- #
- os.chdir(oldcwd)
-}
-
-python populate_packages () {
- import glob, re
-
- workdir = d.getVar('WORKDIR')
- outdir = d.getVar('DEPLOY_DIR')
- dvar = d.getVar('PKGD')
- packages = d.getVar('PACKAGES').split()
- pn = d.getVar('PN')
-
- bb.utils.mkdirhier(outdir)
- os.chdir(dvar)
-
- autodebug = not (d.getVar("NOAUTOPACKAGEDEBUG") or False)
-
- split_source_package = (d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg')
-
- # If debug-with-srcpkg mode is enabled then add the source package if it
- # doesn't exist and add the source file contents to the source package.
- if split_source_package:
- src_package_name = ('%s-src' % d.getVar('PN'))
- if not src_package_name in packages:
- packages.append(src_package_name)
- d.setVar('FILES:%s' % src_package_name, '/usr/src/debug')
-
- # Sanity check PACKAGES for duplicates
- # Sanity should be moved to sanity.bbclass once we have the infrastructure
- package_dict = {}
-
- for i, pkg in enumerate(packages):
- if pkg in package_dict:
- msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg
- oe.qa.handle_error("packages-list", msg, d)
- # Ensure the source package gets the chance to pick up the source files
- # before the debug package by ordering it first in PACKAGES. Whether it
- # actually picks up any source files is controlled by
- # PACKAGE_DEBUG_SPLIT_STYLE.
- elif pkg.endswith("-src"):
- package_dict[pkg] = (10, i)
- elif autodebug and pkg.endswith("-dbg"):
- package_dict[pkg] = (30, i)
- else:
- package_dict[pkg] = (50, i)
- packages = sorted(package_dict.keys(), key=package_dict.get)
- d.setVar('PACKAGES', ' '.join(packages))
- pkgdest = d.getVar('PKGDEST')
-
- seen = []
-
- # os.mkdir masks the permissions with umask so we have to unset it first
- oldumask = os.umask(0)
-
- debug = []
- for root, dirs, files in cpath.walk(dvar):
- dir = root[len(dvar):]
- if not dir:
- dir = os.sep
- for f in (files + dirs):
- path = "." + os.path.join(dir, f)
- if "/.debug/" in path or "/.debug-static/" in path or path.endswith("/.debug"):
- debug.append(path)
-
- for pkg in packages:
- root = os.path.join(pkgdest, pkg)
- bb.utils.mkdirhier(root)
-
- filesvar = d.getVar('FILES:%s' % pkg) or ""
- if "//" in filesvar:
- msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg
- oe.qa.handle_error("files-invalid", msg, d)
- filesvar.replace("//", "/")
-
- origfiles = filesvar.split()
- files, symlink_paths = files_from_filevars(origfiles)
-
- if autodebug and pkg.endswith("-dbg"):
- files.extend(debug)
-
- for file in files:
- if (not cpath.islink(file)) and (not cpath.exists(file)):
- continue
- if file in seen:
- continue
- seen.append(file)
-
- def mkdir(src, dest, p):
- src = os.path.join(src, p)
- dest = os.path.join(dest, p)
- fstat = cpath.stat(src)
- os.mkdir(dest)
- os.chmod(dest, fstat.st_mode)
- os.chown(dest, fstat.st_uid, fstat.st_gid)
- if p not in seen:
- seen.append(p)
- cpath.updatecache(dest)
-
- def mkdir_recurse(src, dest, paths):
- if cpath.exists(dest + '/' + paths):
- return
- while paths.startswith("./"):
- paths = paths[2:]
- p = "."
- for c in paths.split("/"):
- p = os.path.join(p, c)
- if not cpath.exists(os.path.join(dest, p)):
- mkdir(src, dest, p)
-
- if cpath.isdir(file) and not cpath.islink(file):
- mkdir_recurse(dvar, root, file)
- continue
-
- mkdir_recurse(dvar, root, os.path.dirname(file))
- fpath = os.path.join(root,file)
- if not cpath.islink(file):
- os.link(file, fpath)
- continue
- ret = bb.utils.copyfile(file, fpath)
- if ret is False or ret == 0:
- bb.fatal("File population failed")
-
- # Check if symlink paths exist
- for file in symlink_paths:
- if not os.path.exists(os.path.join(root,file)):
- bb.fatal("File '%s' cannot be packaged into '%s' because its "
- "parent directory structure does not exist. One of "
- "its parent directories is a symlink whose target "
- "directory is not included in the package." %
- (file, pkg))
-
- os.umask(oldumask)
- os.chdir(workdir)
-
- # Handle excluding packages with incompatible licenses
- package_list = []
- for pkg in packages:
- licenses = d.getVar('_exclude_incompatible-' + pkg)
- if licenses:
- msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses)
- oe.qa.handle_error("incompatible-license", msg, d)
- else:
- package_list.append(pkg)
- d.setVar('PACKAGES', ' '.join(package_list))
-
- unshipped = []
- for root, dirs, files in cpath.walk(dvar):
- dir = root[len(dvar):]
- if not dir:
- dir = os.sep
- for f in (files + dirs):
- path = os.path.join(dir, f)
- if ('.' + path) not in seen:
- unshipped.append(path)
-
- if unshipped != []:
- msg = pn + ": Files/directories were installed but not shipped in any package:"
- if "installed-vs-shipped" in (d.getVar('INSANE_SKIP:' + pn) or "").split():
- bb.note("Package %s skipping QA tests: installed-vs-shipped" % pn)
- else:
- for f in unshipped:
- msg = msg + "\n " + f
- msg = msg + "\nPlease set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.\n"
- msg = msg + "%s: %d installed and not shipped files." % (pn, len(unshipped))
- oe.qa.handle_error("installed-vs-shipped", msg, d)
-}
-populate_packages[dirs] = "${D}"
-
-python package_fixsymlinks () {
- import errno
- pkgdest = d.getVar('PKGDEST')
- packages = d.getVar("PACKAGES", False).split()
-
- dangling_links = {}
- pkg_files = {}
- for pkg in packages:
- dangling_links[pkg] = []
- pkg_files[pkg] = []
- inst_root = os.path.join(pkgdest, pkg)
- for path in pkgfiles[pkg]:
- rpath = path[len(inst_root):]
- pkg_files[pkg].append(rpath)
- rtarget = cpath.realpath(path, inst_root, True, assume_dir = True)
- if not cpath.lexists(rtarget):
- dangling_links[pkg].append(os.path.normpath(rtarget[len(inst_root):]))
-
- newrdepends = {}
- for pkg in dangling_links:
- for l in dangling_links[pkg]:
- found = False
- bb.debug(1, "%s contains dangling link %s" % (pkg, l))
- for p in packages:
- if l in pkg_files[p]:
- found = True
- bb.debug(1, "target found in %s" % p)
- if p == pkg:
- break
- if pkg not in newrdepends:
- newrdepends[pkg] = []
- newrdepends[pkg].append(p)
- break
- if found == False:
- bb.note("%s contains dangling symlink to %s" % (pkg, l))
-
- for pkg in newrdepends:
- rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
- for p in newrdepends[pkg]:
- if p not in rdepends:
- rdepends[p] = []
- d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False))
-}
-
-
-python package_package_name_hook() {
- """
- A package_name_hook function can be used to rewrite the package names by
- changing PKG. For an example, see debian.bbclass.
- """
- pass
-}
-
-EXPORT_FUNCTIONS package_name_hook
-
-
-PKGDESTWORK = "${WORKDIR}/pkgdata"
-
-PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY RDEPENDS RPROVIDES RRECOMMENDS RSUGGESTS RREPLACES RCONFLICTS SECTION PKG ALLOW_EMPTY FILES CONFFILES FILES_INFO PACKAGE_ADD_METADATA pkg_postinst pkg_postrm pkg_preinst pkg_prerm"
-
-python emit_pkgdata() {
- from glob import glob
- import json
- import bb.compress.zstd
-
- def process_postinst_on_target(pkg, mlprefix):
- pkgval = d.getVar('PKG:%s' % pkg)
- if pkgval is None:
- pkgval = pkg
-
- defer_fragment = """
-if [ -n "$D" ]; then
- $INTERCEPT_DIR/postinst_intercept delay_to_first_boot %s mlprefix=%s
- exit 0
-fi
-""" % (pkgval, mlprefix)
-
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- postinst_ontarget = d.getVar('pkg_postinst_ontarget:%s' % pkg)
-
- if postinst_ontarget:
- bb.debug(1, 'adding deferred pkg_postinst_ontarget() to pkg_postinst() for %s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += defer_fragment
- postinst += postinst_ontarget
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- def add_set_e_to_scriptlets(pkg):
- for scriptlet_name in ('pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'):
- scriptlet = d.getVar('%s:%s' % (scriptlet_name, pkg))
- if scriptlet:
- scriptlet_split = scriptlet.split('\n')
- if scriptlet_split[0].startswith("#!"):
- scriptlet = scriptlet_split[0] + "\nset -e\n" + "\n".join(scriptlet_split[1:])
- else:
- scriptlet = "set -e\n" + "\n".join(scriptlet_split[0:])
- d.setVar('%s:%s' % (scriptlet_name, pkg), scriptlet)
-
- def write_if_exists(f, pkg, var):
- def encode(str):
- import codecs
- c = codecs.getencoder("unicode_escape")
- return c(str)[0].decode("latin1")
-
- val = d.getVar('%s:%s' % (var, pkg))
- if val:
- f.write('%s:%s: %s\n' % (var, pkg, encode(val)))
- return val
- val = d.getVar('%s' % (var))
- if val:
- f.write('%s: %s\n' % (var, encode(val)))
- return val
-
- def write_extra_pkgs(variants, pn, packages, pkgdatadir):
- for variant in variants:
- with open("%s/%s-%s" % (pkgdatadir, variant, pn), 'w') as fd:
- fd.write("PACKAGES: %s\n" % ' '.join(
- map(lambda pkg: '%s-%s' % (variant, pkg), packages.split())))
-
- def write_extra_runtime_pkgs(variants, packages, pkgdatadir):
- for variant in variants:
- for pkg in packages.split():
- ml_pkg = "%s-%s" % (variant, pkg)
- subdata_file = "%s/runtime/%s" % (pkgdatadir, ml_pkg)
- with open(subdata_file, 'w') as fd:
- fd.write("PKG:%s: %s" % (ml_pkg, pkg))
-
- packages = d.getVar('PACKAGES')
- pkgdest = d.getVar('PKGDEST')
- pkgdatadir = d.getVar('PKGDESTWORK')
-
- data_file = pkgdatadir + d.expand("/${PN}")
- with open(data_file, 'w') as fd:
- fd.write("PACKAGES: %s\n" % packages)
-
- pkgdebugsource = d.getVar("PKGDEBUGSOURCES") or []
-
- pn = d.getVar('PN')
- global_variants = (d.getVar('MULTILIB_GLOBAL_VARIANTS') or "").split()
- variants = (d.getVar('MULTILIB_VARIANTS') or "").split()
-
- if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d):
- write_extra_pkgs(variants, pn, packages, pkgdatadir)
-
- if bb.data.inherits_class('allarch', d) and not variants \
- and not bb.data.inherits_class('packagegroup', d):
- write_extra_pkgs(global_variants, pn, packages, pkgdatadir)
-
- workdir = d.getVar('WORKDIR')
-
- for pkg in packages.split():
- pkgval = d.getVar('PKG:%s' % pkg)
- if pkgval is None:
- pkgval = pkg
- d.setVar('PKG:%s' % pkg, pkg)
-
- extended_data = {
- "files_info": {}
- }
-
- pkgdestpkg = os.path.join(pkgdest, pkg)
- files = {}
- files_extra = {}
- total_size = 0
- seen = set()
- for f in pkgfiles[pkg]:
- fpath = os.sep + os.path.relpath(f, pkgdestpkg)
-
- fstat = os.lstat(f)
- files[fpath] = fstat.st_size
-
- extended_data["files_info"].setdefault(fpath, {})
- extended_data["files_info"][fpath]['size'] = fstat.st_size
-
- if fstat.st_ino not in seen:
- seen.add(fstat.st_ino)
- total_size += fstat.st_size
-
- if fpath in pkgdebugsource:
- extended_data["files_info"][fpath]['debugsrc'] = pkgdebugsource[fpath]
- del pkgdebugsource[fpath]
-
- d.setVar('FILES_INFO:' + pkg , json.dumps(files, sort_keys=True))
-
- process_postinst_on_target(pkg, d.getVar("MLPREFIX"))
- add_set_e_to_scriptlets(pkg)
-
- subdata_file = pkgdatadir + "/runtime/%s" % pkg
- with open(subdata_file, 'w') as sf:
- for var in (d.getVar('PKGDATA_VARS') or "").split():
- val = write_if_exists(sf, pkg, var)
-
- write_if_exists(sf, pkg, 'FILERPROVIDESFLIST')
- for dfile in sorted((d.getVar('FILERPROVIDESFLIST:' + pkg) or "").split()):
- write_if_exists(sf, pkg, 'FILERPROVIDES:' + dfile)
-
- write_if_exists(sf, pkg, 'FILERDEPENDSFLIST')
- for dfile in sorted((d.getVar('FILERDEPENDSFLIST:' + pkg) or "").split()):
- write_if_exists(sf, pkg, 'FILERDEPENDS:' + dfile)
-
- sf.write('%s:%s: %d\n' % ('PKGSIZE', pkg, total_size))
-
- subdata_extended_file = pkgdatadir + "/extended/%s.json.zstd" % pkg
- num_threads = int(d.getVar("BB_NUMBER_THREADS"))
- with bb.compress.zstd.open(subdata_extended_file, "wt", encoding="utf-8", num_threads=num_threads) as f:
- json.dump(extended_data, f, sort_keys=True, separators=(",", ":"))
-
- # Symlinks needed for rprovides lookup
- rprov = d.getVar('RPROVIDES:%s' % pkg) or d.getVar('RPROVIDES')
- if rprov:
- for p in bb.utils.explode_deps(rprov):
- subdata_sym = pkgdatadir + "/runtime-rprovides/%s/%s" % (p, pkg)
- bb.utils.mkdirhier(os.path.dirname(subdata_sym))
- oe.path.symlink("../../runtime/%s" % pkg, subdata_sym, True)
-
- allow_empty = d.getVar('ALLOW_EMPTY:%s' % pkg)
- if not allow_empty:
- allow_empty = d.getVar('ALLOW_EMPTY')
- root = "%s/%s" % (pkgdest, pkg)
- os.chdir(root)
- g = glob('*')
- if g or allow_empty == "1":
- # Symlinks needed for reverse lookups (from the final package name)
- subdata_sym = pkgdatadir + "/runtime-reverse/%s" % pkgval
- oe.path.symlink("../runtime/%s" % pkg, subdata_sym, True)
-
- packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg
- open(packagedfile, 'w').close()
-
- if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d):
- write_extra_runtime_pkgs(variants, packages, pkgdatadir)
-
- if bb.data.inherits_class('allarch', d) and not variants \
- and not bb.data.inherits_class('packagegroup', d):
- write_extra_runtime_pkgs(global_variants, packages, pkgdatadir)
-
-}
-emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides ${PKGDESTWORK}/extended"
-emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS"
-
-ldconfig_postinst_fragment() {
-if [ x"$D" = "x" ]; then
- if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
-fi
-}
-
-RPMDEPS = "${STAGING_LIBDIR_NATIVE}/rpm/rpmdeps --alldeps --define '__font_provides %{nil}'"
-
-# Collect perfile run-time dependency metadata
-# Output:
-# FILERPROVIDESFLIST:pkg - list of all files w/ deps
-# FILERPROVIDES:filepath:pkg - per file dep
-#
-# FILERDEPENDSFLIST:pkg - list of all files w/ deps
-# FILERDEPENDS:filepath:pkg - per file dep
-
-python package_do_filedeps() {
- if d.getVar('SKIP_FILEDEPS') == '1':
- return
-
- pkgdest = d.getVar('PKGDEST')
- packages = d.getVar('PACKAGES')
- rpmdeps = d.getVar('RPMDEPS')
-
- def chunks(files, n):
- return [files[i:i+n] for i in range(0, len(files), n)]
-
- pkglist = []
- for pkg in packages.split():
- if d.getVar('SKIP_FILEDEPS:' + pkg) == '1':
- continue
- if pkg.endswith('-dbg') or pkg.endswith('-doc') or pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or pkg.startswith('kernel-module-') or pkg.endswith('-src'):
- continue
- for files in chunks(pkgfiles[pkg], 100):
- pkglist.append((pkg, files, rpmdeps, pkgdest))
-
- processed = oe.utils.multiprocess_launch(oe.package.filedeprunner, pkglist, d)
-
- provides_files = {}
- requires_files = {}
-
- for result in processed:
- (pkg, provides, requires) = result
-
- if pkg not in provides_files:
- provides_files[pkg] = []
- if pkg not in requires_files:
- requires_files[pkg] = []
-
- for file in sorted(provides):
- provides_files[pkg].append(file)
- key = "FILERPROVIDES:" + file + ":" + pkg
- d.appendVar(key, " " + " ".join(provides[file]))
-
- for file in sorted(requires):
- requires_files[pkg].append(file)
- key = "FILERDEPENDS:" + file + ":" + pkg
- d.appendVar(key, " " + " ".join(requires[file]))
-
- for pkg in requires_files:
- d.setVar("FILERDEPENDSFLIST:" + pkg, " ".join(sorted(requires_files[pkg])))
- for pkg in provides_files:
- d.setVar("FILERPROVIDESFLIST:" + pkg, " ".join(sorted(provides_files[pkg])))
-}
-
-SHLIBSDIRS = "${WORKDIR_PKGDATA}/${MLPREFIX}shlibs2"
-SHLIBSWORKDIR = "${PKGDESTWORK}/${MLPREFIX}shlibs2"
-
-python package_do_shlibs() {
- import itertools
- import re, pipes
- import subprocess
-
- exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', False)
- if exclude_shlibs:
- bb.note("not generating shlibs")
- return
-
- lib_re = re.compile(r"^.*\.so")
- libdir_re = re.compile(r".*/%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()
-
- hostos = d.getVar('HOST_OS')
-
- workdir = d.getVar('WORKDIR')
-
- ver = d.getVar('PKGV')
- if not ver:
- msg = "PKGV not defined"
- oe.qa.handle_error("pkgv-undefined", msg, d)
- return
-
- pkgdest = d.getVar('PKGDEST')
-
- shlibswork_dir = d.getVar('SHLIBSWORKDIR')
-
- 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 = tuple()
- for l in lines:
- m = re.match(r"\s+RPATH\s+([^\s]*)", l)
- if m:
- rpaths = m.group(1).replace("$ORIGIN", ldir).split(":")
- rpath = tuple(map(os.path.normpath, rpaths))
- for l in lines:
- m = re.match(r"\s+NEEDED\s+([^\s]*)", l)
- if m:
- dep = m.group(1)
- if dep not in needed:
- needed.add((dep, file, rpath))
- m = re.match(r"\s+SONAME\s+([^\s]*)", l)
- if m:
- this_soname = m.group(1)
- prov = (this_soname, ldir, pkgver)
- if not prov in sonames:
- # if library is private (only used by package) then do not build shlib for it
- import fnmatch
- if not private_libs or len([i for i in private_libs if fnmatch.fnmatch(this_soname, i)]) == 0:
- sonames.add(prov)
- if libdir_re.match(os.path.dirname(file)):
- needs_ldconfig = True
- if needs_ldconfig and snap_symlinks and (os.path.basename(file) != this_soname):
- renames.append((file, os.path.join(os.path.dirname(file), this_soname)))
- return (needs_ldconfig, needed, sonames, renames)
-
- def darwin_so(file, needed, sonames, renames, pkgver):
- if not os.path.exists(file):
- return
- ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
-
- def get_combinations(base):
- #
- # Given a base library name, find all combinations of this split by "." and "-"
- #
- combos = []
- options = base.split(".")
- for i in range(1, len(options) + 1):
- combos.append(".".join(options[0:i]))
- options = base.split("-")
- for i in range(1, len(options) + 1):
- combos.append("-".join(options[0:i]))
- return combos
-
- if (file.endswith('.dylib') or file.endswith('.so')) and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-src'):
- # Drop suffix
- name = os.path.basename(file).rsplit(".",1)[0]
- # Find all combinations
- combos = get_combinations(name)
- for combo in combos:
- if not combo in sonames:
- prov = (combo, ldir, pkgver)
- sonames.add(prov)
- if file.endswith('.dylib') or file.endswith('.so'):
- rpath = []
- 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:
- for l in out.split("\n"):
- l = l.strip()
- if l.startswith('path '):
- rpath.append(l.split()[1])
-
- 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:
- for l in out.split("\n"):
- l = l.strip()
- if not l or l.endswith(":"):
- continue
- if "is not an object file" in l:
- continue
- name = os.path.basename(l.split()[0]).rsplit(".", 1)[0]
- if name and name not in needed[pkg]:
- needed[pkg].add((name, file, tuple()))
-
- def mingw_dll(file, needed, sonames, renames, pkgver):
- if not os.path.exists(file):
- return
-
- if file.endswith(".dll"):
- # assume all dlls are shared objects provided by the package
- 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 = 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(r"DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE):
- dllname = m.group(1)
- if dllname:
- needed[pkg].add((dllname, file, tuple()))
-
- if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS') == "1":
- snap_symlinks = True
- else:
- snap_symlinks = False
-
- needed = {}
-
- shlib_provider = oe.package.read_shlib_providers(d)
-
- 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
- bb.debug(2, "calculating shlib provides for %s" % pkg)
-
- pkgver = d.getVar('PKGV:' + pkg)
- if not pkgver:
- pkgver = d.getVar('PV_' + pkg)
- if not pkgver:
- pkgver = ver
-
- needed[pkg] = set()
- sonames = set()
- renames = []
- linuxlist = []
- for file in pkgfiles[pkg]:
- soname = None
- if cpath.islink(file):
- continue
- if hostos == "darwin" or hostos == "darwin8":
- darwin_so(file, needed, sonames, renames, pkgver)
- elif hostos.startswith("mingw"):
- mingw_dll(file, needed, sonames, renames, pkgver)
- elif os.access(file, os.X_OK) or lib_re.match(file):
- 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))
- bb.utils.rename(old, new)
- pkgfiles[pkg].remove(old)
-
- shlibs_file = os.path.join(shlibswork_dir, pkg + ".list")
- if len(sonames):
- with open(shlibs_file, 'w') as fd:
- for s in sorted(sonames):
- if s[0] in shlib_provider and s[1] in shlib_provider[s[0]]:
- (old_pkg, old_pkgver) = shlib_provider[s[0]][s[1]]
- if old_pkg != pkg:
- bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver))
- bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0]))
- fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n')
- if s[0] not in shlib_provider:
- shlib_provider[s[0]] = {}
- shlib_provider[s[0]][s[1]] = (pkg, pkgver)
- if needs_ldconfig:
- bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('ldconfig_postinst_fragment')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
- bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames))
-
- assumed_libs = d.getVar('ASSUME_SHLIBS')
- if assumed_libs:
- libdir = d.getVar("libdir")
- for e in assumed_libs.split():
- l, dep_pkg = e.split(":")
- lib_ver = None
- dep_pkg = dep_pkg.rsplit("_", 1)
- if len(dep_pkg) == 2:
- lib_ver = dep_pkg[1]
- dep_pkg = dep_pkg[0]
- if l not in shlib_provider:
- shlib_provider[l] = {}
- shlib_provider[l][libdir] = (dep_pkg, lib_ver)
-
- libsearchpath = [d.getVar('libdir'), d.getVar('base_libdir')]
-
- 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 ""
- private_libs = private_libs.split()
-
- deps = list()
- for n in needed[pkg]:
- # if n is in private libraries, don't try to search provider for it
- # this could cause problem in case some abc.bb provides private
- # /opt/abc/lib/libfoo.so.1 and contains /usr/bin/abc depending on system library libfoo.so.1
- # but skipping it is still better alternative than providing own
- # version and then adding runtime dependency for the same system library
- import fnmatch
- if private_libs and len([i for i in private_libs if fnmatch.fnmatch(n[0], i)]) > 0:
- bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0]))
- continue
- if n[0] in shlib_provider.keys():
- shlib_provider_map = shlib_provider[n[0]]
- matches = set()
- for p in itertools.chain(list(n[2]), sorted(shlib_provider_map.keys()), libsearchpath):
- if p in shlib_provider_map:
- matches.add(p)
- if len(matches) > 1:
- matchpkgs = ', '.join([shlib_provider_map[match][0] for match in matches])
- bb.error("%s: Multiple shlib providers for %s: %s (used by files: %s)" % (pkg, n[0], matchpkgs, n[1]))
- elif len(matches) == 1:
- (dep_pkg, ver_needed) = shlib_provider_map[matches.pop()]
-
- bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1]))
-
- if dep_pkg == pkg:
- continue
-
- if ver_needed:
- dep = "%s (>= %s)" % (dep_pkg, ver_needed)
- else:
- dep = dep_pkg
- if not dep in deps:
- deps.append(dep)
- continue
- bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1]))
-
- deps_file = os.path.join(pkgdest, pkg + ".shlibdeps")
- if os.path.exists(deps_file):
- os.remove(deps_file)
- if deps:
- with open(deps_file, 'w') as fd:
- for dep in sorted(deps):
- fd.write(dep + '\n')
-}
-
-python package_do_pkgconfig () {
- import re
-
- packages = d.getVar('PACKAGES')
- workdir = d.getVar('WORKDIR')
- pkgdest = d.getVar('PKGDEST')
-
- shlibs_dirs = d.getVar('SHLIBSDIRS').split()
- shlibswork_dir = d.getVar('SHLIBSWORKDIR')
-
- pc_re = re.compile(r'(.*)\.pc$')
- var_re = re.compile(r'(.*)=(.*)')
- field_re = re.compile(r'(.*): (.*)')
-
- pkgconfig_provided = {}
- pkgconfig_needed = {}
- for pkg in packages.split():
- pkgconfig_provided[pkg] = []
- pkgconfig_needed[pkg] = []
- for file in sorted(pkgfiles[pkg]):
- m = pc_re.match(file)
- if m:
- pd = bb.data.init()
- name = m.group(1)
- pkgconfig_provided[pkg].append(os.path.basename(name))
- if not os.access(file, os.R_OK):
- continue
- with open(file, 'r') as f:
- lines = f.readlines()
- for l in lines:
- m = var_re.match(l)
- if m:
- name = m.group(1)
- val = m.group(2)
- pd.setVar(name, pd.expand(val))
- continue
- m = field_re.match(l)
- if m:
- hdr = m.group(1)
- exp = pd.expand(m.group(2))
- if hdr == 'Requires':
- pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
-
- for pkg in packages.split():
- pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
- if pkgconfig_provided[pkg] != []:
- with open(pkgs_file, 'w') as f:
- for p in sorted(pkgconfig_provided[pkg]):
- f.write('%s\n' % p)
-
- # Go from least to most specific since the last one found wins
- for dir in reversed(shlibs_dirs):
- if not os.path.exists(dir):
- continue
- for file in sorted(os.listdir(dir)):
- m = re.match(r'^(.*)\.pclist$', file)
- if m:
- pkg = m.group(1)
- with open(os.path.join(dir, file)) as fd:
- lines = fd.readlines()
- pkgconfig_provided[pkg] = []
- for l in lines:
- pkgconfig_provided[pkg].append(l.rstrip())
-
- for pkg in packages.split():
- deps = []
- for n in pkgconfig_needed[pkg]:
- found = False
- for k in pkgconfig_provided.keys():
- if n in pkgconfig_provided[k]:
- if k != pkg and not (k in deps):
- deps.append(k)
- found = True
- if found == False:
- bb.note("couldn't find pkgconfig module '%s' in any package" % n)
- deps_file = os.path.join(pkgdest, pkg + ".pcdeps")
- if len(deps):
- with open(deps_file, 'w') as fd:
- for dep in deps:
- fd.write(dep + '\n')
-}
-
-def read_libdep_files(d):
- pkglibdeps = {}
- packages = d.getVar('PACKAGES').split()
- for pkg in packages:
- pkglibdeps[pkg] = {}
- for extension in ".shlibdeps", ".pcdeps", ".clilibdeps":
- depsfile = d.expand("${PKGDEST}/" + pkg + extension)
- if os.access(depsfile, os.R_OK):
- with open(depsfile) as fd:
- lines = fd.readlines()
- for l in lines:
- l.rstrip()
- deps = bb.utils.explode_dep_versions2(l)
- for dep in deps:
- if not dep in pkglibdeps[pkg]:
- pkglibdeps[pkg][dep] = deps[dep]
- return pkglibdeps
-
-python read_shlibdeps () {
- pkglibdeps = read_libdep_files(d)
-
- packages = d.getVar('PACKAGES').split()
- for pkg in packages:
- rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
- for dep in sorted(pkglibdeps[pkg]):
- # Add the dep if it's not already there, or if no comparison is set
- if dep not in rdepends:
- rdepends[dep] = []
- for v in pkglibdeps[pkg][dep]:
- if v not in rdepends[dep]:
- rdepends[dep].append(v)
- d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False))
-}
-
-python package_depchains() {
- """
- For a given set of prefix and postfix modifiers, make those packages
- RRECOMMENDS on the corresponding packages for its RDEPENDS.
-
- Example: If package A depends upon package B, and A's .bb emits an
- A-dev package, this would make A-dev Recommends: B-dev.
-
- If only one of a given suffix is specified, it will take the RRECOMMENDS
- based on the RDEPENDS of *all* other packages. If more than one of a given
- suffix is specified, its will only use the RDEPENDS of the single parent
- package.
- """
-
- packages = d.getVar('PACKAGES')
- postfixes = (d.getVar('DEPCHAIN_POST') or '').split()
- prefixes = (d.getVar('DEPCHAIN_PRE') or '').split()
-
- def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d):
-
- #bb.note('depends for %s is %s' % (base, depends))
- rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "")
-
- for depend in sorted(depends):
- if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'):
- #bb.note("Skipping %s" % depend)
- continue
- if depend.endswith('-dev'):
- depend = depend[:-4]
- if depend.endswith('-dbg'):
- depend = depend[:-4]
- pkgname = getname(depend, suffix)
- #bb.note("Adding %s for %s" % (pkgname, depend))
- if pkgname not in rreclist and pkgname != pkg:
- rreclist[pkgname] = []
-
- #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist)))
- d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False))
-
- def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d):
-
- #bb.note('rdepends for %s is %s' % (base, rdepends))
- rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "")
-
- for depend in sorted(rdepends):
- if depend.find('virtual-locale-') != -1:
- #bb.note("Skipping %s" % depend)
- continue
- if depend.endswith('-dev'):
- depend = depend[:-4]
- if depend.endswith('-dbg'):
- depend = depend[:-4]
- pkgname = getname(depend, suffix)
- #bb.note("Adding %s for %s" % (pkgname, depend))
- if pkgname not in rreclist and pkgname != pkg:
- rreclist[pkgname] = []
-
- #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist)))
- d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False))
-
- def add_dep(list, dep):
- if dep not in list:
- list.append(dep)
-
- depends = []
- for dep in bb.utils.explode_deps(d.getVar('DEPENDS') or ""):
- add_dep(depends, dep)
-
- rdepends = []
- for pkg in packages.split():
- for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + pkg) or ""):
- add_dep(rdepends, dep)
-
- #bb.note('rdepends is %s' % rdepends)
-
- def post_getname(name, suffix):
- return '%s%s' % (name, suffix)
- def pre_getname(name, suffix):
- return '%s%s' % (suffix, name)
-
- pkgs = {}
- for pkg in packages.split():
- for postfix in postfixes:
- if pkg.endswith(postfix):
- if not postfix in pkgs:
- pkgs[postfix] = {}
- pkgs[postfix][pkg] = (pkg[:-len(postfix)], post_getname)
-
- for prefix in prefixes:
- if pkg.startswith(prefix):
- if not prefix in pkgs:
- pkgs[prefix] = {}
- pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname)
-
- if "-dbg" in pkgs:
- pkglibdeps = read_libdep_files(d)
- pkglibdeplist = []
- for pkg in pkglibdeps:
- for k in pkglibdeps[pkg]:
- add_dep(pkglibdeplist, k)
- dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS') == '1') or (bb.data.inherits_class('packagegroup', d)))
-
- for suffix in pkgs:
- for pkg in pkgs[suffix]:
- if d.getVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs'):
- continue
- (base, func) = pkgs[suffix][pkg]
- if suffix == "-dev":
- pkg_adddeprrecs(pkg, base, suffix, func, depends, d)
- elif suffix == "-dbg":
- if not dbgdefaultdeps:
- pkg_addrrecs(pkg, base, suffix, func, pkglibdeplist, d)
- continue
- if len(pkgs[suffix]) == 1:
- pkg_addrrecs(pkg, base, suffix, func, rdepends, d)
- else:
- rdeps = []
- for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + base) or ""):
- add_dep(rdeps, dep)
- pkg_addrrecs(pkg, base, suffix, func, rdeps, d)
-}
-
-# Since bitbake can't determine which variables are accessed during package
-# iteration, we need to list them here:
-PACKAGEVARS = "FILES RDEPENDS RRECOMMENDS SUMMARY DESCRIPTION RSUGGESTS RPROVIDES RCONFLICTS PKG ALLOW_EMPTY pkg_postinst pkg_postrm pkg_postinst_ontarget INITSCRIPT_NAME INITSCRIPT_PARAMS DEBIAN_NOAUTONAME ALTERNATIVE PKGE PKGV PKGR USERADD_PARAM GROUPADD_PARAM CONFFILES SYSTEMD_SERVICE LICENSE SECTION pkg_preinst pkg_prerm RREPLACES GROUPMEMS_PARAM SYSTEMD_AUTO_ENABLE SKIP_FILEDEPS PRIVATE_LIBS PACKAGE_ADD_METADATA"
-
-def gen_packagevar(d, pkgvars="PACKAGEVARS"):
- ret = []
- pkgs = (d.getVar("PACKAGES") or "").split()
- vars = (d.getVar(pkgvars) or "").split()
- for v in vars:
- ret.append(v)
- for p in pkgs:
- for v in vars:
- ret.append(v + ":" + p)
-
- # Ensure that changes to INCOMPATIBLE_LICENSE re-run do_package for
- # affected recipes.
- ret.append('_exclude_incompatible-%s' % p)
- return " ".join(ret)
-
-PACKAGE_PREPROCESS_FUNCS ?= ""
-# Functions for setting up PKGD
-PACKAGEBUILDPKGD ?= " \
- package_prepare_pkgdata \
- perform_packagecopy \
- ${PACKAGE_PREPROCESS_FUNCS} \
- split_and_strip_files \
- fixup_perms \
- "
-# Functions which split PKGD up into separate packages
-PACKAGESPLITFUNCS ?= " \
- package_do_split_locales \
- populate_packages"
-# Functions which process metadata based on split packages
-PACKAGEFUNCS += " \
- package_fixsymlinks \
- package_name_hook \
- package_do_filedeps \
- package_do_shlibs \
- package_do_pkgconfig \
- read_shlibdeps \
- package_depchains \
- emit_pkgdata"
-
-python do_package () {
- # Change the following version to cause sstate to invalidate the package
- # cache. This is useful if an item this class depends on changes in a
- # way that the output of this class changes. rpmdeps is a good example
- # as any change to rpmdeps requires this to be rerun.
- # PACKAGE_BBCLASS_VERSION = "4"
-
- # Init cachedpath
- global cpath
- cpath = oe.cachedpath.CachedPath()
-
- ###########################################################################
- # Sanity test the setup
- ###########################################################################
-
- packages = (d.getVar('PACKAGES') or "").split()
- if len(packages) < 1:
- bb.debug(1, "No packages to build, skipping do_package")
- return
-
- workdir = d.getVar('WORKDIR')
- outdir = d.getVar('DEPLOY_DIR')
- dest = d.getVar('D')
- dvar = d.getVar('PKGD')
- pn = d.getVar('PN')
-
- if not workdir or not outdir or not dest or not dvar or not pn:
- msg = "WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package"
- oe.qa.handle_error("var-undefined", msg, d)
- return
-
- bb.build.exec_func("package_convert_pr_autoinc", d)
-
- ###########################################################################
- # Optimisations
- ###########################################################################
-
- # Continually expanding complex expressions is inefficient, particularly
- # when we write to the datastore and invalidate the expansion cache. This
- # code pre-expands some frequently used variables
-
- def expandVar(x, d):
- d.setVar(x, d.getVar(x))
-
- for x in 'PN', 'PV', 'BPN', 'TARGET_SYS', 'EXTENDPRAUTO':
- expandVar(x, d)
-
- ###########################################################################
- # Setup PKGD (from D)
- ###########################################################################
-
- for f in (d.getVar('PACKAGEBUILDPKGD') or '').split():
- bb.build.exec_func(f, d)
-
- ###########################################################################
- # Split up PKGD into PKGDEST
- ###########################################################################
-
- cpath = oe.cachedpath.CachedPath()
-
- for f in (d.getVar('PACKAGESPLITFUNCS') or '').split():
- bb.build.exec_func(f, d)
-
- ###########################################################################
- # Process PKGDEST
- ###########################################################################
-
- # Build global list of files in each split package
- global pkgfiles
- pkgfiles = {}
- packages = d.getVar('PACKAGES').split()
- pkgdest = d.getVar('PKGDEST')
- for pkg in packages:
- pkgfiles[pkg] = []
- for walkroot, dirs, files in cpath.walk(pkgdest + "/" + pkg):
- for file in files:
- pkgfiles[pkg].append(walkroot + os.sep + file)
-
- for f in (d.getVar('PACKAGEFUNCS') or '').split():
- bb.build.exec_func(f, d)
-
- oe.qa.exit_if_errors(d)
-}
-
-do_package[dirs] = "${SHLIBSWORKDIR} ${D}"
-do_package[vardeps] += "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}"
-addtask package after do_install
-
-SSTATETASKS += "do_package"
-do_package[cleandirs] = "${PKGDEST} ${PKGDESTWORK}"
-do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST} ${PKGDESTWORK}"
-do_package_setscene[dirs] = "${STAGING_DIR}"
-
-python do_package_setscene () {
- sstate_setscene(d)
-}
-addtask do_package_setscene
-
-# Copy from PKGDESTWORK to tempdirectory as tempdirectory can be cleaned at both
-# do_package_setscene and do_packagedata_setscene leading to races
-python do_packagedata () {
- bb.build.exec_func("package_get_auto_pr", d)
-
- src = d.expand("${PKGDESTWORK}")
- dest = d.expand("${WORKDIR}/pkgdata-pdata-input")
- oe.path.copyhardlinktree(src, dest)
-
- bb.build.exec_func("packagedata_translate_pr_autoinc", d)
-}
-do_packagedata[cleandirs] += "${WORKDIR}/pkgdata-pdata-input"
-
-# Translate the EXTENDPRAUTO and AUTOINC to the final values
-packagedata_translate_pr_autoinc() {
- find ${WORKDIR}/pkgdata-pdata-input -type f | xargs --no-run-if-empty \
- sed -e 's,@PRSERV_PV_AUTOINC@,${PRSERV_PV_AUTOINC},g' \
- -e 's,@EXTENDPRAUTO@,${EXTENDPRAUTO},g' -i
-}
-
-addtask packagedata before do_build after do_package
-
-SSTATETASKS += "do_packagedata"
-do_packagedata[sstate-inputdirs] = "${WORKDIR}/pkgdata-pdata-input"
-do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}"
-do_packagedata[stamp-extra-info] = "${MACHINE_ARCH}"
-
-python do_packagedata_setscene () {
- sstate_setscene(d)
-}
-addtask do_packagedata_setscene
-
-#
-# Helper functions for the package writing classes
-#
-
-def mapping_rename_hook(d):
- """
- Rewrite variables to account for package renaming in things
- like debian.bbclass or manual PKG variable name changes
- """
- pkg = d.getVar("PKG")
- runtime_mapping_rename("RDEPENDS", pkg, d)
- runtime_mapping_rename("RRECOMMENDS", pkg, d)
- runtime_mapping_rename("RSUGGESTS", pkg, d)
diff --git a/poky/meta/classes/package_deb.bbclass b/poky/meta/classes/package_deb.bbclass
deleted file mode 100644
index a9b8ba0..0000000
--- a/poky/meta/classes/package_deb.bbclass
+++ /dev/null
@@ -1,327 +0,0 @@
-#
-# Copyright 2006-2008 OpenedHand Ltd.
-#
-
-inherit package
-
-IMAGE_PKGTYPE ?= "deb"
-
-DPKG_BUILDCMD ??= "dpkg-deb"
-
-DPKG_ARCH ?= "${@debian_arch_map(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'))}"
-DPKG_ARCH[vardepvalue] = "${DPKG_ARCH}"
-
-PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs"
-
-APTCONF_TARGET = "${WORKDIR}"
-
-APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
-
-def debian_arch_map(arch, tune):
- tune_features = tune.split()
- if arch == "allarch":
- return "all"
- if arch in ["i586", "i686"]:
- return "i386"
- if arch == "x86_64":
- if "mx32" in tune_features:
- return "x32"
- return "amd64"
- if arch.startswith("mips"):
- endian = ["el", ""]["bigendian" in tune_features]
- if "n64" in tune_features:
- return "mips64" + endian
- if "n32" in tune_features:
- return "mipsn32" + endian
- return "mips" + endian
- if arch == "powerpc":
- return arch + ["", "spe"]["spe" in tune_features]
- if arch == "aarch64":
- return "arm64"
- if arch == "arm":
- return arch + ["el", "hf"]["callconvention-hard" in tune_features]
- return arch
-
-python do_package_deb () {
- packages = d.getVar('PACKAGES')
- if not packages:
- bb.debug(1, "PACKAGES not defined, nothing to package")
- return
-
- tmpdir = d.getVar('TMPDIR')
- 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"))
-
- 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"
-
-def deb_write_pkg(pkg, d):
- import re, copy
- import textwrap
- import subprocess
- import collections
- import codecs
-
- outdir = d.getVar('PKGWRITEDIRDEB')
- pkgdest = d.getVar('PKGDEST')
-
- def cleanupcontrol(root):
- for p in ['CONTROL', 'DEBIAN']:
- p = os.path.join(root, p)
- if os.path.exists(p):
- bb.utils.prunedir(p)
-
- localdata = bb.data.createCopy(d)
- root = "%s/%s" % (pkgdest, pkg)
-
- lf = bb.utils.lockfile(root + ".lock")
- try:
-
- localdata.setVar('ROOT', '')
- localdata.setVar('ROOT_%s' % pkg, root)
- pkgname = localdata.getVar('PKG:%s' % pkg)
- if not pkgname:
- pkgname = pkg
- localdata.setVar('PKG', pkgname)
-
- localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
-
- basedir = os.path.join(os.path.dirname(root))
-
- pkgoutdir = os.path.join(outdir, localdata.getVar('PACKAGE_ARCH'))
- bb.utils.mkdirhier(pkgoutdir)
-
- os.chdir(root)
- cleanupcontrol(root)
- from glob import glob
- g = glob('*')
- if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
- bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
- return
-
- controldir = os.path.join(root, 'DEBIAN')
- bb.utils.mkdirhier(controldir)
- os.chmod(controldir, 0o755)
-
- ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8')
-
- fields = []
- pe = d.getVar('PKGE')
- if pe and int(pe) > 0:
- fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
- else:
- fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']])
- fields.append(["Description: %s\n", ['DESCRIPTION']])
- fields.append(["Section: %s\n", ['SECTION']])
- fields.append(["Priority: %s\n", ['PRIORITY']])
- fields.append(["Maintainer: %s\n", ['MAINTAINER']])
- fields.append(["Architecture: %s\n", ['DPKG_ARCH']])
- fields.append(["OE: %s\n", ['PN']])
- fields.append(["PackageArch: %s\n", ['PACKAGE_ARCH']])
- if d.getVar('HOMEPAGE'):
- fields.append(["Homepage: %s\n", ['HOMEPAGE']])
-
- # Package, Version, Maintainer, Description - mandatory
- # Section, Priority, Essential, Architecture, Source, Depends, Pre-Depends, Recommends, Suggests, Conflicts, Replaces, Provides - Optional
-
-
- def pullData(l, d):
- l2 = []
- for i in l:
- data = d.getVar(i)
- if data is None:
- raise KeyError(i)
- if i == 'DPKG_ARCH' and d.getVar('PACKAGE_ARCH') == 'all':
- data = 'all'
- elif i == 'PACKAGE_ARCH' or i == 'DPKG_ARCH':
- # The params in deb package control don't allow character
- # `_', so change the arch's `_' to `-'. Such as `x86_64'
- # -->`x86-64'
- data = data.replace('_', '-')
- l2.append(data)
- return l2
-
- ctrlfile.write("Package: %s\n" % pkgname)
- if d.getVar('PACKAGE_ARCH') == "all":
- ctrlfile.write("Multi-Arch: foreign\n")
- # check for required fields
- for (c, fs) in fields:
- # Special behavior for description...
- if 'DESCRIPTION' in fs:
- summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "."
- ctrlfile.write('Description: %s\n' % summary)
- description = localdata.getVar('DESCRIPTION') or "."
- description = textwrap.dedent(description).strip()
- if '\\n' in description:
- # Manually indent
- for t in description.split('\\n'):
- ctrlfile.write(' %s\n' % (t.strip() or '.'))
- else:
- # Auto indent
- ctrlfile.write('%s\n' % textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '))
-
- else:
- ctrlfile.write(c % tuple(pullData(fs, localdata)))
-
- # more fields
-
- custom_fields_chunk = get_package_additional_metadata("deb", localdata)
- if custom_fields_chunk:
- ctrlfile.write(custom_fields_chunk)
- ctrlfile.write("\n")
-
- mapping_rename_hook(localdata)
-
- def debian_cmp_remap(var):
- # dpkg does not allow for '(', ')' or ':' in a dependency name
- # Replace any instances of them with '__'
- #
- # In debian '>' and '<' do not mean what it appears they mean
- # '<' = less or equal
- # '>' = greater or equal
- # adjust these to the '<<' and '>>' equivalents
- # Also, "=" specifiers only work if they have the PR in, so 1.2.3 != 1.2.3-r0
- # so to avoid issues, map this to ">= 1.2.3 << 1.2.3.0"
- for dep in list(var.keys()):
- if '(' in dep or '/' in dep:
- newdep = re.sub(r'[(:)/]', '__', dep)
- if newdep.startswith("__"):
- newdep = "A" + newdep
- if newdep != dep:
- var[newdep] = var[dep]
- del var[dep]
- for dep in var:
- for i, v in enumerate(var[dep]):
- if (v or "").startswith("< "):
- var[dep][i] = var[dep][i].replace("< ", "<< ")
- elif (v or "").startswith("> "):
- var[dep][i] = var[dep][i].replace("> ", ">> ")
- elif (v or "").startswith("= ") and "-r" not in v:
- ver = var[dep][i].replace("= ", "")
- var[dep][i] = var[dep][i].replace("= ", ">= ")
- var[dep].append("<< " + ver + ".0")
-
- rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
- debian_cmp_remap(rdepends)
- for dep in list(rdepends.keys()):
- if dep == pkg:
- del rdepends[dep]
- continue
- if '*' in dep:
- del rdepends[dep]
- rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "")
- debian_cmp_remap(rrecommends)
- for dep in list(rrecommends.keys()):
- if '*' in dep:
- del rrecommends[dep]
- rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "")
- debian_cmp_remap(rsuggests)
- # Deliberately drop version information here, not wanted/supported by deb
- rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), [])
- # Remove file paths if any from rprovides, debian does not support custom providers
- for key in list(rprovides.keys()):
- if key.startswith('/'):
- del rprovides[key]
- rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0]))
- debian_cmp_remap(rprovides)
- rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "")
- debian_cmp_remap(rreplaces)
- rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "")
- debian_cmp_remap(rconflicts)
- if rdepends:
- ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
- if rsuggests:
- ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests))
- if rrecommends:
- ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends))
- if rprovides:
- ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides))
- if rreplaces:
- ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
- if rconflicts:
- ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
- ctrlfile.close()
-
- for script in ["preinst", "postinst", "prerm", "postrm"]:
- scriptvar = localdata.getVar('pkg_%s' % script)
- if not scriptvar:
- continue
- scriptvar = scriptvar.strip()
- scriptfile = open(os.path.join(controldir, script), 'w')
-
- if scriptvar.startswith("#!"):
- pos = scriptvar.find("\n") + 1
- scriptfile.write(scriptvar[:pos])
- else:
- pos = 0
- scriptfile.write("#!/bin/sh\n")
-
- # Prevent the prerm/postrm scripts from being run during an upgrade
- if script in ('prerm', 'postrm'):
- scriptfile.write('[ "$1" != "upgrade" ] || exit 0\n')
-
- scriptfile.write(scriptvar[pos:])
- scriptfile.write('\n')
- scriptfile.close()
- os.chmod(os.path.join(controldir, script), 0o755)
-
- conffiles_str = ' '.join(get_conffiles(pkg, d))
- if conffiles_str:
- conffiles = open(os.path.join(controldir, 'conffiles'), 'w')
- for f in conffiles_str.split():
- if os.path.exists(oe.path.join(root, f)):
- conffiles.write('%s\n' % f)
- conffiles.close()
-
- os.chdir(basedir)
- subprocess.check_output("PATH=\"%s\" %s -b %s %s" % (localdata.getVar("PATH"), localdata.getVar("DPKG_BUILDCMD"),
- root, pkgoutdir),
- stderr=subprocess.STDOUT,
- shell=True)
-
- finally:
- cleanupcontrol(root)
- bb.utils.unlockfile(lf)
-
-# Otherwise allarch packages may change depending on override configuration
-deb_write_pkg[vardepsexclude] = "OVERRIDES"
-
-# Have to list any variables referenced as X_<pkg> that aren't in pkgdata here
-DEBEXTRAVARS = "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE PACKAGE_ADD_METADATA_DEB"
-do_package_write_deb[vardeps] += "${@gen_packagevar(d, 'DEBEXTRAVARS')}"
-
-SSTATETASKS += "do_package_write_deb"
-do_package_write_deb[sstate-inputdirs] = "${PKGWRITEDIRDEB}"
-do_package_write_deb[sstate-outputdirs] = "${DEPLOY_DIR_DEB}"
-
-python do_package_write_deb_setscene () {
- tmpdir = d.getVar('TMPDIR')
-
- 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"))
-
- sstate_setscene(d)
-}
-addtask do_package_write_deb_setscene
-
-python () {
- if d.getVar('PACKAGES') != '':
- deps = ' dpkg-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
- d.appendVarFlag('do_package_write_deb', 'depends', deps)
- d.setVarFlag('do_package_write_deb', 'fakeroot', "1")
-}
-
-python do_package_write_deb () {
- bb.build.exec_func("read_subpackage_metadata", d)
- bb.build.exec_func("do_package_deb", d)
-}
-do_package_write_deb[dirs] = "${PKGWRITEDIRDEB}"
-do_package_write_deb[cleandirs] = "${PKGWRITEDIRDEB}"
-do_package_write_deb[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
-addtask package_write_deb after do_packagedata do_package do_deploy_source_date_epoch before do_build
-do_build[rdeptask] += "do_package_write_deb"
-
-PACKAGEINDEXDEPS += "dpkg-native:do_populate_sysroot"
-PACKAGEINDEXDEPS += "apt-native:do_populate_sysroot"
diff --git a/poky/meta/classes/package_ipk.bbclass b/poky/meta/classes/package_ipk.bbclass
deleted file mode 100644
index 9fe3c52..0000000
--- a/poky/meta/classes/package_ipk.bbclass
+++ /dev/null
@@ -1,286 +0,0 @@
-inherit package
-
-IMAGE_PKGTYPE ?= "ipk"
-
-IPKGCONF_TARGET = "${WORKDIR}/opkg.conf"
-IPKGCONF_SDK = "${WORKDIR}/opkg-sdk.conf"
-IPKGCONF_SDK_TARGET = "${WORKDIR}/opkg-sdk-target.conf"
-
-PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks"
-
-# Program to be used to build opkg packages
-OPKGBUILDCMD ??= 'opkg-build -Z xz -a "${XZ_DEFAULTS}"'
-
-OPKG_ARGS += "--force_postinstall --prefer-arch-to-version"
-OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
-OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE') or "").split())][(d.getVar("PACKAGE_EXCLUDE") or "").strip() != ""]}"
-
-OPKGLIBDIR ??= "${localstatedir}/lib"
-
-python do_package_ipk () {
- workdir = d.getVar('WORKDIR')
- outdir = d.getVar('PKGWRITEDIRIPK')
- tmpdir = d.getVar('TMPDIR')
- pkgdest = d.getVar('PKGDEST')
- if not workdir or not outdir or not tmpdir:
- bb.error("Variables incorrectly set, unable to package")
- return
-
- packages = d.getVar('PACKAGES')
- if not packages or packages == '':
- bb.debug(1, "No packages; nothing to do")
- return
-
- # We're about to add new packages so the index needs to be checked
- # so remove the appropriate stamp file.
- 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"))
-
- 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"
-
-def ipk_write_pkg(pkg, d):
- import re, copy
- import subprocess
- import textwrap
- import collections
- import glob
-
- def cleanupcontrol(root):
- for p in ['CONTROL', 'DEBIAN']:
- p = os.path.join(root, p)
- if os.path.exists(p):
- bb.utils.prunedir(p)
-
- outdir = d.getVar('PKGWRITEDIRIPK')
- pkgdest = d.getVar('PKGDEST')
- recipesource = os.path.basename(d.getVar('FILE'))
-
- localdata = bb.data.createCopy(d)
- root = "%s/%s" % (pkgdest, pkg)
-
- lf = bb.utils.lockfile(root + ".lock")
- try:
- localdata.setVar('ROOT', '')
- localdata.setVar('ROOT_%s' % pkg, root)
- pkgname = localdata.getVar('PKG:%s' % pkg)
- if not pkgname:
- pkgname = pkg
- localdata.setVar('PKG', pkgname)
-
- localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
-
- basedir = os.path.join(os.path.dirname(root))
- arch = localdata.getVar('PACKAGE_ARCH')
-
- if localdata.getVar('IPK_HIERARCHICAL_FEED', False) == "1":
- # Spread packages across subdirectories so each isn't too crowded
- if pkgname.startswith('lib'):
- pkg_prefix = 'lib' + pkgname[3]
- else:
- pkg_prefix = pkgname[0]
-
- # Keep -dbg, -dev, -doc, -staticdev, -locale and -locale-* packages
- # together. These package suffixes are taken from the definitions of
- # PACKAGES and PACKAGES_DYNAMIC in meta/conf/bitbake.conf
- if pkgname[-4:] in ('-dbg', '-dev', '-doc'):
- pkg_subdir = pkgname[:-4]
- elif pkgname.endswith('-staticdev'):
- pkg_subdir = pkgname[:-10]
- elif pkgname.endswith('-locale'):
- pkg_subdir = pkgname[:-7]
- elif '-locale-' in pkgname:
- pkg_subdir = pkgname[:pkgname.find('-locale-')]
- else:
- pkg_subdir = pkgname
-
- pkgoutdir = "%s/%s/%s/%s" % (outdir, arch, pkg_prefix, pkg_subdir)
- else:
- pkgoutdir = "%s/%s" % (outdir, arch)
-
- bb.utils.mkdirhier(pkgoutdir)
- os.chdir(root)
- cleanupcontrol(root)
- g = glob.glob('*')
- if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
- bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
- return
-
- controldir = os.path.join(root, 'CONTROL')
- bb.utils.mkdirhier(controldir)
- ctrlfile = open(os.path.join(controldir, 'control'), 'w')
-
- fields = []
- pe = d.getVar('PKGE')
- if pe and int(pe) > 0:
- fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
- else:
- fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']])
- fields.append(["Description: %s\n", ['DESCRIPTION']])
- fields.append(["Section: %s\n", ['SECTION']])
- fields.append(["Priority: %s\n", ['PRIORITY']])
- fields.append(["Maintainer: %s\n", ['MAINTAINER']])
- fields.append(["License: %s\n", ['LICENSE']])
- fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']])
- fields.append(["OE: %s\n", ['PN']])
- if d.getVar('HOMEPAGE'):
- fields.append(["Homepage: %s\n", ['HOMEPAGE']])
-
- def pullData(l, d):
- l2 = []
- for i in l:
- l2.append(d.getVar(i))
- return l2
-
- ctrlfile.write("Package: %s\n" % pkgname)
- # check for required fields
- for (c, fs) in fields:
- for f in fs:
- if localdata.getVar(f, False) is None:
- raise KeyError(f)
- # Special behavior for description...
- if 'DESCRIPTION' in fs:
- summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "."
- ctrlfile.write('Description: %s\n' % summary)
- description = localdata.getVar('DESCRIPTION') or "."
- description = textwrap.dedent(description).strip()
- if '\\n' in description:
- # Manually indent: multiline description includes a leading space
- for t in description.split('\\n'):
- ctrlfile.write(' %s\n' % (t.strip() or ' .'))
- else:
- # Auto indent
- ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))
- else:
- ctrlfile.write(c % tuple(pullData(fs, localdata)))
-
- custom_fields_chunk = get_package_additional_metadata("ipk", localdata)
- if custom_fields_chunk is not None:
- ctrlfile.write(custom_fields_chunk)
- ctrlfile.write("\n")
-
- mapping_rename_hook(localdata)
-
- def debian_cmp_remap(var):
- # In debian '>' and '<' do not mean what it appears they mean
- # '<' = less or equal
- # '>' = greater or equal
- # adjust these to the '<<' and '>>' equivalents
- # Also, "=" specifiers only work if they have the PR in, so 1.2.3 != 1.2.3-r0
- # so to avoid issues, map this to ">= 1.2.3 << 1.2.3.0"
- for dep in var:
- for i, v in enumerate(var[dep]):
- if (v or "").startswith("< "):
- var[dep][i] = var[dep][i].replace("< ", "<< ")
- elif (v or "").startswith("> "):
- var[dep][i] = var[dep][i].replace("> ", ">> ")
- elif (v or "").startswith("= ") and "-r" not in v:
- ver = var[dep][i].replace("= ", "")
- var[dep][i] = var[dep][i].replace("= ", ">= ")
- var[dep].append("<< " + ver + ".0")
-
- rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
- debian_cmp_remap(rdepends)
- rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "")
- debian_cmp_remap(rrecommends)
- rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "")
- debian_cmp_remap(rsuggests)
- # Deliberately drop version information here, not wanted/supported by ipk
- rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), [])
- rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0]))
- debian_cmp_remap(rprovides)
- rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "")
- debian_cmp_remap(rreplaces)
- rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "")
- debian_cmp_remap(rconflicts)
-
- if rdepends:
- ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
- if rsuggests:
- ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests))
- if rrecommends:
- ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends))
- if rprovides:
- ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides))
- if rreplaces:
- ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
- if rconflicts:
- ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
- ctrlfile.write("Source: %s\n" % recipesource)
- ctrlfile.close()
-
- for script in ["preinst", "postinst", "prerm", "postrm"]:
- scriptvar = localdata.getVar('pkg_%s' % script)
- if not scriptvar:
- continue
- scriptfile = open(os.path.join(controldir, script), 'w')
- scriptfile.write(scriptvar)
- scriptfile.close()
- os.chmod(os.path.join(controldir, script), 0o755)
-
- conffiles_str = ' '.join(get_conffiles(pkg, d))
- if conffiles_str:
- conffiles = open(os.path.join(controldir, 'conffiles'), 'w')
- for f in conffiles_str.split():
- if os.path.exists(oe.path.join(root, f)):
- conffiles.write('%s\n' % f)
- conffiles.close()
-
- os.chdir(basedir)
- subprocess.check_output("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH"),
- d.getVar("OPKGBUILDCMD"), pkg, pkgoutdir),
- stderr=subprocess.STDOUT,
- shell=True)
-
- if d.getVar('IPK_SIGN_PACKAGES') == '1':
- ipkver = "%s-%s" % (localdata.getVar('PKGV'), localdata.getVar('PKGR'))
- ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, localdata.getVar('PACKAGE_ARCH'))
- sign_ipk(d, ipk_to_sign)
-
- finally:
- cleanupcontrol(root)
- bb.utils.unlockfile(lf)
-
-# Have to list any variables referenced as X_<pkg> that aren't in pkgdata here
-IPKEXTRAVARS = "PRIORITY MAINTAINER PACKAGE_ARCH HOMEPAGE PACKAGE_ADD_METADATA_IPK"
-ipk_write_pkg[vardeps] += "${@gen_packagevar(d, 'IPKEXTRAVARS')}"
-
-# Otherwise allarch packages may change depending on override configuration
-ipk_write_pkg[vardepsexclude] = "OVERRIDES"
-
-
-SSTATETASKS += "do_package_write_ipk"
-do_package_write_ipk[sstate-inputdirs] = "${PKGWRITEDIRIPK}"
-do_package_write_ipk[sstate-outputdirs] = "${DEPLOY_DIR_IPK}"
-
-python do_package_write_ipk_setscene () {
- tmpdir = d.getVar('TMPDIR')
-
- 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"))
-
- sstate_setscene(d)
-}
-addtask do_package_write_ipk_setscene
-
-python () {
- if d.getVar('PACKAGES') != '':
- deps = ' opkg-utils-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot xz-native:do_populate_sysroot'
- d.appendVarFlag('do_package_write_ipk', 'depends', deps)
- d.setVarFlag('do_package_write_ipk', 'fakeroot', "1")
-}
-
-python do_package_write_ipk () {
- bb.build.exec_func("read_subpackage_metadata", d)
- bb.build.exec_func("do_package_ipk", d)
-}
-do_package_write_ipk[dirs] = "${PKGWRITEDIRIPK}"
-do_package_write_ipk[cleandirs] = "${PKGWRITEDIRIPK}"
-do_package_write_ipk[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
-addtask package_write_ipk after do_packagedata do_package do_deploy_source_date_epoch before do_build
-do_build[rdeptask] += "do_package_write_ipk"
-
-PACKAGEINDEXDEPS += "opkg-utils-native:do_populate_sysroot"
-PACKAGEINDEXDEPS += "opkg-native:do_populate_sysroot"
diff --git a/poky/meta/classes/package_pkgdata.bbclass b/poky/meta/classes/package_pkgdata.bbclass
deleted file mode 100644
index a1ea8fc..0000000
--- a/poky/meta/classes/package_pkgdata.bbclass
+++ /dev/null
@@ -1,167 +0,0 @@
-WORKDIR_PKGDATA = "${WORKDIR}/pkgdata-sysroot"
-
-def package_populate_pkgdata_dir(pkgdatadir, d):
- import glob
-
- postinsts = []
- seendirs = set()
- stagingdir = d.getVar("PKGDATA_DIR")
- pkgarchs = ['${MACHINE_ARCH}']
- pkgarchs = pkgarchs + list(reversed(d.getVar("PACKAGE_EXTRA_ARCHS").split()))
- pkgarchs.append('allarch')
-
- bb.utils.mkdirhier(pkgdatadir)
- for pkgarch in pkgarchs:
- for manifest in glob.glob(d.expand("${SSTATE_MANIFESTS}/manifest-%s-*.packagedata" % pkgarch)):
- with open(manifest, "r") as f:
- for l in f:
- l = l.strip()
- dest = l.replace(stagingdir, "")
- if l.endswith("/"):
- staging_copydir(l, pkgdatadir, dest, seendirs)
- continue
- try:
- staging_copyfile(l, pkgdatadir, dest, postinsts, seendirs)
- except FileExistsError:
- continue
-
-python package_prepare_pkgdata() {
- import copy
- import glob
-
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- mytaskname = d.getVar("BB_RUNTASK")
- if mytaskname.endswith("_setscene"):
- mytaskname = mytaskname.replace("_setscene", "")
- workdir = d.getVar("WORKDIR")
- pn = d.getVar("PN")
- stagingdir = d.getVar("PKGDATA_DIR")
- pkgdatadir = d.getVar("WORKDIR_PKGDATA")
-
- # Detect bitbake -b usage
- nodeps = d.getVar("BB_LIMITEDDEPS") or False
- if nodeps:
- staging_package_populate_pkgdata_dir(pkgdatadir, d)
- return
-
- start = None
- configuredeps = []
- for dep in taskdepdata:
- data = taskdepdata[dep]
- if data[1] == mytaskname and data[0] == pn:
- start = dep
- break
- if start is None:
- bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
-
- # We need to figure out which sysroot files we need to expose to this task.
- # This needs to match what would get restored from sstate, which is controlled
- # ultimately by calls from bitbake to setscene_depvalid().
- # That function expects a setscene dependency tree. We build a dependency tree
- # condensed to inter-sstate task dependencies, similar to that used by setscene
- # tasks. We can then call into setscene_depvalid() and decide
- # which dependencies we can "see" and should expose in the recipe specific sysroot.
- setscenedeps = copy.deepcopy(taskdepdata)
-
- start = set([start])
-
- sstatetasks = d.getVar("SSTATETASKS").split()
- # Add recipe specific tasks referenced by setscene_depvalid()
- sstatetasks.append("do_stash_locale")
-
- # If start is an sstate task (like do_package) we need to add in its direct dependencies
- # else the code below won't recurse into them.
- for dep in set(start):
- for dep2 in setscenedeps[dep][3]:
- start.add(dep2)
- start.remove(dep)
-
- # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
- for dep in taskdepdata:
- data = setscenedeps[dep]
- if data[1] not in sstatetasks:
- for dep2 in setscenedeps:
- data2 = setscenedeps[dep2]
- if dep in data2[3]:
- data2[3].update(setscenedeps[dep][3])
- data2[3].remove(dep)
- if dep in start:
- start.update(setscenedeps[dep][3])
- start.remove(dep)
- del setscenedeps[dep]
-
- # Remove circular references
- for dep in setscenedeps:
- if dep in setscenedeps[dep][3]:
- setscenedeps[dep][3].remove(dep)
-
- # Direct dependencies should be present and can be depended upon
- for dep in set(start):
- if setscenedeps[dep][1] == "do_packagedata":
- if dep not in configuredeps:
- configuredeps.append(dep)
-
- msgbuf = []
- # Call into setscene_depvalid for each sub-dependency and only copy sysroot files
- # for ones that would be restored from sstate.
- done = list(start)
- next = list(start)
- while next:
- new = []
- for dep in next:
- data = setscenedeps[dep]
- for datadep in data[3]:
- if datadep in done:
- continue
- taskdeps = {}
- taskdeps[dep] = setscenedeps[dep][:2]
- taskdeps[datadep] = setscenedeps[datadep][:2]
- retval = setscene_depvalid(datadep, taskdeps, [], d, msgbuf)
- done.append(datadep)
- new.append(datadep)
- if retval:
- msgbuf.append("Skipping setscene dependency %s" % datadep)
- continue
- if datadep not in configuredeps and setscenedeps[datadep][1] == "do_packagedata":
- configuredeps.append(datadep)
- msgbuf.append("Adding dependency on %s" % setscenedeps[datadep][0])
- else:
- msgbuf.append("Following dependency on %s" % setscenedeps[datadep][0])
- next = new
-
- # This logging is too verbose for day to day use sadly
- #bb.debug(2, "\n".join(msgbuf))
-
- seendirs = set()
- postinsts = []
- multilibs = {}
- manifests = {}
-
- msg_adding = []
-
- for dep in configuredeps:
- c = setscenedeps[dep][0]
- msg_adding.append(c)
-
- manifest, d2 = oe.sstatesig.find_sstate_manifest(c, setscenedeps[dep][2], "packagedata", d, multilibs)
- destsysroot = pkgdatadir
-
- if manifest:
- targetdir = destsysroot
- with open(manifest, "r") as f:
- manifests[dep] = manifest
- for l in f:
- l = l.strip()
- dest = targetdir + l.replace(stagingdir, "")
- if l.endswith("/"):
- staging_copydir(l, targetdir, dest, seendirs)
- continue
- staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-
- bb.note("Installed into pkgdata-sysroot: %s" % str(msg_adding))
-
-}
-package_prepare_pkgdata[cleandirs] = "${WORKDIR_PKGDATA}"
-package_prepare_pkgdata[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA SSTATETASKS"
-
-
diff --git a/poky/meta/classes/package_rpm.bbclass b/poky/meta/classes/package_rpm.bbclass
deleted file mode 100644
index e9ff1f7..0000000
--- a/poky/meta/classes/package_rpm.bbclass
+++ /dev/null
@@ -1,755 +0,0 @@
-inherit package
-
-IMAGE_PKGTYPE ?= "rpm"
-
-RPM="rpm"
-RPMBUILD="rpmbuild"
-
-PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
-
-# Maintaining the perfile dependencies has singificant overhead when writing the
-# packages. When set, this value merges them for efficiency.
-MERGEPERFILEDEPS = "1"
-
-# Filter dependencies based on a provided function.
-def filter_deps(var, f):
- import collections
-
- depends_dict = bb.utils.explode_dep_versions2(var)
- newdeps_dict = collections.OrderedDict()
- for dep in depends_dict:
- if f(dep):
- newdeps_dict[dep] = depends_dict[dep]
- return bb.utils.join_deps(newdeps_dict, commasep=False)
-
-# Filter out absolute paths (typically /bin/sh and /usr/bin/env) and any perl
-# dependencies for nativesdk packages.
-def filter_nativesdk_deps(srcname, var):
- if var and srcname.startswith("nativesdk-"):
- var = filter_deps(var, lambda dep: not dep.startswith('/') and dep != 'perl' and not dep.startswith('perl('))
- return var
-
-# Construct per file dependencies file
-def write_rpm_perfiledata(srcname, d):
- workdir = d.getVar('WORKDIR')
- packages = d.getVar('PACKAGES')
- pkgd = d.getVar('PKGD')
-
- def dump_filerdeps(varname, outfile, d):
- outfile.write("#!/usr/bin/env python3\n\n")
- outfile.write("# Dependency table\n")
- outfile.write('deps = {\n')
- for pkg in packages.split():
- dependsflist_key = 'FILE' + varname + 'FLIST' + ":" + pkg
- dependsflist = (d.getVar(dependsflist_key) or "")
- for dfile in dependsflist.split():
- key = "FILE" + varname + ":" + dfile + ":" + pkg
- deps = filter_nativesdk_deps(srcname, d.getVar(key) or "")
- depends_dict = bb.utils.explode_dep_versions(deps)
- file = dfile.replace("@underscore@", "_")
- file = file.replace("@closebrace@", "]")
- file = file.replace("@openbrace@", "[")
- file = file.replace("@tab@", "\t")
- file = file.replace("@space@", " ")
- file = file.replace("@at@", "@")
- outfile.write('"' + pkgd + file + '" : "')
- for dep in depends_dict:
- ver = depends_dict[dep]
- if dep and ver:
- ver = ver.replace("(","")
- ver = ver.replace(")","")
- outfile.write(dep + " " + ver + " ")
- else:
- outfile.write(dep + " ")
- outfile.write('",\n')
- outfile.write('}\n\n')
- outfile.write("import sys\n")
- outfile.write("while 1:\n")
- outfile.write("\tline = sys.stdin.readline().strip()\n")
- outfile.write("\tif not line:\n")
- outfile.write("\t\tsys.exit(0)\n")
- outfile.write("\tif line in deps:\n")
- outfile.write("\t\tprint(deps[line] + '\\n')\n")
-
- # OE-core dependencies a.k.a. RPM requires
- outdepends = workdir + "/" + srcname + ".requires"
-
- dependsfile = open(outdepends, 'w')
-
- dump_filerdeps('RDEPENDS', dependsfile, d)
-
- dependsfile.close()
- os.chmod(outdepends, 0o755)
-
- # OE-core / RPM Provides
- outprovides = workdir + "/" + srcname + ".provides"
-
- providesfile = open(outprovides, 'w')
-
- dump_filerdeps('RPROVIDES', providesfile, d)
-
- providesfile.close()
- os.chmod(outprovides, 0o755)
-
- return (outdepends, outprovides)
-
-
-python write_specfile () {
- import oe.packagedata
-
- # append information for logs and patches to %prep
- def add_prep(d,spec_files_bottom):
- if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
- spec_files_bottom.append('%%prep -n %s' % d.getVar('PN') )
- spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"")
- spec_files_bottom.append('')
-
- # append the name of tarball to key word 'SOURCE' in xxx.spec.
- def tail_source(d):
- if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
- ar_outdir = d.getVar('ARCHIVER_OUTDIR')
- if not os.path.exists(ar_outdir):
- return
- source_list = os.listdir(ar_outdir)
- source_number = 0
- for source in source_list:
- # do_deploy_archives may have already run (from sstate) meaning a .src.rpm may already
- # exist in ARCHIVER_OUTDIR so skip if present.
- if source.endswith(".src.rpm"):
- continue
- # The rpmbuild doesn't need the root permission, but it needs
- # to know the file's user and group name, the only user and
- # group in fakeroot is "root" when working in fakeroot.
- f = os.path.join(ar_outdir, source)
- os.chown(f, 0, 0)
- spec_preamble_top.append('Source%s: %s' % (source_number, source))
- source_number += 1
-
- # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
- # This format is similar to OE, however there are restrictions on the
- # characters that can be in a field. In the Version field, "-"
- # characters are not allowed. "-" is allowed in the Release field.
- #
- # We translate the "-" in the version to a "+", by loading the PKGV
- # from the dependent recipe, replacing the - with a +, and then using
- # that value to do a replace inside of this recipe's dependencies.
- # This preserves the "-" separator between the version and release, as
- # well as any "-" characters inside of the release field.
- #
- # All of this has to happen BEFORE the mapping_rename_hook as
- # after renaming we cannot look up the dependencies in the packagedata
- # store.
- def translate_vers(varname, d):
- depends = d.getVar(varname)
- if depends:
- depends_dict = bb.utils.explode_dep_versions2(depends)
- newdeps_dict = {}
- for dep in depends_dict:
- verlist = []
- for ver in depends_dict[dep]:
- if '-' in ver:
- subd = oe.packagedata.read_subpkgdata_dict(dep, d)
- if 'PKGV' in subd:
- pv = subd['PV']
- pkgv = subd['PKGV']
- reppv = pkgv.replace('-', '+')
- ver = ver.replace(pv, reppv).replace(pkgv, reppv)
- if 'PKGR' in subd:
- # Make sure PKGR rather than PR in ver
- pr = '-' + subd['PR']
- pkgr = '-' + subd['PKGR']
- if pkgr not in ver:
- ver = ver.replace(pr, pkgr)
- verlist.append(ver)
- else:
- verlist.append(ver)
- newdeps_dict[dep] = verlist
- depends = bb.utils.join_deps(newdeps_dict)
- d.setVar(varname, depends.strip())
-
- # We need to change the style the dependency from BB to RPM
- # This needs to happen AFTER the mapping_rename_hook
- def print_deps(variable, tag, array, d):
- depends = variable
- if depends:
- depends_dict = bb.utils.explode_dep_versions2(depends)
- for dep in depends_dict:
- for ver in depends_dict[dep]:
- ver = ver.replace('(', '')
- ver = ver.replace(')', '')
- array.append("%s: %s %s" % (tag, dep, ver))
- if not len(depends_dict[dep]):
- array.append("%s: %s" % (tag, dep))
-
- def walk_files(walkpath, target, conffiles, dirfiles):
- # We can race against the ipk/deb backends which create CONTROL or DEBIAN directories
- # when packaging. We just ignore these files which are created in
- # packages-split/ and not package/
- # We have the odd situation where the CONTROL/DEBIAN directory can be removed in the middle of
- # of the walk, the isdir() test would then fail and the walk code would assume its a file
- # hence we check for the names in files too.
- for rootpath, dirs, files in os.walk(walkpath):
- path = rootpath.replace(walkpath, "")
- if path.endswith("DEBIAN") or path.endswith("CONTROL"):
- continue
- path = path.replace("%", "%%%%%%%%")
- path = path.replace("[", "?")
- path = path.replace("]", "?")
-
- # Treat all symlinks to directories as normal files.
- # os.walk() lists them as directories.
- def move_to_files(dir):
- if os.path.islink(os.path.join(rootpath, dir)):
- files.append(dir)
- return True
- else:
- return False
- dirs[:] = [dir for dir in dirs if not move_to_files(dir)]
-
- # Directory handling can happen in two ways, either DIRFILES is not set at all
- # in which case we fall back to the older behaviour of packages owning all their
- # directories
- if dirfiles is None:
- for dir in dirs:
- if dir == "CONTROL" or dir == "DEBIAN":
- continue
- dir = dir.replace("%", "%%%%%%%%")
- dir = dir.replace("[", "?")
- dir = dir.replace("]", "?")
- # All packages own the directories their files are in...
- target.append('%dir "' + path + '/' + dir + '"')
- else:
- # packages own only empty directories or explict directory.
- # This will prevent the overlapping of security permission.
- if path and not files and not dirs:
- target.append('%dir "' + path + '"')
- elif path and path in dirfiles:
- target.append('%dir "' + path + '"')
-
- for file in files:
- if file == "CONTROL" or file == "DEBIAN":
- continue
- file = file.replace("%", "%%%%%%%%")
- file = file.replace("[", "?")
- file = file.replace("]", "?")
- if conffiles.count(path + '/' + file):
- target.append('%config "' + path + '/' + file + '"')
- else:
- target.append('"' + path + '/' + file + '"')
-
- # Prevent the prerm/postrm scripts from being run during an upgrade
- def wrap_uninstall(scriptvar):
- scr = scriptvar.strip()
- if scr.startswith("#!"):
- pos = scr.find("\n") + 1
- else:
- pos = 0
- scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi'
- return scr
-
- def get_perfile(varname, pkg, d):
- deps = []
- dependsflist_key = 'FILE' + varname + 'FLIST' + ":" + pkg
- dependsflist = (d.getVar(dependsflist_key) or "")
- for dfile in dependsflist.split():
- key = "FILE" + varname + ":" + dfile + ":" + pkg
- depends = d.getVar(key)
- if depends:
- deps.append(depends)
- return " ".join(deps)
-
- def append_description(spec_preamble, text):
- """
- Add the description to the spec file.
- """
- import textwrap
- dedent_text = textwrap.dedent(text).strip()
- # Bitbake saves "\n" as "\\n"
- if '\\n' in dedent_text:
- for t in dedent_text.split('\\n'):
- spec_preamble.append(t.strip())
- else:
- spec_preamble.append('%s' % textwrap.fill(dedent_text, width=75))
-
- packages = d.getVar('PACKAGES')
- if not packages or packages == '':
- bb.debug(1, "No packages; nothing to do")
- return
-
- pkgdest = d.getVar('PKGDEST')
- if not pkgdest:
- bb.fatal("No PKGDEST")
-
- outspecfile = d.getVar('OUTSPECFILE')
- if not outspecfile:
- bb.fatal("No OUTSPECFILE")
-
- # Construct the SPEC file...
- srcname = d.getVar('PN')
- localdata = bb.data.createCopy(d)
- localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + srcname)
- srcsummary = (localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or ".")
- srcversion = localdata.getVar('PKGV').replace('-', '+')
- srcrelease = localdata.getVar('PKGR')
- srcepoch = (localdata.getVar('PKGE') or "")
- srclicense = localdata.getVar('LICENSE')
- srcsection = localdata.getVar('SECTION')
- srcmaintainer = localdata.getVar('MAINTAINER')
- srchomepage = localdata.getVar('HOMEPAGE')
- srcdescription = localdata.getVar('DESCRIPTION') or "."
- srccustomtagschunk = get_package_additional_metadata("rpm", localdata)
-
- srcdepends = d.getVar('DEPENDS')
- srcrdepends = ""
- srcrrecommends = ""
- srcrsuggests = ""
- srcrprovides = ""
- srcrreplaces = ""
- srcrconflicts = ""
- srcrobsoletes = ""
-
- srcrpreinst = []
- srcrpostinst = []
- srcrprerm = []
- srcrpostrm = []
-
- spec_preamble_top = []
- spec_preamble_bottom = []
-
- spec_scriptlets_top = []
- spec_scriptlets_bottom = []
-
- spec_files_top = []
- spec_files_bottom = []
-
- perfiledeps = (d.getVar("MERGEPERFILEDEPS") or "0") == "0"
- extra_pkgdata = (d.getVar("RPM_EXTRA_PKGDATA") or "0") == "1"
-
- for pkg in packages.split():
- localdata = bb.data.createCopy(d)
-
- root = "%s/%s" % (pkgdest, pkg)
-
- localdata.setVar('ROOT', '')
- localdata.setVar('ROOT_%s' % pkg, root)
- pkgname = localdata.getVar('PKG:%s' % pkg)
- if not pkgname:
- pkgname = pkg
- localdata.setVar('PKG', pkgname)
-
- localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)
-
- conffiles = get_conffiles(pkg, d)
- dirfiles = localdata.getVar('DIRFILES')
- if dirfiles is not None:
- dirfiles = dirfiles.split()
-
- splitname = pkgname
-
- splitsummary = (localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or ".")
- splitversion = (localdata.getVar('PKGV') or "").replace('-', '+')
- splitrelease = (localdata.getVar('PKGR') or "")
- splitepoch = (localdata.getVar('PKGE') or "")
- splitlicense = (localdata.getVar('LICENSE') or "")
- splitsection = (localdata.getVar('SECTION') or "")
- splitdescription = (localdata.getVar('DESCRIPTION') or ".")
- splitcustomtagschunk = get_package_additional_metadata("rpm", localdata)
-
- translate_vers('RDEPENDS', localdata)
- translate_vers('RRECOMMENDS', localdata)
- translate_vers('RSUGGESTS', localdata)
- translate_vers('RPROVIDES', localdata)
- translate_vers('RREPLACES', localdata)
- translate_vers('RCONFLICTS', localdata)
-
- # Map the dependencies into their final form
- mapping_rename_hook(localdata)
-
- splitrdepends = localdata.getVar('RDEPENDS') or ""
- splitrrecommends = localdata.getVar('RRECOMMENDS') or ""
- splitrsuggests = localdata.getVar('RSUGGESTS') or ""
- splitrprovides = localdata.getVar('RPROVIDES') or ""
- splitrreplaces = localdata.getVar('RREPLACES') or ""
- splitrconflicts = localdata.getVar('RCONFLICTS') or ""
- splitrobsoletes = ""
-
- splitrpreinst = localdata.getVar('pkg_preinst')
- splitrpostinst = localdata.getVar('pkg_postinst')
- splitrprerm = localdata.getVar('pkg_prerm')
- splitrpostrm = localdata.getVar('pkg_postrm')
-
-
- if not perfiledeps:
- # Add in summary of per file dependencies
- splitrdepends = splitrdepends + " " + get_perfile('RDEPENDS', pkg, d)
- splitrprovides = splitrprovides + " " + get_perfile('RPROVIDES', pkg, d)
-
- splitrdepends = filter_nativesdk_deps(srcname, splitrdepends)
-
- # Gather special src/first package data
- if srcname == splitname:
- archiving = d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and \
- bb.data.inherits_class('archiver', d)
- if archiving and srclicense != splitlicense:
- bb.warn("The SRPM produced may not have the correct overall source license in the License tag. This is due to the LICENSE for the primary package and SRPM conflicting.")
-
- srclicense = splitlicense
- srcrdepends = splitrdepends
- srcrrecommends = splitrrecommends
- srcrsuggests = splitrsuggests
- srcrprovides = splitrprovides
- srcrreplaces = splitrreplaces
- srcrconflicts = splitrconflicts
-
- srcrpreinst = splitrpreinst
- srcrpostinst = splitrpostinst
- srcrprerm = splitrprerm
- srcrpostrm = splitrpostrm
-
- file_list = []
- walk_files(root, file_list, conffiles, dirfiles)
- if not file_list and localdata.getVar('ALLOW_EMPTY', False) != "1":
- bb.note("Not creating empty RPM package for %s" % splitname)
- else:
- spec_files_top.append('%files')
- if extra_pkgdata:
- package_rpm_extra_pkgdata(splitname, spec_files_top, localdata)
- spec_files_top.append('%defattr(-,-,-,-)')
- if file_list:
- bb.note("Creating RPM package for %s" % splitname)
- spec_files_top.extend(file_list)
- else:
- bb.note("Creating empty RPM package for %s" % splitname)
- spec_files_top.append('')
- continue
-
- # Process subpackage data
- spec_preamble_bottom.append('%%package -n %s' % splitname)
- spec_preamble_bottom.append('Summary: %s' % splitsummary)
- if srcversion != splitversion:
- spec_preamble_bottom.append('Version: %s' % splitversion)
- if srcrelease != splitrelease:
- spec_preamble_bottom.append('Release: %s' % splitrelease)
- if srcepoch != splitepoch:
- spec_preamble_bottom.append('Epoch: %s' % splitepoch)
- spec_preamble_bottom.append('License: %s' % splitlicense)
- spec_preamble_bottom.append('Group: %s' % splitsection)
-
- if srccustomtagschunk != splitcustomtagschunk:
- spec_preamble_bottom.append(splitcustomtagschunk)
-
- # Replaces == Obsoletes && Provides
- robsoletes = bb.utils.explode_dep_versions2(splitrobsoletes)
- rprovides = bb.utils.explode_dep_versions2(splitrprovides)
- rreplaces = bb.utils.explode_dep_versions2(splitrreplaces)
- for dep in rreplaces:
- if not dep in robsoletes:
- robsoletes[dep] = rreplaces[dep]
- if not dep in rprovides:
- rprovides[dep] = rreplaces[dep]
- splitrobsoletes = bb.utils.join_deps(robsoletes, commasep=False)
- splitrprovides = bb.utils.join_deps(rprovides, commasep=False)
-
- print_deps(splitrdepends, "Requires", spec_preamble_bottom, d)
- if splitrpreinst:
- print_deps(splitrdepends, "Requires(pre)", spec_preamble_bottom, d)
- if splitrpostinst:
- print_deps(splitrdepends, "Requires(post)", spec_preamble_bottom, d)
- if splitrprerm:
- print_deps(splitrdepends, "Requires(preun)", spec_preamble_bottom, d)
- if splitrpostrm:
- print_deps(splitrdepends, "Requires(postun)", spec_preamble_bottom, d)
-
- print_deps(splitrrecommends, "Recommends", spec_preamble_bottom, d)
- print_deps(splitrsuggests, "Suggests", spec_preamble_bottom, d)
- print_deps(splitrprovides, "Provides", spec_preamble_bottom, d)
- print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d)
- print_deps(splitrconflicts, "Conflicts", spec_preamble_bottom, d)
-
- spec_preamble_bottom.append('')
-
- spec_preamble_bottom.append('%%description -n %s' % splitname)
- append_description(spec_preamble_bottom, splitdescription)
-
- spec_preamble_bottom.append('')
-
- # Now process scriptlets
- if splitrpreinst:
- spec_scriptlets_bottom.append('%%pre -n %s' % splitname)
- spec_scriptlets_bottom.append('# %s - preinst' % splitname)
- spec_scriptlets_bottom.append(splitrpreinst)
- spec_scriptlets_bottom.append('')
- if splitrpostinst:
- spec_scriptlets_bottom.append('%%post -n %s' % splitname)
- spec_scriptlets_bottom.append('# %s - postinst' % splitname)
- spec_scriptlets_bottom.append(splitrpostinst)
- spec_scriptlets_bottom.append('')
- if splitrprerm:
- spec_scriptlets_bottom.append('%%preun -n %s' % splitname)
- spec_scriptlets_bottom.append('# %s - prerm' % splitname)
- scriptvar = wrap_uninstall(splitrprerm)
- spec_scriptlets_bottom.append(scriptvar)
- spec_scriptlets_bottom.append('')
- if splitrpostrm:
- spec_scriptlets_bottom.append('%%postun -n %s' % splitname)
- spec_scriptlets_bottom.append('# %s - postrm' % splitname)
- scriptvar = wrap_uninstall(splitrpostrm)
- spec_scriptlets_bottom.append(scriptvar)
- spec_scriptlets_bottom.append('')
-
- # Now process files
- file_list = []
- walk_files(root, file_list, conffiles, dirfiles)
- if not file_list and localdata.getVar('ALLOW_EMPTY', False) != "1":
- bb.note("Not creating empty RPM package for %s" % splitname)
- else:
- spec_files_bottom.append('%%files -n %s' % splitname)
- if extra_pkgdata:
- package_rpm_extra_pkgdata(splitname, spec_files_bottom, localdata)
- spec_files_bottom.append('%defattr(-,-,-,-)')
- if file_list:
- bb.note("Creating RPM package for %s" % splitname)
- spec_files_bottom.extend(file_list)
- else:
- bb.note("Creating empty RPM package for %s" % splitname)
- spec_files_bottom.append('')
-
- del localdata
-
- add_prep(d,spec_files_bottom)
- spec_preamble_top.append('Summary: %s' % srcsummary)
- spec_preamble_top.append('Name: %s' % srcname)
- spec_preamble_top.append('Version: %s' % srcversion)
- spec_preamble_top.append('Release: %s' % srcrelease)
- if srcepoch and srcepoch.strip() != "":
- spec_preamble_top.append('Epoch: %s' % srcepoch)
- spec_preamble_top.append('License: %s' % srclicense)
- spec_preamble_top.append('Group: %s' % srcsection)
- spec_preamble_top.append('Packager: %s' % srcmaintainer)
- if srchomepage:
- spec_preamble_top.append('URL: %s' % srchomepage)
- if srccustomtagschunk:
- spec_preamble_top.append(srccustomtagschunk)
- tail_source(d)
-
- # Replaces == Obsoletes && Provides
- robsoletes = bb.utils.explode_dep_versions2(srcrobsoletes)
- rprovides = bb.utils.explode_dep_versions2(srcrprovides)
- rreplaces = bb.utils.explode_dep_versions2(srcrreplaces)
- for dep in rreplaces:
- if not dep in robsoletes:
- robsoletes[dep] = rreplaces[dep]
- if not dep in rprovides:
- rprovides[dep] = rreplaces[dep]
- srcrobsoletes = bb.utils.join_deps(robsoletes, commasep=False)
- srcrprovides = bb.utils.join_deps(rprovides, commasep=False)
-
- print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
- print_deps(srcrdepends, "Requires", spec_preamble_top, d)
- if srcrpreinst:
- print_deps(srcrdepends, "Requires(pre)", spec_preamble_top, d)
- if srcrpostinst:
- print_deps(srcrdepends, "Requires(post)", spec_preamble_top, d)
- if srcrprerm:
- print_deps(srcrdepends, "Requires(preun)", spec_preamble_top, d)
- if srcrpostrm:
- print_deps(srcrdepends, "Requires(postun)", spec_preamble_top, d)
-
- print_deps(srcrrecommends, "Recommends", spec_preamble_top, d)
- print_deps(srcrsuggests, "Suggests", spec_preamble_top, d)
- print_deps(srcrprovides, "Provides", spec_preamble_top, d)
- print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
- print_deps(srcrconflicts, "Conflicts", spec_preamble_top, d)
-
- spec_preamble_top.append('')
-
- spec_preamble_top.append('%description')
- append_description(spec_preamble_top, srcdescription)
-
- spec_preamble_top.append('')
-
- if srcrpreinst:
- spec_scriptlets_top.append('%pre')
- spec_scriptlets_top.append('# %s - preinst' % srcname)
- spec_scriptlets_top.append(srcrpreinst)
- spec_scriptlets_top.append('')
- if srcrpostinst:
- spec_scriptlets_top.append('%post')
- spec_scriptlets_top.append('# %s - postinst' % srcname)
- spec_scriptlets_top.append(srcrpostinst)
- spec_scriptlets_top.append('')
- if srcrprerm:
- spec_scriptlets_top.append('%preun')
- spec_scriptlets_top.append('# %s - prerm' % srcname)
- scriptvar = wrap_uninstall(srcrprerm)
- spec_scriptlets_top.append(scriptvar)
- spec_scriptlets_top.append('')
- if srcrpostrm:
- spec_scriptlets_top.append('%postun')
- spec_scriptlets_top.append('# %s - postrm' % srcname)
- scriptvar = wrap_uninstall(srcrpostrm)
- spec_scriptlets_top.append(scriptvar)
- spec_scriptlets_top.append('')
-
- # Write the SPEC file
- specfile = open(outspecfile, 'w')
-
- # RPMSPEC_PREAMBLE is a way to add arbitrary text to the top
- # of the generated spec file
- external_preamble = d.getVar("RPMSPEC_PREAMBLE")
- if external_preamble:
- specfile.write(external_preamble + "\n")
-
- for line in spec_preamble_top:
- specfile.write(line + "\n")
-
- for line in spec_preamble_bottom:
- specfile.write(line + "\n")
-
- for line in spec_scriptlets_top:
- specfile.write(line + "\n")
-
- for line in spec_scriptlets_bottom:
- specfile.write(line + "\n")
-
- for line in spec_files_top:
- specfile.write(line + "\n")
-
- for line in spec_files_bottom:
- specfile.write(line + "\n")
-
- specfile.close()
-}
-# Otherwise allarch packages may change depending on override configuration
-write_specfile[vardepsexclude] = "OVERRIDES"
-
-# Have to list any variables referenced as X_<pkg> that aren't in pkgdata here
-RPMEXTRAVARS = "PACKAGE_ADD_METADATA_RPM"
-write_specfile[vardeps] += "${@gen_packagevar(d, 'RPMEXTRAVARS')}"
-
-python do_package_rpm () {
- workdir = d.getVar('WORKDIR')
- tmpdir = d.getVar('TMPDIR')
- pkgd = d.getVar('PKGD')
- pkgdest = d.getVar('PKGDEST')
- if not workdir or not pkgd or not tmpdir:
- bb.error("Variables incorrectly set, unable to package")
- return
-
- packages = d.getVar('PACKAGES')
- if not packages or packages == '':
- bb.debug(1, "No packages; nothing to do")
- return
-
- # Construct the spec file...
- # If the spec file already exist, and has not been stored into
- # pseudo's files.db, it maybe cause rpmbuild src.rpm fail,
- # so remove it before doing rpmbuild src.rpm.
- srcname = d.getVar('PN')
- outspecfile = workdir + "/" + srcname + ".spec"
- if os.path.isfile(outspecfile):
- os.remove(outspecfile)
- d.setVar('OUTSPECFILE', outspecfile)
- bb.build.exec_func('write_specfile', d)
-
- perfiledeps = (d.getVar("MERGEPERFILEDEPS") or "0") == "0"
- if perfiledeps:
- outdepends, outprovides = write_rpm_perfiledata(srcname, d)
-
- # Setup the rpmbuild arguments...
- rpmbuild = d.getVar('RPMBUILD')
- targetsys = d.getVar('TARGET_SYS')
- targetvendor = d.getVar('HOST_VENDOR')
-
- # Too many places in dnf stack assume that arch-independent packages are "noarch".
- # Let's not fight against this.
- package_arch = (d.getVar('PACKAGE_ARCH') or "").replace("-", "_")
- if package_arch == "all":
- package_arch = "noarch"
-
- sdkpkgsuffix = (d.getVar('SDKPKGSUFFIX') or "nativesdk").replace("-", "_")
- d.setVar('PACKAGE_ARCH_EXTEND', package_arch)
- pkgwritedir = d.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}')
- d.setVar('RPM_PKGWRITEDIR', pkgwritedir)
- bb.debug(1, 'PKGWRITEDIR: %s' % d.getVar('RPM_PKGWRITEDIR'))
- pkgarch = d.expand('${PACKAGE_ARCH_EXTEND}${HOST_VENDOR}-linux')
- bb.utils.mkdirhier(pkgwritedir)
- os.chmod(pkgwritedir, 0o755)
-
- cmd = rpmbuild
- cmd = cmd + " --noclean --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
- cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
- cmd = cmd + " --define '_builddir " + d.getVar('B') + "'"
- cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'"
- cmd = cmd + " --define '_use_internal_dependency_generator 0'"
- cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'"
- cmd = cmd + " --define '_build_id_links none'"
- cmd = cmd + " --define '_binary_payload w19T%d.zstdio'" % int(d.getVar("ZSTD_THREADS"))
- cmd = cmd + " --define '_source_payload w19T%d.zstdio'" % int(d.getVar("ZSTD_THREADS"))
- cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'"
- cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'"
- cmd = cmd + " --define '_buildhost reproducible'"
- cmd = cmd + " --define '__font_provides %{nil}'"
- if perfiledeps:
- cmd = cmd + " --define '__find_requires " + outdepends + "'"
- cmd = cmd + " --define '__find_provides " + outprovides + "'"
- else:
- cmd = cmd + " --define '__find_requires %{nil}'"
- cmd = cmd + " --define '__find_provides %{nil}'"
- cmd = cmd + " --define '_unpackaged_files_terminate_build 0'"
- cmd = cmd + " --define 'debug_package %{nil}'"
- cmd = cmd + " --define '_tmppath " + workdir + "'"
- if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
- cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
- cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_RPMOUTDIR') + "'"
- cmdsrpm = cmdsrpm + " -bs " + outspecfile
- # Build the .src.rpm
- d.setVar('SBUILDSPEC', cmdsrpm + "\n")
- d.setVarFlag('SBUILDSPEC', 'func', '1')
- bb.build.exec_func('SBUILDSPEC', d)
- cmd = cmd + " -bb " + outspecfile
-
- # rpm 4 creates various empty directories in _topdir, let's clean them up
- cleanupcmd = "rm -rf %s/BUILDROOT %s/SOURCES %s/SPECS %s/SRPMS" % (workdir, workdir, workdir, workdir)
-
- # Build the rpm package!
- d.setVar('BUILDSPEC', cmd + "\n" + cleanupcmd + "\n")
- d.setVarFlag('BUILDSPEC', 'func', '1')
- bb.build.exec_func('BUILDSPEC', d)
-
- if d.getVar('RPM_SIGN_PACKAGES') == '1':
- bb.build.exec_func("sign_rpm", d)
-}
-
-python () {
- if d.getVar('PACKAGES') != '':
- deps = ' rpm-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
- d.appendVarFlag('do_package_write_rpm', 'depends', deps)
- d.setVarFlag('do_package_write_rpm', 'fakeroot', '1')
-}
-
-SSTATETASKS += "do_package_write_rpm"
-do_package_write_rpm[sstate-inputdirs] = "${PKGWRITEDIRRPM}"
-do_package_write_rpm[sstate-outputdirs] = "${DEPLOY_DIR_RPM}"
-# Take a shared lock, we can write multiple packages at the same time...
-# but we need to stop the rootfs/solver from running while we do...
-do_package_write_rpm[sstate-lockfile-shared] += "${DEPLOY_DIR_RPM}/rpm.lock"
-
-python do_package_write_rpm_setscene () {
- sstate_setscene(d)
-}
-addtask do_package_write_rpm_setscene
-
-python do_package_write_rpm () {
- bb.build.exec_func("read_subpackage_metadata", d)
- bb.build.exec_func("do_package_rpm", d)
-}
-
-do_package_write_rpm[dirs] = "${PKGWRITEDIRRPM}"
-do_package_write_rpm[cleandirs] = "${PKGWRITEDIRRPM}"
-do_package_write_rpm[depends] += "${@oe.utils.build_depends_string(d.getVar('PACKAGE_WRITE_DEPS'), 'do_populate_sysroot')}"
-addtask package_write_rpm after do_packagedata do_package do_deploy_source_date_epoch before do_build
-do_build[rdeptask] += "do_package_write_rpm"
-
-PACKAGEINDEXDEPS += "rpm-native:do_populate_sysroot"
-PACKAGEINDEXDEPS += "createrepo-c-native:do_populate_sysroot"
diff --git a/poky/meta/classes/package_tar.bbclass b/poky/meta/classes/package_tar.bbclass
deleted file mode 100644
index d6c1b30..0000000
--- a/poky/meta/classes/package_tar.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-inherit package
-
-IMAGE_PKGTYPE ?= "tar"
-
-python do_package_tar () {
- import subprocess
-
- oldcwd = os.getcwd()
-
- workdir = d.getVar('WORKDIR')
- if not workdir:
- bb.error("WORKDIR not defined, unable to package")
- return
-
- outdir = d.getVar('DEPLOY_DIR_TAR')
- if not outdir:
- bb.error("DEPLOY_DIR_TAR not defined, unable to package")
- return
-
- dvar = d.getVar('D')
- if not dvar:
- bb.error("D not defined, unable to package")
- return
-
- packages = d.getVar('PACKAGES')
- if not packages:
- bb.debug(1, "PACKAGES not defined, nothing to package")
- return
-
- pkgdest = d.getVar('PKGDEST')
-
- bb.utils.mkdirhier(outdir)
- bb.utils.mkdirhier(dvar)
-
- for pkg in packages.split():
- localdata = bb.data.createCopy(d)
- root = "%s/%s" % (pkgdest, pkg)
-
- overrides = localdata.getVar('OVERRIDES', False)
- localdata.setVar('OVERRIDES', '%s:%s' % (overrides, pkg))
-
- bb.utils.mkdirhier(root)
- basedir = os.path.dirname(root)
- tarfn = localdata.expand("${DEPLOY_DIR_TAR}/${PKG}-${PKGV}-${PKGR}.tar.gz")
- os.chdir(root)
- dlist = os.listdir(root)
- if not dlist:
- bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
- continue
- args = "tar -cz --exclude=CONTROL --exclude=DEBIAN -f".split()
- ret = subprocess.call(args + [tarfn] + dlist)
- if ret != 0:
- bb.error("Creation of tar %s failed." % tarfn)
-
- os.chdir(oldcwd)
-}
-
-python () {
- if d.getVar('PACKAGES') != '':
- deps = ' tar-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
- d.appendVarFlag('do_package_write_tar', 'depends', deps)
- d.setVarFlag('do_package_write_tar', 'fakeroot', "1")
-}
-
-
-python do_package_write_tar () {
- bb.build.exec_func("read_subpackage_metadata", d)
- bb.build.exec_func("do_package_tar", d)
-}
-do_package_write_tar[dirs] = "${D}"
-addtask package_write_tar before do_build after do_packagedata do_package
diff --git a/poky/meta/classes/packagedata.bbclass b/poky/meta/classes/packagedata.bbclass
deleted file mode 100644
index c2760e2..0000000
--- a/poky/meta/classes/packagedata.bbclass
+++ /dev/null
@@ -1,34 +0,0 @@
-python read_subpackage_metadata () {
- import oe.packagedata
-
- vars = {
- "PN" : d.getVar('PN'),
- "PE" : d.getVar('PE'),
- "PV" : d.getVar('PV'),
- "PR" : d.getVar('PR'),
- }
-
- data = oe.packagedata.read_pkgdata(vars["PN"], d)
-
- for key in data.keys():
- d.setVar(key, data[key])
-
- for pkg in d.getVar('PACKAGES').split():
- sdata = oe.packagedata.read_subpkgdata(pkg, d)
- for key in sdata.keys():
- if key in vars:
- if sdata[key] != vars[key]:
- if key == "PN":
- bb.fatal("Recipe %s is trying to create package %s which was already written by recipe %s. This will cause corruption, please resolve this and only provide the package from one recipe or the other or only build one of the recipes." % (vars[key], pkg, sdata[key]))
- bb.fatal("Recipe %s is trying to change %s from '%s' to '%s'. This will cause do_package_write_* failures since the incorrect data will be used and they will be unable to find the right workdir." % (vars["PN"], key, vars[key], sdata[key]))
- continue
- #
- # If we set unsuffixed variables here there is a chance they could clobber override versions
- # of that variable, e.g. DESCRIPTION could clobber DESCRIPTION:<pkgname>
- # We therefore don't clobber for the unsuffixed variable versions
- #
- if key.endswith(":" + pkg):
- d.setVar(key, sdata[key])
- else:
- d.setVar(key, sdata[key], parsing=True)
-}
diff --git a/poky/meta/classes/packagegroup.bbclass b/poky/meta/classes/packagegroup.bbclass
deleted file mode 100644
index 557b1b6..0000000
--- a/poky/meta/classes/packagegroup.bbclass
+++ /dev/null
@@ -1,61 +0,0 @@
-# Class for packagegroup (package group) recipes
-
-# By default, only the packagegroup package itself is in PACKAGES.
-# -dbg and -dev flavours are handled by the anonfunc below.
-# This means that packagegroup recipes used to build multiple packagegroup
-# packages have to modify PACKAGES after inheriting packagegroup.bbclass.
-PACKAGES = "${PN}"
-
-# By default, packagegroup packages do not depend on a certain architecture.
-# Only if dependencies are modified by MACHINE_FEATURES, packages
-# need to be set to MACHINE_ARCH before inheriting packagegroup.bbclass
-PACKAGE_ARCH ?= "all"
-
-# Fully expanded - so it applies the overrides as well
-PACKAGE_ARCH_EXPANDED := "${PACKAGE_ARCH}"
-
-LICENSE ?= "MIT"
-
-inherit ${@oe.utils.ifelse(d.getVar('PACKAGE_ARCH_EXPANDED') == 'all', 'allarch', '')}
-
-# This automatically adds -dbg and -dev flavours of all PACKAGES
-# to the list. Their dependencies (RRECOMMENDS) are handled as usual
-# by package_depchains in a following step.
-# Also mark all packages as ALLOW_EMPTY
-python () {
- packages = d.getVar('PACKAGES').split()
- if d.getVar('PACKAGEGROUP_DISABLE_COMPLEMENTARY') != '1':
- types = ['', '-dbg', '-dev']
- if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d):
- types.append('-ptest')
- packages = [pkg + suffix for pkg in packages
- for suffix in types]
- d.setVar('PACKAGES', ' '.join(packages))
- for pkg in packages:
- d.setVar('ALLOW_EMPTY:%s' % pkg, '1')
-}
-
-# We don't want to look at shared library dependencies for the
-# dbg packages
-DEPCHAIN_DBGDEFAULTDEPS = "1"
-
-# We only need the packaging tasks - disable the rest
-deltask do_fetch
-deltask do_unpack
-deltask do_patch
-deltask do_configure
-deltask do_compile
-deltask do_install
-deltask do_populate_sysroot
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-python () {
- if bb.data.inherits_class('nativesdk', d):
- return
- initman = d.getVar("VIRTUAL-RUNTIME_init_manager")
- if initman and initman in ['sysvinit', 'systemd'] and not bb.utils.contains('DISTRO_FEATURES', initman, True, False, d):
- bb.fatal("Please ensure that your setting of VIRTUAL-RUNTIME_init_manager (%s) matches the entries enabled in DISTRO_FEATURES" % initman)
-}
-
-CVE_PRODUCT = ""
diff --git a/poky/meta/classes/patch.bbclass b/poky/meta/classes/patch.bbclass
deleted file mode 100644
index 8de7025..0000000
--- a/poky/meta/classes/patch.bbclass
+++ /dev/null
@@ -1,169 +0,0 @@
-# Copyright (C) 2006 OpenedHand LTD
-
-# Point to an empty file so any user's custom settings don't break things
-QUILTRCFILE ?= "${STAGING_ETCDIR_NATIVE}/quiltrc"
-
-PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot"
-
-# There is a bug in patch 2.7.3 and earlier where index lines
-# in patches can change file modes when they shouldn't:
-# http://git.savannah.gnu.org/cgit/patch.git/patch/?id=82b800c9552a088a241457948219d25ce0a407a4
-# This leaks into debug sources in particular. Add the dependency
-# to target recipes to avoid this problem until we can rely on 2.7.4 or later.
-PATCHDEPENDENCY:append:class-target = " patch-replacement-native:do_populate_sysroot"
-
-PATCH_GIT_USER_NAME ?= "OpenEmbedded"
-PATCH_GIT_USER_EMAIL ?= "oe.patch@oe"
-
-inherit terminal
-
-python () {
- if d.getVar('PATCHTOOL') == 'git' and d.getVar('PATCH_COMMIT_FUNCTIONS') == '1':
- extratasks = bb.build.tasksbetween('do_unpack', 'do_patch', d)
- try:
- extratasks.remove('do_unpack')
- except ValueError:
- # For some recipes do_unpack doesn't exist, ignore it
- pass
-
- d.appendVarFlag('do_patch', 'prefuncs', ' patch_task_patch_prefunc')
- for task in extratasks:
- d.appendVarFlag(task, 'postfuncs', ' patch_task_postfunc')
-}
-
-python patch_task_patch_prefunc() {
- # Prefunc for do_patch
- srcsubdir = d.getVar('S')
-
- workdir = os.path.abspath(d.getVar('WORKDIR'))
- testsrcdir = os.path.abspath(srcsubdir)
- if (testsrcdir + os.sep).startswith(workdir + os.sep):
- # Double-check that either workdir or S or some directory in-between is a git repository
- found = False
- while testsrcdir != workdir:
- if os.path.exists(os.path.join(testsrcdir, '.git')):
- found = True
- break
- if testsrcdir == workdir:
- break
- testsrcdir = os.path.dirname(testsrcdir)
- if not found:
- bb.fatal('PATCHTOOL = "git" set for source tree that is not a git repository. Refusing to continue as that may result in commits being made in your metadata repository.')
-
- patchdir = os.path.join(srcsubdir, 'patches')
- if os.path.exists(patchdir):
- if os.listdir(patchdir):
- d.setVar('PATCH_HAS_PATCHES_DIR', '1')
- else:
- os.rmdir(patchdir)
-}
-
-python patch_task_postfunc() {
- # Prefunc for task functions between do_unpack and do_patch
- import oe.patch
- import shutil
- func = d.getVar('BB_RUNTASK')
- srcsubdir = d.getVar('S')
-
- if os.path.exists(srcsubdir):
- if func == 'do_patch':
- haspatches = (d.getVar('PATCH_HAS_PATCHES_DIR') == '1')
- patchdir = os.path.join(srcsubdir, 'patches')
- if os.path.exists(patchdir):
- shutil.rmtree(patchdir)
- if haspatches:
- stdout, _ = bb.process.run('git status --porcelain patches', cwd=srcsubdir)
- if stdout:
- bb.process.run('git checkout patches', cwd=srcsubdir)
- stdout, _ = bb.process.run('git status --porcelain .', cwd=srcsubdir)
- if stdout:
- useroptions = []
- oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d)
- bb.process.run('git add .; git %s commit -a -m "Committing changes from %s\n\n%s"' % (' '.join(useroptions), func, oe.patch.GitApplyTree.ignore_commit_prefix + ' - from %s' % func), cwd=srcsubdir)
-}
-
-def src_patches(d, all=False, expand=True):
- import oe.patch
- return oe.patch.src_patches(d, all, expand)
-
-def should_apply(parm, d):
- """Determine if we should apply the given patch"""
- import oe.patch
- return oe.patch.should_apply(parm, d)
-
-should_apply[vardepsexclude] = "DATE SRCDATE"
-
-python patch_do_patch() {
- import oe.patch
-
- patchsetmap = {
- "patch": oe.patch.PatchTree,
- "quilt": oe.patch.QuiltTree,
- "git": oe.patch.GitApplyTree,
- }
-
- cls = patchsetmap[d.getVar('PATCHTOOL') or 'quilt']
-
- resolvermap = {
- "noop": oe.patch.NOOPResolver,
- "user": oe.patch.UserResolver,
- }
-
- rcls = resolvermap[d.getVar('PATCHRESOLVE') or 'user']
-
- classes = {}
-
- s = d.getVar('S')
-
- os.putenv('PATH', d.getVar('PATH'))
-
- # We must use one TMPDIR per process so that the "patch" processes
- # don't generate the same temp file name.
-
- import tempfile
- process_tmpdir = tempfile.mkdtemp()
- os.environ['TMPDIR'] = process_tmpdir
-
- for patch in src_patches(d):
- _, _, local, _, _, parm = bb.fetch.decodeurl(patch)
-
- if "patchdir" in parm:
- patchdir = parm["patchdir"]
- if not os.path.isabs(patchdir):
- patchdir = os.path.join(s, patchdir)
- if not os.path.isdir(patchdir):
- bb.fatal("Target directory '%s' not found, patchdir '%s' is incorrect in patch file '%s'" %
- (patchdir, parm["patchdir"], parm['patchname']))
- else:
- patchdir = s
-
- if not patchdir in classes:
- patchset = cls(patchdir, d)
- resolver = rcls(patchset, oe_terminal)
- classes[patchdir] = (patchset, resolver)
- patchset.Clean()
- else:
- patchset, resolver = classes[patchdir]
-
- bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d)))
- try:
- patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
- except Exception as exc:
- bb.utils.remove(process_tmpdir, True)
- bb.fatal("Importing patch '%s' with striplevel '%s'\n%s" % (parm['patchname'], parm['striplevel'], repr(exc).replace("\\n", "\n")))
- try:
- resolver.Resolve()
- except bb.BBHandledException as e:
- bb.utils.remove(process_tmpdir, True)
- bb.fatal("Applying patch '%s' on target directory '%s'\n%s" % (parm['patchname'], patchdir, repr(e).replace("\\n", "\n")))
-
- bb.utils.remove(process_tmpdir, True)
- del os.environ['TMPDIR']
-}
-patch_do_patch[vardepsexclude] = "PATCHRESOLVE"
-
-addtask patch after do_unpack
-do_patch[dirs] = "${WORKDIR}"
-do_patch[depends] = "${PATCHDEPENDENCY}"
-
-EXPORT_FUNCTIONS do_patch
diff --git a/poky/meta/classes/perl-version.bbclass b/poky/meta/classes/perl-version.bbclass
deleted file mode 100644
index 84b67b8..0000000
--- a/poky/meta/classes/perl-version.bbclass
+++ /dev/null
@@ -1,66 +0,0 @@
-PERL_OWN_DIR = ""
-
-# Determine the staged version of perl from the perl configuration file
-# Assign vardepvalue, because otherwise signature is changed before and after
-# perl is built (from None to real version in config.sh).
-get_perl_version[vardepvalue] = "${PERL_OWN_DIR}"
-def get_perl_version(d):
- import re
- cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh')
- try:
- f = open(cfg, 'r')
- except IOError:
- return None
- l = f.readlines();
- f.close();
- r = re.compile(r"^version='(\d*\.\d*\.\d*)'")
- for s in l:
- m = r.match(s)
- if m:
- return m.group(1)
- return None
-
-PERLVERSION := "${@get_perl_version(d)}"
-PERLVERSION[vardepvalue] = ""
-
-
-# Determine the staged arch of perl from the perl configuration file
-# Assign vardepvalue, because otherwise signature is changed before and after
-# perl is built (from None to real version in config.sh).
-def get_perl_arch(d):
- import re
- cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh')
- try:
- f = open(cfg, 'r')
- except IOError:
- return None
- l = f.readlines();
- f.close();
- r = re.compile("^archname='([^']*)'")
- for s in l:
- m = r.match(s)
- if m:
- return m.group(1)
- return None
-
-PERLARCH := "${@get_perl_arch(d)}"
-PERLARCH[vardepvalue] = ""
-
-# Determine the staged arch of perl-native from the perl configuration file
-# Assign vardepvalue, because otherwise signature is changed before and after
-# perl is built (from None to real version in config.sh).
-def get_perl_hostarch(d):
- import re
- cfg = d.expand('${STAGING_LIBDIR_NATIVE}/perl5/config.sh')
- try:
- f = open(cfg, 'r')
- except IOError:
- return None
- l = f.readlines();
- f.close();
- r = re.compile("^archname='([^']*)'")
- for s in l:
- m = r.match(s)
- if m:
- return m.group(1)
- return None
diff --git a/poky/meta/classes/perlnative.bbclass b/poky/meta/classes/perlnative.bbclass
deleted file mode 100644
index cc8de8b..0000000
--- a/poky/meta/classes/perlnative.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRANATIVEPATH += "perl-native"
-DEPENDS += "perl-native"
-OECMAKE_PERLNATIVE_DIR = "${STAGING_BINDIR_NATIVE}/perl-native"
diff --git a/poky/meta/classes/pixbufcache.bbclass b/poky/meta/classes/pixbufcache.bbclass
deleted file mode 100644
index 886bf19..0000000
--- a/poky/meta/classes/pixbufcache.bbclass
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# This class will generate the proper postinst/postrm scriptlets for pixbuf
-# packages.
-#
-
-DEPENDS:append:class-target = " qemu-native"
-inherit qemu
-
-PIXBUF_PACKAGES ??= "${PN}"
-
-PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
-
-pixbufcache_common() {
-if [ "x$D" != "x" ]; then
- $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \
- bindir=${bindir} base_libdir=${base_libdir}
-else
-
- # Update the pixbuf loaders in case they haven't been registered yet
- ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
-
- if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
- for icondir in /usr/share/icons/*; do
- if [ -d ${icondir} ]; then
- gtk-update-icon-cache -t -q ${icondir}
- fi
- done
- fi
-fi
-}
-
-python populate_packages:append() {
- pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split()
-
- for pkg in pixbuf_pkgs:
- bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
- postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += d.getVar('pixbufcache_common')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += d.getVar('pixbufcache_common')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-}
-
-gdkpixbuf_complete() {
-GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
-}
-
-DEPENDS:append:class-native = " gdk-pixbuf-native"
-SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst"
-
-pixbufcache_sstate_postinst() {
- mkdir -p ${SYSROOT_DESTDIR}${bindir}
- dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
- echo '#!/bin/sh' > $dest
- echo "${gdkpixbuf_complete}" >> $dest
- chmod 0755 $dest
-}
diff --git a/poky/meta/classes/pkgconfig.bbclass b/poky/meta/classes/pkgconfig.bbclass
deleted file mode 100644
index fa94527..0000000
--- a/poky/meta/classes/pkgconfig.bbclass
+++ /dev/null
@@ -1,2 +0,0 @@
-DEPENDS:prepend = "pkgconfig-native "
-
diff --git a/poky/meta/classes/populate_sdk.bbclass b/poky/meta/classes/populate_sdk.bbclass
deleted file mode 100644
index f64a911..0000000
--- a/poky/meta/classes/populate_sdk.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
-# The majority of populate_sdk is located in populate_sdk_base
-# This chunk simply facilitates compatibility with SDK only recipes.
-
-inherit populate_sdk_base
-
-addtask populate_sdk after do_install before do_build
-
diff --git a/poky/meta/classes/populate_sdk_base.bbclass b/poky/meta/classes/populate_sdk_base.bbclass
deleted file mode 100644
index f260217..0000000
--- a/poky/meta/classes/populate_sdk_base.bbclass
+++ /dev/null
@@ -1,376 +0,0 @@
-PACKAGES = ""
-
-inherit image-postinst-intercepts image-artifact-names
-
-# Wildcards specifying complementary packages to install for every package that has been explicitly
-# installed into the rootfs
-COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev'
-COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev'
-COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc'
-COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg'
-COMPLEMENTARY_GLOB[src-pkgs] = '*-src'
-COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest'
-COMPLEMENTARY_GLOB[bash-completion-pkgs] = '*-bash-completion'
-
-def complementary_globs(featurevar, d):
- all_globs = d.getVarFlags('COMPLEMENTARY_GLOB')
- globs = []
- features = set((d.getVar(featurevar) or '').split())
- for name, glob in all_globs.items():
- if name in features:
- globs.append(glob)
- return ' '.join(globs)
-
-SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}"
-SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
-SDKIMAGE_INSTALL_COMPLEMENTARY[vardeps] += "SDKIMAGE_FEATURES"
-
-PACKAGE_ARCHS:append:task-populate-sdk = " sdk-provides-dummy-target"
-SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}"
-
-# List of locales to install, or "all" for all of them, or unset for none.
-SDKIMAGE_LINGUAS ?= "all"
-
-inherit rootfs_${IMAGE_PKGTYPE}
-
-SDK_DIR = "${WORKDIR}/sdk"
-SDK_OUTPUT = "${SDK_DIR}/image"
-SDK_DEPLOY = "${DEPLOY_DIR}/sdk"
-
-SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk"
-
-B:task-populate-sdk = "${SDK_DIR}"
-
-SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
-
-SDK_TOOLCHAIN_LANGS ??= ""
-SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust"
-
-TOOLCHAIN_HOST_TASK ?= " \
- nativesdk-packagegroup-sdk-host \
- packagegroup-cross-canadian-${MACHINE} \
- ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-cross-canadian-${MACHINE}', '', d)} \
- ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-cross-canadian-${MACHINE}', '', d)} \
-"
-TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= ""
-TOOLCHAIN_TARGET_TASK ?= " \
- ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \
- ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \
- ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \
- target-sdk-provides-dummy \
-"
-TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
-TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
-
-# Default archived SDK's suffix
-SDK_ARCHIVE_TYPE ?= "tar.xz"
-SDK_XZ_COMPRESSION_LEVEL ?= "-9"
-SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}"
-
-# To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz
-python () {
- if d.getVar('SDK_ARCHIVE_TYPE') == 'zip':
- d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native')
- # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR}
- # recommand to cd into input dir first to avoid archive with buildpath
- d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r -y ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
- else:
- d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native')
- d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}')
-}
-
-SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
-SDK_DEPENDS = "virtual/fakeroot-native ${SDK_ARCHIVE_DEPENDS} cross-localedef-native nativesdk-qemuwrapper-cross ${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross"
-PATH:prepend = "${WORKDIR}/recipe-sysroot/${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
-SDK_DEPENDS += "nativesdk-glibc-locale"
-
-# We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
-# could be set to the MACHINE_ARCH
-REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
-
-PID = "${@os.getpid()}"
-
-EXCLUDE_FROM_WORLD = "1"
-
-SDK_PACKAGING_FUNC ?= "create_shar"
-SDK_PRE_INSTALL_COMMAND ?= ""
-SDK_POST_INSTALL_COMMAND ?= ""
-SDK_RELOCATE_AFTER_INSTALL ?= "1"
-
-SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk"
-SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK"
-
-SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest"
-SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest"
-SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
-SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
-
-SDK_PRUNE_SYSROOT_DIRS ?= "/dev"
-
-python write_target_sdk_manifest () {
- from oe.sdk import sdk_list_installed_packages
- from oe.utils import format_pkg_list
- sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST"))
- pkgs = sdk_list_installed_packages(d, True)
- if not os.path.exists(sdkmanifestdir):
- bb.utils.mkdirhier(sdkmanifestdir)
- with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output:
- output.write(format_pkg_list(pkgs, 'ver'))
-}
-
-sdk_prune_dirs () {
- for d in ${SDK_PRUNE_SYSROOT_DIRS}; do
- rm -rf ${SDK_OUTPUT}${SDKTARGETSYSROOT}$d
- done
-}
-
-python write_sdk_test_data() {
- from oe.data import export2json
- testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME'))
- bb.utils.mkdirhier(os.path.dirname(testdata))
- export2json(d, testdata)
-}
-
-python write_host_sdk_manifest () {
- from oe.sdk import sdk_list_installed_packages
- from oe.utils import format_pkg_list
- sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST"))
- pkgs = sdk_list_installed_packages(d, False)
- if not os.path.exists(sdkmanifestdir):
- bb.utils.mkdirhier(sdkmanifestdir)
- with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output:
- output.write(format_pkg_list(pkgs, 'ver'))
-}
-
-POPULATE_SDK_POST_TARGET_COMMAND:append = " write_sdk_test_data ; "
-POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " write_target_sdk_manifest; sdk_prune_dirs; "
-POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manifest; "
-
-SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}"
-SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} "
-
-def populate_sdk_common(d):
- from oe.sdk import populate_sdk
- from oe.manifest import create_manifest, Manifest
-
- # Handle package exclusions
- excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split()
- inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split()
- inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split()
-
- d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
- d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
-
- for pkg in excl_pkgs:
- if pkg in inst_pkgs:
- bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
- inst_pkgs.remove(pkg)
-
- if pkg in inst_attempt_pkgs:
- bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
- inst_attempt_pkgs.remove(pkg)
-
- d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
- d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
-
- pn = d.getVar('PN')
- runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d)
- runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d)
-
- ld = bb.data.createCopy(d)
- ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata")
- runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld)
- runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld)
- d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK"))
- d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY"))
-
- # create target/host SDK manifests
- create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
- manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST)
- create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
- manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET)
-
- populate_sdk(d)
-
-fakeroot python do_populate_sdk() {
- populate_sdk_common(d)
-}
-SSTATETASKS += "do_populate_sdk"
-SSTATE_SKIP_CREATION:task-populate-sdk = '1'
-do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}"
-do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}"
-do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}"
-do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}"
-python do_populate_sdk_setscene () {
- sstate_setscene(d)
-}
-addtask do_populate_sdk_setscene
-
-PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk"
-
-fakeroot create_sdk_files() {
- cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
-
- # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern.
- # Escape special characters like '+' and '.' in the SDKPATH
- escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g")
- sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py
-
- mkdir -p ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/
- echo '${SDKPATHNATIVE}${libdir_nativesdk}
-${SDKPATHNATIVE}${base_libdir_nativesdk}
-include /etc/ld.so.conf' > ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ld.so.conf
-}
-
-python check_sdk_sysroots() {
- # Fails build if there are broken or dangling symlinks in SDK sysroots
-
- if d.getVar('CHECK_SDK_SYSROOTS') != '1':
- # disabled, bail out
- return
-
- def norm_path(path):
- return os.path.abspath(path)
-
- # Get scan root
- SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'),
- d.getVar('SDKPATH')))
-
- bb.note('Checking SDK sysroots at ' + SCAN_ROOT)
-
- def check_symlink(linkPath):
- if not os.path.islink(linkPath):
- return
-
- linkDirPath = os.path.dirname(linkPath)
-
- targetPath = os.readlink(linkPath)
- if not os.path.isabs(targetPath):
- targetPath = os.path.join(linkDirPath, targetPath)
- targetPath = norm_path(targetPath)
-
- if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ):
- bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath))
- return
-
- if not os.path.exists(targetPath):
- bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath))
- return
-
- if os.path.isdir(targetPath):
- dir_walk(targetPath)
-
- def walk_error_handler(e):
- bb.error(str(e))
-
- def dir_walk(rootDir):
- for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler):
- entries = subDirEntries + fileEntries
- for e in entries:
- ePath = os.path.join(dirPath, e)
- check_symlink(ePath)
-
- # start
- dir_walk(SCAN_ROOT)
-}
-
-SDKTAROPTS = "--owner=root --group=root"
-
-fakeroot archive_sdk() {
- # Package it up
- mkdir -p ${SDKDEPLOYDIR}
- ${SDK_ARCHIVE_CMD}
-}
-
-TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh"
-TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh"
-
-fakeroot create_shar() {
- # copy in the template shar extractor script
- cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
- rm -f ${T}/pre_install_command ${T}/post_install_command
-
- if [ "${SDK_RELOCATE_AFTER_INSTALL}" = "1" ] ; then
- cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command
- fi
- cat << "EOF" >> ${T}/pre_install_command
-${SDK_PRE_INSTALL_COMMAND}
-EOF
-
- cat << "EOF" >> ${T}/post_install_command
-${SDK_POST_INSTALL_COMMAND}
-EOF
- sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \
- -e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \
- ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
- # substitute variables
- sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \
- -e 's#@SDKPATH@#${SDKPATH}#g' \
- -e 's#@SDKPATHINSTALL@#${SDKPATHINSTALL}#g' \
- -e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \
- -e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \
- -e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \
- -e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \
- -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
- -e '/@SDK_PRE_INSTALL_COMMAND@/d' \
- -e '/@SDK_POST_INSTALL_COMMAND@/d' \
- -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \
- -e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \
- ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
- # add execution permission
- chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
- # append the SDK tarball
- cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
-
- # delete the old tarball, we don't need it anymore
- rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}
-}
-
-populate_sdk_log_check() {
- for target in $*
- do
- lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}"
-
- echo "log_check: Using $lf_path as logfile"
-
- if [ -e "$lf_path" ]; then
- ${IMAGE_PKGTYPE}_log_check $target $lf_path
- else
- echo "Cannot find logfile [$lf_path]"
- fi
- echo "Logfile is clean"
- done
-}
-
-def sdk_command_variables(d):
- return ['OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','POPULATE_SDK_POST_HOST_COMMAND','POPULATE_SDK_PRE_TARGET_COMMAND','POPULATE_SDK_POST_TARGET_COMMAND','SDK_POSTPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS']
-
-def sdk_variables(d):
- variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT',
- 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS',
- 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS']
- variables.extend(sdk_command_variables(d))
- return " ".join(variables)
-
-do_populate_sdk[vardeps] += "${@sdk_variables(d)}"
-
-python () {
- variables = sdk_command_variables(d)
- for var in variables:
- if d.getVar(var, False):
- d.setVarFlag(var, 'func', '1')
-}
-
-do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \
- ${TOOLCHAIN_SHAR_EXT_TMPL}:True"
-
-do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}"
-do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])} ${@d.getVarFlag('do_rootfs', 'depends', False)}"
-do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}"
-do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb"
-do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
-addtask populate_sdk
diff --git a/poky/meta/classes/populate_sdk_ext.bbclass b/poky/meta/classes/populate_sdk_ext.bbclass
deleted file mode 100644
index d58b2ba..0000000
--- a/poky/meta/classes/populate_sdk_ext.bbclass
+++ /dev/null
@@ -1,836 +0,0 @@
-# Extensible SDK
-
-inherit populate_sdk_base
-
-# Used to override TOOLCHAIN_HOST_TASK in the eSDK case
-TOOLCHAIN_HOST_TASK_ESDK = " \
- meta-environment-extsdk-${MACHINE} \
- "
-
-SDK_RELOCATE_AFTER_INSTALL:task-populate-sdk-ext = "0"
-
-SDK_EXT = ""
-SDK_EXT:task-populate-sdk-ext = "-ext"
-
-# Options are full or minimal
-SDK_EXT_TYPE ?= "full"
-SDK_INCLUDE_PKGDATA ?= "0"
-SDK_INCLUDE_TOOLCHAIN ?= "${@'1' if d.getVar('SDK_EXT_TYPE') == 'full' else '0'}"
-SDK_INCLUDE_NATIVESDK ?= "0"
-SDK_INCLUDE_BUILDTOOLS ?= '1'
-
-SDK_RECRDEP_TASKS ?= ""
-SDK_CUSTOM_TEMPLATECONF ?= "0"
-
-ESDK_LOCALCONF_ALLOW ?= ""
-ESDK_LOCALCONF_REMOVE ?= "CONF_VERSION \
- BB_NUMBER_THREADS \
- BB_NUMBER_PARSE_THREADS \
- PARALLEL_MAKE \
- PRSERV_HOST \
- SSTATE_MIRRORS \
- DL_DIR \
- SSTATE_DIR \
- TMPDIR \
- BB_SERVER_TIMEOUT \
- "
-ESDK_CLASS_INHERIT_DISABLE ?= "buildhistory icecc"
-SDK_UPDATE_URL ?= ""
-
-SDK_TARGETS ?= "${PN}"
-
-def get_sdk_install_targets(d, images_only=False):
- sdk_install_targets = ''
- if images_only or d.getVar('SDK_EXT_TYPE') != 'minimal':
- sdk_install_targets = d.getVar('SDK_TARGETS')
-
- depd = d.getVar('BB_TASKDEPDATA', False)
- tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d)
- tasklist.remove('do_build')
- for v in depd.values():
- if v[1] in tasklist:
- if v[0] not in sdk_install_targets:
- sdk_install_targets += ' {}'.format(v[0])
-
- if not images_only:
- if d.getVar('SDK_INCLUDE_PKGDATA') == '1':
- sdk_install_targets += ' meta-world-pkgdata:do_allpackagedata'
- if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1':
- sdk_install_targets += ' meta-extsdk-toolchain:do_populate_sysroot'
-
- return sdk_install_targets
-
-get_sdk_install_targets[vardepsexclude] = "BB_TASKDEPDATA"
-
-OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
-
-# The files from COREBASE that you want preserved in the COREBASE copied
-# into the sdk. This allows someone to have their own setup scripts in
-# COREBASE be preserved as well as untracked files.
-COREBASE_FILES ?= " \
- oe-init-build-env \
- scripts \
- LICENSE \
- .templateconf \
-"
-
-SDK_DIR:task-populate-sdk-ext = "${WORKDIR}/sdk-ext"
-B:task-populate-sdk-ext = "${SDK_DIR}"
-TOOLCHAINEXT_OUTPUTNAME ?= "${SDK_NAME}-toolchain-ext-${SDK_VERSION}"
-TOOLCHAIN_OUTPUTNAME:task-populate-sdk-ext = "${TOOLCHAINEXT_OUTPUTNAME}"
-
-SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
-SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
-
-python write_target_sdk_ext_manifest () {
- from oe.sdk import get_extra_sdkinfo
- sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')
- extra_info = get_extra_sdkinfo(sstate_dir)
-
- target = d.getVar('TARGET_SYS')
- target_multimach = d.getVar('MULTIMACH_TARGET_SYS')
- real_target_multimach = d.getVar('REAL_MULTIMACH_TARGET_SYS')
-
- pkgs = {}
- os.makedirs(os.path.dirname(d.getVar('SDK_EXT_TARGET_MANIFEST')), exist_ok=True)
- with open(d.getVar('SDK_EXT_TARGET_MANIFEST'), 'w') as f:
- for fn in extra_info['filesizes']:
- info = fn.split(':')
- if info[2] in (target, target_multimach, real_target_multimach) \
- or info[5] == 'allarch':
- if not info[1] in pkgs:
- f.write("%s %s %s\n" % (info[1], info[2], info[3]))
- pkgs[info[1]] = {}
-}
-python write_host_sdk_ext_manifest () {
- from oe.sdk import get_extra_sdkinfo
- sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')
- extra_info = get_extra_sdkinfo(sstate_dir)
- host = d.getVar('BUILD_SYS')
- with open(d.getVar('SDK_EXT_HOST_MANIFEST'), 'w') as f:
- for fn in extra_info['filesizes']:
- info = fn.split(':')
- if info[2] == host:
- f.write("%s %s %s\n" % (info[1], info[2], info[3]))
-}
-
-SDK_POSTPROCESS_COMMAND:append:task-populate-sdk-ext = "write_target_sdk_ext_manifest; write_host_sdk_ext_manifest; "
-
-SDK_TITLE:task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} Extensible SDK"
-
-def clean_esdk_builddir(d, sdkbasepath):
- """Clean up traces of the fake build for create_filtered_tasklist()"""
- import shutil
- cleanpaths = ['cache', 'tmp']
- for pth in cleanpaths:
- fullpth = os.path.join(sdkbasepath, pth)
- if os.path.isdir(fullpth):
- shutil.rmtree(fullpth)
- elif os.path.isfile(fullpth):
- os.remove(fullpth)
-
-def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
- """
- Create a filtered list of tasks. Also double-checks that the build system
- within the SDK basically works and required sstate artifacts are available.
- """
- import tempfile
- import shutil
- import oe.copy_buildsystem
-
- # Create a temporary build directory that we can pass to the env setup script
- shutil.copyfile(sdkbasepath + '/conf/local.conf', sdkbasepath + '/conf/local.conf.bak')
- try:
- with open(sdkbasepath + '/conf/local.conf', 'a') as f:
- # Force the use of sstate from the build system
- f.write('\nSSTATE_DIR:forcevariable = "%s"\n' % d.getVar('SSTATE_DIR'))
- f.write('SSTATE_MIRRORS:forcevariable = "file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n')
- # Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it
- f.write('TMPDIR:forcevariable = "${TOPDIR}/tmp"\n')
- f.write('TCLIBCAPPEND:forcevariable = ""\n')
- # Drop uninative if the build isn't using it (or else NATIVELSBSTRING will
- # be different and we won't be able to find our native sstate)
- if not bb.data.inherits_class('uninative', d):
- f.write('INHERIT:remove = "uninative"\n')
-
- # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
- # will not allow in its COREBASE path, so we need to rename the directory temporarily
- temp_sdkbasepath = d.getVar('SDK_OUTPUT') + '/tmp-renamed-sdk'
- # Delete any existing temp dir
- try:
- shutil.rmtree(temp_sdkbasepath)
- except FileNotFoundError:
- pass
- bb.utils.rename(sdkbasepath, temp_sdkbasepath)
- cmdprefix = '. %s .; ' % conf_initpath
- logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt'
- try:
- oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile)
- except bb.process.ExecutionError as e:
- msg = 'Failed to generate filtered task list for extensible SDK:\n%s' % e.stdout.rstrip()
- if 'attempted to execute unexpectedly and should have been setscened' in e.stdout:
- msg += '\n----------\n\nNOTE: "attempted to execute unexpectedly and should have been setscened" errors indicate this may be caused by missing sstate artifacts that were likely produced in earlier builds, but have been subsequently deleted for some reason.\n'
- bb.fatal(msg)
- bb.utils.rename(temp_sdkbasepath, sdkbasepath)
- # Clean out residue of running bitbake, which check_sstate_task_list()
- # will effectively do
- clean_esdk_builddir(d, sdkbasepath)
- finally:
- localconf = sdkbasepath + '/conf/local.conf'
- if os.path.exists(localconf + '.bak'):
- os.replace(localconf + '.bak', localconf)
-
-python copy_buildsystem () {
- import re
- import shutil
- import glob
- import oe.copy_buildsystem
-
- oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT')
-
- conf_bbpath = ''
- conf_initpath = ''
- core_meta_subdir = ''
-
- # Copy in all metadata layers + bitbake (as repositories)
- buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
- baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
-
- #check if custome templateconf path is set
- use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
-
- # Determine if we're building a derivative extensible SDK (from devtool build-sdk)
- derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
- if derivative:
- workspace_name = 'orig-workspace'
- else:
- workspace_name = None
-
- corebase, sdkbblayers = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers', workspace_name)
- conf_bbpath = os.path.join('layers', corebase, 'bitbake')
-
- for path in os.listdir(baseoutpath + '/layers'):
- relpath = os.path.join('layers', path, oe_init_env_script)
- if os.path.exists(os.path.join(baseoutpath, relpath)):
- conf_initpath = relpath
-
- relpath = os.path.join('layers', path, 'scripts', 'devtool')
- if os.path.exists(os.path.join(baseoutpath, relpath)):
- scriptrelpath = os.path.dirname(relpath)
-
- relpath = os.path.join('layers', path, 'meta')
- if os.path.exists(os.path.join(baseoutpath, relpath, 'lib', 'oe')):
- core_meta_subdir = relpath
-
- d.setVar('oe_init_build_env_path', conf_initpath)
- d.setVar('scriptrelpath', scriptrelpath)
-
- # Write out config file for devtool
- import configparser
- config = configparser.SafeConfigParser()
- config.add_section('General')
- config.set('General', 'bitbake_subdir', conf_bbpath)
- config.set('General', 'init_path', conf_initpath)
- config.set('General', 'core_meta_subdir', core_meta_subdir)
- config.add_section('SDK')
- config.set('SDK', 'sdk_targets', d.getVar('SDK_TARGETS'))
- updateurl = d.getVar('SDK_UPDATE_URL')
- if updateurl:
- config.set('SDK', 'updateserver', updateurl)
- bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf'))
- with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
- config.write(f)
-
- unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc')
- with open(unlockedsigs, 'w') as f:
- pass
-
- # Create a layer for new recipes / appends
- bbpath = d.getVar('BBPATH')
- env = os.environ.copy()
- env['PYTHONDONTWRITEBYTECODE'] = '1'
- bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')], env=env)
-
- # Create bblayers.conf
- bb.utils.mkdirhier(baseoutpath + '/conf')
- with open(baseoutpath + '/conf/bblayers.conf', 'w') as f:
- f.write('# WARNING: this configuration has been automatically generated and in\n')
- f.write('# most cases should not be edited. If you need more flexibility than\n')
- f.write('# this configuration provides, it is strongly suggested that you set\n')
- f.write('# up a proper instance of the full build system and use that instead.\n\n')
-
- # LCONF_VERSION may not be set, for example when using meta-poky
- # so don't error if it isn't found
- lconf_version = d.getVar('LCONF_VERSION', False)
- if lconf_version is not None:
- f.write('LCONF_VERSION = "%s"\n\n' % lconf_version)
-
- f.write('BBPATH = "$' + '{TOPDIR}"\n')
- f.write('SDKBASEMETAPATH = "$' + '{TOPDIR}"\n')
- f.write('BBLAYERS := " \\\n')
- for layerrelpath in sdkbblayers:
- f.write(' $' + '{SDKBASEMETAPATH}/layers/%s \\\n' % layerrelpath)
- f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
- f.write(' "\n')
-
- # Copy uninative tarball
- # For now this is where uninative.bbclass expects the tarball
- if bb.data.inherits_class('uninative', d):
- uninative_file = d.expand('${UNINATIVE_DLDIR}/' + d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH")) + '/${UNINATIVE_TARBALL}')
- uninative_checksum = bb.utils.sha256_file(uninative_file)
- uninative_outdir = '%s/downloads/uninative/%s' % (baseoutpath, uninative_checksum)
- bb.utils.mkdirhier(uninative_outdir)
- shutil.copy(uninative_file, uninative_outdir)
-
- env_passthrough = (d.getVar('BB_ENV_PASSTHROUGH_ADDITIONS') or '').split()
- env_passthrough_values = {}
-
- # Create local.conf
- builddir = d.getVar('TOPDIR')
- if derivative and os.path.exists(builddir + '/conf/site.conf'):
- shutil.copyfile(builddir + '/conf/site.conf', baseoutpath + '/conf/site.conf')
- if derivative and os.path.exists(builddir + '/conf/auto.conf'):
- shutil.copyfile(builddir + '/conf/auto.conf', baseoutpath + '/conf/auto.conf')
- if derivative:
- shutil.copyfile(builddir + '/conf/local.conf', baseoutpath + '/conf/local.conf')
- else:
- local_conf_allowed = (d.getVar('ESDK_LOCALCONF_ALLOW') or '').split()
- local_conf_remove = (d.getVar('ESDK_LOCALCONF_REMOVE') or '').split()
- def handle_var(varname, origvalue, op, newlines):
- if varname in local_conf_remove or (origvalue.strip().startswith('/') and not varname in local_conf_allowed):
- newlines.append('# Removed original setting of %s\n' % varname)
- return None, op, 0, True
- else:
- if varname in env_passthrough:
- env_passthrough_values[varname] = origvalue
- return origvalue, op, 0, True
- varlist = ['[^#=+ ]*']
- oldlines = []
- if os.path.exists(builddir + '/conf/site.conf'):
- with open(builddir + '/conf/site.conf', 'r') as f:
- oldlines += f.readlines()
- if os.path.exists(builddir + '/conf/auto.conf'):
- with open(builddir + '/conf/auto.conf', 'r') as f:
- oldlines += f.readlines()
- if os.path.exists(builddir + '/conf/local.conf'):
- with open(builddir + '/conf/local.conf', 'r') as f:
- oldlines += f.readlines()
- (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var)
-
- with open(baseoutpath + '/conf/local.conf', 'w') as f:
- f.write('# WARNING: this configuration has been automatically generated and in\n')
- f.write('# most cases should not be edited. If you need more flexibility than\n')
- f.write('# this configuration provides, it is strongly suggested that you set\n')
- f.write('# up a proper instance of the full build system and use that instead.\n\n')
- for line in newlines:
- if line.strip() and not line.startswith('#'):
- f.write(line)
- # Write a newline just in case there's none at the end of the original
- f.write('\n')
-
- f.write('TMPDIR = "${TOPDIR}/tmp"\n')
- f.write('TCLIBCAPPEND = ""\n')
- f.write('DL_DIR = "${TOPDIR}/downloads"\n')
-
- if bb.data.inherits_class('uninative', d):
- f.write('INHERIT += "%s"\n' % 'uninative')
- f.write('UNINATIVE_CHECKSUM[%s] = "%s"\n\n' % (d.getVar('BUILD_ARCH'), uninative_checksum))
- f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False))
-
- # Some classes are not suitable for SDK, remove them from INHERIT
- f.write('INHERIT:remove = "%s"\n' % d.getVar('ESDK_CLASS_INHERIT_DISABLE', False))
-
- # Bypass the default connectivity check if any
- f.write('CONNECTIVITY_CHECK_URIS = ""\n\n')
-
- # This warning will come out if reverse dependencies for a task
- # don't have sstate as well as the task itself. We already know
- # this will be the case for the extensible sdk, so turn off the
- # warning.
- f.write('SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK = "none"\n\n')
-
- # Warn if the sigs in the locked-signature file don't match
- # the sig computed from the metadata.
- f.write('SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n\n')
-
- # We want to be able to set this without a full reparse
- f.write('BB_HASHCONFIG_IGNORE_VARS:append = " SIGGEN_UNLOCKED_RECIPES"\n\n')
-
- # Set up which tasks are ignored for run on install
- f.write('BB_SETSCENE_ENFORCE_IGNORE_TASKS = "%:* *:do_shared_workdir *:do_rm_work wic-tools:* *:do_addto_recipe_sysroot"\n\n')
-
- # Hide the config information from bitbake output (since it's fixed within the SDK)
- f.write('BUILDCFG_HEADER = ""\n\n')
-
- # Write METADATA_REVISION
- f.write('METADATA_REVISION = "%s"\n\n' % d.getVar('METADATA_REVISION'))
-
- f.write('# Provide a flag to indicate we are in the EXT_SDK Context\n')
- f.write('WITHIN_EXT_SDK = "1"\n\n')
-
- # Map gcc-dependent uninative sstate cache for installer usage
- f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n')
-
- if d.getVar("PRSERV_HOST"):
- # Override this, we now include PR data, so it should only point ot the local database
- f.write('PRSERV_HOST = "localhost:0"\n\n')
-
- # Allow additional config through sdk-extra.conf
- fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d)
- if fn:
- with open(fn, 'r') as xf:
- for line in xf:
- f.write(line)
-
- # If you define a sdk_extraconf() function then it can contain additional config
- # (Though this is awkward; sdk-extra.conf should probably be used instead)
- extraconf = (d.getVar('sdk_extraconf') or '').strip()
- if extraconf:
- # Strip off any leading / trailing spaces
- for line in extraconf.splitlines():
- f.write(line.strip() + '\n')
-
- f.write('require conf/locked-sigs.inc\n')
- f.write('require conf/unlocked-sigs.inc\n')
-
- # Copy multiple configurations if they exist in the users config directory
- if d.getVar('BBMULTICONFIG') is not None:
- bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf', 'multiconfig'))
- for mc in d.getVar('BBMULTICONFIG').split():
- dest_stub = "/conf/multiconfig/%s.conf" % (mc,)
- if os.path.exists(builddir + dest_stub):
- shutil.copyfile(builddir + dest_stub, baseoutpath + dest_stub)
-
- cachedir = os.path.join(baseoutpath, 'cache')
- bb.utils.mkdirhier(cachedir)
- bb.parse.siggen.copy_unitaskhashes(cachedir)
-
- # If PR Service is in use, we need to export this as well
- bb.note('Do we have a pr database?')
- if d.getVar("PRSERV_HOST"):
- bb.note('Writing PR database...')
- # Based on the code in classes/prexport.bbclass
- import oe.prservice
- #dump meta info of tables
- localdata = d.createCopy()
- localdata.setVar('PRSERV_DUMPOPT_COL', "1")
- localdata.setVar('PRSERV_DUMPDIR', os.path.join(baseoutpath, 'conf'))
- localdata.setVar('PRSERV_DUMPFILE', '${PRSERV_DUMPDIR}/prserv.inc')
-
- bb.note('PR Database write to %s' % (localdata.getVar('PRSERV_DUMPFILE')))
-
- retval = oe.prservice.prserv_dump_db(localdata)
- if not retval:
- bb.error("prexport_handler: export failed!")
- return
- (metainfo, datainfo) = retval
- oe.prservice.prserv_export_tofile(localdata, metainfo, datainfo, True)
-
- # Use templateconf.cfg file from builddir if exists
- if os.path.exists(builddir + '/conf/templateconf.cfg') and use_custom_templateconf == '1':
- shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg')
- else:
- # Write a templateconf.cfg
- with open(baseoutpath + '/conf/templateconf.cfg', 'w') as f:
- f.write('meta/conf\n')
-
- # Ensure any variables set from the external environment (by way of
- # BB_ENV_PASSTHROUGH_ADDITIONS) are set in the SDK's configuration
- extralines = []
- for name, value in env_passthrough_values.items():
- actualvalue = d.getVar(name) or ''
- if value != actualvalue:
- extralines.append('%s = "%s"\n' % (name, actualvalue))
- if extralines:
- with open(baseoutpath + '/conf/local.conf', 'a') as f:
- f.write('\n')
- f.write('# Extra settings from environment:\n')
- for line in extralines:
- f.write(line)
- f.write('\n')
-
- # Filter the locked signatures file to just the sstate tasks we are interested in
- excluded_targets = get_sdk_install_targets(d, images_only=True)
- sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
- lockedsigs_pruned = baseoutpath + '/conf/locked-sigs.inc'
- #nativesdk-only sigfile to merge into locked-sigs.inc
- sdk_include_nativesdk = (d.getVar("SDK_INCLUDE_NATIVESDK") == '1')
- nativesigfile = d.getVar('WORKDIR') + '/locked-sigs_nativesdk.inc'
- nativesigfile_pruned = d.getVar('WORKDIR') + '/locked-sigs_nativesdk_pruned.inc'
-
- if sdk_include_nativesdk:
- oe.copy_buildsystem.prune_lockedsigs([],
- excluded_targets.split(),
- nativesigfile,
- True,
- nativesigfile_pruned)
-
- oe.copy_buildsystem.merge_lockedsigs([],
- sigfile,
- nativesigfile_pruned,
- sigfile)
-
- oe.copy_buildsystem.prune_lockedsigs([],
- excluded_targets.split(),
- sigfile,
- False,
- lockedsigs_pruned)
-
- sstate_out = baseoutpath + '/sstate-cache'
- bb.utils.remove(sstate_out, True)
-
- # uninative.bbclass sets NATIVELSBSTRING to 'universal%s' % oe.utils.host_gcc_version(d)
- fixedlsbstring = "universal%s" % oe.utils.host_gcc_version(d)
-
- sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1')
- sdk_ext_type = d.getVar('SDK_EXT_TYPE')
- if (sdk_ext_type != 'minimal' or sdk_include_toolchain or derivative) and not sdk_include_nativesdk:
- # Create the filtered task list used to generate the sstate cache shipped with the SDK
- tasklistfn = d.getVar('WORKDIR') + '/tasklist.txt'
- create_filtered_tasklist(d, baseoutpath, tasklistfn, conf_initpath)
- else:
- tasklistfn = None
-
-
- cachedir = os.path.join(baseoutpath, 'cache')
- bb.utils.mkdirhier(cachedir)
- bb.parse.siggen.copy_unitaskhashes(cachedir)
-
- # Add packagedata if enabled
- if d.getVar('SDK_INCLUDE_PKGDATA') == '1':
- lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base.inc'
- lockedsigs_copy = d.getVar('WORKDIR') + '/locked-sigs-copy.inc'
- shutil.move(lockedsigs_pruned, lockedsigs_base)
- oe.copy_buildsystem.merge_lockedsigs(['do_packagedata'],
- lockedsigs_base,
- d.getVar('STAGING_DIR_HOST') + '/world-pkgdata/locked-sigs-pkgdata.inc',
- lockedsigs_pruned,
- lockedsigs_copy)
-
- if sdk_include_toolchain:
- lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base2.inc'
- lockedsigs_toolchain = d.expand("${STAGING_DIR}/${TUNE_PKGARCH}/meta-extsdk-toolchain/locked-sigs/locked-sigs-extsdk-toolchain.inc")
- shutil.move(lockedsigs_pruned, lockedsigs_base)
- oe.copy_buildsystem.merge_lockedsigs([],
- lockedsigs_base,
- lockedsigs_toolchain,
- lockedsigs_pruned)
- oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain,
- d.getVar('SSTATE_DIR'),
- sstate_out, d,
- fixedlsbstring,
- filterfile=tasklistfn)
-
- if sdk_ext_type == 'minimal':
- if derivative:
- # Assume the user is not going to set up an additional sstate
- # mirror, thus we need to copy the additional artifacts (from
- # workspace recipes) into the derivative SDK
- lockedsigs_orig = d.getVar('TOPDIR') + '/conf/locked-sigs.inc'
- if os.path.exists(lockedsigs_orig):
- lockedsigs_extra = d.getVar('WORKDIR') + '/locked-sigs-extra.inc'
- oe.copy_buildsystem.merge_lockedsigs(None,
- lockedsigs_orig,
- lockedsigs_pruned,
- None,
- lockedsigs_extra)
- oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra,
- d.getVar('SSTATE_DIR'),
- sstate_out, d,
- fixedlsbstring,
- filterfile=tasklistfn)
- else:
- oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
- d.getVar('SSTATE_DIR'),
- sstate_out, d,
- fixedlsbstring,
- filterfile=tasklistfn)
-
- # We don't need sstate do_package files
- for root, dirs, files in os.walk(sstate_out):
- for name in files:
- if name.endswith("_package.tar.zst"):
- f = os.path.join(root, name)
- os.remove(f)
-
- # Write manifest file
- # Note: at the moment we cannot include the env setup script here to keep
- # it updated, since it gets modified during SDK installation (see
- # sdk_ext_postinst() below) thus the checksum we take here would always
- # be different.
- manifest_file_list = ['conf/*']
- if d.getVar('BBMULTICONFIG') is not None:
- manifest_file_list.append('conf/multiconfig/*')
-
- esdk_manifest_excludes = (d.getVar('ESDK_MANIFEST_EXCLUDES') or '').split()
- esdk_manifest_excludes_list = []
- for exclude_item in esdk_manifest_excludes:
- esdk_manifest_excludes_list += glob.glob(os.path.join(baseoutpath, exclude_item))
- manifest_file = os.path.join(baseoutpath, 'conf', 'sdk-conf-manifest')
- with open(manifest_file, 'w') as f:
- for item in manifest_file_list:
- for fn in glob.glob(os.path.join(baseoutpath, item)):
- if fn == manifest_file or os.path.isdir(fn):
- continue
- if fn in esdk_manifest_excludes_list:
- continue
- chksum = bb.utils.sha256_file(fn)
- f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath)))
-}
-
-def get_current_buildtools(d):
- """Get the file name of the current buildtools installer"""
- import glob
- btfiles = glob.glob(os.path.join(d.getVar('SDK_DEPLOY'), '*-buildtools-nativesdk-standalone-*.sh'))
- btfiles.sort(key=os.path.getctime)
- return os.path.basename(btfiles[-1])
-
-def get_sdk_required_utilities(buildtools_fn, d):
- """Find required utilities that aren't provided by the buildtools"""
- sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES') or '').split()
- sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc'))
- sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++'))
- if buildtools_fn:
- buildtools_installer = os.path.join(d.getVar('SDK_DEPLOY'), buildtools_fn)
- filelist, _ = bb.process.run('%s -l' % buildtools_installer)
- else:
- buildtools_installer = None
- filelist = ""
- localdata = bb.data.createCopy(d)
- localdata.setVar('SDKPATH', '.')
- sdkpathnative = localdata.getVar('SDKPATHNATIVE')
- sdkbindirs = [localdata.getVar('bindir_nativesdk'),
- localdata.getVar('sbindir_nativesdk'),
- localdata.getVar('base_bindir_nativesdk'),
- localdata.getVar('base_sbindir_nativesdk')]
- for line in filelist.splitlines():
- splitline = line.split()
- if len(splitline) > 5:
- fn = splitline[5]
- if not fn.startswith('./'):
- fn = './%s' % fn
- if fn.startswith(sdkpathnative):
- relpth = '/' + os.path.relpath(fn, sdkpathnative)
- for bindir in sdkbindirs:
- if relpth.startswith(bindir):
- relpth = os.path.relpath(relpth, bindir)
- if relpth in sanity_required_utilities:
- sanity_required_utilities.remove(relpth)
- break
- return ' '.join(sanity_required_utilities)
-
-install_tools() {
- install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}
- scripts="devtool recipetool oe-find-native-sysroot runqemu* wic"
- for script in $scripts; do
- for scriptfn in `find ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath} -maxdepth 1 -executable -name "$script"`; do
- targetscriptfn="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/$(basename $scriptfn)"
- test -e ${targetscriptfn} || ln -rs ${scriptfn} ${targetscriptfn}
- done
- done
- # We can't use the same method as above because files in the sysroot won't exist at this point
- # (they get populated from sstate on installation)
- unfsd_path="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/unfsd"
- if [ "${SDK_INCLUDE_TOOLCHAIN}" = "1" -a ! -e $unfsd_path ] ; then
- binrelpath=${@os.path.relpath(d.getVar('STAGING_BINDIR_NATIVE'), d.getVar('TMPDIR'))}
- ln -rs ${SDK_OUTPUT}/${SDKPATH}/tmp/$binrelpath/unfsd $unfsd_path
- fi
- touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase
-
- # find latest buildtools-tarball and install it
- if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then
- install ${SDK_DEPLOY}/${SDK_BUILDTOOLS_INSTALLER} ${SDK_OUTPUT}/${SDKPATH}
- fi
-
- install -m 0644 ${COREBASE}/meta/files/ext-sdk-prepare.py ${SDK_OUTPUT}/${SDKPATH}
-}
-do_populate_sdk_ext[file-checksums] += "${COREBASE}/meta/files/ext-sdk-prepare.py:True"
-
-sdk_ext_preinst() {
- # Since bitbake won't run as root it doesn't make sense to try and install
- # the extensible sdk as root.
- if [ "`id -u`" = "0" ]; then
- echo "ERROR: The extensible sdk cannot be installed as root."
- exit 1
- fi
- if ! command -v locale > /dev/null; then
- echo "ERROR: The installer requires the locale command, please install it first"
- exit 1
- fi
- # Check setting of LC_ALL set above
- canonicalised_locale=`echo $LC_ALL | sed 's/UTF-8/utf8/'`
- if ! locale -a | grep -q $canonicalised_locale ; then
- echo "ERROR: the installer requires the $LC_ALL locale to be installed (but not selected), please install it first"
- exit 1
- fi
- # The relocation script used by buildtools installer requires python
- if ! command -v python3 > /dev/null; then
- echo "ERROR: The installer requires python3, please install it first"
- exit 1
- fi
- missing_utils=""
- for util in ${SDK_REQUIRED_UTILITIES}; do
- if ! command -v $util > /dev/null; then
- missing_utils="$missing_utils $util"
- fi
- done
- if [ -n "$missing_utils" ] ; then
- echo "ERROR: the SDK requires the following missing utilities, please install them: $missing_utils"
- exit 1
- fi
- SDK_EXTENSIBLE="1"
- if [ "$publish" = "1" ] && [ "${SDK_EXT_TYPE}" = "minimal" ] ; then
- EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=sstate-cache"
- fi
-}
-SDK_PRE_INSTALL_COMMAND:task-populate-sdk-ext = "${sdk_ext_preinst}"
-
-# FIXME this preparation should be done as part of the SDK construction
-sdk_ext_postinst() {
- printf "\nExtracting buildtools...\n"
- cd $target_sdk_dir
- env_setup_script="$target_sdk_dir/environment-setup-${REAL_MULTIMACH_TARGET_SYS}"
- if [ -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then
- printf "buildtools\ny" | ./${SDK_BUILDTOOLS_INSTALLER} > buildtools.log || { printf 'ERROR: buildtools installation failed:\n' ; cat buildtools.log ; echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; }
-
- # Delete the buildtools tar file since it won't be used again
- rm -f ./${SDK_BUILDTOOLS_INSTALLER}
- # We don't need the log either since it succeeded
- rm -f buildtools.log
-
- # Make sure when the user sets up the environment, they also get
- # the buildtools-tarball tools in their path.
- echo "# Save and reset OECORE_NATIVE_SYSROOT as buildtools may change it" >> $env_setup_script
- echo "SAVED=\"\$OECORE_NATIVE_SYSROOT\"" >> $env_setup_script
- echo ". $target_sdk_dir/buildtools/environment-setup*" >> $env_setup_script
- echo "OECORE_NATIVE_SYSROOT=\"\$SAVED\"" >> $env_setup_script
- fi
-
- # Allow bitbake environment setup to be ran as part of this sdk.
- echo "export OE_SKIP_SDK_CHECK=1" >> $env_setup_script
- # Work around runqemu not knowing how to get this information within the eSDK
- echo "export DEPLOY_DIR_IMAGE=$target_sdk_dir/tmp/${@os.path.relpath(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('TMPDIR'))}" >> $env_setup_script
-
- # A bit of another hack, but we need this in the path only for devtool
- # so put it at the end of $PATH.
- echo "export PATH=$target_sdk_dir/sysroots/${SDK_SYS}${bindir_nativesdk}:\$PATH" >> $env_setup_script
-
- echo "printf 'SDK environment now set up; additionally you may now run devtool to perform development tasks.\nRun devtool --help for further details.\n'" >> $env_setup_script
-
- # Warn if trying to use external bitbake and the ext SDK together
- echo "(which bitbake > /dev/null 2>&1 && echo 'WARNING: attempting to use the extensible SDK in an environment set up to run bitbake - this may lead to unexpected results. Please source this script in a new shell session instead.') || true" >> $env_setup_script
-
- if [ "$prepare_buildsystem" != "no" -a -n "${SDK_BUILDTOOLS_INSTALLER}" ]; then
- printf "Preparing build system...\n"
- # dash which is /bin/sh on Ubuntu will not preserve the
- # current working directory when first ran, nor will it set $1 when
- # sourcing a script. That is why this has to look so ugly.
- LOGFILE="$target_sdk_dir/preparing_build_system.log"
- sh -c ". buildtools/environment-setup* > $LOGFILE && cd $target_sdk_dir/`dirname ${oe_init_build_env_path}` && set $target_sdk_dir && . $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE && python3 $target_sdk_dir/ext-sdk-prepare.py $LOGFILE '${SDK_INSTALL_TARGETS}'" || { echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; }
- fi
- if [ -e $target_sdk_dir/ext-sdk-prepare.py ]; then
- rm $target_sdk_dir/ext-sdk-prepare.py
- fi
- echo done
-}
-
-SDK_POST_INSTALL_COMMAND:task-populate-sdk-ext = "${sdk_ext_postinst}"
-
-SDK_POSTPROCESS_COMMAND:prepend:task-populate-sdk-ext = "copy_buildsystem; install_tools; "
-
-SDK_INSTALL_TARGETS = ""
-fakeroot python do_populate_sdk_ext() {
- # FIXME hopefully we can remove this restriction at some point, but uninative
- # currently forces this upon us
- if d.getVar('SDK_ARCH') != d.getVar('BUILD_ARCH'):
- bb.fatal('The extensible SDK can currently only be built for the same architecture as the machine being built on - SDK_ARCH is set to %s (likely via setting SDKMACHINE) which is different from the architecture of the build machine (%s). Unable to continue.' % (d.getVar('SDK_ARCH'), d.getVar('BUILD_ARCH')))
-
- # FIXME hopefully we can remove this restriction at some point, but the eSDK
- # can only be built for the primary (default) multiconfig
- if d.getVar('BB_CURRENT_MC') != 'default':
- bb.fatal('The extensible SDK can currently only be built for the default multiconfig. Currently trying to build for %s.' % d.getVar('BB_CURRENT_MC'))
-
- # eSDK dependencies don't use the traditional variables and things don't work properly if they are set
- d.setVar("TOOLCHAIN_HOST_TASK", "${TOOLCHAIN_HOST_TASK_ESDK}")
- d.setVar("TOOLCHAIN_TARGET_TASK", "")
-
- d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d))
- if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1':
- buildtools_fn = get_current_buildtools(d)
- else:
- buildtools_fn = None
- d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d))
- d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn)
- d.setVar('SDKDEPLOYDIR', '${SDKEXTDEPLOYDIR}')
- # ESDKs have a libc from the buildtools so ensure we don't ship linguas twice
- d.delVar('SDKIMAGE_LINGUAS')
- if d.getVar("SDK_INCLUDE_NATIVESDK") == '1':
- generate_nativesdk_lockedsigs(d)
- populate_sdk_common(d)
-}
-
-def generate_nativesdk_lockedsigs(d):
- import oe.copy_buildsystem
- sigfile = d.getVar('WORKDIR') + '/locked-sigs_nativesdk.inc'
- oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
-
-def get_ext_sdk_depends(d):
- # Note: the deps varflag is a list not a string, so we need to specify expand=False
- deps = d.getVarFlag('do_image_complete', 'deps', False)
- pn = d.getVar('PN')
- deplist = ['%s:%s' % (pn, dep) for dep in deps]
- tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d)
- tasklist.append('do_rootfs')
- for task in tasklist:
- deplist.extend((d.getVarFlag(task, 'depends') or '').split())
- return ' '.join(deplist)
-
-python do_sdk_depends() {
- # We have to do this separately in its own task so we avoid recursing into
- # dependencies we don't need to (e.g. buildtools-tarball) and bringing those
- # into the SDK's sstate-cache
- import oe.copy_buildsystem
- sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
- oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
-}
-addtask sdk_depends
-
-do_sdk_depends[dirs] = "${WORKDIR}"
-do_sdk_depends[depends] = "${@get_ext_sdk_depends(d)} meta-extsdk-toolchain:do_populate_sysroot"
-do_sdk_depends[recrdeptask] = "${@d.getVarFlag('do_populate_sdk', 'recrdeptask', False)}"
-do_sdk_depends[recrdeptask] += "do_populate_lic do_package_qa do_populate_sysroot do_deploy ${SDK_RECRDEP_TASKS}"
-do_sdk_depends[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('TOOLCHAIN_HOST_TASK_ESDK').split()])}"
-
-do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}"
-
-do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \
- ${@'buildtools-tarball:do_populate_sdk' if d.getVar('SDK_INCLUDE_BUILDTOOLS') == '1' else ''} \
- ${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA') == '1' else ''} \
- ${@'meta-extsdk-toolchain:do_locked_sigs' if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1' else ''}"
-
-# We must avoid depending on do_build here if rm_work.bbclass is active,
-# because otherwise do_rm_work may run before do_populate_sdk_ext itself.
-# We can't mark do_populate_sdk_ext and do_sdk_depends as having to
-# run before do_rm_work, because then they would also run as part
-# of normal builds.
-do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':' + (d.getVar('RM_WORK_BUILD_WITHOUT') or 'do_build') for x in d.getVar('SDK_TARGETS').split()])}"
-
-# Make sure code changes can result in rebuild
-do_populate_sdk_ext[vardeps] += "copy_buildsystem \
- sdk_ext_postinst"
-
-# Since any change in the metadata of any layer should cause a rebuild of the
-# sdk(since the layers are put in the sdk) set the task to nostamp so it
-# always runs.
-do_populate_sdk_ext[nostamp] = "1"
-
-SDKEXTDEPLOYDIR = "${WORKDIR}/deploy-${PN}-populate-sdk-ext"
-
-SSTATETASKS += "do_populate_sdk_ext"
-SSTATE_SKIP_CREATION:task-populate-sdk-ext = '1'
-do_populate_sdk_ext[cleandirs] = "${SDKEXTDEPLOYDIR}"
-do_populate_sdk_ext[sstate-inputdirs] = "${SDKEXTDEPLOYDIR}"
-do_populate_sdk_ext[sstate-outputdirs] = "${SDK_DEPLOY}"
-do_populate_sdk_ext[stamp-extra-info] = "${MACHINE_ARCH}"
-
-addtask populate_sdk_ext after do_sdk_depends
diff --git a/poky/meta/classes/prexport.bbclass b/poky/meta/classes/prexport.bbclass
index 6dcf99e..e5098e3 100644
--- a/poky/meta/classes/prexport.bbclass
+++ b/poky/meta/classes/prexport.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
PRSERV_DUMPOPT_VERSION = "${PRAUTOINX}"
PRSERV_DUMPOPT_PKGARCH = ""
PRSERV_DUMPOPT_CHECKSUM = ""
diff --git a/poky/meta/classes/primport.bbclass b/poky/meta/classes/primport.bbclass
index 8ed45f0..0092417 100644
--- a/poky/meta/classes/primport.bbclass
+++ b/poky/meta/classes/primport.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
python primport_handler () {
import bb.event
if not e.data:
diff --git a/poky/meta/classes/ptest-gnome.bbclass b/poky/meta/classes/ptest-gnome.bbclass
deleted file mode 100644
index 18bd3db..0000000
--- a/poky/meta/classes/ptest-gnome.bbclass
+++ /dev/null
@@ -1,8 +0,0 @@
-inherit ptest
-
-EXTRA_OECONF:append = " ${@bb.utils.contains('PTEST_ENABLED', '1', '--enable-installed-tests', '--disable-installed-tests', d)}"
-
-FILES:${PN}-ptest += "${libexecdir}/installed-tests/ \
- ${datadir}/installed-tests/"
-
-RDEPENDS:${PN}-ptest += "gnome-desktop-testing"
diff --git a/poky/meta/classes/ptest-perl.bbclass b/poky/meta/classes/ptest-perl.bbclass
deleted file mode 100644
index 5dd72c9..0000000
--- a/poky/meta/classes/ptest-perl.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-inherit ptest
-
-FILESEXTRAPATHS:prepend := "${COREBASE}/meta/files:"
-
-SRC_URI += "file://ptest-perl/run-ptest"
-
-do_install_ptest_perl() {
- install -d ${D}${PTEST_PATH}
- if [ ! -f ${D}${PTEST_PATH}/run-ptest ]; then
- install -m 0755 ${WORKDIR}/ptest-perl/run-ptest ${D}${PTEST_PATH}
- fi
- cp -r ${B}/t ${D}${PTEST_PATH}
- chown -R root:root ${D}${PTEST_PATH}
-}
-
-FILES:${PN}-ptest:prepend = "${PTEST_PATH}/t/* ${PTEST_PATH}/run-ptest "
-
-RDEPENDS:${PN}-ptest:prepend = "perl "
-
-addtask install_ptest_perl after do_install_ptest_base before do_package
-
-python () {
- if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
- d.setVarFlag('do_install_ptest_perl', 'fakeroot', '1')
-
- # Remove all '*ptest_perl' tasks when ptest is not enabled
- if not(d.getVar('PTEST_ENABLED') == "1"):
- for i in ['do_install_ptest_perl']:
- bb.build.deltask(i, d)
-}
diff --git a/poky/meta/classes/ptest.bbclass b/poky/meta/classes/ptest.bbclass
deleted file mode 100644
index c162f5d..0000000
--- a/poky/meta/classes/ptest.bbclass
+++ /dev/null
@@ -1,136 +0,0 @@
-SUMMARY:${PN}-ptest ?= "${SUMMARY} - Package test files"
-DESCRIPTION:${PN}-ptest ?= "${DESCRIPTION} \
-This package contains a test directory ${PTEST_PATH} for package test purposes."
-
-PTEST_PATH ?= "${libdir}/${BPN}/ptest"
-PTEST_BUILD_HOST_FILES ?= "Makefile"
-PTEST_BUILD_HOST_PATTERN ?= ""
-PTEST_PARALLEL_MAKE ?= "${PARALLEL_MAKE}"
-PTEST_PARALLEL_MAKEINST ?= "${PARALLEL_MAKEINST}"
-EXTRA_OEMAKE:prepend:task-compile-ptest-base = "${PTEST_PARALLEL_MAKE} "
-EXTRA_OEMAKE:prepend:task-install-ptest-base = "${PTEST_PARALLEL_MAKEINST} "
-
-FILES:${PN}-ptest += "${PTEST_PATH}"
-SECTION:${PN}-ptest = "devel"
-ALLOW_EMPTY:${PN}-ptest = "1"
-PTEST_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}"
-PTEST_ENABLED:class-native = ""
-PTEST_ENABLED:class-nativesdk = ""
-PTEST_ENABLED:class-cross-canadian = ""
-RDEPENDS:${PN}-ptest += "${PN}"
-RDEPENDS:${PN}-ptest:class-native = ""
-RDEPENDS:${PN}-ptest:class-nativesdk = ""
-RRECOMMENDS:${PN}-ptest += "ptest-runner"
-
-PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}"
-
-require conf/distro/include/ptest-packagelists.inc
-
-do_configure_ptest() {
- :
-}
-
-do_configure_ptest_base() {
- do_configure_ptest
-}
-
-do_compile_ptest() {
- :
-}
-
-do_compile_ptest_base() {
- do_compile_ptest
-}
-
-do_install_ptest() {
- :
-}
-
-do_install_ptest_base() {
- if [ -f ${WORKDIR}/run-ptest ]; then
- install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
- fi
- if grep -q install-ptest: Makefile; then
- oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
- fi
- do_install_ptest
- chown -R root:root ${D}${PTEST_PATH}
-
- # Strip build host paths from any installed Makefile
- for filename in ${PTEST_BUILD_HOST_FILES}; do
- for installed_ptest_file in $(find ${D}${PTEST_PATH} -type f -name $filename); do
- bbnote "Stripping host paths from: $installed_ptest_file"
- sed -e 's#${HOSTTOOLS_DIR}/*##g' \
- -e 's#${WORKDIR}/*=#.=#g' \
- -e 's#${WORKDIR}/*##g' \
- -i $installed_ptest_file
- if [ -n "${PTEST_BUILD_HOST_PATTERN}" ]; then
- sed -E '/${PTEST_BUILD_HOST_PATTERN}/d' \
- -i $installed_ptest_file
- fi
- done
- done
-}
-
-PTEST_BINDIR_PKGD_PATH = "${PKGD}${PTEST_PATH}/bin"
-
-# This function needs to run after apply_update_alternative_renames because the
-# aforementioned function will update the ALTERNATIVE_LINK_NAME flag. Append is
-# used here to make this function to run as late as possible.
-PACKAGE_PREPROCESS_FUNCS:append = "${@bb.utils.contains('PTEST_BINDIR', '1', \
- bb.utils.contains('PTEST_ENABLED', '1', ' ptest_update_alternatives', '', d), '', d)}"
-
-python ptest_update_alternatives() {
- """
- This function will generate the symlinks in the PTEST_BINDIR_PKGD_PATH
- to match the renamed binaries by update-alternatives.
- """
-
- if not bb.data.inherits_class('update-alternatives', d) \
- or not update_alternatives_enabled(d):
- return
-
- bb.note("Generating symlinks for ptest")
- bin_paths = { d.getVar("bindir"), d.getVar("base_bindir"),
- d.getVar("sbindir"), d.getVar("base_sbindir") }
- ptest_bindir = d.getVar("PTEST_BINDIR_PKGD_PATH")
- os.mkdir(ptest_bindir)
- for pkg in (d.getVar('PACKAGES') or "").split():
- alternatives = update_alternatives_alt_targets(d, pkg)
- for alt_name, alt_link, alt_target, _ in alternatives:
- # Some alternatives are for man pages,
- # check if the alternative is in PATH
- if os.path.dirname(alt_link) in bin_paths:
- os.symlink(alt_target, os.path.join(ptest_bindir, alt_name))
-}
-
-do_configure_ptest_base[dirs] = "${B}"
-do_compile_ptest_base[dirs] = "${B}"
-do_install_ptest_base[dirs] = "${B}"
-do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}"
-
-addtask configure_ptest_base after do_configure before do_compile
-addtask compile_ptest_base after do_compile before do_install
-addtask install_ptest_base after do_install before do_package do_populate_sysroot
-
-python () {
- if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
- d.setVarFlag('do_install_ptest_base', 'fakeroot', '1')
- d.setVarFlag('do_install_ptest_base', 'umask', '022')
-
- # Remove all '*ptest_base' tasks when ptest is not enabled
- if not(d.getVar('PTEST_ENABLED') == "1"):
- for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
- bb.build.deltask(i, d)
-}
-
-QARECIPETEST[missing-ptest] = "package_qa_check_missing_ptest"
-def package_qa_check_missing_ptest(pn, d, messages):
- # This checks that ptest package is actually included
- # in standard oe-core ptest images - only for oe-core recipes
- if not 'meta/recipes' in d.getVar('FILE') or not(d.getVar('PTEST_ENABLED') == "1"):
- return
-
- enabled_ptests = " ".join([d.getVar('PTESTS_FAST'), d.getVar('PTESTS_SLOW'), d.getVar('PTESTS_PROBLEMS')]).split()
- if (pn + "-ptest").replace(d.getVar('MLPREFIX'), '') not in enabled_ptests:
- oe.qa.handle_error("missing-ptest", "supports ptests but is not included in oe-core's ptest-packagelists.inc", d)
diff --git a/poky/meta/classes/pypi.bbclass b/poky/meta/classes/pypi.bbclass
deleted file mode 100644
index 5fa7b8a..0000000
--- a/poky/meta/classes/pypi.bbclass
+++ /dev/null
@@ -1,28 +0,0 @@
-def pypi_package(d):
- bpn = d.getVar('BPN')
- if bpn.startswith('python-'):
- return bpn[7:]
- elif bpn.startswith('python3-'):
- return bpn[8:]
- return bpn
-
-PYPI_PACKAGE ?= "${@pypi_package(d)}"
-PYPI_PACKAGE_EXT ?= "tar.gz"
-PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
-
-def pypi_src_uri(d):
- package = d.getVar('PYPI_PACKAGE')
- archive_name = d.getVar('PYPI_ARCHIVE_NAME')
- return 'https://files.pythonhosted.org/packages/source/%s/%s/%s' % (package[0], package, archive_name)
-
-PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
-
-HOMEPAGE ?= "https://pypi.python.org/pypi/${PYPI_PACKAGE}/"
-SECTION = "devel/python"
-SRC_URI:prepend = "${PYPI_SRC_URI} "
-S = "${WORKDIR}/${PYPI_PACKAGE}-${PV}"
-
-UPSTREAM_CHECK_URI ?= "https://pypi.org/project/${PYPI_PACKAGE}/"
-UPSTREAM_CHECK_REGEX ?= "/${PYPI_PACKAGE}/(?P<pver>(\d+[\.\-_]*)+)/"
-
-CVE_PRODUCT ?= "python:${PYPI_PACKAGE}"
diff --git a/poky/meta/classes/python3-dir.bbclass b/poky/meta/classes/python3-dir.bbclass
deleted file mode 100644
index ff03e58..0000000
--- a/poky/meta/classes/python3-dir.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-PYTHON_BASEVERSION = "3.10"
-PYTHON_ABI = ""
-PYTHON_DIR = "python${PYTHON_BASEVERSION}"
-PYTHON_PN = "python3"
-PYTHON_SITEPACKAGES_DIR = "${libdir}/${PYTHON_DIR}/site-packages"
diff --git a/poky/meta/classes/python3native.bbclass b/poky/meta/classes/python3native.bbclass
deleted file mode 100644
index 3783c0c..0000000
--- a/poky/meta/classes/python3native.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-inherit python3-dir
-
-PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"
-EXTRANATIVEPATH += "python3-native"
-DEPENDS:append = " python3-native "
-
-# python-config and other scripts are using sysconfig modules
-# which we patch to access these variables
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-# Packages can use
-# find_package(PythonInterp REQUIRED)
-# find_package(PythonLibs REQUIRED)
-# which ends up using libs/includes from build host
-# Therefore pre-empt that effort
-export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
-export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
-
-# suppress host user's site-packages dirs.
-export PYTHONNOUSERSITE = "1"
-
-# autoconf macros will use their internal default preference otherwise
-export PYTHON
diff --git a/poky/meta/classes/python3targetconfig.bbclass b/poky/meta/classes/python3targetconfig.bbclass
deleted file mode 100644
index 2476858..0000000
--- a/poky/meta/classes/python3targetconfig.bbclass
+++ /dev/null
@@ -1,29 +0,0 @@
-inherit python3native
-
-EXTRA_PYTHON_DEPENDS ?= ""
-EXTRA_PYTHON_DEPENDS:class-target = "python3"
-DEPENDS:append = " ${EXTRA_PYTHON_DEPENDS}"
-
-do_configure:prepend:class-target() {
- export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_compile:prepend:class-target() {
- export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_install:prepend:class-target() {
- export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_configure:prepend:class-nativesdk() {
- export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_compile:prepend:class-nativesdk() {
- export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
-
-do_install:prepend:class-nativesdk() {
- export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-}
diff --git a/poky/meta/classes/python_flit_core.bbclass b/poky/meta/classes/python_flit_core.bbclass
deleted file mode 100644
index 7109307..0000000
--- a/poky/meta/classes/python_flit_core.bbclass
+++ /dev/null
@@ -1,8 +0,0 @@
-inherit python_pep517 python3native python3-dir setuptools3-base
-
-DEPENDS += "python3 python3-flit-core-native"
-
-python_flit_core_do_manual_build () {
- cd ${PEP517_SOURCE_PATH}
- nativepython3 -m flit_core.wheel --outdir ${PEP517_WHEEL_PATH} .
-}
diff --git a/poky/meta/classes/python_hatchling.bbclass b/poky/meta/classes/python_hatchling.bbclass
deleted file mode 100644
index 984eb6b..0000000
--- a/poky/meta/classes/python_hatchling.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit python_pep517 python3native python3-dir setuptools3-base
-
-DEPENDS += "python3-hatchling-native"
diff --git a/poky/meta/classes/python_pep517.bbclass b/poky/meta/classes/python_pep517.bbclass
deleted file mode 100644
index 7cdb9c8..0000000
--- a/poky/meta/classes/python_pep517.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-# Common infrastructure for Python packages that use PEP-517 compliant packaging.
-# https://www.python.org/dev/peps/pep-0517/
-#
-# This class will build a wheel in do_compile, and use pypa/installer to install
-# it in do_install.
-
-DEPENDS:append = " python3-picobuild-native python3-installer-native"
-
-# Where to execute the build process from
-PEP517_SOURCE_PATH ?= "${S}"
-
-# The directory where wheels will be written
-PEP517_WHEEL_PATH ?= "${WORKDIR}/dist"
-
-PEP517_PICOBUILD_OPTS ?= ""
-
-# The interpreter to use for installed scripts
-PEP517_INSTALL_PYTHON = "python3"
-PEP517_INSTALL_PYTHON:class-native = "nativepython3"
-
-# pypa/installer option to control the bytecode compilation
-INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
-
-# PEP517 doesn't have a specific configure step, so set an empty do_configure to avoid
-# running base_do_configure.
-python_pep517_do_configure () {
- :
-}
-
-# When we have Python 3.11 we can parse pyproject.toml to determine the build
-# API entry point directly
-python_pep517_do_compile () {
- nativepython3 -m picobuild --source ${PEP517_SOURCE_PATH} --dest ${PEP517_WHEEL_PATH} --wheel ${PEP517_PICOBUILD_OPTS}
-}
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-python_pep517_do_install () {
- COUNT=$(find ${PEP517_WHEEL_PATH} -name '*.whl' | wc -l)
- if test $COUNT -eq 0; then
- bbfatal No wheels found in ${PEP517_WHEEL_PATH}
- elif test $COUNT -gt 1; then
- bbfatal More than one wheel found in ${PEP517_WHEEL_PATH}, this should not happen
- fi
-
- nativepython3 -m installer ${INSTALL_WHEEL_COMPILE_BYTECODE} --interpreter "${USRBINPATH}/env ${PEP517_INSTALL_PYTHON}" --destdir=${D} ${PEP517_WHEEL_PATH}/*.whl
-}
-
-# A manual do_install that just uses unzip for bootstrapping purposes. Callers should DEPEND on unzip-native.
-python_pep517_do_bootstrap_install () {
- install -d ${D}${PYTHON_SITEPACKAGES_DIR}
- unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/python_poetry_core.bbclass b/poky/meta/classes/python_poetry_core.bbclass
deleted file mode 100644
index 0aaf66b..0000000
--- a/poky/meta/classes/python_poetry_core.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit python_pep517 python3native setuptools3-base
-
-DEPENDS += "python3-poetry-core-native"
diff --git a/poky/meta/classes/python_pyo3.bbclass b/poky/meta/classes/python_pyo3.bbclass
deleted file mode 100644
index 10cc3a0..0000000
--- a/poky/meta/classes/python_pyo3.bbclass
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# This class helps make sure that Python extensions built with PyO3
-# and setuptools_rust properly set up the environment for cross compilation
-#
-
-inherit cargo python3-dir siteinfo
-
-export PYO3_CROSS="1"
-export PYO3_CROSS_PYTHON_VERSION="${PYTHON_BASEVERSION}"
-export PYO3_CROSS_LIB_DIR="${STAGING_LIBDIR}"
-export CARGO_BUILD_TARGET="${HOST_SYS}"
-export RUSTFLAGS
-export PYO3_PYTHON="${PYTHON}"
-export PYO3_CONFIG_FILE="${WORKDIR}/pyo3.config"
-
-python_pyo3_do_configure () {
- cat > ${WORKDIR}/pyo3.config << EOF
-implementation=CPython
-version=${PYTHON_BASEVERSION}
-shared=true
-abi3=false
-lib_name=${PYTHON_DIR}
-lib_dir=${STAGING_LIBDIR}
-pointer_width=${SITEINFO_BITS}
-build_flags=WITH_THREAD
-suppress_build_script_link_lines=false
-EOF
-}
-
-EXPORT_FUNCTIONS do_configure
diff --git a/poky/meta/classes/python_setuptools3_rust.bbclass b/poky/meta/classes/python_setuptools3_rust.bbclass
deleted file mode 100644
index f12e5d0..0000000
--- a/poky/meta/classes/python_setuptools3_rust.bbclass
+++ /dev/null
@@ -1,11 +0,0 @@
-inherit python_pyo3 setuptools3
-
-DEPENDS += "python3-setuptools-rust-native"
-
-python_setuptools3_rust_do_configure() {
- python_pyo3_do_configure
- cargo_common_do_configure
- setuptools3_do_configure
-}
-
-EXPORT_FUNCTIONS do_configure
diff --git a/poky/meta/classes/python_setuptools_build_meta.bbclass b/poky/meta/classes/python_setuptools_build_meta.bbclass
deleted file mode 100644
index 974054f..0000000
--- a/poky/meta/classes/python_setuptools_build_meta.bbclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit setuptools3-base python_pep517
-
-DEPENDS += "python3-setuptools-native python3-wheel-native"
diff --git a/poky/meta/classes/qemu.bbclass b/poky/meta/classes/qemu.bbclass
deleted file mode 100644
index 7493ac3..0000000
--- a/poky/meta/classes/qemu.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# This class contains functions for recipes that need QEMU or test for its
-# existence.
-#
-
-def qemu_target_binary(data):
- package_arch = data.getVar("PACKAGE_ARCH")
- qemu_target_binary = (data.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "")
- if qemu_target_binary:
- return qemu_target_binary
-
- target_arch = data.getVar("TARGET_ARCH")
- if target_arch in ("i486", "i586", "i686"):
- target_arch = "i386"
- elif target_arch == "powerpc":
- target_arch = "ppc"
- elif target_arch == "powerpc64":
- target_arch = "ppc64"
- elif target_arch == "powerpc64le":
- target_arch = "ppc64le"
-
- return "qemu-" + target_arch
-
-def qemu_wrapper_cmdline(data, rootfs_path, library_paths):
- import string
-
- qemu_binary = qemu_target_binary(data)
- if qemu_binary == "qemu-allarch":
- qemu_binary = "qemuwrapper"
-
- qemu_options = data.getVar("QEMU_OPTIONS")
-
- return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\
- + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " "
-
-# Next function will return a string containing the command that is needed to
-# to run a certain binary through qemu. For example, in order to make a certain
-# postinstall scriptlet run at do_rootfs time and running the postinstall is
-# architecture dependent, we can run it through qemu. For example, in the
-# postinstall scriptlet, we could use the following:
-#
-# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments]
-#
-def qemu_run_binary(data, rootfs_path, binary):
- libdir = rootfs_path + data.getVar("libdir", False)
- base_libdir = rootfs_path + data.getVar("base_libdir", False)
-
- return qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir]) + rootfs_path + binary
-
-# QEMU_EXTRAOPTIONS is not meant to be directly used, the extensions are
-# PACKAGE_ARCH, *NOT* overrides.
-# In some cases (e.g. ppc) simply being arch specific (apparently) isn't good
-# enough and a PACKAGE_ARCH specific -cpu option is needed (hence we have to do
-# this dance). For others (e.g. arm) a -cpu option is not necessary, since the
-# qemu-arm default CPU supports all required architecture levels.
-
-QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH')) or ""}"
-QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS_${PACKAGE_ARCH}"
-
-QEMU_EXTRAOPTIONS_ppce500v2 = " -cpu e500v2"
-QEMU_EXTRAOPTIONS_ppce500mc = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppce5500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppc64e5500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppce6500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppc64e6500 = " -cpu e500mc"
-QEMU_EXTRAOPTIONS_ppc7400 = " -cpu 7400"
-QEMU_EXTRAOPTIONS_powerpc64le = " -cpu POWER9"
-# Some packages e.g. fwupd sets PACKAGE_ARCH = MACHINE_ARCH and uses meson which
-# needs right options to usermode qemu
-QEMU_EXTRAOPTIONS_qemuppc = " -cpu 7400"
-QEMU_EXTRAOPTIONS_qemuppc64 = " -cpu POWER9"
diff --git a/poky/meta/classes/qemuboot.bbclass b/poky/meta/classes/qemuboot.bbclass
deleted file mode 100644
index ad84899..0000000
--- a/poky/meta/classes/qemuboot.bbclass
+++ /dev/null
@@ -1,165 +0,0 @@
-# Help runqemu boot target board, "QB" means Qemu Boot, the following
-# vars can be set in conf files, such as <bsp.conf> to make it can be
-# boot by runqemu:
-#
-# QB_SYSTEM_NAME: qemu name, e.g., "qemu-system-i386"
-#
-# QB_OPT_APPEND: options to append to qemu, e.g., "-device usb-mouse"
-#
-# QB_DEFAULT_KERNEL: default kernel to boot, e.g., "bzImage"
-#
-# QB_DEFAULT_FSTYPE: default FSTYPE to boot, e.g., "ext4"
-#
-# QB_MEM: memory, e.g., "-m 512"
-#
-# QB_MACHINE: qemu machine, e.g., "-machine virt"
-#
-# QB_CPU: qemu cpu, e.g., "-cpu qemu32"
-#
-# QB_CPU_KVM: the similar to QB_CPU, but used when kvm, e.g., '-cpu kvm64',
-# set it when support kvm.
-#
-# QB_SMP: amount of CPU cores inside qemu guest, each mapped to a thread on the host,
-# e.g. "-smp 8".
-#
-# QB_KERNEL_CMDLINE_APPEND: options to append to kernel's -append
-# option, e.g., "console=ttyS0 console=tty"
-#
-# QB_DTB: qemu dtb name
-#
-# QB_AUDIO_DRV: qemu audio driver, e.g., "alsa", set it when support audio
-#
-# QB_AUDIO_OPT: qemu audio option, e.g., "-device AC97", used
-# when QB_AUDIO_DRV is set.
-#
-# QB_RNG: Pass-through for host random number generator, it can speedup boot
-# in system mode, where system is experiencing entropy starvation
-#
-# QB_KERNEL_ROOT: kernel's root, e.g., /dev/vda
-# By default "/dev/vda rw" gets passed to the kernel.
-# To mount the rootfs read-only QB_KERNEL_ROOT can be set to e.g. "/dev/vda ro".
-#
-# QB_NETWORK_DEVICE: network device, e.g., "-device virtio-net-pci,netdev=net0,mac=@MAC@",
-# it needs work with QB_TAP_OPT and QB_SLIRP_OPT.
-# Note, runqemu will replace @MAC@ with a predefined mac, you can set
-# a custom one, but that may cause conflicts when multiple qemus are
-# running on the same host.
-# Note: If more than one interface of type -device virtio-net-device gets added,
-# QB_NETWORK_DEVICE:prepend might be used, since Qemu enumerates the eth*
-# devices in reverse order to -device arguments.
-#
-# QB_TAP_OPT: network option for 'tap' mode, e.g.,
-# "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
-# Note, runqemu will replace "@TAP@" with the one which is used, such as tap0, tap1 ...
-#
-# QB_SLIRP_OPT: network option for SLIRP mode, e.g., -netdev user,id=net0"
-#
-# QB_CMDLINE_IP_SLIRP: If QB_NETWORK_DEVICE adds more than one network interface to qemu, usually the
-# ip= kernel comand line argument needs to be changed accordingly. Details are documented
-# in the kernel docuemntation https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
-# Example to configure only the first interface: "ip=eth0:dhcp"
-# QB_CMDLINE_IP_TAP: This parameter is similar to the QB_CMDLINE_IP_SLIRP parameter. Since the tap interface requires
-# static IP configuration @CLIENT@ and @GATEWAY@ place holders are replaced by the IP and the gateway
-# address of the qemu guest by runqemu.
-# Example: "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0::eth0"
-#
-# QB_ROOTFS_OPT: used as rootfs, e.g.,
-# "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
-# Note, runqemu will replace "@ROOTFS@" with the one which is used, such as core-image-minimal-qemuarm64.ext4.
-#
-# QB_SERIAL_OPT: serial port, e.g., "-serial mon:stdio"
-#
-# QB_TCPSERIAL_OPT: tcp serial port option, e.g.,
-# " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
-# Note, runqemu will replace "@PORT@" with the port number which is used.
-#
-# QB_ROOTFS_EXTRA_OPT: extra options to be appended to the rootfs device in case there is none specified by QB_ROOTFS_OPT.
-# Can be used to automatically determine the image from the other variables
-# but define things link 'bootindex' when booting from EFI or 'readonly' when using squashfs
-# without the need to specify a dedicated qemu configuration
-#
-# QB_GRAPHICS: QEMU video card type (e.g. "-vga std")
-#
-# Usage:
-# IMAGE_CLASSES += "qemuboot"
-# See "runqemu help" for more info
-
-QB_MEM ?= "-m 256"
-QB_SMP ?= ""
-QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
-QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}"
-QB_DEFAULT_FSTYPE ?= "ext4"
-QB_RNG ?= "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
-QB_OPT_APPEND ?= ""
-QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
-QB_CMDLINE_IP_SLIRP ?= "ip=dhcp"
-QB_CMDLINE_IP_TAP ?= "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0::eth0:off:8.8.8.8"
-QB_ROOTFS_EXTRA_OPT ?= ""
-QB_GRAPHICS ?= ""
-
-# This should be kept align with ROOT_VM
-QB_DRIVE_TYPE ?= "/dev/sd"
-
-inherit image-artifact-names
-
-# Create qemuboot.conf
-addtask do_write_qemuboot_conf after do_rootfs before do_image
-
-def qemuboot_vars(d):
- build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
- 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
- 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE',
- 'STAGING_DIR_HOST', 'SERIAL_CONSOLES', 'UNINATIVE_LOADER']
- return build_vars + [k for k in d.keys() if k.startswith('QB_')]
-
-do_write_qemuboot_conf[vardeps] += "${@' '.join(qemuboot_vars(d))}"
-do_write_qemuboot_conf[vardepsexclude] += "TOPDIR"
-python do_write_qemuboot_conf() {
- import configparser
-
- qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME'))
- if d.getVar('IMAGE_LINK_NAME'):
- qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
- else:
- qemuboot_link = ""
- finalpath = d.getVar("DEPLOY_DIR_IMAGE")
- topdir = d.getVar('TOPDIR')
- cf = configparser.ConfigParser()
- cf.add_section('config_bsp')
- for k in sorted(qemuboot_vars(d)):
- if ":" in k:
- continue
- # qemu-helper-native sysroot is not removed by rm_work and
- # contains all tools required by runqemu
- if k == 'STAGING_BINDIR_NATIVE':
- val = os.path.join(d.getVar('BASE_WORKDIR'), d.getVar('BUILD_SYS'),
- 'qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/')
- else:
- val = d.getVar(k)
- if val is None:
- continue
- # we only want to write out relative paths so that we can relocate images
- # and still run them
- if val.startswith(topdir):
- val = os.path.relpath(val, finalpath)
- cf.set('config_bsp', k, '%s' % val)
-
- # QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink
- # to the kernel file, which hinders relocatability of the qb conf.
- # Read the link and replace it with the full filename of the target.
- kernel_link = os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('QB_DEFAULT_KERNEL'))
- kernel = os.path.realpath(kernel_link)
- # we only want to write out relative paths so that we can relocate images
- # and still run them
- kernel = os.path.relpath(kernel, finalpath)
- cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
-
- bb.utils.mkdirhier(os.path.dirname(qemuboot))
- with open(qemuboot, 'w') as f:
- cf.write(f)
-
- if qemuboot_link and qemuboot_link != qemuboot:
- if os.path.lexists(qemuboot_link):
- os.remove(qemuboot_link)
- os.symlink(os.path.basename(qemuboot), qemuboot_link)
-}
diff --git a/poky/meta/classes/recipe_sanity.bbclass b/poky/meta/classes/recipe_sanity.bbclass
index 7fa4a84..1c2e24c 100644
--- a/poky/meta/classes/recipe_sanity.bbclass
+++ b/poky/meta/classes/recipe_sanity.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
def __note(msg, d):
bb.note("%s: recipe_sanity: %s" % (d.getVar("P"), msg))
diff --git a/poky/meta/classes/relative_symlinks.bbclass b/poky/meta/classes/relative_symlinks.bbclass
index 3157737..9ee20e0 100644
--- a/poky/meta/classes/relative_symlinks.bbclass
+++ b/poky/meta/classes/relative_symlinks.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
do_install[postfuncs] += "install_relative_symlinks"
python install_relative_symlinks () {
diff --git a/poky/meta/classes/relocatable.bbclass b/poky/meta/classes/relocatable.bbclass
index af04be5..d0a623f 100644
--- a/poky/meta/classes/relocatable.bbclass
+++ b/poky/meta/classes/relocatable.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
inherit chrpath
SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
diff --git a/poky/meta/classes/remove-libtool.bbclass b/poky/meta/classes/remove-libtool.bbclass
index 3fd0cd5..8e98738 100644
--- a/poky/meta/classes/remove-libtool.bbclass
+++ b/poky/meta/classes/remove-libtool.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# This class removes libtool .la files after do_install
REMOVE_LIBTOOL_LA ?= "1"
diff --git a/poky/meta/classes/report-error.bbclass b/poky/meta/classes/report-error.bbclass
index 6866d47..2f692fb 100644
--- a/poky/meta/classes/report-error.bbclass
+++ b/poky/meta/classes/report-error.bbclass
@@ -4,7 +4,8 @@
# Copyright (C) 2013 Intel Corporation
# Author: Andreea Brandusa Proca <andreea.b.proca@intel.com>
#
-# Licensed under the MIT license, see COPYING.MIT for details
+# SPDX-License-Identifier: MIT
+#
ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
diff --git a/poky/meta/classes/rm_work.bbclass b/poky/meta/classes/rm_work.bbclass
index 5f12d5a..c493eff 100644
--- a/poky/meta/classes/rm_work.bbclass
+++ b/poky/meta/classes/rm_work.bbclass
@@ -1,4 +1,10 @@
#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
# Removes source after build
#
# To use it add that line to conf/local.conf:
diff --git a/poky/meta/classes/rm_work_and_downloads.bbclass b/poky/meta/classes/rm_work_and_downloads.bbclass
index 15e6091..2695a38 100644
--- a/poky/meta/classes/rm_work_and_downloads.bbclass
+++ b/poky/meta/classes/rm_work_and_downloads.bbclass
@@ -1,8 +1,7 @@
# Author: Patrick Ohly <patrick.ohly@intel.com>
# Copyright: Copyright (C) 2015 Intel Corporation
#
-# This file is licensed under the MIT license, see COPYING.MIT in
-# this source distribution for the terms.
+# SPDX-License-Identifier: MIT
# This class is used like rm_work:
# INHERIT += "rm_work_and_downloads"
diff --git a/poky/meta/classes/rootfs-postcommands.bbclass b/poky/meta/classes/rootfs-postcommands.bbclass
deleted file mode 100644
index a8a952f..0000000
--- a/poky/meta/classes/rootfs-postcommands.bbclass
+++ /dev/null
@@ -1,435 +0,0 @@
-
-# Zap the root password if debug-tweaks and empty-root-password features are not enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'empty-root-password' ], "", "zap_empty_root_password; ",d)}'
-
-# Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks or allow-empty-password is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-empty-password' ], "ssh_allow_empty_password; ", "",d)}'
-
-# Allow dropbear/openssh to accept root logins if debug-tweaks or allow-root-login is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "ssh_allow_root_login; ", "",d)}'
-
-# Enable postinst logging if debug-tweaks or post-install-logging is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}'
-
-# Create /etc/timestamp during image construction to give a reasonably sane default time setting
-ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp; "
-
-# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
-
-# We also need to do the same for the kernel boot parameters,
-# otherwise kernel or initramfs end up mounting the rootfs read/write
-# (the default) if supported by the underlying storage.
-#
-# We do this with :append because the default value might get set later with ?=
-# and we don't want to disable such a default that by setting a value here.
-APPEND:append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}'
-
-# Generates test data file with data store variables expanded in json format
-ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data; "
-
-# Write manifest
-IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.manifest"
-ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
-# Set default postinst log file
-POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
-# Set default target for systemd images
-SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains_any("IMAGE_FEATURES", [ "x11-base", "weston" ], "graphical.target", "multi-user.target", d)}'
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; systemd_create_users;", "", d)}'
-
-ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
-
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "overlayfs", "overlayfs_qa_check; overlayfs_postprocess;", "", d)}'
-
-inherit image-artifact-names
-
-# Sort the user and group entries in /etc by ID in order to make the content
-# deterministic. Package installs are not deterministic, causing the ordering
-# of entries to change between builds. In case that this isn't desired,
-# the command can be overridden.
-#
-# Note that useradd-staticids.bbclass has to be used to ensure that
-# the numeric IDs of dynamically created entries remain stable.
-#
-# We want this to run as late as possible, in particular after
-# systemd_sysusers_create and set_user_group. Using :append is not
-# enough for that, set_user_group is added that way and would end
-# up running after us.
-SORT_PASSWD_POSTPROCESS_COMMAND ??= " sort_passwd; "
-python () {
- d.appendVar('ROOTFS_POSTPROCESS_COMMAND', '${SORT_PASSWD_POSTPROCESS_COMMAND}')
- d.appendVar('ROOTFS_POSTPROCESS_COMMAND', 'rootfs_reproducible;')
-}
-
-systemd_create_users () {
- for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/*.conf; do
- [ -e $conffile ] || continue
- grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do
- if [ "$type" = "u" ]; then
- useradd_params="--shell /sbin/nologin"
- [ "$id" != "-" ] && useradd_params="$useradd_params --uid $id"
- [ "$comment" != "-" ] && useradd_params="$useradd_params --comment $comment"
- useradd_params="$useradd_params --system $name"
- eval useradd --root ${IMAGE_ROOTFS} $useradd_params || true
- elif [ "$type" = "g" ]; then
- groupadd_params=""
- [ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id"
- groupadd_params="$groupadd_params --system $name"
- eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true
- elif [ "$type" = "m" ]; then
- group=$id
- eval groupadd --root ${IMAGE_ROOTFS} --system $group || true
- eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name --no-user-group || true
- eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name
- fi
- done
- done
-}
-
-#
-# A hook function to support read-only-rootfs IMAGE_FEATURES
-#
-read_only_rootfs_hook () {
- # Tweak the mount option and fs_passno for rootfs in fstab
- if [ -f ${IMAGE_ROOTFS}/etc/fstab ]; then
- sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab
- fi
-
- # Tweak the "mount -o remount,rw /" command in busybox-inittab inittab
- if [ -f ${IMAGE_ROOTFS}/etc/inittab ]; then
- sed -i 's|/bin/mount -o remount,rw /|/bin/mount -o remount,ro /|' ${IMAGE_ROOTFS}/etc/inittab
- fi
-
- # If we're using openssh and the /etc/ssh directory has no pre-generated keys,
- # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
- # and the keys under /var/run/ssh.
- if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then
- if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then
- echo "SYSCONFDIR=\${SYSCONFDIR:-/etc/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh
- echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh
- else
- echo "SYSCONFDIR=\${SYSCONFDIR:-/var/run/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh
- echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh
- fi
- fi
-
- # Also tweak the key location for dropbear in the same way.
- if [ -d ${IMAGE_ROOTFS}/etc/dropbear ]; then
- if [ ! -e ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ]; then
- echo "DROPBEAR_RSAKEY_DIR=/var/lib/dropbear" >> ${IMAGE_ROOTFS}/etc/default/dropbear
- fi
- fi
-
- if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
- # Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes
- if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
- sed -i 's/ROOTFS_READ_ONLY=no/ROOTFS_READ_ONLY=yes/' ${IMAGE_ROOTFS}/etc/default/rcS
- fi
- # Run populate-volatile.sh at rootfs time to set up basic files
- # and directories to support read-only rootfs.
- if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
- ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
- fi
- fi
-
- if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
- # Create machine-id
- # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
- touch ${IMAGE_ROOTFS}${sysconfdir}/machine-id
- fi
-}
-
-#
-# This function disallows empty root passwords
-#
-zap_empty_root_password () {
- if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
- sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow
- fi
- if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
- sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd
- fi
-}
-
-#
-# allow dropbear/openssh to accept logins from accounts with an empty password string
-#
-ssh_allow_empty_password () {
- for config in sshd_config sshd_config_readonly; do
- if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
- sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
- fi
- done
-
- if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
- if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
- if ! grep -q "DROPBEAR_EXTRA_ARGS=.*-B" ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear ; then
- sed -i 's/^DROPBEAR_EXTRA_ARGS="*\([^"]*\)"*/DROPBEAR_EXTRA_ARGS="\1 -B"/' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
- fi
- else
- printf '\nDROPBEAR_EXTRA_ARGS="-B"\n' >> ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
- fi
- fi
-
- if [ -d ${IMAGE_ROOTFS}${sysconfdir}/pam.d ] ; then
- for f in `find ${IMAGE_ROOTFS}${sysconfdir}/pam.d/* -type f -exec test -e {} \; -print`
- do
- sed -i 's/nullok_secure/nullok/' $f
- done
- fi
-}
-
-#
-# allow dropbear/openssh to accept root logins
-#
-ssh_allow_root_login () {
- for config in sshd_config sshd_config_readonly; do
- if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
- sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
- fi
- done
-
- if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
- if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
- sed -i '/^DROPBEAR_EXTRA_ARGS=/ s/-w//' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
- fi
- fi
-}
-
-python sort_passwd () {
- import rootfspostcommands
- rootfspostcommands.sort_passwd(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
-}
-
-#
-# Enable postinst logging
-#
-postinst_enable_logging () {
- mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
- echo "POSTINST_LOGGING=1" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
- echo "LOGFILE=${POSTINST_LOGFILE}" >> ${IMAGE_ROOTFS}${sysconfdir}/default/postinst
-}
-
-#
-# Modify systemd default target
-#
-set_systemd_default_target () {
- if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ]; then
- ln -sf ${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target
- fi
-}
-
-# If /var/volatile is not empty, we have seen problems where programs such as the
-# journal make assumptions based on the contents of /var/volatile. The journal
-# would then write to /var/volatile before it was mounted, thus hiding the
-# items previously written.
-#
-# This change is to attempt to fix those types of issues in a way that doesn't
-# affect users that may not be using /var/volatile.
-empty_var_volatile () {
- if [ -e ${IMAGE_ROOTFS}/etc/fstab ]; then
- match=`awk '$1 !~ "#" && $2 ~ /\/var\/volatile/{print $2}' ${IMAGE_ROOTFS}/etc/fstab 2> /dev/null`
- if [ -n "$match" ]; then
- find ${IMAGE_ROOTFS}/var/volatile -mindepth 1 -delete
- fi
- fi
-}
-
-# Turn any symbolic /sbin/init link into a file
-remove_init_link () {
- if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
- LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
- rm ${IMAGE_ROOTFS}/sbin/init
- cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
- fi
-}
-
-make_zimage_symlink_relative () {
- if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
- (cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
- fi
-}
-
-python write_image_manifest () {
- from oe.rootfs import image_list_installed_packages
- from oe.utils import format_pkg_list
-
- deploy_dir = d.getVar('IMGDEPLOYDIR')
- link_name = d.getVar('IMAGE_LINK_NAME')
- manifest_name = d.getVar('IMAGE_MANIFEST')
-
- if not manifest_name:
- return
-
- pkgs = image_list_installed_packages(d)
- with open(manifest_name, 'w+') as image_manifest:
- image_manifest.write(format_pkg_list(pkgs, "ver"))
-
- if os.path.exists(manifest_name) and link_name:
- manifest_link = deploy_dir + "/" + link_name + ".manifest"
- if manifest_link != manifest_name:
- if os.path.lexists(manifest_link):
- os.remove(manifest_link)
- os.symlink(os.path.basename(manifest_name), manifest_link)
-}
-
-# Can be used to create /etc/timestamp during image construction to give a reasonably
-# sane default time setting
-rootfs_update_timestamp () {
- if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
- # Convert UTC into %4Y%2m%2d%2H%2M%2S
- sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
- else
- sformatted=`date -u +%4Y%2m%2d%2H%2M%2S`
- fi
- echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp
- bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted"
-}
-
-# Prevent X from being started
-rootfs_no_x_startup () {
- if [ -f ${IMAGE_ROOTFS}/etc/init.d/xserver-nodm ]; then
- chmod a-x ${IMAGE_ROOTFS}/etc/init.d/xserver-nodm
- fi
-}
-
-rootfs_trim_schemas () {
- for schema in ${IMAGE_ROOTFS}/etc/gconf/schemas/*.schemas
- do
- # Need this in case no files exist
- if [ -e $schema ]; then
- oe-trim-schemas $schema > $schema.new
- mv $schema.new $schema
- fi
- done
-}
-
-rootfs_check_host_user_contaminated () {
- contaminated="${S}/host-user-contaminated.txt"
- HOST_USER_UID="$(PSEUDO_UNLOAD=1 id -u)"
- HOST_USER_GID="$(PSEUDO_UNLOAD=1 id -g)"
-
- find "${IMAGE_ROOTFS}" -path "${IMAGE_ROOTFS}/home" -prune -o \
- -user "$HOST_USER_UID" -print -o -group "$HOST_USER_GID" -print >"$contaminated"
-
- sed -e "s,${IMAGE_ROOTFS},," $contaminated | while read line; do
- bbwarn "Path in the rootfs is owned by the same user or group as the user running bitbake:" $line `ls -lan ${IMAGE_ROOTFS}/$line`
- done
-
- if [ -s "$contaminated" ]; then
- bbwarn "/etc/passwd:" `cat ${IMAGE_ROOTFS}/etc/passwd`
- bbwarn "/etc/group:" `cat ${IMAGE_ROOTFS}/etc/group`
- fi
-}
-
-# Make any absolute links in a sysroot relative
-rootfs_sysroot_relativelinks () {
- sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
-}
-
-# Generated test data json file
-python write_image_test_data() {
- from oe.data import export2json
-
- deploy_dir = d.getVar('IMGDEPLOYDIR')
- link_name = d.getVar('IMAGE_LINK_NAME')
- testdata_name = os.path.join(deploy_dir, "%s.testdata.json" % d.getVar('IMAGE_NAME'))
-
- searchString = "%s/"%(d.getVar("TOPDIR")).replace("//","/")
- export2json(d, testdata_name, searchString=searchString, replaceString="")
-
- if os.path.exists(testdata_name) and link_name:
- testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
- if testdata_link != testdata_name:
- if os.path.lexists(testdata_link):
- os.remove(testdata_link)
- os.symlink(os.path.basename(testdata_name), testdata_link)
-}
-write_image_test_data[vardepsexclude] += "TOPDIR"
-
-# Check for unsatisfied recommendations (RRECOMMENDS)
-python rootfs_log_check_recommends() {
- log_path = d.expand("${T}/log.do_rootfs")
- with open(log_path, 'r') as log:
- for line in log:
- if 'log_check' in line:
- continue
-
- if 'unsatisfied recommendation for' in line:
- bb.warn('[log_check] %s: %s' % (d.getVar('PN'), line))
-}
-
-# Perform any additional adjustments needed to make rootf binary reproducible
-rootfs_reproducible () {
- if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" != "" ]; then
- # Convert UTC into %4Y%2m%2d%2H%2M%2S
- sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S`
- echo $sformatted > ${IMAGE_ROOTFS}/etc/version
- bbnote "rootfs_reproducible: set /etc/version to $sformatted"
-
- if [ -d ${IMAGE_ROOTFS}${sysconfdir}/gconf ]; then
- find ${IMAGE_ROOTFS}${sysconfdir}/gconf -name '%gconf.xml' -print0 | xargs -0r \
- sed -i -e 's@\bmtime="[0-9][0-9]*"@mtime="'${REPRODUCIBLE_TIMESTAMP_ROOTFS}'"@g'
- fi
- fi
-}
-
-# Perform a dumb check for unit existence, not its validity
-python overlayfs_qa_check() {
- from oe.overlayfs import mountUnitName
-
- overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
- imagepath = d.getVar("IMAGE_ROOTFS")
- sysconfdir = d.getVar("sysconfdir")
- searchpaths = [oe.path.join(imagepath, sysconfdir, "systemd", "system"),
- oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
- fstabpath = oe.path.join(imagepath, sysconfdir, "fstab")
-
- if not any(os.path.exists(path) for path in [*searchpaths, fstabpath]):
- return
-
- fstabDevices = []
- if os.path.isfile(fstabpath):
- with open(fstabpath, 'r') as f:
- for line in f:
- if line[0] == '#':
- continue
- path = line.split(maxsplit=2)
- if len(path) > 2:
- fstabDevices.append(path[1])
-
- allUnitExist = True;
- for mountPoint in overlayMountPoints:
- qaSkip = (d.getVarFlag("OVERLAYFS_QA_SKIP", mountPoint) or "").split()
- if "mount-configured" in qaSkip:
- continue
-
- mountPath = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
- if mountPath in fstabDevices:
- continue
-
- mountUnit = mountUnitName(mountPath)
- if any(os.path.isfile(oe.path.join(dirpath, mountUnit))
- for dirpath in searchpaths):
- continue
-
- bb.warn(f'Mount path {mountPath} not found in fstab and unit '
- f'{mountUnit} not found in systemd unit directories.')
- bb.warn(f'Skip this check by setting OVERLAYFS_QA_SKIP[{mountPoint}] = '
- '"mount-configured"')
- allUnitExist = False;
-
- if not allUnitExist:
- bb.fatal('Not all mount paths and units are installed in the image')
-}
-
-python overlayfs_postprocess() {
- import shutil
-
- # install helper script
- helperScriptName = "overlayfs-create-dirs.sh"
- helperScriptSource = oe.path.join(d.getVar("COREBASE"), "meta/files", helperScriptName)
- helperScriptDest = oe.path.join(d.getVar("IMAGE_ROOTFS"), "/usr/sbin/", helperScriptName)
- shutil.copyfile(helperScriptSource, helperScriptDest)
- os.chmod(helperScriptDest, 0o755)
-}
diff --git a/poky/meta/classes/rootfs_deb.bbclass b/poky/meta/classes/rootfs_deb.bbclass
deleted file mode 100644
index 0469ba7..0000000
--- a/poky/meta/classes/rootfs_deb.bbclass
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright 2006-2007 Openedhand Ltd.
-#
-
-ROOTFS_PKGMANAGE = "dpkg apt"
-
-do_rootfs[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot"
-do_populate_sdk[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot bzip2-native:do_populate_sysroot"
-do_rootfs[recrdeptask] += "do_package_write_deb do_package_qa"
-do_rootfs[vardeps] += "PACKAGE_FEED_URIS PACKAGE_FEED_BASE_PATHS PACKAGE_FEED_ARCHS"
-
-do_rootfs[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-do_populate_sdk[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-do_populate_sdk_ext[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-
-python rootfs_deb_bad_recommendations() {
- if d.getVar("BAD_RECOMMENDATIONS"):
- bb.warn("Debian package install does not support BAD_RECOMMENDATIONS")
-}
-do_rootfs[prefuncs] += "rootfs_deb_bad_recommendations"
-
-DEB_POSTPROCESS_COMMANDS = ""
-
-opkglibdir = "${localstatedir}/lib/opkg"
-
-python () {
- # Map TARGET_ARCH to Debian's ideas about architectures
- darch = d.getVar('SDK_ARCH')
- if darch in ["x86", "i486", "i586", "i686", "pentium"]:
- d.setVar('DEB_SDK_ARCH', 'i386')
- elif darch == "x86_64":
- d.setVar('DEB_SDK_ARCH', 'amd64')
- elif darch == "arm":
- d.setVar('DEB_SDK_ARCH', 'armel')
- elif darch == "aarch64":
- d.setVar('DEB_SDK_ARCH', 'arm64')
- else:
- bb.fatal("Unhandled SDK_ARCH %s" % darch)
-}
diff --git a/poky/meta/classes/rootfs_ipk.bbclass b/poky/meta/classes/rootfs_ipk.bbclass
deleted file mode 100644
index 245c256..0000000
--- a/poky/meta/classes/rootfs_ipk.bbclass
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Creates a root filesystem out of IPKs
-#
-# This rootfs can be mounted via root-nfs or it can be put into an cramfs/jffs etc.
-# See image.bbclass for a usage of this.
-#
-
-EXTRAOPKGCONFIG ?= ""
-ROOTFS_PKGMANAGE = "opkg ${EXTRAOPKGCONFIG}"
-
-do_rootfs[depends] += "opkg-native:do_populate_sysroot opkg-utils-native:do_populate_sysroot"
-do_populate_sdk[depends] += "opkg-native:do_populate_sysroot opkg-utils-native:do_populate_sysroot"
-do_rootfs[recrdeptask] += "do_package_write_ipk do_package_qa"
-do_rootfs[vardeps] += "PACKAGE_FEED_URIS PACKAGE_FEED_BASE_PATHS PACKAGE_FEED_ARCHS"
-
-do_rootfs[lockfiles] += "${WORKDIR}/ipk.lock"
-do_populate_sdk[lockfiles] += "${WORKDIR}/sdk-ipk.lock"
-do_populate_sdk_ext[lockfiles] += "${WORKDIR}/sdk-ipk.lock"
-
-OPKG_PREPROCESS_COMMANDS = ""
-
-OPKG_POSTPROCESS_COMMANDS = ""
-
-OPKGLIBDIR ??= "${localstatedir}/lib"
-
-MULTILIBRE_ALLOW_REP = "${OPKGLIBDIR}/opkg|/usr/lib/opkg"
-
-python () {
-
- if d.getVar('BUILD_IMAGES_FROM_FEEDS'):
- flags = d.getVarFlag('do_rootfs', 'recrdeptask')
- flags = flags.replace("do_package_write_ipk", "")
- flags = flags.replace("do_deploy", "")
- flags = flags.replace("do_populate_sysroot", "")
- d.setVarFlag('do_rootfs', 'recrdeptask', flags)
- d.setVar('OPKG_PREPROCESS_COMMANDS', "")
- d.setVar('OPKG_POSTPROCESS_COMMANDS', '')
-}
diff --git a/poky/meta/classes/rootfs_rpm.bbclass b/poky/meta/classes/rootfs_rpm.bbclass
deleted file mode 100644
index bec4d63..0000000
--- a/poky/meta/classes/rootfs_rpm.bbclass
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Creates a root filesystem out of rpm packages
-#
-
-ROOTFS_PKGMANAGE = "rpm dnf"
-
-# dnf is using our custom sysconfig module, and so will fail without these
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-# Add 100Meg of extra space for dnf
-IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("PACKAGE_INSTALL", "dnf", " + 102400", "", d)}"
-
-# Dnf is python based, so be sure python3-native is available to us.
-EXTRANATIVEPATH += "python3-native"
-
-# opkg is needed for update-alternatives
-RPMROOTFSDEPENDS = "rpm-native:do_populate_sysroot \
- dnf-native:do_populate_sysroot \
- createrepo-c-native:do_populate_sysroot \
- opkg-native:do_populate_sysroot"
-
-do_rootfs[depends] += "${RPMROOTFSDEPENDS}"
-do_populate_sdk[depends] += "${RPMROOTFSDEPENDS}"
-
-do_rootfs[recrdeptask] += "do_package_write_rpm do_package_qa"
-do_rootfs[vardeps] += "PACKAGE_FEED_URIS PACKAGE_FEED_BASE_PATHS PACKAGE_FEED_ARCHS"
-
-python () {
- if d.getVar('BUILD_IMAGES_FROM_FEEDS'):
- flags = d.getVarFlag('do_rootfs', 'recrdeptask')
- flags = flags.replace("do_package_write_rpm", "")
- flags = flags.replace("do_deploy", "")
- flags = flags.replace("do_populate_sysroot", "")
- d.setVarFlag('do_rootfs', 'recrdeptask', flags)
- d.setVar('RPM_PREPROCESS_COMMANDS', '')
- d.setVar('RPM_POSTPROCESS_COMMANDS', '')
-
-}
diff --git a/poky/meta/classes/rootfsdebugfiles.bbclass b/poky/meta/classes/rootfsdebugfiles.bbclass
deleted file mode 100644
index 85c7ec7..0000000
--- a/poky/meta/classes/rootfsdebugfiles.bbclass
+++ /dev/null
@@ -1,41 +0,0 @@
-# This class installs additional files found on the build host
-# directly into the rootfs.
-#
-# One use case is to install a constant ssh host key in
-# an image that gets created for just one machine. This
-# solves two issues:
-# - host key generation on the device can stall when the
-# kernel has not gathered enough entropy yet (seen in practice
-# under qemu)
-# - ssh complains by default when the host key changes
-#
-# For dropbear, with the ssh host key store along side the local.conf:
-# 1. Extend local.conf:
-# INHERIT += "rootfsdebugfiles"
-# ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ;"
-# 2. Boot the image once, copy the dropbear_rsa_host_key from
-# the device into your build conf directory.
-# 3. A optional parameter can be used to set file mode
-# of the copied target, for instance:
-# ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key 0600;"
-# in case they might be required to have a specific mode. (Shoundn't be too open, for example)
-#
-# Do not use for production images! It bypasses several
-# core build mechanisms (updating the image when one
-# of the files changes, license tracking in the image
-# manifest, ...).
-
-ROOTFS_DEBUG_FILES ?= ""
-ROOTFS_DEBUG_FILES[doc] = "Lists additional files or directories to be installed with 'cp -a' in the format 'source1 target1;source2 target2;...'"
-
-ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files;"
-rootfs_debug_files () {
- #!/bin/sh -e
- echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target mode; do
- if [ -e "$source" ]; then
- mkdir -p $(dirname $target)
- cp -a $source $target
- [ -n "$mode" ] && chmod $mode $target
- fi
- done
-}
diff --git a/poky/meta/classes/rust-bin.bbclass b/poky/meta/classes/rust-bin.bbclass
deleted file mode 100644
index c87343b..0000000
--- a/poky/meta/classes/rust-bin.bbclass
+++ /dev/null
@@ -1,149 +0,0 @@
-inherit rust
-
-RDEPENDS:${PN}:append:class-target = " ${RUSTLIB_DEP}"
-
-RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir} -C linker=${RUST_TARGET_CCLD}"
-EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
-
-# Some libraries alias with the standard library but libstd is configured to
-# make it difficult or imposisble to use its version. Unfortunately libstd
-# must be explicitly overridden using extern.
-OVERLAP_LIBS = "\
- libc \
- log \
- getopts \
- rand \
-"
-def get_overlap_deps(d):
- deps = d.getVar("DEPENDS").split()
- overlap_deps = []
- for o in d.getVar("OVERLAP_LIBS").split():
- l = len([o for dep in deps if (o + '-rs' in dep)])
- if l > 0:
- overlap_deps.append(o)
- return " ".join(overlap_deps)
-OVERLAP_DEPS = "${@get_overlap_deps(d)}"
-
-# Prevents multiple static copies of standard library modules
-# See https://github.com/rust-lang/rust/issues/19680
-RUSTC_PREFER_DYNAMIC = "-C prefer-dynamic"
-RUSTC_FLAGS += "${RUSTC_PREFER_DYNAMIC}"
-
-CRATE_NAME ?= "${@d.getVar('BPN').replace('-rs', '').replace('-', '_')}"
-BINNAME ?= "${BPN}"
-LIBNAME ?= "lib${CRATE_NAME}-rs"
-CRATE_TYPE ?= "dylib"
-BIN_SRC ?= "${S}/src/main.rs"
-LIB_SRC ?= "${S}/src/lib.rs"
-
-rustbindest ?= "${bindir}"
-rustlibdest ?= "${rustlibdir}"
-RUST_RPATH_ABS ?= "${rustlibdir}:${rustlib}"
-
-def relative_rpaths(paths, base):
- relpaths = set()
- for p in paths.split(':'):
- if p == base:
- relpaths.add('$ORIGIN')
- continue
- relpaths.add(os.path.join('$ORIGIN', os.path.relpath(p, base)))
- return '-rpath=' + ':'.join(relpaths) if len(relpaths) else ''
-
-RUST_LIB_RPATH_FLAGS ?= "${@relative_rpaths(d.getVar('RUST_RPATH_ABS', True), d.getVar('rustlibdest', True))}"
-RUST_BIN_RPATH_FLAGS ?= "${@relative_rpaths(d.getVar('RUST_RPATH_ABS', True), d.getVar('rustbindest', True))}"
-
-def libfilename(d):
- if d.getVar('CRATE_TYPE', True) == 'dylib':
- return d.getVar('LIBNAME', True) + '.so'
- else:
- return d.getVar('LIBNAME', True) + '.rlib'
-
-def link_args(d, bin):
- linkargs = []
- if bin:
- rpaths = d.getVar('RUST_BIN_RPATH_FLAGS', False)
- else:
- rpaths = d.getVar('RUST_LIB_RPATH_FLAGS', False)
- if d.getVar('CRATE_TYPE', True) == 'dylib':
- linkargs.append('-soname')
- linkargs.append(libfilename(d))
- if len(rpaths):
- linkargs.append(rpaths)
- if len(linkargs):
- return ' '.join(['-Wl,' + arg for arg in linkargs])
- else:
- return ''
-
-get_overlap_externs () {
- externs=
- for dep in ${OVERLAP_DEPS}; do
- extern=$(ls ${STAGING_DIR_HOST}/${rustlibdir}/lib$dep-rs.{so,rlib} 2>/dev/null \
- | awk '{print $1}');
- if [ -n "$extern" ]; then
- externs="$externs --extern $dep=$extern"
- else
- echo "$dep in depends but no such library found in ${rustlibdir}!" >&2
- exit 1
- fi
- done
- echo "$externs"
-}
-
-do_configure () {
-}
-
-oe_runrustc () {
- export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
- bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@"
- "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@"
-}
-
-oe_compile_rust_lib () {
- rm -rf ${LIBNAME}.{rlib,so}
- local -a link_args
- if [ -n '${@link_args(d, False)}' ]; then
- link_args[0]='-C'
- link_args[1]='link-args=${@link_args(d, False)}'
- fi
- oe_runrustc $(get_overlap_externs) \
- "${link_args[@]}" \
- ${LIB_SRC} \
- -o ${@libfilename(d)} \
- --crate-name=${CRATE_NAME} --crate-type=${CRATE_TYPE} \
- "$@"
-}
-oe_compile_rust_lib[vardeps] += "get_overlap_externs"
-
-oe_compile_rust_bin () {
- rm -rf ${BINNAME}
- local -a link_args
- if [ -n '${@link_args(d, True)}' ]; then
- link_args[0]='-C'
- link_args[1]='link-args=${@link_args(d, True)}'
- fi
- oe_runrustc $(get_overlap_externs) \
- "${link_args[@]}" \
- ${BIN_SRC} -o ${BINNAME} "$@"
-}
-oe_compile_rust_bin[vardeps] += "get_overlap_externs"
-
-oe_install_rust_lib () {
- for lib in $(ls ${LIBNAME}.{so,rlib} 2>/dev/null); do
- echo Installing $lib
- install -D -m 755 $lib ${D}/${rustlibdest}/$lib
- done
-}
-
-oe_install_rust_bin () {
- echo Installing ${BINNAME}
- install -D -m 755 ${BINNAME} ${D}/${rustbindest}/${BINNAME}
-}
-
-do_rust_bin_fixups() {
- for f in `find ${PKGD} -name '*.so*'`; do
- echo "Strip rust note: $f"
- ${OBJCOPY} -R .note.rustc $f $f
- done
-}
-PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups"
-
diff --git a/poky/meta/classes/rust-common.bbclass b/poky/meta/classes/rust-common.bbclass
deleted file mode 100644
index cb811ac..0000000
--- a/poky/meta/classes/rust-common.bbclass
+++ /dev/null
@@ -1,189 +0,0 @@
-inherit python3native
-
-# Common variables used by all Rust builds
-export rustlibdir = "${libdir}/rust"
-FILES:${PN} += "${rustlibdir}/*.so"
-FILES:${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
-FILES:${PN}-dbg += "${rustlibdir}/.debug"
-
-RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
-RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
-RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}"
-RUSTLIB_DEP ?= "libstd-rs"
-export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/rustlib"
-RUST_PANIC_STRATEGY ?= "unwind"
-
-# Native builds are not effected by TCLIBC. Without this, rust-native
-# thinks it's "target" (i.e. x86_64-linux) is a musl target.
-RUST_LIBC = "${TCLIBC}"
-RUST_LIBC:class-crosssdk = "glibc"
-RUST_LIBC:class-native = "glibc"
-
-def determine_libc(d, thing):
- '''Determine which libc something should target'''
-
- # BUILD is never musl, TARGET may be musl or glibc,
- # HOST could be musl, but only if a compiler is built to be run on
- # target in which case HOST_SYS != BUILD_SYS.
- if thing == 'TARGET':
- libc = d.getVar('RUST_LIBC')
- elif thing == 'BUILD' and (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
- libc = d.getVar('RUST_LIBC')
- else:
- libc = d.getVar('RUST_LIBC:class-native')
-
- return libc
-
-def target_is_armv7(d):
- '''Determine if target is armv7'''
- # TUNE_FEATURES may include arm* even if the target is not arm
- # in the case of *-native packages
- if d.getVar('TARGET_ARCH') != 'arm':
- return False
-
- feat = d.getVar('TUNE_FEATURES')
- feat = frozenset(feat.split())
- mach_overrides = d.getVar('MACHINEOVERRIDES')
- mach_overrides = frozenset(mach_overrides.split(':'))
-
- v7=frozenset(['armv7a', 'armv7r', 'armv7m', 'armv7ve'])
- if mach_overrides.isdisjoint(v7) and feat.isdisjoint(v7):
- return False
- else:
- return True
-target_is_armv7[vardepvalue] = "${@target_is_armv7(d)}"
-
-# Responsible for taking Yocto triples and converting it to Rust triples
-def rust_base_triple(d, thing):
- '''
- Mangle bitbake's *_SYS into something that rust might support (see
- rust/mk/cfg/* for a list)
-
- Note that os is assumed to be some linux form
- '''
-
- # The llvm-target for armv7 is armv7-unknown-linux-gnueabihf
- if thing == "TARGET" and target_is_armv7(d):
- arch = "armv7"
- else:
- arch = oe.rust.arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
-
- # All the Yocto targets are Linux and are 'unknown'
- vendor = "-unknown"
- os = d.getVar('{}_OS'.format(thing))
- libc = determine_libc(d, thing)
-
- # Prefix with a dash and convert glibc -> gnu
- if libc == "glibc":
- libc = "-gnu"
- elif libc == "musl":
- libc = "-musl"
-
- # Don't double up musl (only appears to be the case on aarch64)
- if os == "linux-musl":
- if libc != "-musl":
- bb.fatal("{}_OS was '{}' but TCLIBC was not 'musl'".format(thing, os))
- os = "linux"
-
- # This catches ARM targets and appends the necessary hard float bits
- if os == "linux-gnueabi" or os == "linux-musleabi":
- libc = bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
- return arch + vendor + '-' + os + libc
-
-
-# In some cases uname and the toolchain differ on their idea of the arch name
-RUST_BUILD_ARCH = "${@oe.rust.arch_to_rust_arch(d.getVar('BUILD_ARCH'))}"
-
-# Naming explanation
-# Yocto
-# - BUILD_SYS - Yocto triple of the build environment
-# - HOST_SYS - What we're building for in Yocto
-# - TARGET_SYS - What we're building for in Yocto
-#
-# So when building '-native' packages BUILD_SYS == HOST_SYS == TARGET_SYS
-# When building packages for the image HOST_SYS == TARGET_SYS
-# This is a gross over simplification as there are other modes but
-# currently this is all that's supported.
-#
-# Rust
-# - TARGET - the system where the binary will run
-# - HOST - the system where the binary is being built
-#
-# Rust additionally will use two additional cases:
-# - undecorated (e.g. CC) - equivalent to TARGET
-# - triple suffix (e.g. CC:x86_64_unknown_linux_gnu) - both
-# see: https://github.com/alexcrichton/gcc-rs
-# The way that Rust's internal triples and Yocto triples are mapped together
-# its likely best to not use the triple suffix due to potential confusion.
-
-RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}"
-RUST_BUILD_SYS[vardepvalue] = "${RUST_BUILD_SYS}"
-RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}"
-RUST_HOST_SYS[vardepvalue] = "${RUST_HOST_SYS}"
-RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}"
-RUST_TARGET_SYS[vardepvalue] = "${RUST_TARGET_SYS}"
-
-# wrappers to get around the fact that Rust needs a single
-# binary but Yocto's compiler and linker commands have
-# arguments. Technically the archiver is always one command but
-# this is necessary for builds that determine the prefix and then
-# use those commands based on the prefix.
-WRAPPER_DIR = "${WORKDIR}/wrapper"
-RUST_BUILD_CC = "${WRAPPER_DIR}/build-rust-cc"
-RUST_BUILD_CXX = "${WRAPPER_DIR}/build-rust-cxx"
-RUST_BUILD_CCLD = "${WRAPPER_DIR}/build-rust-ccld"
-RUST_BUILD_AR = "${WRAPPER_DIR}/build-rust-ar"
-RUST_TARGET_CC = "${WRAPPER_DIR}/target-rust-cc"
-RUST_TARGET_CXX = "${WRAPPER_DIR}/target-rust-cxx"
-RUST_TARGET_CCLD = "${WRAPPER_DIR}/target-rust-ccld"
-RUST_TARGET_AR = "${WRAPPER_DIR}/target-rust-ar"
-
-create_wrapper () {
- file="$1"
- shift
-
- cat <<- EOF > "${file}"
- #!/usr/bin/env python3
- import os, sys
- orig_binary = "$@"
- binary = orig_binary.split()[0]
- args = orig_binary.split() + sys.argv[1:]
- os.execvp(binary, args)
- EOF
- chmod +x "${file}"
-}
-
-export WRAPPER_TARGET_CC = "${CC}"
-export WRAPPER_TARGET_CXX = "${CXX}"
-export WRAPPER_TARGET_CCLD = "${CCLD}"
-export WRAPPER_TARGET_LDFLAGS = "${LDFLAGS}"
-export WRAPPER_TARGET_AR = "${AR}"
-
-# compiler is used by gcc-rs
-# linker is used by rustc/cargo
-# archiver is used by the build of libstd-rs
-do_rust_create_wrappers () {
- mkdir -p "${WRAPPER_DIR}"
-
- # Yocto Build / Rust Host C compiler
- create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}"
- # Yocto Build / Rust Host C++ compiler
- create_wrapper "${RUST_BUILD_CXX}" "${BUILD_CXX}"
- # Yocto Build / Rust Host linker
- create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}"
- # Yocto Build / Rust Host archiver
- create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
-
- # Yocto Target / Rust Target C compiler
- create_wrapper "${RUST_TARGET_CC}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}"
- # Yocto Target / Rust Target C++ compiler
- create_wrapper "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_CXX}"
- # Yocto Target / Rust Target linker
- create_wrapper "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}"
- # Yocto Target / Rust Target archiver
- create_wrapper "${RUST_TARGET_AR}" "${WRAPPER_TARGET_AR}"
-
-}
-
-addtask rust_create_wrappers before do_configure after do_patch do_prepare_recipe_sysroot
-do_rust_create_wrappers[dirs] += "${WRAPPER_DIR}"
diff --git a/poky/meta/classes/rust-target-config.bbclass b/poky/meta/classes/rust-target-config.bbclass
deleted file mode 100644
index 87b7dee..0000000
--- a/poky/meta/classes/rust-target-config.bbclass
+++ /dev/null
@@ -1,374 +0,0 @@
-# Right now this is focused on arm-specific tune features.
-# We get away with this for now as one can only use x86-64 as the build host
-# (not arm).
-# Note that TUNE_FEATURES is _always_ refering to the target, so we really
-# don't want to use this for the host/build.
-def llvm_features_from_tune(d):
- f = []
- feat = d.getVar('TUNE_FEATURES')
- if not feat:
- return []
- feat = frozenset(feat.split())
-
- mach_overrides = d.getVar('MACHINEOVERRIDES')
- mach_overrides = frozenset(mach_overrides.split(':'))
-
- if 'vfpv4' in feat:
- f.append("+vfp4")
- if 'vfpv3' in feat:
- f.append("+vfp3")
- if 'vfpv3d16' in feat:
- f.append("+d16")
-
- if 'vfpv2' in feat or 'vfp' in feat:
- f.append("+vfp2")
-
- if 'neon' in feat:
- f.append("+neon")
-
- if 'mips32' in feat:
- f.append("+mips32")
-
- if 'mips32r2' in feat:
- f.append("+mips32r2")
-
- if target_is_armv7(d):
- f.append('+v7')
-
- if ('armv6' in mach_overrides) or ('armv6' in feat):
- f.append("+v6")
- if 'armv5te' in feat:
- f.append("+strict-align")
- f.append("+v5te")
- elif 'armv5' in feat:
- f.append("+strict-align")
- f.append("+v5")
-
- if ('armv4' in mach_overrides) or ('armv4' in feat):
- f.append("+strict-align")
-
- if 'dsp' in feat:
- f.append("+dsp")
-
- if 'thumb' in feat:
- if d.getVar('ARM_THUMB_OPT') == "thumb":
- if target_is_armv7(d):
- f.append('+thumb2')
- f.append("+thumb-mode")
-
- if 'cortexa5' in feat:
- f.append("+a5")
- if 'cortexa7' in feat:
- f.append("+a7")
- if 'cortexa9' in feat:
- f.append("+a9")
- if 'cortexa15' in feat:
- f.append("+a15")
- if 'cortexa17' in feat:
- f.append("+a17")
- if ('riscv64' in feat) or ('riscv32' in feat):
- f.append("+a,+c,+d,+f,+m")
- return f
-llvm_features_from_tune[vardepvalue] = "${@llvm_features_from_tune(d)}"
-
-# TARGET_CC_ARCH changes from build/cross/target so it'll do the right thing
-# this should go away when https://github.com/rust-lang/rust/pull/31709 is
-# stable (1.9.0?)
-def llvm_features_from_cc_arch(d):
- f = []
- feat = d.getVar('TARGET_CC_ARCH')
- if not feat:
- return []
- feat = frozenset(feat.split())
-
- if '-mmmx' in feat:
- f.append("+mmx")
- if '-msse' in feat:
- f.append("+sse")
- if '-msse2' in feat:
- f.append("+sse2")
- if '-msse3' in feat:
- f.append("+sse3")
- if '-mssse3' in feat:
- f.append("+ssse3")
- if '-msse4.1' in feat:
- f.append("+sse4.1")
- if '-msse4.2' in feat:
- f.append("+sse4.2")
- if '-msse4a' in feat:
- f.append("+sse4a")
- if '-mavx' in feat:
- f.append("+avx")
- if '-mavx2' in feat:
- f.append("+avx2")
-
- return f
-
-def llvm_features_from_target_fpu(d):
- # TARGET_FPU can be hard or soft. +soft-float tell llvm to use soft float
- # ABI. There is no option for hard.
-
- fpu = d.getVar('TARGET_FPU', True)
- return ["+soft-float"] if fpu == "soft" else []
-
-def llvm_features(d):
- return ','.join(llvm_features_from_tune(d) +
- llvm_features_from_cc_arch(d) +
- llvm_features_from_target_fpu(d))
-
-llvm_features[vardepvalue] = "${@llvm_features(d)}"
-
-## arm-unknown-linux-gnueabihf
-DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-TARGET_ENDIAN[arm-eabi] = "little"
-TARGET_POINTER_WIDTH[arm-eabi] = "32"
-TARGET_C_INT_WIDTH[arm-eabi] = "32"
-MAX_ATOMIC_WIDTH[arm-eabi] = "64"
-FEATURES[arm-eabi] = "+v6,+vfp2"
-
-## armv7-unknown-linux-gnueabihf
-DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-TARGET_ENDIAN[armv7-eabi] = "little"
-TARGET_POINTER_WIDTH[armv7-eabi] = "32"
-TARGET_C_INT_WIDTH[armv7-eabi] = "32"
-MAX_ATOMIC_WIDTH[armv7-eabi] = "64"
-FEATURES[armv7-eabi] = "+v7,+vfp2,+thumb2"
-
-## aarch64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
-TARGET_ENDIAN[aarch64] = "little"
-TARGET_POINTER_WIDTH[aarch64] = "64"
-TARGET_C_INT_WIDTH[aarch64] = "32"
-MAX_ATOMIC_WIDTH[aarch64] = "128"
-
-## x86_64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-TARGET_ENDIAN[x86_64] = "little"
-TARGET_POINTER_WIDTH[x86_64] = "64"
-TARGET_C_INT_WIDTH[x86_64] = "32"
-MAX_ATOMIC_WIDTH[x86_64] = "64"
-
-## x86_64-unknown-linux-gnux32
-DATA_LAYOUT[x86_64-x32] = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-TARGET_ENDIAN[x86_64-x32] = "little"
-TARGET_POINTER_WIDTH[x86_64-x32] = "32"
-TARGET_C_INT_WIDTH[x86_64-x32] = "32"
-MAX_ATOMIC_WIDTH[x86_64-x32] = "64"
-
-## i686-unknown-linux-{gnu, musl}
-DATA_LAYOUT[i686] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
-TARGET_ENDIAN[i686] = "little"
-TARGET_POINTER_WIDTH[i686] = "32"
-TARGET_C_INT_WIDTH[i686] = "32"
-MAX_ATOMIC_WIDTH[i686] = "64"
-
-## XXX: a bit of a hack so qemux86 builds, clone of i686-unknown-linux-{gnu, musl} above
-DATA_LAYOUT[i586] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
-TARGET_ENDIAN[i586] = "little"
-TARGET_POINTER_WIDTH[i586] = "32"
-TARGET_C_INT_WIDTH[i586] = "32"
-MAX_ATOMIC_WIDTH[i586] = "64"
-
-## mips-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mips] = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
-TARGET_ENDIAN[mips] = "big"
-TARGET_POINTER_WIDTH[mips] = "32"
-TARGET_C_INT_WIDTH[mips] = "32"
-MAX_ATOMIC_WIDTH[mips] = "32"
-
-## mipsel-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mipsel] = "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
-TARGET_ENDIAN[mipsel] = "little"
-TARGET_POINTER_WIDTH[mipsel] = "32"
-TARGET_C_INT_WIDTH[mipsel] = "32"
-MAX_ATOMIC_WIDTH[mipsel] = "32"
-
-## mips64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mips64] = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
-TARGET_ENDIAN[mips64] = "big"
-TARGET_POINTER_WIDTH[mips64] = "64"
-TARGET_C_INT_WIDTH[mips64] = "64"
-MAX_ATOMIC_WIDTH[mips64] = "64"
-
-## mips64el-unknown-linux-{gnu, musl}
-DATA_LAYOUT[mips64el] = "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
-TARGET_ENDIAN[mips64el] = "little"
-TARGET_POINTER_WIDTH[mips64el] = "64"
-TARGET_C_INT_WIDTH[mips64el] = "64"
-MAX_ATOMIC_WIDTH[mips64el] = "64"
-
-## powerpc-unknown-linux-{gnu, musl}
-DATA_LAYOUT[powerpc] = "E-m:e-p:32:32-i64:64-n32"
-TARGET_ENDIAN[powerpc] = "big"
-TARGET_POINTER_WIDTH[powerpc] = "32"
-TARGET_C_INT_WIDTH[powerpc] = "32"
-MAX_ATOMIC_WIDTH[powerpc] = "32"
-
-## powerpc64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[powerpc64] = "E-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
-TARGET_ENDIAN[powerpc64] = "big"
-TARGET_POINTER_WIDTH[powerpc64] = "64"
-TARGET_C_INT_WIDTH[powerpc64] = "64"
-MAX_ATOMIC_WIDTH[powerpc64] = "64"
-
-## powerpc64le-unknown-linux-{gnu, musl}
-DATA_LAYOUT[powerpc64le] = "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512"
-TARGET_ENDIAN[powerpc64le] = "little"
-TARGET_POINTER_WIDTH[powerpc64le] = "64"
-TARGET_C_INT_WIDTH[powerpc64le] = "64"
-MAX_ATOMIC_WIDTH[powerpc64le] = "64"
-
-## riscv32-unknown-linux-{gnu, musl}
-DATA_LAYOUT[riscv32] = "e-m:e-p:32:32-i64:64-n32-S128"
-TARGET_ENDIAN[riscv32] = "little"
-TARGET_POINTER_WIDTH[riscv32] = "32"
-TARGET_C_INT_WIDTH[riscv32] = "32"
-MAX_ATOMIC_WIDTH[riscv32] = "32"
-
-## riscv64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[riscv64] = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
-TARGET_ENDIAN[riscv64] = "little"
-TARGET_POINTER_WIDTH[riscv64] = "64"
-TARGET_C_INT_WIDTH[riscv64] = "64"
-MAX_ATOMIC_WIDTH[riscv64] = "64"
-
-# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
-# rust's internals won't choke on.
-def arch_to_rust_target_arch(arch):
- if arch == "i586" or arch == "i686":
- return "x86"
- elif arch == "mipsel":
- return "mips"
- elif arch == "mip64sel":
- return "mips64"
- elif arch == "armv7":
- return "arm"
- elif arch == "powerpc64le":
- return "powerpc64"
- else:
- return arch
-
-# generates our target CPU value
-def llvm_cpu(d):
- cpu = d.getVar('PACKAGE_ARCH')
- target = d.getVar('TRANSLATED_TARGET_ARCH')
-
- trans = {}
- trans['corei7-64'] = "corei7"
- trans['core2-32'] = "core2"
- trans['x86-64'] = "x86-64"
- trans['i686'] = "i686"
- trans['i586'] = "i586"
- trans['powerpc'] = "powerpc"
- trans['mips64'] = "mips64"
- trans['mips64el'] = "mips64"
- trans['riscv64'] = "generic-rv64"
- trans['riscv32'] = "generic-rv32"
-
- if target in ["mips", "mipsel"]:
- feat = frozenset(d.getVar('TUNE_FEATURES').split())
- if "mips32r2" in feat:
- trans['mipsel'] = "mips32r2"
- trans['mips'] = "mips32r2"
- elif "mips32" in feat:
- trans['mipsel'] = "mips32"
- trans['mips'] = "mips32"
-
- try:
- return trans[cpu]
- except:
- return trans.get(target, "generic")
-
-llvm_cpu[vardepvalue] = "${@llvm_cpu(d)}"
-
-def rust_gen_target(d, thing, wd, arch):
- import json
- sys = d.getVar('{}_SYS'.format(thing))
- prefix = d.getVar('{}_PREFIX'.format(thing))
-
- abi = None
- cpu = "generic"
- features = ""
-
- if thing == "TARGET":
- abi = d.getVar('ABIEXTENSION')
- cpu = llvm_cpu(d)
- if bb.data.inherits_class('native', d):
- features = ','.join(llvm_features_from_cc_arch(d))
- else:
- features = llvm_features(d) or ""
- # arm and armv7 have different targets in llvm
- if arch == "arm" and target_is_armv7(d):
- arch = 'armv7'
-
- rust_arch = oe.rust.arch_to_rust_arch(arch)
-
- if abi:
- arch_abi = "{}-{}".format(rust_arch, abi)
- else:
- arch_abi = rust_arch
-
- features = features or d.getVarFlag('FEATURES', arch_abi) or ""
- features = features.strip()
-
- llvm_target = d.getVar('RUST_TARGET_SYS')
- if thing == "BUILD":
- llvm_target = d.getVar('RUST_HOST_SYS')
-
- # build tspec
- tspec = {}
- tspec['llvm-target'] = llvm_target
- tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi)
- tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi))
- tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
- tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
- tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
- tspec['arch'] = arch_to_rust_target_arch(rust_arch)
- tspec['os'] = "linux"
- if "musl" in tspec['llvm-target']:
- tspec['env'] = "musl"
- else:
- tspec['env'] = "gnu"
- if "riscv64" in tspec['llvm-target']:
- tspec['llvm-abiname'] = "lp64d"
- if "riscv32" in tspec['llvm-target']:
- tspec['llvm-abiname'] = "ilp32d"
- tspec['vendor'] = "unknown"
- tspec['target-family'] = "unix"
- tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)
- tspec['cpu'] = cpu
- if features != "":
- tspec['features'] = features
- tspec['dynamic-linking'] = True
- tspec['executables'] = True
- tspec['linker-is-gnu'] = True
- tspec['linker-flavor'] = "gcc"
- tspec['has-rpath'] = True
- tspec['has-elf-tls'] = True
- tspec['position-independent-executables'] = True
- tspec['panic-strategy'] = d.getVar("RUST_PANIC_STRATEGY")
-
- # write out the target spec json file
- with open(wd + sys + '.json', 'w') as f:
- json.dump(tspec, f, indent=4)
-
-# These are accounted for in tmpdir path names so don't need to be in the task sig
-rust_gen_target[vardepsexclude] += "RUST_HOST_SYS RUST_TARGET_SYS ABIEXTENSION llvm_cpu"
-
-do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES"
-
-RUST_TARGETGENS = "BUILD"
-
-python do_rust_gen_targets () {
- wd = d.getVar('WORKDIR') + '/targets/'
- # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
- rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
- if "HOST" in d.getVar("RUST_TARGETGENS"):
- rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH'))
- if "TARGET" in d.getVar("RUST_TARGETGENS"):
- rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH'))
-}
-
-addtask rust_gen_targets after do_patch before do_compile
-do_rust_gen_targets[dirs] += "${WORKDIR}/targets"
-
diff --git a/poky/meta/classes/rust.bbclass b/poky/meta/classes/rust.bbclass
deleted file mode 100644
index 5c8938d..0000000
--- a/poky/meta/classes/rust.bbclass
+++ /dev/null
@@ -1,45 +0,0 @@
-inherit rust-common
-
-RUSTC = "rustc"
-
-RUSTC_ARCHFLAGS += "--target=${HOST_SYS} ${RUSTFLAGS}"
-
-def rust_base_dep(d):
- # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
- # use rust instead of gcc
- deps = ""
- if not d.getVar('INHIBIT_DEFAULT_RUST_DEPS'):
- if (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
- deps += " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
- else:
- deps += " rust-native"
- return deps
-
-DEPENDS:append = " ${@rust_base_dep(d)}"
-
-# BUILD_LDFLAGS
-# ${STAGING_LIBDIR_NATIVE}
-# ${STAGING_BASE_LIBDIR_NATIVE}
-# BUILDSDK_LDFLAGS
-# ${STAGING_LIBDIR}
-# #{STAGING_DIR_HOST}
-# TARGET_LDFLAGS ?????
-#RUSTC_BUILD_LDFLAGS = "\
-# --sysroot ${STAGING_DIR_NATIVE} \
-# -L${STAGING_LIBDIR_NATIVE} \
-# -L${STAGING_BASE_LIBDIR_NATIVE} \
-#"
-
-# XXX: for some reason bitbake sets BUILD_* & TARGET_* but uses the bare
-# variables for HOST. Alias things to make it easier for us.
-HOST_LDFLAGS ?= "${LDFLAGS}"
-HOST_CFLAGS ?= "${CFLAGS}"
-HOST_CXXFLAGS ?= "${CXXFLAGS}"
-HOST_CPPFLAGS ?= "${CPPFLAGS}"
-
-rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
-# Native sysroot standard library path
-rustlib_src="${prefix}/lib/${rustlib_suffix}"
-# Host sysroot standard library path
-rustlib="${libdir}/${rustlib_suffix}"
-rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"
diff --git a/poky/meta/classes/sanity.bbclass b/poky/meta/classes/sanity.bbclass
deleted file mode 100644
index b1fac10..0000000
--- a/poky/meta/classes/sanity.bbclass
+++ /dev/null
@@ -1,1022 +0,0 @@
-#
-# Sanity check the users setup for common misconfigurations
-#
-
-SANITY_REQUIRED_UTILITIES ?= "patch diffstat git bzip2 tar \
- gzip gawk chrpath wget cpio perl file which"
-
-def bblayers_conf_file(d):
- return os.path.join(d.getVar('TOPDIR'), 'conf/bblayers.conf')
-
-def sanity_conf_read(fn):
- with open(fn, 'r') as f:
- lines = f.readlines()
- return lines
-
-def sanity_conf_find_line(pattern, lines):
- import re
- return next(((index, line)
- for index, line in enumerate(lines)
- if re.search(pattern, line)), (None, None))
-
-def sanity_conf_update(fn, lines, version_var_name, new_version):
- index, line = sanity_conf_find_line(r"^%s" % version_var_name, lines)
- lines[index] = '%s = "%d"\n' % (version_var_name, new_version)
- with open(fn, "w") as f:
- f.write(''.join(lines))
-
-# Functions added to this variable MUST throw a NotImplementedError exception unless
-# they successfully changed the config version in the config file. Exceptions
-# are used since exec_func doesn't handle return values.
-BBLAYERS_CONF_UPDATE_FUNCS += " \
- conf/bblayers.conf:LCONF_VERSION:LAYER_CONF_VERSION:oecore_update_bblayers \
- conf/local.conf:CONF_VERSION:LOCALCONF_VERSION:oecore_update_localconf \
- conf/site.conf:SCONF_VERSION:SITE_CONF_VERSION:oecore_update_siteconf \
-"
-
-SANITY_DIFF_TOOL ?= "meld"
-
-SANITY_LOCALCONF_SAMPLE ?= "${COREBASE}/meta*/conf/local.conf.sample"
-python oecore_update_localconf() {
- # Check we are using a valid local.conf
- current_conf = d.getVar('CONF_VERSION')
- conf_version = d.getVar('LOCALCONF_VERSION')
-
- failmsg = """Your version of local.conf was generated from an older/newer version of
-local.conf.sample and there have been updates made to this file. Please compare the two
-files and merge any changes before continuing.
-
-Matching the version numbers will remove this message.
-
-\"${SANITY_DIFF_TOOL} conf/local.conf ${SANITY_LOCALCONF_SAMPLE}\"
-
-is a good way to visualise the changes."""
- failmsg = d.expand(failmsg)
-
- raise NotImplementedError(failmsg)
-}
-
-SANITY_SITECONF_SAMPLE ?= "${COREBASE}/meta*/conf/site.conf.sample"
-python oecore_update_siteconf() {
- # If we have a site.conf, check it's valid
- current_sconf = d.getVar('SCONF_VERSION')
- sconf_version = d.getVar('SITE_CONF_VERSION')
-
- failmsg = """Your version of site.conf was generated from an older version of
-site.conf.sample and there have been updates made to this file. Please compare the two
-files and merge any changes before continuing.
-
-Matching the version numbers will remove this message.
-
-\"${SANITY_DIFF_TOOL} conf/site.conf ${SANITY_SITECONF_SAMPLE}\"
-
-is a good way to visualise the changes."""
- failmsg = d.expand(failmsg)
-
- raise NotImplementedError(failmsg)
-}
-
-SANITY_BBLAYERCONF_SAMPLE ?= "${COREBASE}/meta*/conf/bblayers.conf.sample"
-python oecore_update_bblayers() {
- # bblayers.conf is out of date, so see if we can resolve that
-
- current_lconf = int(d.getVar('LCONF_VERSION'))
- lconf_version = int(d.getVar('LAYER_CONF_VERSION'))
-
- failmsg = """Your version of bblayers.conf has the wrong LCONF_VERSION (has ${LCONF_VERSION}, expecting ${LAYER_CONF_VERSION}).
-Please compare your file against bblayers.conf.sample and merge any changes before continuing.
-"${SANITY_DIFF_TOOL} conf/bblayers.conf ${SANITY_BBLAYERCONF_SAMPLE}"
-
-is a good way to visualise the changes."""
- failmsg = d.expand(failmsg)
-
- if not current_lconf:
- raise NotImplementedError(failmsg)
-
- lines = []
-
- if current_lconf < 4:
- raise NotImplementedError(failmsg)
-
- bblayers_fn = bblayers_conf_file(d)
- lines = sanity_conf_read(bblayers_fn)
-
- if current_lconf == 4 and lconf_version > 4:
- topdir_var = '$' + '{TOPDIR}'
- index, bbpath_line = sanity_conf_find_line('BBPATH', lines)
- if bbpath_line:
- start = bbpath_line.find('"')
- if start != -1 and (len(bbpath_line) != (start + 1)):
- if bbpath_line[start + 1] == '"':
- lines[index] = (bbpath_line[:start + 1] +
- topdir_var + bbpath_line[start + 1:])
- else:
- if not topdir_var in bbpath_line:
- lines[index] = (bbpath_line[:start + 1] +
- topdir_var + ':' + bbpath_line[start + 1:])
- else:
- raise NotImplementedError(failmsg)
- else:
- index, bbfiles_line = sanity_conf_find_line('BBFILES', lines)
- if bbfiles_line:
- lines.insert(index, 'BBPATH = "' + topdir_var + '"\n')
- else:
- raise NotImplementedError(failmsg)
-
- current_lconf += 1
- sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_lconf)
- bb.note("Your conf/bblayers.conf has been automatically updated.")
- return
-
- elif current_lconf == 5 and lconf_version > 5:
- # Null update, to avoid issues with people switching between poky and other distros
- current_lconf = 6
- sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_lconf)
- bb.note("Your conf/bblayers.conf has been automatically updated.")
- return
-
- status.addresult()
-
- elif current_lconf == 6 and lconf_version > 6:
- # Handle rename of meta-yocto -> meta-poky
- # This marks the start of separate version numbers but code is needed in OE-Core
- # for the migration, one last time.
- layers = d.getVar('BBLAYERS').split()
- layers = [ os.path.basename(path) for path in layers ]
- if 'meta-yocto' in layers:
- found = False
- while True:
- index, meta_yocto_line = sanity_conf_find_line(r'.*meta-yocto[\'"\s\n]', lines)
- if meta_yocto_line:
- lines[index] = meta_yocto_line.replace('meta-yocto', 'meta-poky')
- found = True
- else:
- break
- if not found:
- raise NotImplementedError(failmsg)
- index, meta_yocto_line = sanity_conf_find_line('LCONF_VERSION.*\n', lines)
- if meta_yocto_line:
- lines[index] = 'POKY_BBLAYERS_CONF_VERSION = "1"\n'
- else:
- raise NotImplementedError(failmsg)
- with open(bblayers_fn, "w") as f:
- f.write(''.join(lines))
- bb.note("Your conf/bblayers.conf has been automatically updated.")
- return
- current_lconf += 1
- sanity_conf_update(bblayers_fn, lines, 'LCONF_VERSION', current_lconf)
- bb.note("Your conf/bblayers.conf has been automatically updated.")
- return
-
- raise NotImplementedError(failmsg)
-}
-
-def raise_sanity_error(msg, d, network_error=False):
- if d.getVar("SANITY_USE_EVENTS") == "1":
- try:
- bb.event.fire(bb.event.SanityCheckFailed(msg, network_error), d)
- except TypeError:
- bb.event.fire(bb.event.SanityCheckFailed(msg), d)
- return
-
- bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration.
- Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
- Following is the list of potential problems / advisories:
-
- %s""" % msg)
-
-# Check a single tune for validity.
-def check_toolchain_tune(data, tune, multilib):
- tune_errors = []
- if not tune:
- return "No tuning found for %s multilib." % multilib
- localdata = bb.data.createCopy(data)
- if multilib != "default":
- # Apply the overrides so we can look at the details.
- overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + multilib
- localdata.setVar("OVERRIDES", overrides)
- bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib))
- features = (localdata.getVar("TUNE_FEATURES:tune-%s" % tune) or "").split()
- if not features:
- return "Tuning '%s' has no defined features, and cannot be used." % tune
- valid_tunes = localdata.getVarFlags('TUNEVALID') or {}
- conflicts = localdata.getVarFlags('TUNECONFLICTS') or {}
- # [doc] is the documentation for the variable, not a real feature
- if 'doc' in valid_tunes:
- del valid_tunes['doc']
- if 'doc' in conflicts:
- del conflicts['doc']
- for feature in features:
- if feature in conflicts:
- for conflict in conflicts[feature].split():
- if conflict in features:
- tune_errors.append("Feature '%s' conflicts with '%s'." %
- (feature, conflict))
- if feature in valid_tunes:
- bb.debug(2, " %s: %s" % (feature, valid_tunes[feature]))
- else:
- tune_errors.append("Feature '%s' is not defined." % feature)
- if tune_errors:
- return "Tuning '%s' has the following errors:\n" % tune + '\n'.join(tune_errors)
-
-def check_toolchain(data):
- tune_error_set = []
- deftune = data.getVar("DEFAULTTUNE")
- tune_errors = check_toolchain_tune(data, deftune, 'default')
- if tune_errors:
- tune_error_set.append(tune_errors)
-
- multilibs = (data.getVar("MULTILIB_VARIANTS") or "").split()
- global_multilibs = (data.getVar("MULTILIB_GLOBAL_VARIANTS") or "").split()
-
- if multilibs:
- seen_libs = []
- seen_tunes = []
- for lib in multilibs:
- if lib in seen_libs:
- tune_error_set.append("The multilib '%s' appears more than once." % lib)
- else:
- seen_libs.append(lib)
- if not lib in global_multilibs:
- tune_error_set.append("Multilib %s is not present in MULTILIB_GLOBAL_VARIANTS" % lib)
- tune = data.getVar("DEFAULTTUNE:virtclass-multilib-%s" % lib)
- if tune in seen_tunes:
- tune_error_set.append("The tuning '%s' appears in more than one multilib." % tune)
- else:
- seen_libs.append(tune)
- if tune == deftune:
- tune_error_set.append("Multilib '%s' (%s) is also the default tuning." % (lib, deftune))
- else:
- tune_errors = check_toolchain_tune(data, tune, lib)
- if tune_errors:
- tune_error_set.append(tune_errors)
- if tune_error_set:
- return "Toolchain tunings invalid:\n" + '\n'.join(tune_error_set) + "\n"
-
- return ""
-
-def check_conf_exists(fn, data):
- bbpath = []
- fn = data.expand(fn)
- vbbpath = data.getVar("BBPATH", False)
- if vbbpath:
- bbpath += vbbpath.split(":")
- for p in bbpath:
- currname = os.path.join(data.expand(p), fn)
- if os.access(currname, os.R_OK):
- return True
- return False
-
-def check_create_long_filename(filepath, pathname):
- import string, random
- testfile = os.path.join(filepath, ''.join(random.choice(string.ascii_letters) for x in range(200)))
- try:
- if not os.path.exists(filepath):
- bb.utils.mkdirhier(filepath)
- f = open(testfile, "w")
- f.close()
- os.remove(testfile)
- except IOError as e:
- import errno
- err, strerror = e.args
- if err == errno.ENAMETOOLONG:
- return "Failed to create a file with a long name in %s. Please use a filesystem that does not unreasonably limit filename length.\n" % pathname
- else:
- return "Failed to create a file in %s: %s.\n" % (pathname, strerror)
- except OSError as e:
- errno, strerror = e.args
- return "Failed to create %s directory in which to run long name sanity check: %s.\n" % (pathname, strerror)
- return ""
-
-def check_path_length(filepath, pathname, limit):
- if len(filepath) > limit:
- return "The length of %s is longer than %s, this would cause unexpected errors, please use a shorter path.\n" % (pathname, limit)
- return ""
-
-def get_filesystem_id(path):
- import subprocess
- try:
- return subprocess.check_output(["stat", "-f", "-c", "%t", path]).decode('utf-8').strip()
- except subprocess.CalledProcessError:
- bb.warn("Can't get filesystem id of: %s" % path)
- return None
-
-# Check that the path isn't located on nfs.
-def check_not_nfs(path, name):
- # The nfs' filesystem id is 6969
- if get_filesystem_id(path) == "6969":
- return "The %s: %s can't be located on nfs.\n" % (name, path)
- return ""
-
-# Check that the path is on a case-sensitive file system
-def check_case_sensitive(path, name):
- import tempfile
- with tempfile.NamedTemporaryFile(prefix='TmP', dir=path) as tmp_file:
- if os.path.exists(tmp_file.name.lower()):
- return "The %s (%s) can't be on a case-insensitive file system.\n" % (name, path)
- return ""
-
-# Check that path isn't a broken symlink
-def check_symlink(lnk, data):
- if os.path.islink(lnk) and not os.path.exists(lnk):
- raise_sanity_error("%s is a broken symlink." % lnk, data)
-
-def check_connectivity(d):
- # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
- # using the same syntax as for SRC_URI. If the variable is not set
- # the check is skipped
- test_uris = (d.getVar('CONNECTIVITY_CHECK_URIS') or "").split()
- retval = ""
-
- bbn = d.getVar('BB_NO_NETWORK')
- if bbn not in (None, '0', '1'):
- return 'BB_NO_NETWORK should be "0" or "1", but it is "%s"' % bbn
-
- # Only check connectivity if network enabled and the
- # CONNECTIVITY_CHECK_URIS are set
- network_enabled = not (bbn == '1')
- check_enabled = len(test_uris)
- if check_enabled and network_enabled:
- # Take a copy of the data store and unset MIRRORS and PREMIRRORS
- data = bb.data.createCopy(d)
- data.delVar('PREMIRRORS')
- data.delVar('MIRRORS')
- try:
- fetcher = bb.fetch2.Fetch(test_uris, data)
- fetcher.checkstatus()
- except Exception as err:
- # Allow the message to be configured so that users can be
- # pointed to a support mechanism.
- msg = data.getVar('CONNECTIVITY_CHECK_MSG') or ""
- if len(msg) == 0:
- msg = "%s.\n" % err
- msg += " Please ensure your host's network is configured correctly.\n"
- msg += " If your ISP or network is blocking the above URL,\n"
- msg += " try with another domain name, for example by setting:\n"
- msg += " CONNECTIVITY_CHECK_URIS = \"https://www.example.com/\""
- msg += " You could also set BB_NO_NETWORK = \"1\" to disable network\n"
- msg += " access if all required sources are on local disk.\n"
- retval = msg
-
- return retval
-
-def check_supported_distro(sanity_data):
- from fnmatch import fnmatch
-
- tested_distros = sanity_data.getVar('SANITY_TESTED_DISTROS')
- if not tested_distros:
- return
-
- try:
- distro = oe.lsb.distro_identifier()
- except Exception:
- distro = None
-
- if not distro:
- bb.warn('Host distribution could not be determined; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.')
-
- for supported in [x.strip() for x in tested_distros.split('\\n')]:
- if fnmatch(distro, supported):
- return
-
- bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro)
-
-# Checks we should only make if MACHINE is set correctly
-def check_sanity_validmachine(sanity_data):
- messages = ""
-
- # Check TUNE_ARCH is set
- if sanity_data.getVar('TUNE_ARCH') == 'INVALID':
- messages = messages + 'TUNE_ARCH is unset. Please ensure your MACHINE configuration includes a valid tune configuration file which will set this correctly.\n'
-
- # Check TARGET_OS is set
- if sanity_data.getVar('TARGET_OS') == 'INVALID':
- messages = messages + 'Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.\n'
-
- # Check that we don't have duplicate entries in PACKAGE_ARCHS & that TUNE_PKGARCH is in PACKAGE_ARCHS
- pkgarchs = sanity_data.getVar('PACKAGE_ARCHS')
- tunepkg = sanity_data.getVar('TUNE_PKGARCH')
- defaulttune = sanity_data.getVar('DEFAULTTUNE')
- tunefound = False
- seen = {}
- dups = []
-
- for pa in pkgarchs.split():
- if seen.get(pa, 0) == 1:
- dups.append(pa)
- else:
- seen[pa] = 1
- if pa == tunepkg:
- tunefound = True
-
- if len(dups):
- messages = messages + "Error, the PACKAGE_ARCHS variable contains duplicates. The following archs are listed more than once: %s" % " ".join(dups)
-
- if tunefound == False:
- messages = messages + "Error, the PACKAGE_ARCHS variable (%s) for DEFAULTTUNE (%s) does not contain TUNE_PKGARCH (%s)." % (pkgarchs, defaulttune, tunepkg)
-
- return messages
-
-# Patch before 2.7 can't handle all the features in git-style diffs. Some
-# patches may incorrectly apply, and others won't apply at all.
-def check_patch_version(sanity_data):
- import re, subprocess
-
- try:
- result = subprocess.check_output(["patch", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
- version = re.search(r"[0-9.]+", result.splitlines()[0]).group()
- if bb.utils.vercmp_string_op(version, "2.7", "<"):
- return "Your version of patch is older than 2.7 and has bugs which will break builds. Please install a newer version of patch.\n"
- else:
- return None
- except subprocess.CalledProcessError as e:
- return "Unable to execute patch --version, exit code %d:\n%s\n" % (e.returncode, e.output)
-
-# Glibc needs make 4.0 or later, we may as well match at this point
-def check_make_version(sanity_data):
- import subprocess
-
- try:
- result = subprocess.check_output(['make', '--version'], stderr=subprocess.STDOUT).decode('utf-8')
- except subprocess.CalledProcessError as e:
- return "Unable to execute make --version, exit code %d\n%s\n" % (e.returncode, e.output)
- version = result.split()[2]
- if bb.utils.vercmp_string_op(version, "4.0", "<"):
- return "Please install a make version of 4.0 or later.\n"
-
- if bb.utils.vercmp_string_op(version, "4.2.1", "=="):
- distro = oe.lsb.distro_identifier()
- if "ubuntu" in distro or "debian" in distro or "linuxmint" in distro:
- return None
- return "make version 4.2.1 is known to have issues on Centos/OpenSUSE and other non-Ubuntu systems. Please use a buildtools-make-tarball or a newer version of make.\n"
- return None
-
-
-# Check if we're running on WSL (Windows Subsystem for Linux).
-# WSLv1 is known not to work but WSLv2 should work properly as
-# long as the VHDX file is optimized often, let the user know
-# upfront.
-# More information on installing WSLv2 at:
-# https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
-def check_wsl(d):
- with open("/proc/version", "r") as f:
- verdata = f.readlines()
- for l in verdata:
- if "Microsoft" in l:
- return "OpenEmbedded doesn't work under WSLv1, please upgrade to WSLv2 if you want to run builds on Windows"
- elif "microsoft" in l:
- bb.warn("You are running bitbake under WSLv2, this works properly but you should optimize your VHDX file eventually to avoid running out of storage space")
- return None
-
-# Require at least gcc version 7.5.
-#
-# This can be fixed on CentOS-7 with devtoolset-6+
-# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/
-#
-# A less invasive fix is with scripts/install-buildtools (or with user
-# built buildtools-extended-tarball)
-#
-def check_gcc_version(sanity_data):
- import subprocess
-
- build_cc, version = oe.utils.get_host_compiler_version(sanity_data)
- if build_cc.strip() == "gcc":
- if bb.utils.vercmp_string_op(version, "7.5", "<"):
- return "Your version of gcc is older than 7.5 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n"
- return None
-
-# Tar version 1.24 and onwards handle overwriting symlinks correctly
-# but earlier versions do not; this needs to work properly for sstate
-# Version 1.28 is needed so opkg-build works correctly when reproducibile builds are enabled
-def check_tar_version(sanity_data):
- import subprocess
- try:
- result = subprocess.check_output(["tar", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
- except subprocess.CalledProcessError as e:
- return "Unable to execute tar --version, exit code %d\n%s\n" % (e.returncode, e.output)
- version = result.split()[3]
- if bb.utils.vercmp_string_op(version, "1.28", "<"):
- return "Your version of tar is older than 1.28 and does not have the support needed to enable reproducible builds. Please install a newer version of tar (you could use the project's buildtools-tarball from our last release or use scripts/install-buildtools).\n"
- return None
-
-# We use git parameters and functionality only found in 1.7.8 or later
-# The kernel tools assume git >= 1.8.3.1 (verified needed > 1.7.9.5) see #6162
-# The git fetcher also had workarounds for git < 1.7.9.2 which we've dropped
-def check_git_version(sanity_data):
- import subprocess
- try:
- result = subprocess.check_output(["git", "--version"], stderr=subprocess.DEVNULL).decode('utf-8')
- except subprocess.CalledProcessError as e:
- return "Unable to execute git --version, exit code %d\n%s\n" % (e.returncode, e.output)
- version = result.split()[2]
- if bb.utils.vercmp_string_op(version, "1.8.3.1", "<"):
- return "Your version of git is older than 1.8.3.1 and has bugs which will break builds. Please install a newer version of git.\n"
- return None
-
-# Check the required perl modules which may not be installed by default
-def check_perl_modules(sanity_data):
- import subprocess
- ret = ""
- modules = ( "Text::ParseWords", "Thread::Queue", "Data::Dumper" )
- errresult = ''
- for m in modules:
- try:
- subprocess.check_output(["perl", "-e", "use %s" % m])
- except subprocess.CalledProcessError as e:
- errresult += bytes.decode(e.output)
- ret += "%s " % m
- if ret:
- return "Required perl module(s) not found: %s\n\n%s\n" % (ret, errresult)
- return None
-
-def sanity_check_conffiles(d):
- funcs = d.getVar('BBLAYERS_CONF_UPDATE_FUNCS').split()
- for func in funcs:
- conffile, current_version, required_version, func = func.split(":")
- if check_conf_exists(conffile, d) and d.getVar(current_version) is not None and \
- d.getVar(current_version) != d.getVar(required_version):
- try:
- bb.build.exec_func(func, d)
- except NotImplementedError as e:
- bb.fatal(str(e))
- d.setVar("BB_INVALIDCONF", True)
-
-def drop_v14_cross_builds(d):
- import glob
- indexes = glob.glob(d.expand("${SSTATE_MANIFESTS}/index-${BUILD_ARCH}_*"))
- for i in indexes:
- with open(i, "r") as f:
- lines = f.readlines()
- for l in reversed(lines):
- try:
- (stamp, manifest, workdir) = l.split()
- except ValueError:
- bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i))
- for m in glob.glob(manifest + ".*"):
- if m.endswith(".postrm"):
- continue
- sstate_clean_manifest(m, d)
- bb.utils.remove(stamp + "*")
- bb.utils.remove(workdir, recurse = True)
-
-def sanity_handle_abichanges(status, d):
- #
- # Check the 'ABI' of TMPDIR
- #
- import subprocess
-
- current_abi = d.getVar('OELAYOUT_ABI')
- abifile = d.getVar('SANITY_ABIFILE')
- if os.path.exists(abifile):
- with open(abifile, "r") as f:
- abi = f.read().strip()
- if not abi.isdigit():
- with open(abifile, "w") as f:
- f.write(current_abi)
- elif int(abi) <= 11 and current_abi == "12":
- status.addresult("The layout of TMPDIR changed for Recipe Specific Sysroots.\nConversion doesn't make sense and this change will rebuild everything so please delete TMPDIR (%s).\n" % d.getVar("TMPDIR"))
- elif int(abi) <= 13 and current_abi == "14":
- status.addresult("TMPDIR changed to include path filtering from the pseudo database.\nIt is recommended to use a clean TMPDIR with the new pseudo path filtering so TMPDIR (%s) would need to be removed to continue.\n" % d.getVar("TMPDIR"))
- elif int(abi) == 14 and current_abi == "15":
- drop_v14_cross_builds(d)
- with open(abifile, "w") as f:
- f.write(current_abi)
- elif (abi != current_abi):
- # Code to convert from one ABI to another could go here if possible.
- status.addresult("Error, TMPDIR has changed its layout version number (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi))
- else:
- with open(abifile, "w") as f:
- f.write(current_abi)
-
-def check_sanity_sstate_dir_change(sstate_dir, data):
- # Sanity checks to be done when the value of SSTATE_DIR changes
-
- # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
- testmsg = ""
- if sstate_dir != "":
- testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
- # If we don't have permissions to SSTATE_DIR, suggest the user set it as an SSTATE_MIRRORS
- try:
- err = testmsg.split(': ')[1].strip()
- if err == "Permission denied.":
- testmsg = testmsg + "You could try using %s in SSTATE_MIRRORS rather than as an SSTATE_CACHE.\n" % (sstate_dir)
- except IndexError:
- pass
- return testmsg
-
-def check_sanity_version_change(status, d):
- # Sanity checks to be done when SANITY_VERSION or NATIVELSBSTRING changes
- # In other words, these tests run once in a given build directory and then
- # never again until the sanity version or host distrubution id/version changes.
-
- # Check the python install is complete. Examples that are often removed in
- # minimal installations: glib-2.0-natives requries # xml.parsers.expat and icu
- # requires distutils.sysconfig.
- try:
- import xml.parsers.expat
- import distutils.sysconfig
- except ImportError as e:
- status.addresult('Your Python 3 is not a full install. Please install the module %s (see the Getting Started guide for further information).\n' % e.name)
-
- status.addresult(check_gcc_version(d))
- status.addresult(check_make_version(d))
- status.addresult(check_patch_version(d))
- status.addresult(check_tar_version(d))
- status.addresult(check_git_version(d))
- status.addresult(check_perl_modules(d))
- status.addresult(check_wsl(d))
-
- missing = ""
-
- if not check_app_exists("${MAKE}", d):
- missing = missing + "GNU make,"
-
- if not check_app_exists('${BUILD_CC}', d):
- missing = missing + "C Compiler (%s)," % d.getVar("BUILD_CC")
-
- if not check_app_exists('${BUILD_CXX}', d):
- missing = missing + "C++ Compiler (%s)," % d.getVar("BUILD_CXX")
-
- required_utilities = d.getVar('SANITY_REQUIRED_UTILITIES')
-
- for util in required_utilities.split():
- if not check_app_exists(util, d):
- missing = missing + "%s," % util
-
- if missing:
- missing = missing.rstrip(',')
- status.addresult("Please install the following missing utilities: %s\n" % missing)
-
- assume_provided = d.getVar('ASSUME_PROVIDED').split()
- # Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf
- if "diffstat-native" not in assume_provided:
- status.addresult('Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf\n')
-
- # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
- import stat
- tmpdir = d.getVar('TMPDIR')
- status.addresult(check_create_long_filename(tmpdir, "TMPDIR"))
- tmpdirmode = os.stat(tmpdir).st_mode
- if (tmpdirmode & stat.S_ISGID):
- status.addresult("TMPDIR is setgid, please don't build in a setgid directory")
- if (tmpdirmode & stat.S_ISUID):
- status.addresult("TMPDIR is setuid, please don't build in a setuid directory")
-
- # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS
- pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
- workdir = d.getVar('WORKDIR', expand=True)
- for i in pseudoignorepaths:
- if i and workdir.startswith(i):
- status.addresult("You are building in a path included in PSEUDO_IGNORE_PATHS " + str(i) + " please locate the build outside this path.\n")
-
- # Check if PSEUDO_IGNORE_PATHS and and paths under pseudo control overlap
- pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
- pseudo_control_dir = "${D},${PKGD},${PKGDEST},${IMAGEROOTFS},${SDK_OUTPUT}"
- pseudocontroldir = d.expand(pseudo_control_dir).split(",")
- for i in pseudoignorepaths:
- for j in pseudocontroldir:
- if i and j:
- if j.startswith(i):
- status.addresult("A path included in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " overlap and this will break pseudo permission and ownership tracking. Please set the path " + str(j) + " to a different directory which does not overlap with pseudo controlled directories. \n")
-
- # Some third-party software apparently relies on chmod etc. being suid root (!!)
- import stat
- suid_check_bins = "chown chmod mknod".split()
- for bin_cmd in suid_check_bins:
- bin_path = bb.utils.which(os.environ["PATH"], bin_cmd)
- if bin_path:
- bin_stat = os.stat(bin_path)
- if bin_stat.st_uid == 0 and bin_stat.st_mode & stat.S_ISUID:
- status.addresult('%s has the setuid bit set. This interferes with pseudo and may cause other issues that break the build process.\n' % bin_path)
-
- # Check that we can fetch from various network transports
- netcheck = check_connectivity(d)
- status.addresult(netcheck)
- if netcheck:
- status.network_error = True
-
- nolibs = d.getVar('NO32LIBS')
- if not nolibs:
- lib32path = '/lib'
- if os.path.exists('/lib64') and ( os.path.islink('/lib64') or os.path.islink('/lib') ):
- lib32path = '/lib32'
-
- if os.path.exists('%s/libc.so.6' % lib32path) and not os.path.exists('/usr/include/gnu/stubs-32.h'):
- status.addresult("You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n")
-
- bbpaths = d.getVar('BBPATH').split(":")
- if ("." in bbpaths or "./" in bbpaths or "" in bbpaths):
- status.addresult("BBPATH references the current directory, either through " \
- "an empty entry, a './' or a '.'.\n\t This is unsafe and means your "\
- "layer configuration is adding empty elements to BBPATH.\n\t "\
- "Please check your layer.conf files and other BBPATH " \
- "settings to remove the current working directory " \
- "references.\n" \
- "Parsed BBPATH is" + str(bbpaths));
-
- oes_bb_conf = d.getVar( 'OES_BITBAKE_CONF')
- if not oes_bb_conf:
- status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n')
-
- # The length of TMPDIR can't be longer than 410
- status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
-
- # Check that TMPDIR isn't located on nfs
- status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
-
- # Check for case-insensitive file systems (such as Linux in Docker on
- # macOS with default HFS+ file system)
- status.addresult(check_case_sensitive(tmpdir, "TMPDIR"))
-
-def sanity_check_locale(d):
- """
- Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists.
- """
- import locale
- try:
- locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
- except locale.Error:
- raise_sanity_error("Your system needs to support the en_US.UTF-8 locale.", d)
-
-def check_sanity_everybuild(status, d):
- import os, stat
- # Sanity tests which test the users environment so need to run at each build (or are so cheap
- # it makes sense to always run them.
-
- if 0 == os.getuid():
- raise_sanity_error("Do not use Bitbake as root.", d)
-
- # Check the Python version, we now have a minimum of Python 3.6
- import sys
- if sys.hexversion < 0x030600F0:
- status.addresult('The system requires at least Python 3.6 to run. Please update your Python interpreter.\n')
-
- # Check the bitbake version meets minimum requirements
- minversion = d.getVar('BB_MIN_VERSION')
- if bb.utils.vercmp_string_op(bb.__version__, minversion, "<"):
- status.addresult('Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__))
-
- sanity_check_locale(d)
-
- paths = d.getVar('PATH').split(":")
- if "." in paths or "./" in paths or "" in paths:
- status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n")
-
- #Check if bitbake is present in PATH environment variable
- bb_check = bb.utils.which(d.getVar('PATH'), 'bitbake')
- if not bb_check:
- bb.warn("bitbake binary is not found in PATH, did you source the script?")
-
- # Check whether 'inherit' directive is found (used for a class to inherit)
- # in conf file it's supposed to be uppercase INHERIT
- inherit = d.getVar('inherit')
- if inherit:
- status.addresult("Please don't use inherit directive in your local.conf. The directive is supposed to be used in classes and recipes only to inherit of bbclasses. Here INHERIT should be used.\n")
-
- # Check that the DISTRO is valid, if set
- # need to take into account DISTRO renaming DISTRO
- distro = d.getVar('DISTRO')
- if distro and distro != "nodistro":
- if not ( check_conf_exists("conf/distro/${DISTRO}.conf", d) or check_conf_exists("conf/distro/include/${DISTRO}.inc", d) ):
- status.addresult("DISTRO '%s' not found. Please set a valid DISTRO in your local.conf\n" % d.getVar("DISTRO"))
-
- # Check that these variables don't use tilde-expansion as we don't do that
- for v in ("TMPDIR", "DL_DIR", "SSTATE_DIR"):
- if d.getVar(v).startswith("~"):
- status.addresult("%s uses ~ but Bitbake will not expand this, use an absolute path or variables." % v)
-
- # Check that DL_DIR is set, exists and is writable. In theory, we should never even hit the check if DL_DIR isn't
- # set, since so much relies on it being set.
- dldir = d.getVar('DL_DIR')
- if not dldir:
- status.addresult("DL_DIR is not set. Your environment is misconfigured, check that DL_DIR is set, and if the directory exists, that it is writable. \n")
- if os.path.exists(dldir) and not os.access(dldir, os.W_OK):
- status.addresult("DL_DIR: %s exists but you do not appear to have write access to it. \n" % dldir)
- check_symlink(dldir, d)
-
- # Check that the MACHINE is valid, if it is set
- machinevalid = True
- if d.getVar('MACHINE'):
- if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
- status.addresult('MACHINE=%s is invalid. Please set a valid MACHINE in your local.conf, environment or other configuration file.\n' % (d.getVar('MACHINE')))
- machinevalid = False
- else:
- status.addresult(check_sanity_validmachine(d))
- else:
- status.addresult('Please set a MACHINE in your local.conf or environment\n')
- machinevalid = False
- if machinevalid:
- status.addresult(check_toolchain(d))
-
- # Check that the SDKMACHINE is valid, if it is set
- if d.getVar('SDKMACHINE'):
- if not check_conf_exists("conf/machine-sdk/${SDKMACHINE}.conf", d):
- status.addresult('Specified SDKMACHINE value is not valid\n')
- elif d.getVar('SDK_ARCH', False) == "${BUILD_ARCH}":
- status.addresult('SDKMACHINE is set, but SDK_ARCH has not been changed as a result - SDKMACHINE may have been set too late (e.g. in the distro configuration)\n')
-
- # If SDK_VENDOR looks like "-my-sdk" then the triples are badly formed so fail early
- sdkvendor = d.getVar("SDK_VENDOR")
- if not (sdkvendor.startswith("-") and sdkvendor.count("-") == 1):
- status.addresult("SDK_VENDOR should be of the form '-foosdk' with a single dash; found '%s'\n" % sdkvendor)
-
- check_supported_distro(d)
-
- omask = os.umask(0o022)
- if omask & 0o755:
- status.addresult("Please use a umask which allows a+rx and u+rwx\n")
- os.umask(omask)
-
- if d.getVar('TARGET_ARCH') == "arm":
- # This path is no longer user-readable in modern (very recent) Linux
- try:
- if os.path.exists("/proc/sys/vm/mmap_min_addr"):
- f = open("/proc/sys/vm/mmap_min_addr", "r")
- try:
- if (int(f.read().strip()) > 65536):
- status.addresult("/proc/sys/vm/mmap_min_addr is not <= 65536. This will cause problems with qemu so please fix the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 65536 in /etc/sysctl.conf.\n")
- finally:
- f.close()
- except:
- pass
-
- for checkdir in ['COREBASE', 'TMPDIR']:
- val = d.getVar(checkdir)
- if val.find('..') != -1:
- status.addresult("Error, you have '..' in your %s directory path. Please ensure the variable contains an absolute path as this can break some recipe builds in obtuse ways." % checkdir)
- if val.find('+') != -1:
- status.addresult("Error, you have an invalid character (+) in your %s directory path. Please move the installation to a directory which doesn't include any + characters." % checkdir)
- if val.find('@') != -1:
- status.addresult("Error, you have an invalid character (@) in your %s directory path. Please move the installation to a directory which doesn't include any @ characters." % checkdir)
- if val.find(' ') != -1:
- status.addresult("Error, you have a space in your %s directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this." % checkdir)
- if val.find('%') != -1:
- status.addresult("Error, you have an invalid character (%) in your %s directory path which causes problems with python string formatting. Please move the installation to a directory which doesn't include any % characters." % checkdir)
-
- # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
- import re
- mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
- protocols = ['http', 'ftp', 'file', 'https', \
- 'git', 'gitsm', 'hg', 'osc', 'p4', 'svn', \
- 'bzr', 'cvs', 'npm', 'sftp', 'ssh', 's3', 'az', 'ftps']
- for mirror_var in mirror_vars:
- mirrors = (d.getVar(mirror_var) or '').replace('\\n', ' ').split()
-
- # Split into pairs
- if len(mirrors) % 2 != 0:
- bb.warn('Invalid mirror variable value for %s: %s, should contain paired members.' % (mirror_var, str(mirrors)))
- continue
- mirrors = list(zip(*[iter(mirrors)]*2))
-
- for mirror_entry in mirrors:
- pattern, mirror = mirror_entry
-
- decoded = bb.fetch2.decodeurl(pattern)
- try:
- pattern_scheme = re.compile(decoded[0])
- except re.error as exc:
- bb.warn('Invalid scheme regex (%s) in %s; %s' % (pattern, mirror_var, mirror_entry))
- continue
-
- if not any(pattern_scheme.match(protocol) for protocol in protocols):
- bb.warn('Invalid protocol (%s) in %s: %s' % (decoded[0], mirror_var, mirror_entry))
- continue
-
- if not any(mirror.startswith(protocol + '://') for protocol in protocols):
- bb.warn('Invalid protocol in %s: %s' % (mirror_var, mirror_entry))
- continue
-
- if mirror.startswith('file://'):
- import urllib
- check_symlink(urllib.parse.urlparse(mirror).path, d)
- # SSTATE_MIRROR ends with a /PATH string
- if mirror.endswith('/PATH'):
- # remove /PATH$ from SSTATE_MIRROR to get a working
- # base directory path
- mirror_base = urllib.parse.urlparse(mirror[:-1*len('/PATH')]).path
- check_symlink(mirror_base, d)
-
- # Check sstate mirrors aren't being used with a local hash server and no remote
- hashserv = d.getVar("BB_HASHSERVE")
- if d.getVar("SSTATE_MIRRORS") and hashserv and hashserv.startswith("unix://") and not d.getVar("BB_HASHSERVE_UPSTREAM"):
- bb.warn("You are using a local hash equivalence server but have configured an sstate mirror. This will likely mean no sstate will match from the mirror. You may wish to disable the hash equivalence use (BB_HASHSERVE), or use a hash equivalence server alongside the sstate mirror.")
-
- # Check that TMPDIR hasn't changed location since the last time we were run
- tmpdir = d.getVar('TMPDIR')
- checkfile = os.path.join(tmpdir, "saved_tmpdir")
- if os.path.exists(checkfile):
- with open(checkfile, "r") as f:
- saved_tmpdir = f.read().strip()
- if (saved_tmpdir != tmpdir):
- status.addresult("Error, TMPDIR has changed location. You need to either move it back to %s or delete it and rebuild\n" % saved_tmpdir)
- else:
- bb.utils.mkdirhier(tmpdir)
- # Remove setuid, setgid and sticky bits from TMPDIR
- try:
- os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISUID)
- os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISGID)
- os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISVTX)
- except OSError as exc:
- bb.warn("Unable to chmod TMPDIR: %s" % exc)
- with open(checkfile, "w") as f:
- f.write(tmpdir)
-
- # If /bin/sh is a symlink, check that it points to dash or bash
- if os.path.islink('/bin/sh'):
- real_sh = os.path.realpath('/bin/sh')
- # Due to update-alternatives, the shell name may take various
- # forms, such as /bin/dash, bin/bash, /bin/bash.bash ...
- if '/dash' not in real_sh and '/bash' not in real_sh:
- status.addresult("Error, /bin/sh links to %s, must be dash or bash\n" % real_sh)
-
-def check_sanity(sanity_data):
- class SanityStatus(object):
- def __init__(self):
- self.messages = ""
- self.network_error = False
-
- def addresult(self, message):
- if message:
- self.messages = self.messages + message
-
- status = SanityStatus()
-
- tmpdir = sanity_data.getVar('TMPDIR')
- sstate_dir = sanity_data.getVar('SSTATE_DIR')
-
- check_symlink(sstate_dir, sanity_data)
-
- # Check saved sanity info
- last_sanity_version = 0
- last_tmpdir = ""
- last_sstate_dir = ""
- last_nativelsbstr = ""
- sanityverfile = sanity_data.expand("${TOPDIR}/cache/sanity_info")
- if os.path.exists(sanityverfile):
- with open(sanityverfile, 'r') as f:
- for line in f:
- if line.startswith('SANITY_VERSION'):
- last_sanity_version = int(line.split()[1])
- if line.startswith('TMPDIR'):
- last_tmpdir = line.split()[1]
- if line.startswith('SSTATE_DIR'):
- last_sstate_dir = line.split()[1]
- if line.startswith('NATIVELSBSTRING'):
- last_nativelsbstr = line.split()[1]
-
- check_sanity_everybuild(status, sanity_data)
-
- sanity_version = int(sanity_data.getVar('SANITY_VERSION') or 1)
- network_error = False
- # NATIVELSBSTRING var may have been overridden with "universal", so
- # get actual host distribution id and version
- nativelsbstr = lsb_distro_identifier(sanity_data)
- if last_sanity_version < sanity_version or last_nativelsbstr != nativelsbstr:
- check_sanity_version_change(status, sanity_data)
- status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
- else:
- if last_sstate_dir != sstate_dir:
- status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
-
- if os.path.exists(os.path.dirname(sanityverfile)) and not status.messages:
- with open(sanityverfile, 'w') as f:
- f.write("SANITY_VERSION %s\n" % sanity_version)
- f.write("TMPDIR %s\n" % tmpdir)
- f.write("SSTATE_DIR %s\n" % sstate_dir)
- f.write("NATIVELSBSTRING %s\n" % nativelsbstr)
-
- sanity_handle_abichanges(status, sanity_data)
-
- if status.messages != "":
- raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
-
-# Create a copy of the datastore and finalise it to ensure appends and
-# overrides are set - the datastore has yet to be finalised at ConfigParsed
-def copy_data(e):
- sanity_data = bb.data.createCopy(e.data)
- sanity_data.finalize()
- return sanity_data
-
-addhandler config_reparse_eventhandler
-config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed"
-python config_reparse_eventhandler() {
- sanity_check_conffiles(e.data)
-}
-
-addhandler check_sanity_eventhandler
-check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
-python check_sanity_eventhandler() {
- if bb.event.getName(e) == "SanityCheck":
- sanity_data = copy_data(e)
- check_sanity(sanity_data)
- if e.generateevents:
- sanity_data.setVar("SANITY_USE_EVENTS", "1")
- bb.event.fire(bb.event.SanityCheckPassed(), e.data)
- elif bb.event.getName(e) == "NetworkTest":
- sanity_data = copy_data(e)
- if e.generateevents:
- sanity_data.setVar("SANITY_USE_EVENTS", "1")
- bb.event.fire(bb.event.NetworkTestFailed() if check_connectivity(sanity_data) else bb.event.NetworkTestPassed(), e.data)
-
- return
-}
diff --git a/poky/meta/classes/scons.bbclass b/poky/meta/classes/scons.bbclass
deleted file mode 100644
index 80f8382..0000000
--- a/poky/meta/classes/scons.bbclass
+++ /dev/null
@@ -1,28 +0,0 @@
-inherit python3native
-
-DEPENDS += "python3-scons-native"
-
-EXTRA_OESCONS ?= ""
-
-do_configure() {
- if [ -n "${CONFIGURESTAMPFILE}" -a "${S}" = "${B}" ]; then
- if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then
- ${STAGING_BINDIR_NATIVE}/scons --directory=${S} --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
- fi
-
- mkdir -p `dirname ${CONFIGURESTAMPFILE}`
- echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
- fi
-}
-
-scons_do_compile() {
- ${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
- die "scons build execution failed."
-}
-
-scons_do_install() {
- ${STAGING_BINDIR_NATIVE}/scons --directory=${S} install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \
- die "scons install execution failed."
-}
-
-EXPORT_FUNCTIONS do_compile do_install
diff --git a/poky/meta/classes/setuptools3-base.bbclass b/poky/meta/classes/setuptools3-base.bbclass
deleted file mode 100644
index 15abe1d..0000000
--- a/poky/meta/classes/setuptools3-base.bbclass
+++ /dev/null
@@ -1,31 +0,0 @@
-DEPENDS:append:class-target = " ${PYTHON_PN}-native ${PYTHON_PN}"
-DEPENDS:append:class-nativesdk = " ${PYTHON_PN}-native ${PYTHON_PN}"
-RDEPENDS:${PN}:append:class-target = " ${PYTHON_PN}-core"
-
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-# LDSHARED is the ld *command* used to create shared library
-export LDSHARED = "${CCLD} -shared"
-# LDXXSHARED is the ld *command* used to create shared library of C++
-# objects
-export LDCXXSHARED = "${CXX} -shared"
-# CCSHARED are the C *flags* used to create objects to go into a shared
-# library (module)
-export CCSHARED = "-fPIC -DPIC"
-# LINKFORSHARED are the flags passed to the $(CC) command that links
-# the python executable
-export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic"
-
-FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*"
-
-FILES:${PN}-staticdev += "\
- ${PYTHON_SITEPACKAGES_DIR}/*.a \
-"
-FILES:${PN}-dev += "\
- ${datadir}/pkgconfig \
- ${libdir}/pkgconfig \
- ${PYTHON_SITEPACKAGES_DIR}/*.la \
-"
-inherit python3native python3targetconfig
-
diff --git a/poky/meta/classes/setuptools3.bbclass b/poky/meta/classes/setuptools3.bbclass
deleted file mode 100644
index 66c9466..0000000
--- a/poky/meta/classes/setuptools3.bbclass
+++ /dev/null
@@ -1,32 +0,0 @@
-inherit setuptools3-base python_pep517
-
-DEPENDS += "python3-setuptools-native python3-wheel-native"
-
-SETUPTOOLS_BUILD_ARGS ?= ""
-
-SETUPTOOLS_SETUP_PATH ?= "${S}"
-
-setuptools3_do_configure() {
- :
-}
-
-setuptools3_do_compile() {
- cd ${SETUPTOOLS_SETUP_PATH}
- NO_FETCH_BUILD=1 \
- STAGING_INCDIR=${STAGING_INCDIR} \
- STAGING_LIBDIR=${STAGING_LIBDIR} \
- ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
- bdist_wheel --verbose --dist-dir ${PEP517_WHEEL_PATH} ${SETUPTOOLS_BUILD_ARGS} || \
- bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed."
-}
-setuptools3_do_compile[vardepsexclude] = "MACHINE"
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-# This could be removed in the future but some recipes in meta-oe still use it
-setuptools3_do_install() {
- python_pep517_do_install
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
-
-export LDSHARED="${CCLD} -shared"
diff --git a/poky/meta/classes/setuptools3_legacy.bbclass b/poky/meta/classes/setuptools3_legacy.bbclass
deleted file mode 100644
index 5a99daa..0000000
--- a/poky/meta/classes/setuptools3_legacy.bbclass
+++ /dev/null
@@ -1,78 +0,0 @@
-# This class is for packages which use the deprecated setuptools behaviour,
-# specifically custom install tasks which don't work correctly with bdist_wheel.
-# This behaviour is deprecated in setuptools[1] and won't work in the future, so
-# all users of this should consider their options: pure Python modules can use a
-# modern Python tool such as build[2], or packages which are doing more (such as
-# installing init scripts) should use a fully-featured build system such as Meson.
-#
-# [1] https://setuptools.pypa.io/en/latest/history.html#id142
-# [2] https://pypi.org/project/build/
-
-inherit setuptools3-base
-
-B = "${WORKDIR}/build"
-
-SETUPTOOLS_BUILD_ARGS ?= ""
-SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
- --prefix=${prefix} \
- --install-lib=${PYTHON_SITEPACKAGES_DIR} \
- --install-data=${datadir}"
-
-SETUPTOOLS_PYTHON = "python3"
-SETUPTOOLS_PYTHON:class-native = "nativepython3"
-
-SETUPTOOLS_SETUP_PATH ?= "${S}"
-
-setuptools3_legacy_do_configure() {
- :
-}
-
-setuptools3_legacy_do_compile() {
- cd ${SETUPTOOLS_SETUP_PATH}
- NO_FETCH_BUILD=1 \
- STAGING_INCDIR=${STAGING_INCDIR} \
- STAGING_LIBDIR=${STAGING_LIBDIR} \
- ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
- build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \
- bbfatal_log "'${PYTHON_PN} setup.py build ${SETUPTOOLS_BUILD_ARGS}' execution failed."
-}
-setuptools3_legacy_do_compile[vardepsexclude] = "MACHINE"
-
-setuptools3_legacy_do_install() {
- cd ${SETUPTOOLS_SETUP_PATH}
- install -d ${D}${PYTHON_SITEPACKAGES_DIR}
- STAGING_INCDIR=${STAGING_INCDIR} \
- STAGING_LIBDIR=${STAGING_LIBDIR} \
- PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
- ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
- build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \
- bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed."
-
- # support filenames with *spaces*
- find ${D} -name "*.py" -exec grep -q ${D} {} \; \
- -exec sed -i -e s:${D}::g {} \;
-
- for i in ${D}${bindir}/* ${D}${sbindir}/*; do
- if [ -f "$i" ]; then
- sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i
- sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
- fi
- done
-
- rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
-
- #
- # FIXME: Bandaid against wrong datadir computation
- #
- if [ -e ${D}${datadir}/share ]; then
- mv -f ${D}${datadir}/share/* ${D}${datadir}/
- rmdir ${D}${datadir}/share
- fi
-}
-setuptools3_legacy_do_install[vardepsexclude] = "MACHINE"
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
-
-export LDSHARED="${CCLD} -shared"
-DEPENDS += "python3-setuptools-native"
-
diff --git a/poky/meta/classes/sign_ipk.bbclass b/poky/meta/classes/sign_ipk.bbclass
index e5057b7..51c24b3 100644
--- a/poky/meta/classes/sign_ipk.bbclass
+++ b/poky/meta/classes/sign_ipk.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Class for generating signed IPK packages.
#
# Configuration variables used by this class:
diff --git a/poky/meta/classes/sign_package_feed.bbclass b/poky/meta/classes/sign_package_feed.bbclass
index f1504c2..e9d6647 100644
--- a/poky/meta/classes/sign_package_feed.bbclass
+++ b/poky/meta/classes/sign_package_feed.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Class for signing package feeds
#
# Related configuration variables that will be used after this class is
diff --git a/poky/meta/classes/sign_rpm.bbclass b/poky/meta/classes/sign_rpm.bbclass
index 73a55a5..ee0c480 100644
--- a/poky/meta/classes/sign_rpm.bbclass
+++ b/poky/meta/classes/sign_rpm.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Class for generating signed RPM packages.
#
# Configuration variables used by this class:
diff --git a/poky/meta/classes/siteconfig.bbclass b/poky/meta/classes/siteconfig.bbclass
index 0cfa5a6..953cafd 100644
--- a/poky/meta/classes/siteconfig.bbclass
+++ b/poky/meta/classes/siteconfig.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
python siteconfig_do_siteconfig () {
shared_state = sstate_state_fromvars(d)
if shared_state['task'] != 'populate_sysroot':
diff --git a/poky/meta/classes/siteinfo.bbclass b/poky/meta/classes/siteinfo.bbclass
deleted file mode 100644
index 3555d5a..0000000
--- a/poky/meta/classes/siteinfo.bbclass
+++ /dev/null
@@ -1,226 +0,0 @@
-# This class exists to provide information about the targets that
-# may be needed by other classes and/or recipes. If you add a new
-# target this will probably need to be updated.
-
-#
-# Returns information about 'what' for the named target 'target'
-# where 'target' == "<arch>-<os>"
-#
-# 'what' can be one of
-# * target: Returns the target name ("<arch>-<os>")
-# * endianness: Return "be" for big endian targets, "le" for little endian
-# * bits: Returns the bit size of the target, either "32" or "64"
-# * libc: Returns the name of the c library used by the target
-#
-# It is an error for the target not to exist.
-# If 'what' doesn't exist then an empty value is returned
-#
-def siteinfo_data_for_machine(arch, os, d):
- archinfo = {
- "allarch": "endian-little bit-32", # bogus, but better than special-casing the checks below for allarch
- "aarch64": "endian-little bit-64 arm-common arm-64",
- "aarch64_be": "endian-big bit-64 arm-common arm-64",
- "arc": "endian-little bit-32 arc-common",
- "arceb": "endian-big bit-32 arc-common",
- "arm": "endian-little bit-32 arm-common arm-32",
- "armeb": "endian-big bit-32 arm-common arm-32",
- "avr32": "endian-big bit-32 avr32-common",
- "bfin": "endian-little bit-32 bfin-common",
- "epiphany": "endian-little bit-32",
- "i386": "endian-little bit-32 ix86-common",
- "i486": "endian-little bit-32 ix86-common",
- "i586": "endian-little bit-32 ix86-common",
- "i686": "endian-little bit-32 ix86-common",
- "ia64": "endian-little bit-64",
- "lm32": "endian-big bit-32",
- "m68k": "endian-big bit-32",
- "microblaze": "endian-big bit-32 microblaze-common",
- "microblazeel": "endian-little bit-32 microblaze-common",
- "mips": "endian-big bit-32 mips-common",
- "mips64": "endian-big bit-64 mips-common",
- "mips64el": "endian-little bit-64 mips-common",
- "mipsisa64r6": "endian-big bit-64 mips-common",
- "mipsisa64r6el": "endian-little bit-64 mips-common",
- "mipsel": "endian-little bit-32 mips-common",
- "mipsisa32r6": "endian-big bit-32 mips-common",
- "mipsisa32r6el": "endian-little bit-32 mips-common",
- "powerpc": "endian-big bit-32 powerpc-common",
- "powerpcle": "endian-little bit-32 powerpc-common",
- "nios2": "endian-little bit-32 nios2-common",
- "powerpc64": "endian-big bit-64 powerpc-common",
- "powerpc64le": "endian-little bit-64 powerpc-common",
- "ppc": "endian-big bit-32 powerpc-common",
- "ppc64": "endian-big bit-64 powerpc-common",
- "ppc64le" : "endian-little bit-64 powerpc-common",
- "riscv32": "endian-little bit-32 riscv-common",
- "riscv64": "endian-little bit-64 riscv-common",
- "sh3": "endian-little bit-32 sh-common",
- "sh3eb": "endian-big bit-32 sh-common",
- "sh4": "endian-little bit-32 sh-common",
- "sh4eb": "endian-big bit-32 sh-common",
- "sparc": "endian-big bit-32",
- "viac3": "endian-little bit-32 ix86-common",
- "x86_64": "endian-little", # bitinfo specified in targetinfo
- }
- osinfo = {
- "darwin": "common-darwin",
- "darwin9": "common-darwin",
- "linux": "common-linux common-glibc",
- "linux-gnu": "common-linux common-glibc",
- "linux-gnu_ilp32": "common-linux common-glibc",
- "linux-gnux32": "common-linux common-glibc",
- "linux-gnun32": "common-linux common-glibc",
- "linux-gnueabi": "common-linux common-glibc",
- "linux-gnuspe": "common-linux common-glibc",
- "linux-musl": "common-linux common-musl",
- "linux-muslx32": "common-linux common-musl",
- "linux-musleabi": "common-linux common-musl",
- "linux-muslspe": "common-linux common-musl",
- "uclinux-uclibc": "common-uclibc",
- "cygwin": "common-cygwin",
- "mingw32": "common-mingw",
- }
- targetinfo = {
- "aarch64-linux-gnu": "aarch64-linux",
- "aarch64_be-linux-gnu": "aarch64_be-linux",
- "aarch64-linux-gnu_ilp32": "bit-32 aarch64_be-linux arm-32",
- "aarch64_be-linux-gnu_ilp32": "bit-32 aarch64_be-linux arm-32",
- "aarch64-linux-musl": "aarch64-linux",
- "aarch64_be-linux-musl": "aarch64_be-linux",
- "arm-linux-gnueabi": "arm-linux",
- "arm-linux-musleabi": "arm-linux",
- "armeb-linux-gnueabi": "armeb-linux",
- "armeb-linux-musleabi": "armeb-linux",
- "microblazeel-linux" : "microblaze-linux",
- "microblazeel-linux-musl" : "microblaze-linux",
- "mips-linux-musl": "mips-linux",
- "mipsel-linux-musl": "mipsel-linux",
- "mips64-linux-musl": "mips64-linux",
- "mips64el-linux-musl": "mips64el-linux",
- "mips64-linux-gnun32": "mips-linux bit-32",
- "mips64el-linux-gnun32": "mipsel-linux bit-32",
- "mipsisa64r6-linux-gnun32": "mipsisa32r6-linux bit-32",
- "mipsisa64r6el-linux-gnun32": "mipsisa32r6el-linux bit-32",
- "powerpc-linux": "powerpc32-linux powerpc32-linux-glibc",
- "powerpc-linux-musl": "powerpc-linux powerpc32-linux powerpc32-linux-musl",
- "powerpcle-linux": "powerpc32-linux powerpc32-linux-glibc",
- "powerpcle-linux-musl": "powerpc-linux powerpc32-linux powerpc32-linux-musl",
- "powerpc-linux-gnuspe": "powerpc-linux powerpc32-linux powerpc32-linux-glibc",
- "powerpc-linux-muslspe": "powerpc-linux powerpc32-linux powerpc32-linux-musl",
- "powerpc64-linux-gnuspe": "powerpc-linux powerpc64-linux powerpc64-linux-glibc",
- "powerpc64-linux-muslspe": "powerpc-linux powerpc64-linux powerpc64-linux-musl",
- "powerpc64-linux": "powerpc-linux powerpc64-linux powerpc64-linux-glibc",
- "powerpc64-linux-musl": "powerpc-linux powerpc64-linux powerpc64-linux-musl",
- "powerpc64le-linux": "powerpc-linux powerpc64-linux powerpc64-linux-glibc",
- "powerpc64le-linux-musl": "powerpc-linux powerpc64-linux powerpc64-linux-musl",
- "riscv32-linux": "riscv32-linux",
- "riscv32-linux-musl": "riscv32-linux",
- "riscv64-linux": "riscv64-linux",
- "riscv64-linux-musl": "riscv64-linux",
- "x86_64-cygwin": "bit-64",
- "x86_64-darwin": "bit-64",
- "x86_64-darwin9": "bit-64",
- "x86_64-linux": "bit-64",
- "x86_64-linux-musl": "x86_64-linux bit-64",
- "x86_64-linux-muslx32": "bit-32 ix86-common x32-linux",
- "x86_64-elf": "bit-64",
- "x86_64-linux-gnu": "bit-64 x86_64-linux",
- "x86_64-linux-gnux32": "bit-32 ix86-common x32-linux",
- "x86_64-mingw32": "bit-64",
- }
-
- # Add in any extra user supplied data which may come from a BSP layer, removing the
- # need to always change this class directly
- extra_siteinfo = (d.getVar("SITEINFO_EXTRA_DATAFUNCS") or "").split()
- for m in extra_siteinfo:
- call = m + "(archinfo, osinfo, targetinfo, d)"
- locs = { "archinfo" : archinfo, "osinfo" : osinfo, "targetinfo" : targetinfo, "d" : d}
- archinfo, osinfo, targetinfo = bb.utils.better_eval(call, locs)
-
- target = "%s-%s" % (arch, os)
-
- sitedata = []
- if arch in archinfo:
- sitedata.extend(archinfo[arch].split())
- if os in osinfo:
- sitedata.extend(osinfo[os].split())
- if target in targetinfo:
- sitedata.extend(targetinfo[target].split())
- sitedata.append(target)
- sitedata.append("common")
-
- bb.debug(1, "SITE files %s" % sitedata);
- return sitedata
-
-def siteinfo_data(d):
- return siteinfo_data_for_machine(d.getVar("HOST_ARCH"), d.getVar("HOST_OS"), d)
-
-python () {
- sitedata = set(siteinfo_data(d))
- if "endian-little" in sitedata:
- d.setVar("SITEINFO_ENDIANNESS", "le")
- elif "endian-big" in sitedata:
- d.setVar("SITEINFO_ENDIANNESS", "be")
- else:
- bb.error("Unable to determine endianness for architecture '%s'" %
- d.getVar("HOST_ARCH"))
- bb.fatal("Please add your architecture to siteinfo.bbclass")
-
- if "bit-32" in sitedata:
- d.setVar("SITEINFO_BITS", "32")
- elif "bit-64" in sitedata:
- d.setVar("SITEINFO_BITS", "64")
- else:
- bb.error("Unable to determine bit size for architecture '%s'" %
- d.getVar("HOST_ARCH"))
- bb.fatal("Please add your architecture to siteinfo.bbclass")
-}
-
-# Layers with siteconfig need to add a replacement path to this variable so the
-# sstate isn't path specific
-SITEINFO_PATHVARS = "COREBASE"
-
-def siteinfo_get_files(d, sysrootcache=False):
- sitedata = siteinfo_data(d)
- sitefiles = []
- searched = []
- for path in d.getVar("BBPATH").split(":"):
- for element in sitedata:
- filename = os.path.join(path, "site", element)
- if os.path.exists(filename):
- searched.append(filename + ":True")
- sitefiles.append(filename)
- else:
- searched.append(filename + ":False")
-
- # Have to parameterise out hardcoded paths such as COREBASE for the main site files
- for var in d.getVar("SITEINFO_PATHVARS").split():
- searched2 = []
- replace = os.path.normpath(d.getVar(var))
- for s in searched:
- searched2.append(s.replace(replace, "${" + var + "}"))
- searched = searched2
-
- if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
- # We need sstate sigs for native/cross not to vary upon arch so we can't depend on the site files.
- # In future we may want to depend upon all site files?
- # This would show up as breaking sstatetests.SStateTests.test_sstate_32_64_same_hash for example
- searched = []
-
- if not sysrootcache:
- return sitefiles, searched
-
- # Now check for siteconfig cache files in sysroots
- path_siteconfig = d.getVar('SITECONFIG_SYSROOTCACHE')
- if path_siteconfig and os.path.isdir(path_siteconfig):
- for i in os.listdir(path_siteconfig):
- if not i.endswith("_config"):
- continue
- filename = os.path.join(path_siteconfig, i)
- sitefiles.append(filename)
- return sitefiles, searched
-
-#
-# Make some information available via variables
-#
-SITECONFIG_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d"
diff --git a/poky/meta/classes/sstate.bbclass b/poky/meta/classes/sstate.bbclass
deleted file mode 100644
index 0aa901f..0000000
--- a/poky/meta/classes/sstate.bbclass
+++ /dev/null
@@ -1,1358 +0,0 @@
-SSTATE_VERSION = "10"
-
-SSTATE_ZSTD_CLEVEL ??= "8"
-
-SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
-SSTATE_MANFILEPREFIX = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-${PN}"
-
-def generate_sstatefn(spec, hash, taskname, siginfo, d):
- if taskname is None:
- return ""
- extension = ".tar.zst"
- # 8 chars reserved for siginfo
- limit = 254 - 8
- if siginfo:
- limit = 254
- extension = ".tar.zst.siginfo"
- if not hash:
- hash = "INVALID"
- fn = spec + hash + "_" + taskname + extension
- # If the filename is too long, attempt to reduce it
- if len(fn) > limit:
- components = spec.split(":")
- # Fields 0,5,6 are mandatory, 1 is most useful, 2,3,4 are just for information
- # 7 is for the separators
- avail = (limit - len(hash + "_" + taskname + extension) - len(components[0]) - len(components[1]) - len(components[5]) - len(components[6]) - 7) // 3
- components[2] = components[2][:avail]
- components[3] = components[3][:avail]
- components[4] = components[4][:avail]
- spec = ":".join(components)
- fn = spec + hash + "_" + taskname + extension
- if len(fn) > limit:
- bb.fatal("Unable to reduce sstate name to less than 255 chararacters")
- return hash[:2] + "/" + hash[2:4] + "/" + fn
-
-SSTATE_PKGARCH = "${PACKAGE_ARCH}"
-SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"
-SSTATE_SWSPEC = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:"
-SSTATE_PKGNAME = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC'), d.getVar('BB_UNIHASH'), d.getVar('SSTATE_CURRTASK'), False, d)}"
-SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
-SSTATE_EXTRAPATH = ""
-SSTATE_EXTRAPATHWILDCARD = ""
-SSTATE_PATHSPEC = "${SSTATE_DIR}/${SSTATE_EXTRAPATHWILDCARD}*/*/${SSTATE_PKGSPEC}*_${SSTATE_PATH_CURRTASK}.tar.zst*"
-
-# explicitly make PV to depend on evaluated value of PV variable
-PV[vardepvalue] = "${PV}"
-
-# We don't want the sstate to depend on things like the distro string
-# of the system, we let the sstate paths take care of this.
-SSTATE_EXTRAPATH[vardepvalue] = ""
-SSTATE_EXTRAPATHWILDCARD[vardepvalue] = ""
-
-# For multilib rpm the allarch packagegroup files can overwrite (in theory they're identical)
-SSTATE_ALLOW_OVERLAP_FILES = "${DEPLOY_DIR}/licenses/"
-# Avoid docbook/sgml catalog warnings for now
-SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_ETCDIR_NATIVE}/sgml ${STAGING_DATADIR_NATIVE}/sgml"
-# sdk-provides-dummy-nativesdk and nativesdk-buildtools-perl-dummy overlap for different SDKMACHINE
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_RPM}/sdk_provides_dummy_nativesdk/ ${DEPLOY_DIR_IPK}/sdk-provides-dummy-nativesdk/"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_RPM}/buildtools_dummy_nativesdk/ ${DEPLOY_DIR_IPK}/buildtools-dummy-nativesdk/"
-# target-sdk-provides-dummy overlaps that allarch is disabled when multilib is used
-SSTATE_ALLOW_OVERLAP_FILES += "${COMPONENTS_DIR}/sdk-provides-dummy-target/ ${DEPLOY_DIR_RPM}/sdk_provides_dummy_target/ ${DEPLOY_DIR_IPK}/sdk-provides-dummy-target/"
-# Archive the sources for many architectures in one deploy folder
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_SRC}"
-# ovmf/grub-efi/systemd-boot/intel-microcode multilib recipes can generate identical overlapping files
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/ovmf"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/grub-efi"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/systemd-boot"
-SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/microcode"
-
-SSTATE_SCAN_FILES ?= "*.la *-config *_config postinst-*"
-SSTATE_SCAN_CMD ??= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES").split())}" \) -type f'
-SSTATE_SCAN_CMD_NATIVE ??= 'grep -Irl -e ${RECIPE_SYSROOT} -e ${RECIPE_SYSROOT_NATIVE} -e ${HOSTTOOLS_DIR} ${SSTATE_BUILDDIR}'
-SSTATE_HASHEQUIV_FILEMAP ?= " \
- populate_sysroot:*/postinst-useradd-*:${TMPDIR} \
- populate_sysroot:*/postinst-useradd-*:${COREBASE} \
- populate_sysroot:*/postinst-useradd-*:regex-\s(PATH|PSEUDO_IGNORE_PATHS|HOME|LOGNAME|OMP_NUM_THREADS|USER)=.*\s \
- populate_sysroot:*/crossscripts/*:${TMPDIR} \
- populate_sysroot:*/crossscripts/*:${COREBASE} \
- "
-
-BB_HASHFILENAME = "False ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}"
-
-SSTATE_ARCHS = " \
- ${BUILD_ARCH} \
- ${BUILD_ARCH}_${ORIGNATIVELSBSTRING} \
- ${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS} \
- ${SDK_ARCH}_${SDK_OS} \
- ${SDK_ARCH}_${PACKAGE_ARCH} \
- allarch \
- ${PACKAGE_ARCH} \
- ${PACKAGE_EXTRA_ARCHS} \
- ${MACHINE_ARCH}"
-SSTATE_ARCHS[vardepsexclude] = "ORIGNATIVELSBSTRING"
-
-SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
-
-SSTATECREATEFUNCS += "sstate_hardcode_path"
-SSTATECREATEFUNCS[vardeps] = "SSTATE_SCAN_FILES"
-SSTATEPOSTCREATEFUNCS = ""
-SSTATEPREINSTFUNCS = ""
-SSTATEPOSTUNPACKFUNCS = "sstate_hardcode_path_unpack"
-SSTATEPOSTINSTFUNCS = ""
-EXTRA_STAGING_FIXMES ?= "HOSTTOOLS_DIR"
-
-# Check whether sstate exists for tasks that support sstate and are in the
-# locked signatures file.
-SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK ?= 'error'
-
-# Check whether the task's computed hash matches the task's hash in the
-# locked signatures file.
-SIGGEN_LOCKEDSIGS_TASKSIG_CHECK ?= "error"
-
-# The GnuPG key ID and passphrase to use to sign sstate archives (or unset to
-# not sign)
-SSTATE_SIG_KEY ?= ""
-SSTATE_SIG_PASSPHRASE ?= ""
-# Whether to verify the GnUPG signatures when extracting sstate archives
-SSTATE_VERIFY_SIG ?= "0"
-# List of signatures to consider valid.
-SSTATE_VALID_SIGS ??= ""
-SSTATE_VALID_SIGS[vardepvalue] = ""
-
-SSTATE_HASHEQUIV_METHOD ?= "oe.sstatesig.OEOuthashBasic"
-SSTATE_HASHEQUIV_METHOD[doc] = "The fully-qualified function used to calculate \
- the output hash for a task, which in turn is used to determine equivalency. \
- "
-
-SSTATE_HASHEQUIV_REPORT_TASKDATA ?= "0"
-SSTATE_HASHEQUIV_REPORT_TASKDATA[doc] = "Report additional useful data to the \
- hash equivalency server, such as PN, PV, taskname, etc. This information \
- is very useful for developers looking at task data, but may leak sensitive \
- data if the equivalence server is public. \
- "
-
-python () {
- if bb.data.inherits_class('native', d):
- d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False))
- elif bb.data.inherits_class('crosssdk', d):
- d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}"))
- elif bb.data.inherits_class('cross', d):
- d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}"))
- elif bb.data.inherits_class('nativesdk', d):
- d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${SDK_OS}"))
- elif bb.data.inherits_class('cross-canadian', d):
- d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${PACKAGE_ARCH}"))
- elif bb.data.inherits_class('allarch', d) and d.getVar("PACKAGE_ARCH") == "all":
- d.setVar('SSTATE_PKGARCH', "allarch")
- else:
- d.setVar('SSTATE_MANMACH', d.expand("${PACKAGE_ARCH}"))
-
- if bb.data.inherits_class('native', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross', d):
- d.setVar('SSTATE_EXTRAPATH', "${NATIVELSBSTRING}/")
- d.setVar('BB_HASHFILENAME', "True ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}")
- d.setVar('SSTATE_EXTRAPATHWILDCARD', "${NATIVELSBSTRING}/")
-
- unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split()))
- d.setVar('SSTATETASKS', " ".join(unique_tasks))
- for task in unique_tasks:
- d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ")
- d.appendVarFlag(task, 'postfuncs', " sstate_task_postfunc")
- d.setVarFlag(task, 'network', '1')
- d.setVarFlag(task + "_setscene", 'network', '1')
-}
-
-def sstate_init(task, d):
- ss = {}
- ss['task'] = task
- ss['dirs'] = []
- ss['plaindirs'] = []
- ss['lockfiles'] = []
- ss['lockfiles-shared'] = []
- return ss
-
-def sstate_state_fromvars(d, task = None):
- if task is None:
- task = d.getVar('BB_CURRENTTASK')
- if not task:
- bb.fatal("sstate code running without task context?!")
- task = task.replace("_setscene", "")
-
- if task.startswith("do_"):
- task = task[3:]
- inputs = (d.getVarFlag("do_" + task, 'sstate-inputdirs') or "").split()
- outputs = (d.getVarFlag("do_" + task, 'sstate-outputdirs') or "").split()
- plaindirs = (d.getVarFlag("do_" + task, 'sstate-plaindirs') or "").split()
- lockfiles = (d.getVarFlag("do_" + task, 'sstate-lockfile') or "").split()
- lockfilesshared = (d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "").split()
- interceptfuncs = (d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "").split()
- fixmedir = d.getVarFlag("do_" + task, 'sstate-fixmedir') or ""
- if not task or len(inputs) != len(outputs):
- bb.fatal("sstate variables not setup correctly?!")
-
- if task == "populate_lic":
- d.setVar("SSTATE_PKGSPEC", "${SSTATE_SWSPEC}")
- d.setVar("SSTATE_EXTRAPATH", "")
- d.setVar('SSTATE_EXTRAPATHWILDCARD', "")
-
- ss = sstate_init(task, d)
- for i in range(len(inputs)):
- sstate_add(ss, inputs[i], outputs[i], d)
- ss['lockfiles'] = lockfiles
- ss['lockfiles-shared'] = lockfilesshared
- ss['plaindirs'] = plaindirs
- ss['interceptfuncs'] = interceptfuncs
- ss['fixmedir'] = fixmedir
- return ss
-
-def sstate_add(ss, source, dest, d):
- if not source.endswith("/"):
- source = source + "/"
- if not dest.endswith("/"):
- dest = dest + "/"
- source = os.path.normpath(source)
- dest = os.path.normpath(dest)
- srcbase = os.path.basename(source)
- ss['dirs'].append([srcbase, source, dest])
- return ss
-
-def sstate_install(ss, d):
- import oe.path
- import oe.sstatesig
- import subprocess
-
- sharedfiles = []
- shareddirs = []
- bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
-
- sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
-
- manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d)
-
- if os.access(manifest, os.R_OK):
- bb.fatal("Package already staged (%s)?!" % manifest)
-
- d.setVar("SSTATE_INST_POSTRM", manifest + ".postrm")
-
- locks = []
- for lock in ss['lockfiles-shared']:
- locks.append(bb.utils.lockfile(lock, True))
- for lock in ss['lockfiles']:
- locks.append(bb.utils.lockfile(lock))
-
- for state in ss['dirs']:
- bb.debug(2, "Staging files from %s to %s" % (state[1], state[2]))
- for walkroot, dirs, files in os.walk(state[1]):
- for file in files:
- srcpath = os.path.join(walkroot, file)
- dstpath = srcpath.replace(state[1], state[2])
- #bb.debug(2, "Staging %s to %s" % (srcpath, dstpath))
- sharedfiles.append(dstpath)
- for dir in dirs:
- srcdir = os.path.join(walkroot, dir)
- dstdir = srcdir.replace(state[1], state[2])
- #bb.debug(2, "Staging %s to %s" % (srcdir, dstdir))
- if os.path.islink(srcdir):
- sharedfiles.append(dstdir)
- continue
- if not dstdir.endswith("/"):
- dstdir = dstdir + "/"
- shareddirs.append(dstdir)
-
- # Check the file list for conflicts against files which already exist
- overlap_allowed = (d.getVar("SSTATE_ALLOW_OVERLAP_FILES") or "").split()
- match = []
- for f in sharedfiles:
- if os.path.exists(f) and not os.path.islink(f):
- f = os.path.normpath(f)
- realmatch = True
- for w in overlap_allowed:
- w = os.path.normpath(w)
- if f.startswith(w):
- realmatch = False
- break
- if realmatch:
- match.append(f)
- sstate_search_cmd = "grep -rlF '%s' %s --exclude=master.list | sed -e 's:^.*/::'" % (f, d.expand("${SSTATE_MANIFESTS}"))
- search_output = subprocess.Popen(sstate_search_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
- if search_output:
- match.append(" (matched in %s)" % search_output.decode('utf-8').rstrip())
- else:
- match.append(" (not matched to any task)")
- if match:
- bb.error("The recipe %s is trying to install files into a shared " \
- "area when those files already exist. Those files and their manifest " \
- "location are:\n %s\nPlease verify which recipe should provide the " \
- "above files.\n\nThe build has stopped, as continuing in this scenario WILL " \
- "break things - if not now, possibly in the future (we've seen builds fail " \
- "several months later). If the system knew how to recover from this " \
- "automatically it would, however there are several different scenarios " \
- "which can result in this and we don't know which one this is. It may be " \
- "you have switched providers of something like virtual/kernel (e.g. from " \
- "linux-yocto to linux-yocto-dev), in that case you need to execute the " \
- "clean task for both recipes and it will resolve this error. It may be " \
- "you changed DISTRO_FEATURES from systemd to udev or vice versa. Cleaning " \
- "those recipes should again resolve this error, however switching " \
- "DISTRO_FEATURES on an existing build directory is not supported - you " \
- "should really clean out tmp and rebuild (reusing sstate should be safe). " \
- "It could be the overlapping files detected are harmless in which case " \
- "adding them to SSTATE_ALLOW_OVERLAP_FILES may be the correct solution. It could " \
- "also be your build is including two different conflicting versions of " \
- "things (e.g. bluez 4 and bluez 5 and the correct solution for that would " \
- "be to resolve the conflict. If in doubt, please ask on the mailing list, " \
- "sharing the error and filelist above." % \
- (d.getVar('PN'), "\n ".join(match)))
- bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.")
-
- if ss['fixmedir'] and os.path.exists(ss['fixmedir'] + "/fixmepath.cmd"):
- sharedfiles.append(ss['fixmedir'] + "/fixmepath.cmd")
- sharedfiles.append(ss['fixmedir'] + "/fixmepath")
-
- # Write out the manifest
- f = open(manifest, "w")
- for file in sharedfiles:
- f.write(file + "\n")
-
- # We want to ensure that directories appear at the end of the manifest
- # so that when we test to see if they should be deleted any contents
- # added by the task will have been removed first.
- dirs = sorted(shareddirs, key=len)
- # Must remove children first, which will have a longer path than the parent
- for di in reversed(dirs):
- f.write(di + "\n")
- f.close()
-
- # Append to the list of manifests for this PACKAGE_ARCH
-
- i = d2.expand("${SSTATE_MANIFESTS}/index-${SSTATE_MANMACH}")
- l = bb.utils.lockfile(i + ".lock")
- filedata = d.getVar("STAMP") + " " + d2.getVar("SSTATE_MANFILEPREFIX") + " " + d.getVar("WORKDIR") + "\n"
- manifests = []
- if os.path.exists(i):
- with open(i, "r") as f:
- manifests = f.readlines()
- # We append new entries, we don't remove older entries which may have the same
- # manifest name but different versions from stamp/workdir. See below.
- if filedata not in manifests:
- with open(i, "a+") as f:
- f.write(filedata)
- bb.utils.unlockfile(l)
-
- # Run the actual file install
- for state in ss['dirs']:
- if os.path.exists(state[1]):
- oe.path.copyhardlinktree(state[1], state[2])
-
- for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split():
- # All hooks should run in the SSTATE_INSTDIR
- bb.build.exec_func(postinst, d, (sstateinst,))
-
- for lock in locks:
- bb.utils.unlockfile(lock)
-
-sstate_install[vardepsexclude] += "SSTATE_ALLOW_OVERLAP_FILES STATE_MANMACH SSTATE_MANFILEPREFIX"
-sstate_install[vardeps] += "${SSTATEPOSTINSTFUNCS}"
-
-def sstate_installpkg(ss, d):
- from oe.gpg_sign import get_signer
-
- sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
- d.setVar("SSTATE_CURRTASK", ss['task'])
- sstatefetch = d.getVar('SSTATE_PKGNAME')
- sstatepkg = d.getVar('SSTATE_PKG')
-
- if not os.path.exists(sstatepkg):
- pstaging_fetch(sstatefetch, d)
-
- if not os.path.isfile(sstatepkg):
- bb.note("Sstate package %s does not exist" % sstatepkg)
- return False
-
- sstate_clean(ss, d)
-
- d.setVar('SSTATE_INSTDIR', sstateinst)
-
- if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
- if not os.path.isfile(sstatepkg + '.sig'):
- bb.warn("No signature file for sstate package %s, skipping acceleration..." % sstatepkg)
- return False
- signer = get_signer(d, 'local')
- if not signer.verify(sstatepkg + '.sig', d.getVar("SSTATE_VALID_SIGS")):
- bb.warn("Cannot verify signature on sstate package %s, skipping acceleration..." % sstatepkg)
- return False
-
- # Empty sstateinst directory, ensure its clean
- if os.path.exists(sstateinst):
- oe.path.remove(sstateinst)
- bb.utils.mkdirhier(sstateinst)
-
- sstateinst = d.getVar("SSTATE_INSTDIR")
- d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
-
- for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package']:
- # All hooks should run in the SSTATE_INSTDIR
- bb.build.exec_func(f, d, (sstateinst,))
-
- return sstate_installpkgdir(ss, d)
-
-def sstate_installpkgdir(ss, d):
- import oe.path
- import subprocess
-
- sstateinst = d.getVar("SSTATE_INSTDIR")
- d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
-
- for f in (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
- # All hooks should run in the SSTATE_INSTDIR
- bb.build.exec_func(f, d, (sstateinst,))
-
- def prepdir(dir):
- # remove dir if it exists, ensure any parent directories do exist
- if os.path.exists(dir):
- oe.path.remove(dir)
- bb.utils.mkdirhier(dir)
- oe.path.remove(dir)
-
- for state in ss['dirs']:
- prepdir(state[1])
- bb.utils.rename(sstateinst + state[0], state[1])
- sstate_install(ss, d)
-
- for plain in ss['plaindirs']:
- workdir = d.getVar('WORKDIR')
- sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared")
- src = sstateinst + "/" + plain.replace(workdir, '')
- if sharedworkdir in plain:
- src = sstateinst + "/" + plain.replace(sharedworkdir, '')
- dest = plain
- bb.utils.mkdirhier(src)
- prepdir(dest)
- bb.utils.rename(src, dest)
-
- return True
-
-python sstate_hardcode_path_unpack () {
- # Fixup hardcoded paths
- #
- # Note: The logic below must match the reverse logic in
- # sstate_hardcode_path(d)
- import subprocess
-
- sstateinst = d.getVar('SSTATE_INSTDIR')
- sstatefixmedir = d.getVar('SSTATE_FIXMEDIR')
- fixmefn = sstateinst + "fixmepath"
- if os.path.isfile(fixmefn):
- staging_target = d.getVar('RECIPE_SYSROOT')
- staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
-
- if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
- sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host)
- elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
- sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (staging_target, staging_host)
- else:
- sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g'" % (staging_target)
-
- extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
- for fixmevar in extra_staging_fixmes.split():
- fixme_path = d.getVar(fixmevar)
- sstate_sed_cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
-
- # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed
- sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd)
-
- # Defer do_populate_sysroot relocation command
- if sstatefixmedir:
- bb.utils.mkdirhier(sstatefixmedir)
- with open(sstatefixmedir + "/fixmepath.cmd", "w") as f:
- sstate_hardcode_cmd = sstate_hardcode_cmd.replace(fixmefn, sstatefixmedir + "/fixmepath")
- sstate_hardcode_cmd = sstate_hardcode_cmd.replace(sstateinst, "FIXMEFINALSSTATEINST")
- sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_host, "FIXMEFINALSSTATEHOST")
- sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_target, "FIXMEFINALSSTATETARGET")
- f.write(sstate_hardcode_cmd)
- bb.utils.copyfile(fixmefn, sstatefixmedir + "/fixmepath")
- return
-
- bb.note("Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd))
- subprocess.check_call(sstate_hardcode_cmd, shell=True)
-
- # Need to remove this or we'd copy it into the target directory and may
- # conflict with another writer
- os.remove(fixmefn)
-}
-
-def sstate_clean_cachefile(ss, d):
- import oe.path
-
- if d.getVarFlag('do_%s' % ss['task'], 'task'):
- d.setVar("SSTATE_PATH_CURRTASK", ss['task'])
- sstatepkgfile = d.getVar('SSTATE_PATHSPEC')
- bb.note("Removing %s" % sstatepkgfile)
- oe.path.remove(sstatepkgfile)
-
-def sstate_clean_cachefiles(d):
- for task in (d.getVar('SSTATETASKS') or "").split():
- ld = d.createCopy()
- ss = sstate_state_fromvars(ld, task)
- sstate_clean_cachefile(ss, ld)
-
-def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
- import oe.path
-
- mfile = open(manifest)
- entries = mfile.readlines()
- mfile.close()
-
- for entry in entries:
- entry = entry.strip()
- if prefix and not entry.startswith("/"):
- entry = prefix + "/" + entry
- bb.debug(2, "Removing manifest: %s" % entry)
- # We can race against another package populating directories as we're removing them
- # so we ignore errors here.
- try:
- if entry.endswith("/"):
- if os.path.islink(entry[:-1]):
- os.remove(entry[:-1])
- elif os.path.exists(entry) and len(os.listdir(entry)) == 0 and not canrace:
- # Removing directories whilst builds are in progress exposes a race. Only
- # do it in contexts where it is safe to do so.
- os.rmdir(entry[:-1])
- else:
- os.remove(entry)
- except OSError:
- pass
-
- postrm = manifest + ".postrm"
- if os.path.exists(manifest + ".postrm"):
- import subprocess
- os.chmod(postrm, 0o755)
- subprocess.check_call(postrm, shell=True)
- oe.path.remove(postrm)
-
- oe.path.remove(manifest)
-
-def sstate_clean(ss, d):
- import oe.path
- import glob
-
- d2 = d.createCopy()
- stamp_clean = d.getVar("STAMPCLEAN")
- extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info')
- if extrainf:
- d2.setVar("SSTATE_MANMACH", extrainf)
- wildcard_stfile = "%s.do_%s*.%s" % (stamp_clean, ss['task'], extrainf)
- else:
- wildcard_stfile = "%s.do_%s*" % (stamp_clean, ss['task'])
-
- manifest = d2.expand("${SSTATE_MANFILEPREFIX}.%s" % ss['task'])
-
- if os.path.exists(manifest):
- locks = []
- for lock in ss['lockfiles-shared']:
- locks.append(bb.utils.lockfile(lock))
- for lock in ss['lockfiles']:
- locks.append(bb.utils.lockfile(lock))
-
- sstate_clean_manifest(manifest, d, canrace=True)
-
- for lock in locks:
- bb.utils.unlockfile(lock)
-
- # Remove the current and previous stamps, but keep the sigdata.
- #
- # The glob() matches do_task* which may match multiple tasks, for
- # example: do_package and do_package_write_ipk, so we need to
- # exactly match *.do_task.* and *.do_task_setscene.*
- rm_stamp = '.do_%s.' % ss['task']
- rm_setscene = '.do_%s_setscene.' % ss['task']
- # For BB_SIGNATURE_HANDLER = "noop"
- rm_nohash = ".do_%s" % ss['task']
- for stfile in glob.glob(wildcard_stfile):
- # Keep the sigdata
- if ".sigdata." in stfile or ".sigbasedata." in stfile:
- continue
- # Preserve taint files in the stamps directory
- if stfile.endswith('.taint'):
- continue
- if rm_stamp in stfile or rm_setscene in stfile or \
- stfile.endswith(rm_nohash):
- oe.path.remove(stfile)
-
-sstate_clean[vardepsexclude] = "SSTATE_MANFILEPREFIX"
-
-CLEANFUNCS += "sstate_cleanall"
-
-python sstate_cleanall() {
- bb.note("Removing shared state for package %s" % d.getVar('PN'))
-
- manifest_dir = d.getVar('SSTATE_MANIFESTS')
- if not os.path.exists(manifest_dir):
- return
-
- tasks = d.getVar('SSTATETASKS').split()
- for name in tasks:
- ld = d.createCopy()
- shared_state = sstate_state_fromvars(ld, name)
- sstate_clean(shared_state, ld)
-}
-
-python sstate_hardcode_path () {
- import subprocess, platform
-
- # Need to remove hardcoded paths and fix these when we install the
- # staging packages.
- #
- # Note: the logic in this function needs to match the reverse logic
- # in sstate_installpkg(ss, d)
-
- staging_target = d.getVar('RECIPE_SYSROOT')
- staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
- sstate_builddir = d.getVar('SSTATE_BUILDDIR')
-
- sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % staging_host
- if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
- sstate_grep_cmd = "grep -l -e '%s'" % (staging_host)
- elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
- sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging_host)
- sstate_sed_cmd += " -e 's:%s:FIXMESTAGINGDIRTARGET:g'" % staging_target
- else:
- sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging_host)
- sstate_sed_cmd += " -e 's:%s:FIXMESTAGINGDIRTARGET:g'" % staging_target
-
- extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
- for fixmevar in extra_staging_fixmes.split():
- fixme_path = d.getVar(fixmevar)
- sstate_sed_cmd += " -e 's:%s:FIXME_%s:g'" % (fixme_path, fixmevar)
- sstate_grep_cmd += " -e '%s'" % (fixme_path)
-
- fixmefn = sstate_builddir + "fixmepath"
-
- sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD')
- sstate_filelist_cmd = "tee %s" % (fixmefn)
-
- # fixmepath file needs relative paths, drop sstate_builddir prefix
- sstate_filelist_relative_cmd = "sed -i -e 's:^%s::g' %s" % (sstate_builddir, fixmefn)
-
- xargs_no_empty_run_cmd = '--no-run-if-empty'
- if platform.system() == 'Darwin':
- xargs_no_empty_run_cmd = ''
-
- # Limit the fixpaths and sed operations based on the initial grep search
- # This has the side effect of making sure the vfs cache is hot
- sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd)
-
- bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
- subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
-
- # If the fixmefn is empty, remove it..
- if os.stat(fixmefn).st_size == 0:
- os.remove(fixmefn)
- else:
- bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
- subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
-}
-
-def sstate_package(ss, d):
- import oe.path
- import time
-
- tmpdir = d.getVar('TMPDIR')
-
- fixtime = False
- if ss['task'] == "package":
- fixtime = True
-
- def fixtimestamp(root, path):
- f = os.path.join(root, path)
- if os.lstat(f).st_mtime > sde:
- os.utime(f, (sde, sde), follow_symlinks=False)
-
- sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task'])
- sde = int(d.getVar("SOURCE_DATE_EPOCH") or time.time())
- d.setVar("SSTATE_CURRTASK", ss['task'])
- bb.utils.remove(sstatebuild, recurse=True)
- bb.utils.mkdirhier(sstatebuild)
- for state in ss['dirs']:
- if not os.path.exists(state[1]):
- continue
- srcbase = state[0].rstrip("/").rsplit('/', 1)[0]
- # Find and error for absolute symlinks. We could attempt to relocate but its not
- # clear where the symlink is relative to in this context. We could add that markup
- # to sstate tasks but there aren't many of these so better just avoid them entirely.
- for walkroot, dirs, files in os.walk(state[1]):
- for file in files + dirs:
- if fixtime:
- fixtimestamp(walkroot, file)
- srcpath = os.path.join(walkroot, file)
- if not os.path.islink(srcpath):
- continue
- link = os.readlink(srcpath)
- if not os.path.isabs(link):
- continue
- if not link.startswith(tmpdir):
- continue
- bb.error("sstate found an absolute path symlink %s pointing at %s. Please replace this with a relative link." % (srcpath, link))
- bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
- bb.utils.rename(state[1], sstatebuild + state[0])
-
- workdir = d.getVar('WORKDIR')
- sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared")
- for plain in ss['plaindirs']:
- pdir = plain.replace(workdir, sstatebuild)
- if sharedworkdir in plain:
- pdir = plain.replace(sharedworkdir, sstatebuild)
- bb.utils.mkdirhier(plain)
- bb.utils.mkdirhier(pdir)
- bb.utils.rename(plain, pdir)
- if fixtime:
- fixtimestamp(pdir, "")
- for walkroot, dirs, files in os.walk(pdir):
- for file in files + dirs:
- fixtimestamp(walkroot, file)
-
- d.setVar('SSTATE_BUILDDIR', sstatebuild)
- d.setVar('SSTATE_INSTDIR', sstatebuild)
-
- if d.getVar('SSTATE_SKIP_CREATION') == '1':
- return
-
- sstate_create_package = ['sstate_report_unihash', 'sstate_create_package']
- if d.getVar('SSTATE_SIG_KEY'):
- sstate_create_package.append('sstate_sign_package')
-
- for f in (d.getVar('SSTATECREATEFUNCS') or '').split() + \
- sstate_create_package + \
- (d.getVar('SSTATEPOSTCREATEFUNCS') or '').split():
- # All hooks should run in SSTATE_BUILDDIR.
- bb.build.exec_func(f, d, (sstatebuild,))
-
- # SSTATE_PKG may have been changed by sstate_report_unihash
- siginfo = d.getVar('SSTATE_PKG') + ".siginfo"
- if not os.path.exists(siginfo):
- bb.siggen.dump_this_task(siginfo, d)
- else:
- try:
- os.utime(siginfo, None)
- except PermissionError:
- pass
- except OSError as e:
- # Handle read-only file systems gracefully
- import errno
- if e.errno != errno.EROFS:
- raise e
-
- return
-
-sstate_package[vardepsexclude] += "SSTATE_SIG_KEY"
-
-def pstaging_fetch(sstatefetch, d):
- import bb.fetch2
-
- # Only try and fetch if the user has configured a mirror
- mirrors = d.getVar('SSTATE_MIRRORS')
- if not mirrors:
- return
-
- # Copy the data object and override DL_DIR and SRC_URI
- localdata = bb.data.createCopy(d)
-
- dldir = localdata.expand("${SSTATE_DIR}")
- bb.utils.mkdirhier(dldir)
-
- localdata.delVar('MIRRORS')
- localdata.setVar('FILESPATH', dldir)
- localdata.setVar('DL_DIR', dldir)
- localdata.setVar('PREMIRRORS', mirrors)
- localdata.setVar('SRCPV', d.getVar('SRCPV'))
-
- # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK,
- # we'll want to allow network access for the current set of fetches.
- if bb.utils.to_boolean(localdata.getVar('BB_NO_NETWORK')) and \
- bb.utils.to_boolean(localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK')):
- localdata.delVar('BB_NO_NETWORK')
-
- # Try a fetch from the sstate mirror, if it fails just return and
- # we will build the package
- uris = ['file://{0};downloadfilename={0}'.format(sstatefetch),
- 'file://{0}.siginfo;downloadfilename={0}.siginfo'.format(sstatefetch)]
- if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
- uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)]
-
- for srcuri in uris:
- localdata.setVar('SRC_URI', srcuri)
- try:
- fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
- fetcher.checkstatus()
- fetcher.download()
-
- except bb.fetch2.BBFetchException:
- pass
-
-pstaging_fetch[vardepsexclude] += "SRCPV"
-
-
-def sstate_setscene(d):
- shared_state = sstate_state_fromvars(d)
- accelerate = sstate_installpkg(shared_state, d)
- if not accelerate:
- msg = "No sstate archive obtainable, will run full task instead."
- bb.warn(msg)
- raise bb.BBHandledException(msg)
-
-python sstate_task_prefunc () {
- shared_state = sstate_state_fromvars(d)
- sstate_clean(shared_state, d)
-}
-sstate_task_prefunc[dirs] = "${WORKDIR}"
-
-python sstate_task_postfunc () {
- shared_state = sstate_state_fromvars(d)
-
- for intercept in shared_state['interceptfuncs']:
- bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),))
-
- omask = os.umask(0o002)
- if omask != 0o002:
- bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
- sstate_package(shared_state, d)
- os.umask(omask)
-
- sstateinst = d.getVar("SSTATE_INSTDIR")
- d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
-
- sstate_installpkgdir(shared_state, d)
-
- bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
-}
-sstate_task_postfunc[dirs] = "${WORKDIR}"
-
-
-#
-# Shell function to generate a sstate package from a directory
-# set as SSTATE_BUILDDIR. Will be run from within SSTATE_BUILDDIR.
-#
-sstate_create_package () {
- # Exit early if it already exists
- if [ -e ${SSTATE_PKG} ]; then
- touch ${SSTATE_PKG} 2>/dev/null || true
- return
- fi
-
- mkdir --mode=0775 -p `dirname ${SSTATE_PKG}`
- TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX`
-
- OPT="-cS"
- ZSTD="zstd -${SSTATE_ZSTD_CLEVEL} -T${ZSTD_THREADS}"
- # Use pzstd if available
- if [ -x "$(command -v pzstd)" ]; then
- ZSTD="pzstd -${SSTATE_ZSTD_CLEVEL} -p ${ZSTD_THREADS}"
- fi
-
- # Need to handle empty directories
- if [ "$(ls -A)" ]; then
- set +e
- tar -I "$ZSTD" $OPT -f $TFILE *
- ret=$?
- if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
- exit 1
- fi
- set -e
- else
- tar -I "$ZSTD" $OPT --file=$TFILE --files-from=/dev/null
- fi
- chmod 0664 $TFILE
- # Skip if it was already created by some other process
- if [ -h ${SSTATE_PKG} ] && [ ! -e ${SSTATE_PKG} ]; then
- # There is a symbolic link, but it links to nothing.
- # Forcefully replace it with the new file.
- ln -f $TFILE ${SSTATE_PKG} || true
- elif [ ! -e ${SSTATE_PKG} ]; then
- # Move into place using ln to attempt an atomic op.
- # Abort if it already exists
- ln $TFILE ${SSTATE_PKG} || true
- else
- touch ${SSTATE_PKG} 2>/dev/null || true
- fi
- rm $TFILE
-}
-
-python sstate_sign_package () {
- from oe.gpg_sign import get_signer
-
-
- signer = get_signer(d, 'local')
- sstate_pkg = d.getVar('SSTATE_PKG')
- if os.path.exists(sstate_pkg + '.sig'):
- os.unlink(sstate_pkg + '.sig')
- signer.detach_sign(sstate_pkg, d.getVar('SSTATE_SIG_KEY', False), None,
- d.getVar('SSTATE_SIG_PASSPHRASE'), armor=False)
-}
-
-python sstate_report_unihash() {
- report_unihash = getattr(bb.parse.siggen, 'report_unihash', None)
-
- if report_unihash:
- ss = sstate_state_fromvars(d)
- report_unihash(os.getcwd(), ss['task'], d)
-}
-
-#
-# Shell function to decompress and prepare a package for installation
-# Will be run from within SSTATE_INSTDIR.
-#
-sstate_unpack_package () {
- ZSTD="zstd -T${ZSTD_THREADS}"
- # Use pzstd if available
- if [ -x "$(command -v pzstd)" ]; then
- ZSTD="pzstd -p ${ZSTD_THREADS}"
- fi
-
- tar -I "$ZSTD" -xvpf ${SSTATE_PKG}
- # update .siginfo atime on local/NFS mirror if it is a symbolic link
- [ ! -h ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
- # update each symbolic link instead of any referenced file
- touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
- [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true
- [ ! -e ${SSTATE_PKG}.siginfo ] || touch --no-dereference ${SSTATE_PKG}.siginfo 2>/dev/null || true
-}
-
-BB_HASHCHECK_FUNCTION = "sstate_checkhashes"
-
-def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs):
- found = set()
- missed = set()
-
- def gethash(task):
- return sq_data['unihash'][task]
-
- def getpathcomponents(task, d):
- # Magic data from BB_HASHFILENAME
- splithashfn = sq_data['hashfn'][task].split(" ")
- spec = splithashfn[1]
- if splithashfn[0] == "True":
- extrapath = d.getVar("NATIVELSBSTRING") + "/"
- else:
- extrapath = ""
-
- tname = bb.runqueue.taskname_from_tid(task)[3:]
-
- if tname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and splithashfn[2]:
- spec = splithashfn[2]
- extrapath = ""
-
- return spec, extrapath, tname
-
- def getsstatefile(tid, siginfo, d):
- spec, extrapath, tname = getpathcomponents(tid, d)
- return extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d)
-
- for tid in sq_data['hash']:
-
- sstatefile = d.expand("${SSTATE_DIR}/" + getsstatefile(tid, siginfo, d))
-
- if os.path.exists(sstatefile):
- found.add(tid)
- bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
- else:
- missed.add(tid)
- bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile)
-
- foundLocal = len(found)
- mirrors = d.getVar("SSTATE_MIRRORS")
- if mirrors:
- # Copy the data object and override DL_DIR and SRC_URI
- localdata = bb.data.createCopy(d)
-
- dldir = localdata.expand("${SSTATE_DIR}")
- localdata.delVar('MIRRORS')
- localdata.setVar('FILESPATH', dldir)
- localdata.setVar('DL_DIR', dldir)
- localdata.setVar('PREMIRRORS', mirrors)
-
- bb.debug(2, "SState using premirror of: %s" % mirrors)
-
- # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK,
- # we'll want to allow network access for the current set of fetches.
- if bb.utils.to_boolean(localdata.getVar('BB_NO_NETWORK')) and \
- bb.utils.to_boolean(localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK')):
- localdata.delVar('BB_NO_NETWORK')
-
- from bb.fetch2 import FetchConnectionCache
- def checkstatus_init():
- while not connection_cache_pool.full():
- connection_cache_pool.put(FetchConnectionCache())
-
- def checkstatus_end():
- while not connection_cache_pool.empty():
- connection_cache = connection_cache_pool.get()
- connection_cache.close_connections()
-
- def checkstatus(arg):
- (tid, sstatefile) = arg
-
- connection_cache = connection_cache_pool.get()
- localdata2 = bb.data.createCopy(localdata)
- srcuri = "file://" + sstatefile
- localdata2.setVar('SRC_URI', srcuri)
- bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
-
- import traceback
-
- try:
- fetcher = bb.fetch2.Fetch(srcuri.split(), localdata2,
- connection_cache=connection_cache)
- fetcher.checkstatus()
- bb.debug(2, "SState: Successful fetch test for %s" % srcuri)
- found.add(tid)
- missed.remove(tid)
- except bb.fetch2.FetchError as e:
- bb.debug(2, "SState: Unsuccessful fetch test for %s (%s)\n%s" % (srcuri, repr(e), traceback.format_exc()))
- except Exception as e:
- bb.error("SState: cannot test %s: %s\n%s" % (srcuri, repr(e), traceback.format_exc()))
-
- connection_cache_pool.put(connection_cache)
-
- if progress:
- bb.event.fire(bb.event.ProcessProgress(msg, len(tasklist) - thread_worker.tasks.qsize()), d)
-
- tasklist = []
- for tid in missed:
- sstatefile = d.expand(getsstatefile(tid, siginfo, d))
- tasklist.append((tid, sstatefile))
-
- if tasklist:
- nproc = min(int(d.getVar("BB_NUMBER_THREADS")), len(tasklist))
-
- progress = len(tasklist) >= 100
- if progress:
- msg = "Checking sstate mirror object availability"
- bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
-
- # Have to setup the fetcher environment here rather than in each thread as it would race
- fetcherenv = bb.fetch2.get_fetcher_environment(d)
- with bb.utils.environment(**fetcherenv):
- bb.event.enable_threadlock()
- import concurrent.futures
- from queue import Queue
- connection_cache_pool = Queue(nproc)
- checkstatus_init()
- with concurrent.futures.ThreadPoolExecutor(max_workers=nproc) as executor:
- executor.map(checkstatus, tasklist.copy())
- checkstatus_end()
- bb.event.disable_threadlock()
-
- if progress:
- bb.event.fire(bb.event.ProcessFinished(msg), d)
-
- inheritlist = d.getVar("INHERIT")
- if "toaster" in inheritlist:
- evdata = {'missed': [], 'found': []};
- for tid in missed:
- sstatefile = d.expand(getsstatefile(tid, False, d))
- evdata['missed'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) )
- for tid in found:
- sstatefile = d.expand(getsstatefile(tid, False, d))
- evdata['found'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) )
- bb.event.fire(bb.event.MetadataEvent("MissedSstate", evdata), d)
-
- if summary:
- # Print some summary statistics about the current task completion and how much sstate
- # reuse there was. Avoid divide by zero errors.
- total = len(sq_data['hash'])
- complete = 0
- if currentcount:
- complete = (len(found) + currentcount) / (total + currentcount) * 100
- match = 0
- if total:
- match = len(found) / total * 100
- bb.plain("Sstate summary: Wanted %d Local %d Mirrors %d Missed %d Current %d (%d%% match, %d%% complete)" %
- (total, foundLocal, len(found)-foundLocal, len(missed), currentcount, match, complete))
-
- if hasattr(bb.parse.siggen, "checkhashes"):
- bb.parse.siggen.checkhashes(sq_data, missed, found, d)
-
- return found
-setscene_depvalid[vardepsexclude] = "SSTATE_EXCLUDEDEPS_SYSROOT"
-
-BB_SETSCENE_DEPVALID = "setscene_depvalid"
-
-def setscene_depvalid(task, taskdependees, notneeded, d, log=None):
- # taskdependees is a dict of tasks which depend on task, each being a 3 item list of [PN, TASKNAME, FILENAME]
- # task is included in taskdependees too
- # Return - False - We need this dependency
- # - True - We can skip this dependency
- import re
-
- def logit(msg, log):
- if log is not None:
- log.append(msg)
- else:
- bb.debug(2, msg)
-
- logit("Considering setscene task: %s" % (str(taskdependees[task])), log)
-
- directtasks = ["do_populate_lic", "do_deploy_source_date_epoch", "do_shared_workdir", "do_stash_locale", "do_gcc_stash_builddir", "do_create_spdx"]
-
- def isNativeCross(x):
- return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross")
-
- # We only need to trigger deploy_source_date_epoch through direct dependencies
- if taskdependees[task][1] in directtasks:
- return True
-
- # We only need to trigger packagedata through direct dependencies
- # but need to preserve packagedata on packagedata links
- if taskdependees[task][1] == "do_packagedata":
- for dep in taskdependees:
- if taskdependees[dep][1] == "do_packagedata":
- return False
- return True
-
- for dep in taskdependees:
- logit(" considering dependency: %s" % (str(taskdependees[dep])), log)
- if task == dep:
- continue
- if dep in notneeded:
- continue
- # do_package_write_* and do_package doesn't need do_package
- if taskdependees[task][1] == "do_package" and taskdependees[dep][1] in ['do_package', 'do_package_write_deb', 'do_package_write_ipk', 'do_package_write_rpm', 'do_packagedata', 'do_package_qa']:
- continue
- # do_package_write_* need do_populate_sysroot as they're mainly postinstall dependencies
- if taskdependees[task][1] == "do_populate_sysroot" and taskdependees[dep][1] in ['do_package_write_deb', 'do_package_write_ipk', 'do_package_write_rpm']:
- return False
- # do_package/packagedata/package_qa/deploy don't need do_populate_sysroot
- if taskdependees[task][1] == "do_populate_sysroot" and taskdependees[dep][1] in ['do_package', 'do_packagedata', 'do_package_qa', 'do_deploy']:
- continue
- # Native/Cross packages don't exist and are noexec anyway
- if isNativeCross(taskdependees[dep][0]) and taskdependees[dep][1] in ['do_package_write_deb', 'do_package_write_ipk', 'do_package_write_rpm', 'do_packagedata', 'do_package', 'do_package_qa']:
- continue
-
- # This is due to the [depends] in useradd.bbclass complicating matters
- # The logic *is* reversed here due to the way hard setscene dependencies are injected
- if (taskdependees[task][1] == 'do_package' or taskdependees[task][1] == 'do_populate_sysroot') and taskdependees[dep][0].endswith(('shadow-native', 'shadow-sysroot', 'base-passwd', 'pseudo-native')) and taskdependees[dep][1] == 'do_populate_sysroot':
- continue
-
- # Consider sysroot depending on sysroot tasks
- if taskdependees[task][1] == 'do_populate_sysroot' and taskdependees[dep][1] == 'do_populate_sysroot':
- # Allow excluding certain recursive dependencies. If a recipe needs it should add a
- # specific dependency itself, rather than relying on one of its dependees to pull
- # them in.
- # See also http://lists.openembedded.org/pipermail/openembedded-core/2018-January/146324.html
- not_needed = False
- excludedeps = d.getVar('_SSTATE_EXCLUDEDEPS_SYSROOT')
- if excludedeps is None:
- # Cache the regular expressions for speed
- excludedeps = []
- for excl in (d.getVar('SSTATE_EXCLUDEDEPS_SYSROOT') or "").split():
- excludedeps.append((re.compile(excl.split('->', 1)[0]), re.compile(excl.split('->', 1)[1])))
- d.setVar('_SSTATE_EXCLUDEDEPS_SYSROOT', excludedeps)
- for excl in excludedeps:
- if excl[0].match(taskdependees[dep][0]):
- if excl[1].match(taskdependees[task][0]):
- not_needed = True
- break
- if not_needed:
- continue
- # For meta-extsdk-toolchain we want all sysroot dependencies
- if taskdependees[dep][0] == 'meta-extsdk-toolchain':
- return False
- # Native/Cross populate_sysroot need their dependencies
- if isNativeCross(taskdependees[task][0]) and isNativeCross(taskdependees[dep][0]):
- return False
- # Target populate_sysroot depended on by cross tools need to be installed
- if isNativeCross(taskdependees[dep][0]):
- return False
- # Native/cross tools depended upon by target sysroot are not needed
- # Add an exception for shadow-native as required by useradd.bbclass
- if isNativeCross(taskdependees[task][0]) and taskdependees[task][0] != 'shadow-native':
- continue
- # Target populate_sysroot need their dependencies
- return False
-
- if taskdependees[dep][1] in directtasks:
- continue
-
- # Safe fallthrough default
- logit(" Default setscene dependency fall through due to dependency: %s" % (str(taskdependees[dep])), log)
- return False
- return True
-
-addhandler sstate_eventhandler
-sstate_eventhandler[eventmask] = "bb.build.TaskSucceeded"
-python sstate_eventhandler() {
- d = e.data
- writtensstate = d.getVar('SSTATE_CURRTASK')
- if not writtensstate:
- taskname = d.getVar("BB_RUNTASK")[3:]
- spec = d.getVar('SSTATE_PKGSPEC')
- swspec = d.getVar('SSTATE_SWSPEC')
- if taskname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and swspec:
- d.setVar("SSTATE_PKGSPEC", "${SSTATE_SWSPEC}")
- d.setVar("SSTATE_EXTRAPATH", "")
- d.setVar("SSTATE_CURRTASK", taskname)
- siginfo = d.getVar('SSTATE_PKG') + ".siginfo"
- if not os.path.exists(siginfo):
- bb.siggen.dump_this_task(siginfo, d)
- else:
- try:
- os.utime(siginfo, None)
- except PermissionError:
- pass
- except OSError as e:
- # Handle read-only file systems gracefully
- import errno
- if e.errno != errno.EROFS:
- raise e
-
-}
-
-SSTATE_PRUNE_OBSOLETEWORKDIR ?= "1"
-
-#
-# Event handler which removes manifests and stamps file for recipes which are no
-# longer 'reachable' in a build where they once were. 'Reachable' refers to
-# whether a recipe is parsed so recipes in a layer which was removed would no
-# longer be reachable. Switching between systemd and sysvinit where recipes
-# became skipped would be another example.
-#
-# Also optionally removes the workdir of those tasks/recipes
-#
-addhandler sstate_eventhandler_reachablestamps
-sstate_eventhandler_reachablestamps[eventmask] = "bb.event.ReachableStamps"
-python sstate_eventhandler_reachablestamps() {
- import glob
- d = e.data
- stamps = e.stamps.values()
- removeworkdir = (d.getVar("SSTATE_PRUNE_OBSOLETEWORKDIR", False) == "1")
- preservestampfile = d.expand('${SSTATE_MANIFESTS}/preserve-stamps')
- preservestamps = []
- if os.path.exists(preservestampfile):
- with open(preservestampfile, 'r') as f:
- preservestamps = f.readlines()
- seen = []
-
- # The machine index contains all the stamps this machine has ever seen in this build directory.
- # We should only remove things which this machine once accessed but no longer does.
- machineindex = set()
- bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
- mi = d.expand("${SSTATE_MANIFESTS}/index-machine-${MACHINE}")
- if os.path.exists(mi):
- with open(mi, "r") as f:
- machineindex = set(line.strip() for line in f.readlines())
-
- for a in sorted(list(set(d.getVar("SSTATE_ARCHS").split()))):
- toremove = []
- i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
- if not os.path.exists(i):
- continue
- manseen = set()
- ignore = []
- with open(i, "r") as f:
- lines = f.readlines()
- for l in reversed(lines):
- try:
- (stamp, manifest, workdir) = l.split()
- # The index may have multiple entries for the same manifest as the code above only appends
- # new entries and there may be an entry with matching manifest but differing version in stamp/workdir.
- # The last entry in the list is the valid one, any earlier entries with matching manifests
- # should be ignored.
- if manifest in manseen:
- ignore.append(l)
- continue
- manseen.add(manifest)
- if stamp not in stamps and stamp not in preservestamps and stamp in machineindex:
- toremove.append(l)
- if stamp not in seen:
- bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp)
- seen.append(stamp)
- except ValueError:
- bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i))
-
- if toremove:
- msg = "Removing %d recipes from the %s sysroot" % (len(toremove), a)
- bb.event.fire(bb.event.ProcessStarted(msg, len(toremove)), d)
-
- removed = 0
- for r in toremove:
- (stamp, manifest, workdir) = r.split()
- for m in glob.glob(manifest + ".*"):
- if m.endswith(".postrm"):
- continue
- sstate_clean_manifest(m, d)
- bb.utils.remove(stamp + "*")
- if removeworkdir:
- bb.utils.remove(workdir, recurse = True)
- lines.remove(r)
- removed = removed + 1
- bb.event.fire(bb.event.ProcessProgress(msg, removed), d)
-
- bb.event.fire(bb.event.ProcessFinished(msg), d)
-
- with open(i, "w") as f:
- for l in lines:
- if l in ignore:
- continue
- f.write(l)
- machineindex |= set(stamps)
- with open(mi, "w") as f:
- for l in machineindex:
- f.write(l + "\n")
-
- if preservestamps:
- os.remove(preservestampfile)
-}
-
-
-#
-# Bitbake can generate an event showing which setscene tasks are 'stale',
-# i.e. which ones will be rerun. These are ones where a stamp file is present but
-# it is stable (e.g. taskhash doesn't match). With that list we can go through
-# the manifests for matching tasks and "uninstall" those manifests now. We do
-# this now rather than mid build since the distribution of files between sstate
-# objects may have changed, new tasks may run first and if those new tasks overlap
-# with the stale tasks, we'd see overlapping files messages and failures. Thankfully
-# removing these files is fast.
-#
-addhandler sstate_eventhandler_stalesstate
-sstate_eventhandler_stalesstate[eventmask] = "bb.event.StaleSetSceneTasks"
-python sstate_eventhandler_stalesstate() {
- d = e.data
- tasks = e.tasks
-
- bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
-
- for a in list(set(d.getVar("SSTATE_ARCHS").split())):
- toremove = []
- i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
- if not os.path.exists(i):
- continue
- with open(i, "r") as f:
- lines = f.readlines()
- for l in lines:
- try:
- (stamp, manifest, workdir) = l.split()
- for tid in tasks:
- for s in tasks[tid]:
- if s.startswith(stamp):
- taskname = bb.runqueue.taskname_from_tid(tid)[3:]
- manname = manifest + "." + taskname
- if os.path.exists(manname):
- bb.debug(2, "Sstate for %s is stale, removing related manifest %s" % (tid, manname))
- toremove.append((manname, tid, tasks[tid]))
- break
- except ValueError:
- bb.fatal("Invalid line '%s' in sstate manifest '%s'" % (l, i))
-
- if toremove:
- msg = "Removing %d stale sstate objects for arch %s" % (len(toremove), a)
- bb.event.fire(bb.event.ProcessStarted(msg, len(toremove)), d)
-
- removed = 0
- for (manname, tid, stamps) in toremove:
- sstate_clean_manifest(manname, d)
- for stamp in stamps:
- bb.utils.remove(stamp)
- removed = removed + 1
- bb.event.fire(bb.event.ProcessProgress(msg, removed), d)
-
- bb.event.fire(bb.event.ProcessFinished(msg), d)
-}
diff --git a/poky/meta/classes/staging.bbclass b/poky/meta/classes/staging.bbclass
deleted file mode 100644
index bf8ca58..0000000
--- a/poky/meta/classes/staging.bbclass
+++ /dev/null
@@ -1,684 +0,0 @@
-# These directories will be staged in the sysroot
-SYSROOT_DIRS = " \
- ${includedir} \
- ${libdir} \
- ${base_libdir} \
- ${nonarch_base_libdir} \
- ${datadir} \
- /sysroot-only \
-"
-
-# These directories are also staged in the sysroot when they contain files that
-# are usable on the build system
-SYSROOT_DIRS_NATIVE = " \
- ${bindir} \
- ${sbindir} \
- ${base_bindir} \
- ${base_sbindir} \
- ${libexecdir} \
- ${sysconfdir} \
- ${localstatedir} \
-"
-SYSROOT_DIRS:append:class-native = " ${SYSROOT_DIRS_NATIVE}"
-SYSROOT_DIRS:append:class-cross = " ${SYSROOT_DIRS_NATIVE}"
-SYSROOT_DIRS:append:class-crosssdk = " ${SYSROOT_DIRS_NATIVE}"
-
-# These directories will not be staged in the sysroot
-SYSROOT_DIRS_IGNORE = " \
- ${mandir} \
- ${docdir} \
- ${infodir} \
- ${datadir}/X11/locale \
- ${datadir}/applications \
- ${datadir}/bash-completion \
- ${datadir}/fonts \
- ${datadir}/gtk-doc/html \
- ${datadir}/installed-tests \
- ${datadir}/locale \
- ${datadir}/pixmaps \
- ${datadir}/terminfo \
- ${libdir}/${BPN}/ptest \
-"
-
-sysroot_stage_dir() {
- src="$1"
- dest="$2"
- # if the src doesn't exist don't do anything
- if [ ! -d "$src" ]; then
- return
- fi
-
- mkdir -p "$dest"
- rdest=$(realpath --relative-to="$src" "$dest")
- (
- cd $src
- find . -print0 | cpio --null -pdlu $rdest
- )
-}
-
-sysroot_stage_dirs() {
- from="$1"
- to="$2"
-
- for dir in ${SYSROOT_DIRS}; do
- sysroot_stage_dir "$from$dir" "$to$dir"
- done
-
- # Remove directories we do not care about
- for dir in ${SYSROOT_DIRS_IGNORE}; do
- rm -rf "$to$dir"
- done
-}
-
-sysroot_stage_all() {
- sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR}
-}
-
-python sysroot_strip () {
- inhibit_sysroot = d.getVar('INHIBIT_SYSROOT_STRIP')
- if inhibit_sysroot and oe.types.boolean(inhibit_sysroot):
- return
-
- dstdir = d.getVar('SYSROOT_DESTDIR')
- pn = d.getVar('PN')
- libdir = d.getVar("libdir")
- base_libdir = d.getVar("base_libdir")
- 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, d,
- qa_already_stripped=qa_already_stripped)
-}
-
-do_populate_sysroot[dirs] = "${SYSROOT_DESTDIR}"
-
-addtask populate_sysroot after do_install
-
-SYSROOT_PREPROCESS_FUNCS ?= ""
-SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir"
-
-python do_populate_sysroot () {
- # SYSROOT 'version' 2
- bb.build.exec_func("sysroot_stage_all", d)
- bb.build.exec_func("sysroot_strip", d)
- for f in (d.getVar('SYSROOT_PREPROCESS_FUNCS') or '').split():
- bb.build.exec_func(f, d)
- pn = d.getVar("PN")
- multiprov = d.getVar("BB_MULTI_PROVIDER_ALLOWED").split()
- provdir = d.expand("${SYSROOT_DESTDIR}${base_prefix}/sysroot-providers/")
- bb.utils.mkdirhier(provdir)
- for p in d.getVar("PROVIDES").split():
- if p in multiprov:
- continue
- p = p.replace("/", "_")
- with open(provdir + p, "w") as f:
- f.write(pn)
-}
-
-do_populate_sysroot[vardeps] += "${SYSROOT_PREPROCESS_FUNCS}"
-do_populate_sysroot[vardepsexclude] += "BB_MULTI_PROVIDER_ALLOWED"
-
-POPULATESYSROOTDEPS = ""
-POPULATESYSROOTDEPS:class-target = "virtual/${MLPREFIX}${HOST_PREFIX}binutils:do_populate_sysroot"
-POPULATESYSROOTDEPS:class-nativesdk = "virtual/${HOST_PREFIX}binutils-crosssdk:do_populate_sysroot"
-do_populate_sysroot[depends] += "${POPULATESYSROOTDEPS}"
-
-SSTATETASKS += "do_populate_sysroot"
-do_populate_sysroot[cleandirs] = "${SYSROOT_DESTDIR}"
-do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}"
-do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
-do_populate_sysroot[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
-
-python do_populate_sysroot_setscene () {
- sstate_setscene(d)
-}
-addtask do_populate_sysroot_setscene
-
-def staging_copyfile(c, target, dest, postinsts, seendirs):
- import errno
-
- destdir = os.path.dirname(dest)
- if destdir not in seendirs:
- bb.utils.mkdirhier(destdir)
- seendirs.add(destdir)
- if "/usr/bin/postinst-" in c:
- postinsts.append(dest)
- if os.path.islink(c):
- linkto = os.readlink(c)
- if os.path.lexists(dest):
- if not os.path.islink(dest):
- raise OSError(errno.EEXIST, "Link %s already exists as a file" % dest, dest)
- if os.readlink(dest) == linkto:
- return dest
- raise OSError(errno.EEXIST, "Link %s already exists to a different location? (%s vs %s)" % (dest, os.readlink(dest), linkto), dest)
- os.symlink(linkto, dest)
- #bb.warn(c)
- else:
- try:
- os.link(c, dest)
- except OSError as err:
- if err.errno == errno.EXDEV:
- bb.utils.copyfile(c, dest)
- else:
- raise
- return dest
-
-def staging_copydir(c, target, dest, seendirs):
- if dest not in seendirs:
- bb.utils.mkdirhier(dest)
- seendirs.add(dest)
-
-def staging_processfixme(fixme, target, recipesysroot, recipesysrootnative, d):
- import subprocess
-
- if not fixme:
- return
- cmd = "sed -e 's:^[^/]*/:%s/:g' %s | xargs sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (target, " ".join(fixme), recipesysroot, recipesysrootnative)
- for fixmevar in ['PSEUDO_SYSROOT', 'HOSTTOOLS_DIR', 'PKGDATA_DIR', 'PSEUDO_LOCALSTATEDIR', 'LOGFIFO']:
- fixme_path = d.getVar(fixmevar)
- cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
- bb.debug(2, cmd)
- subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-
-
-def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
- import glob
- import subprocess
- import errno
-
- fixme = []
- postinsts = []
- seendirs = set()
- stagingdir = d.getVar("STAGING_DIR")
- if native:
- pkgarchs = ['${BUILD_ARCH}', '${BUILD_ARCH}_*']
- targetdir = nativesysroot
- else:
- pkgarchs = ['${MACHINE_ARCH}']
- pkgarchs = pkgarchs + list(reversed(d.getVar("PACKAGE_EXTRA_ARCHS").split()))
- pkgarchs.append('allarch')
- targetdir = targetsysroot
-
- bb.utils.mkdirhier(targetdir)
- for pkgarch in pkgarchs:
- for manifest in glob.glob(d.expand("${SSTATE_MANIFESTS}/manifest-%s-*.populate_sysroot" % pkgarch)):
- if manifest.endswith("-initial.populate_sysroot"):
- # skip libgcc-initial due to file overlap
- continue
- if not native and (manifest.endswith("-native.populate_sysroot") or "nativesdk-" in manifest):
- continue
- if native and not (manifest.endswith("-native.populate_sysroot") or manifest.endswith("-cross.populate_sysroot") or "-cross-" in manifest):
- continue
- tmanifest = targetdir + "/" + os.path.basename(manifest)
- if os.path.exists(tmanifest):
- continue
- try:
- os.link(manifest, tmanifest)
- except OSError as err:
- if err.errno == errno.EXDEV:
- bb.utils.copyfile(manifest, tmanifest)
- else:
- raise
- with open(manifest, "r") as f:
- for l in f:
- l = l.strip()
- if l.endswith("/fixmepath"):
- fixme.append(l)
- continue
- if l.endswith("/fixmepath.cmd"):
- continue
- dest = l.replace(stagingdir, "")
- dest = targetdir + "/" + "/".join(dest.split("/")[3:])
- if l.endswith("/"):
- staging_copydir(l, targetdir, dest, seendirs)
- continue
- try:
- staging_copyfile(l, targetdir, dest, postinsts, seendirs)
- except FileExistsError:
- continue
-
- staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d)
- for p in postinsts:
- subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)
-
-#
-# Manifests here are complicated. The main sysroot area has the unpacked sstate
-# which us unrelocated and tracked by the main sstate manifests. Each recipe
-# specific sysroot has manifests for each dependency that is installed there.
-# The task hash is used to tell whether the data needs to be reinstalled. We
-# use a symlink to point to the currently installed hash. There is also a
-# "complete" stamp file which is used to mark if installation completed. If
-# something fails (e.g. a postinst), this won't get written and we would
-# remove and reinstall the dependency. This also means partially installed
-# dependencies should get cleaned up correctly.
-#
-
-python extend_recipe_sysroot() {
- import copy
- import subprocess
- import errno
- import collections
- import glob
-
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- mytaskname = d.getVar("BB_RUNTASK")
- if mytaskname.endswith("_setscene"):
- mytaskname = mytaskname.replace("_setscene", "")
- workdir = d.getVar("WORKDIR")
- #bb.warn(str(taskdepdata))
- pn = d.getVar("PN")
- stagingdir = d.getVar("STAGING_DIR")
- sharedmanifests = d.getVar("COMPONENTS_DIR") + "/manifests"
- recipesysroot = d.getVar("RECIPE_SYSROOT")
- recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE")
-
- # Detect bitbake -b usage
- nodeps = d.getVar("BB_LIMITEDDEPS") or False
- if nodeps:
- lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
- staging_populate_sysroot_dir(recipesysroot, recipesysrootnative, True, d)
- staging_populate_sysroot_dir(recipesysroot, recipesysrootnative, False, d)
- bb.utils.unlockfile(lock)
- return
-
- start = None
- configuredeps = []
- owntaskdeps = []
- for dep in taskdepdata:
- data = taskdepdata[dep]
- if data[1] == mytaskname and data[0] == pn:
- start = dep
- elif data[0] == pn:
- owntaskdeps.append(data[1])
- if start is None:
- bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
-
- # We need to figure out which sysroot files we need to expose to this task.
- # This needs to match what would get restored from sstate, which is controlled
- # ultimately by calls from bitbake to setscene_depvalid().
- # That function expects a setscene dependency tree. We build a dependency tree
- # condensed to inter-sstate task dependencies, similar to that used by setscene
- # tasks. We can then call into setscene_depvalid() and decide
- # which dependencies we can "see" and should expose in the recipe specific sysroot.
- setscenedeps = copy.deepcopy(taskdepdata)
-
- start = set([start])
-
- sstatetasks = d.getVar("SSTATETASKS").split()
- # Add recipe specific tasks referenced by setscene_depvalid()
- sstatetasks.append("do_stash_locale")
- sstatetasks.append("do_deploy")
-
- def print_dep_tree(deptree):
- data = ""
- for dep in deptree:
- deps = " " + "\n ".join(deptree[dep][3]) + "\n"
- data = data + "%s:\n %s\n %s\n%s %s\n %s\n" % (deptree[dep][0], deptree[dep][1], deptree[dep][2], deps, deptree[dep][4], deptree[dep][5])
- return data
-
- #bb.note("Full dep tree is:\n%s" % print_dep_tree(taskdepdata))
-
- #bb.note(" start2 is %s" % str(start))
-
- # If start is an sstate task (like do_package) we need to add in its direct dependencies
- # else the code below won't recurse into them.
- for dep in set(start):
- for dep2 in setscenedeps[dep][3]:
- start.add(dep2)
- start.remove(dep)
-
- #bb.note(" start3 is %s" % str(start))
-
- # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
- for dep in taskdepdata:
- data = setscenedeps[dep]
- if data[1] not in sstatetasks:
- for dep2 in setscenedeps:
- data2 = setscenedeps[dep2]
- if dep in data2[3]:
- data2[3].update(setscenedeps[dep][3])
- data2[3].remove(dep)
- if dep in start:
- start.update(setscenedeps[dep][3])
- start.remove(dep)
- del setscenedeps[dep]
-
- # Remove circular references
- for dep in setscenedeps:
- if dep in setscenedeps[dep][3]:
- setscenedeps[dep][3].remove(dep)
-
- #bb.note("Computed dep tree is:\n%s" % print_dep_tree(setscenedeps))
- #bb.note(" start is %s" % str(start))
-
- # Direct dependencies should be present and can be depended upon
- for dep in sorted(set(start)):
- if setscenedeps[dep][1] == "do_populate_sysroot":
- if dep not in configuredeps:
- configuredeps.append(dep)
- bb.note("Direct dependencies are %s" % str(configuredeps))
- #bb.note(" or %s" % str(start))
-
- msgbuf = []
- # Call into setscene_depvalid for each sub-dependency and only copy sysroot files
- # for ones that would be restored from sstate.
- done = list(start)
- next = list(start)
- while next:
- new = []
- for dep in next:
- data = setscenedeps[dep]
- for datadep in data[3]:
- if datadep in done:
- continue
- taskdeps = {}
- taskdeps[dep] = setscenedeps[dep][:2]
- taskdeps[datadep] = setscenedeps[datadep][:2]
- retval = setscene_depvalid(datadep, taskdeps, [], d, msgbuf)
- if retval:
- msgbuf.append("Skipping setscene dependency %s for installation into the sysroot" % datadep)
- continue
- done.append(datadep)
- new.append(datadep)
- if datadep not in configuredeps and setscenedeps[datadep][1] == "do_populate_sysroot":
- configuredeps.append(datadep)
- msgbuf.append("Adding dependency on %s" % setscenedeps[datadep][0])
- else:
- msgbuf.append("Following dependency on %s" % setscenedeps[datadep][0])
- next = new
-
- # This logging is too verbose for day to day use sadly
- #bb.debug(2, "\n".join(msgbuf))
-
- depdir = recipesysrootnative + "/installeddeps"
- bb.utils.mkdirhier(depdir)
- bb.utils.mkdirhier(sharedmanifests)
-
- lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
-
- fixme = {}
- seendirs = set()
- postinsts = []
- multilibs = {}
- manifests = {}
- # All files that we're going to be installing, to find conflicts.
- fileset = {}
-
- invalidate_tasks = set()
- for f in os.listdir(depdir):
- removed = []
- if not f.endswith(".complete"):
- continue
- f = depdir + "/" + f
- if os.path.islink(f) and not os.path.exists(f):
- bb.note("%s no longer exists, removing from sysroot" % f)
- lnk = os.readlink(f.replace(".complete", ""))
- sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
- os.unlink(f)
- os.unlink(f.replace(".complete", ""))
- removed.append(os.path.basename(f.replace(".complete", "")))
-
- # If we've removed files from the sysroot above, the task that installed them may still
- # have a stamp file present for the task. This is probably invalid right now but may become
- # valid again if the user were to change configuration back for example. Since we've removed
- # the files a task might need, remove the stamp file too to force it to rerun.
- # YOCTO #14790
- if removed:
- for i in glob.glob(depdir + "/index.*"):
- if i.endswith("." + mytaskname):
- continue
- with open(i, "r") as f:
- for l in f:
- if l.startswith("TaskDeps:"):
- continue
- l = l.strip()
- if l in removed:
- invalidate_tasks.add(i.rsplit(".", 1)[1])
- break
- for t in invalidate_tasks:
- bb.note("Invalidating stamps for task %s" % t)
- bb.build.clean_stamp(t, d)
-
- installed = []
- for dep in configuredeps:
- c = setscenedeps[dep][0]
- if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
- bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
- continue
- installed.append(c)
-
- # We want to remove anything which this task previously installed but is no longer a dependency
- taskindex = depdir + "/" + "index." + mytaskname
- if os.path.exists(taskindex):
- potential = []
- with open(taskindex, "r") as f:
- for l in f:
- l = l.strip()
- if l not in installed:
- fl = depdir + "/" + l
- if not os.path.exists(fl):
- # Was likely already uninstalled
- continue
- potential.append(l)
- # We need to ensure no other task needs this dependency. We hold the sysroot
- # lock so we ca search the indexes to check
- if potential:
- for i in glob.glob(depdir + "/index.*"):
- if i.endswith("." + mytaskname):
- continue
- with open(i, "r") as f:
- for l in f:
- if l.startswith("TaskDeps:"):
- prevtasks = l.split()[1:]
- if mytaskname in prevtasks:
- # We're a dependency of this task so we can clear items out the sysroot
- break
- l = l.strip()
- if l in potential:
- potential.remove(l)
- for l in potential:
- fl = depdir + "/" + l
- bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
- lnk = os.readlink(fl)
- sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
- os.unlink(fl)
- os.unlink(fl + ".complete")
-
- msg_exists = []
- msg_adding = []
-
- # Handle all removals first since files may move between recipes
- for dep in configuredeps:
- c = setscenedeps[dep][0]
- if c not in installed:
- continue
- taskhash = setscenedeps[dep][5]
- taskmanifest = depdir + "/" + c + "." + taskhash
-
- if os.path.exists(depdir + "/" + c):
- lnk = os.readlink(depdir + "/" + c)
- if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
- continue
- else:
- bb.note("%s exists in sysroot, but is stale (%s vs. %s), removing." % (c, lnk, c + "." + taskhash))
- sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
- os.unlink(depdir + "/" + c)
- if os.path.lexists(depdir + "/" + c + ".complete"):
- os.unlink(depdir + "/" + c + ".complete")
- elif os.path.lexists(depdir + "/" + c):
- os.unlink(depdir + "/" + c)
-
- binfiles = {}
- # Now handle installs
- for dep in configuredeps:
- c = setscenedeps[dep][0]
- if c not in installed:
- continue
- taskhash = setscenedeps[dep][5]
- taskmanifest = depdir + "/" + c + "." + taskhash
-
- if os.path.exists(depdir + "/" + c):
- lnk = os.readlink(depdir + "/" + c)
- if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
- msg_exists.append(c)
- continue
-
- msg_adding.append(c)
-
- os.symlink(c + "." + taskhash, depdir + "/" + c)
-
- manifest, d2 = oe.sstatesig.find_sstate_manifest(c, setscenedeps[dep][2], "populate_sysroot", d, multilibs)
- if d2 is not d:
- # If we don't do this, the recipe sysroot will be placed in the wrong WORKDIR for multilibs
- # We need a consistent WORKDIR for the image
- d2.setVar("WORKDIR", d.getVar("WORKDIR"))
- destsysroot = d2.getVar("RECIPE_SYSROOT")
- # We put allarch recipes into the default sysroot
- if manifest and "allarch" in manifest:
- destsysroot = d.getVar("RECIPE_SYSROOT")
-
- native = False
- if c.endswith("-native") or "-cross-" in c or "-crosssdk" in c:
- native = True
-
- if manifest:
- newmanifest = collections.OrderedDict()
- targetdir = destsysroot
- if native:
- targetdir = recipesysrootnative
- if targetdir not in fixme:
- fixme[targetdir] = []
- fm = fixme[targetdir]
-
- with open(manifest, "r") as f:
- manifests[dep] = manifest
- for l in f:
- l = l.strip()
- if l.endswith("/fixmepath"):
- fm.append(l)
- continue
- if l.endswith("/fixmepath.cmd"):
- continue
- dest = l.replace(stagingdir, "")
- dest = "/" + "/".join(dest.split("/")[3:])
- newmanifest[l] = targetdir + dest
-
- # Check if files have already been installed by another
- # recipe and abort if they have, explaining what recipes are
- # conflicting.
- hashname = targetdir + dest
- if not hashname.endswith("/"):
- if hashname in fileset:
- bb.fatal("The file %s is installed by both %s and %s, aborting" % (dest, c, fileset[hashname]))
- else:
- fileset[hashname] = c
-
- # Having multiple identical manifests in each sysroot eats diskspace so
- # create a shared pool of them and hardlink if we can.
- # We create the manifest in advance so that if something fails during installation,
- # or the build is interrupted, subsequent exeuction can cleanup.
- sharedm = sharedmanifests + "/" + os.path.basename(taskmanifest)
- if not os.path.exists(sharedm):
- smlock = bb.utils.lockfile(sharedm + ".lock")
- # Can race here. You'd think it just means we may not end up with all copies hardlinked to each other
- # but python can lose file handles so we need to do this under a lock.
- if not os.path.exists(sharedm):
- with open(sharedm, 'w') as m:
- for l in newmanifest:
- dest = newmanifest[l]
- m.write(dest.replace(workdir + "/", "") + "\n")
- bb.utils.unlockfile(smlock)
- try:
- os.link(sharedm, taskmanifest)
- except OSError as err:
- if err.errno == errno.EXDEV:
- bb.utils.copyfile(sharedm, taskmanifest)
- else:
- raise
- # Finally actually install the files
- for l in newmanifest:
- dest = newmanifest[l]
- if l.endswith("/"):
- staging_copydir(l, targetdir, dest, seendirs)
- continue
- if "/bin/" in l or "/sbin/" in l:
- # defer /*bin/* files until last in case they need libs
- binfiles[l] = (targetdir, dest)
- else:
- staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-
- # Handle deferred binfiles
- for l in binfiles:
- (targetdir, dest) = binfiles[l]
- staging_copyfile(l, targetdir, dest, postinsts, seendirs)
-
- bb.note("Installed into sysroot: %s" % str(msg_adding))
- bb.note("Skipping as already exists in sysroot: %s" % str(msg_exists))
-
- for f in fixme:
- staging_processfixme(fixme[f], f, recipesysroot, recipesysrootnative, d)
-
- for p in postinsts:
- subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)
-
- for dep in manifests:
- c = setscenedeps[dep][0]
- os.symlink(manifests[dep], depdir + "/" + c + ".complete")
-
- with open(taskindex, "w") as f:
- f.write("TaskDeps: " + " ".join(owntaskdeps) + "\n")
- for l in sorted(installed):
- f.write(l + "\n")
-
- bb.utils.unlockfile(lock)
-}
-extend_recipe_sysroot[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"
-
-do_prepare_recipe_sysroot[deptask] = "do_populate_sysroot"
-python do_prepare_recipe_sysroot () {
- bb.build.exec_func("extend_recipe_sysroot", d)
-}
-addtask do_prepare_recipe_sysroot before do_configure after do_fetch
-
-python staging_taskhandler() {
- bbtasks = e.tasklist
- for task in bbtasks:
- deps = d.getVarFlag(task, "depends")
- if task == "do_configure" or (deps and "populate_sysroot" in deps):
- d.prependVarFlag(task, "prefuncs", "extend_recipe_sysroot ")
-}
-staging_taskhandler[eventmask] = "bb.event.RecipeTaskPreProcess"
-addhandler staging_taskhandler
-
-
-#
-# Target build output, stored in do_populate_sysroot or do_package can depend
-# not only upon direct dependencies but also indirect ones. A good example is
-# linux-libc-headers. The toolchain depends on this but most target recipes do
-# not. There are some headers which are not used by the toolchain build and do
-# not change the toolchain task output, hence the task hashes can change without
-# changing the sysroot output of that recipe yet they can influence others.
-#
-# A specific example is rtc.h which can change rtcwake.c in util-linux but is not
-# used in the glibc or gcc build. To account for this, we need to account for the
-# populate_sysroot hashes in the task output hashes.
-#
-python target_add_sysroot_deps () {
- current_task = "do_" + d.getVar("BB_CURRENTTASK")
- if current_task not in ["do_populate_sysroot", "do_package"]:
- return
-
- pn = d.getVar("PN")
- if pn.endswith("-native"):
- return
-
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- deps = {}
- for dep in taskdepdata.values():
- if dep[1] == "do_populate_sysroot" and not dep[0].endswith(("-native", "-initial")) and "-cross-" not in dep[0] and dep[0] != pn:
- deps[dep[0]] = dep[6]
-
- d.setVar("HASHEQUIV_EXTRA_SIGDATA", "\n".join("%s: %s" % (k, deps[k]) for k in sorted(deps.keys())))
-}
-SSTATECREATEFUNCS += "target_add_sysroot_deps"
-
diff --git a/poky/meta/classes/syslinux.bbclass b/poky/meta/classes/syslinux.bbclass
deleted file mode 100644
index 894f6b3..0000000
--- a/poky/meta/classes/syslinux.bbclass
+++ /dev/null
@@ -1,194 +0,0 @@
-# syslinux.bbclass
-# Copyright (C) 2004-2006, Advanced Micro Devices, Inc. All Rights Reserved
-# Released under the MIT license (see packages/COPYING)
-
-# Provide syslinux specific functions for building bootable images.
-
-# External variables
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-# ${AUTO_SYSLINUXMENU} - set this to 1 to enable creating an automatic menu
-# ${LABELS} - a list of targets for the automatic config
-# ${APPEND} - an override list of append strings for each label
-# ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
-# ${SYSLINUX_SPLASH} - A background for the vga boot menu if using the boot menu
-# ${SYSLINUX_DEFAULT_CONSOLE} - set to "console=ttyX" to change kernel boot default console
-# ${SYSLINUX_SERIAL} - Set an alternate serial port or turn off serial with empty string
-# ${SYSLINUX_SERIAL_TTY} - Set alternate console=tty... kernel boot argument
-# ${SYSLINUX_KERNEL_ARGS} - Add additional kernel arguments
-
-do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \
- syslinux-native:do_populate_sysroot"
-
-ISOLINUXDIR ?= "/isolinux"
-SYSLINUXDIR = "/"
-# The kernel has an internal default console, which you can override with
-# a console=...some_tty...
-SYSLINUX_DEFAULT_CONSOLE ?= ""
-SYSLINUX_SERIAL ?= "0 115200"
-SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200"
-SYSLINUX_PROMPT ?= "0"
-SYSLINUX_TIMEOUT ?= "50"
-AUTO_SYSLINUXMENU ?= "1"
-SYSLINUX_ALLOWOPTIONS ?= "1"
-SYSLINUX_ROOT ?= "${ROOT}"
-SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg"
-SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg"
-APPEND ?= ""
-
-# Need UUID utility code.
-inherit fs-uuid
-
-syslinux_populate() {
- DEST=$1
- BOOTDIR=$2
- CFGNAME=$3
-
- install -d ${DEST}${BOOTDIR}
-
- # Install the config files
- install -m 0644 ${SYSLINUX_CFG} ${DEST}${BOOTDIR}/${CFGNAME}
- if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then
- install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${DEST}${BOOTDIR}/vesamenu.c32
- install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${DEST}${BOOTDIR}/libcom32.c32
- install -m 0444 ${STAGING_DATADIR}/syslinux/libutil.c32 ${DEST}${BOOTDIR}/libutil.c32
- if [ "${SYSLINUX_SPLASH}" != "" ] ; then
- install -m 0644 ${SYSLINUX_SPLASH} ${DEST}${BOOTDIR}/splash.lss
- fi
- fi
-}
-
-syslinux_iso_populate() {
- iso_dir=$1
- syslinux_populate $iso_dir ${ISOLINUXDIR} isolinux.cfg
- install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin $iso_dir${ISOLINUXDIR}
- install -m 0644 ${STAGING_DATADIR}/syslinux/ldlinux.c32 $iso_dir${ISOLINUXDIR}
-}
-
-syslinux_hddimg_populate() {
- hdd_dir=$1
- syslinux_populate $hdd_dir ${SYSLINUXDIR} syslinux.cfg
- install -m 0444 ${STAGING_DATADIR}/syslinux/ldlinux.sys $hdd_dir${SYSLINUXDIR}/ldlinux.sys
-}
-
-syslinux_hddimg_install() {
- syslinux ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg
-}
-
-python build_syslinux_cfg () {
- import copy
- import sys
-
- workdir = d.getVar('WORKDIR')
- if not workdir:
- bb.error("WORKDIR not defined, unable to package")
- return
-
- labels = d.getVar('LABELS')
- if not labels:
- bb.debug(1, "LABELS not defined, nothing to do")
- return
-
- if labels == []:
- bb.debug(1, "No labels, nothing to do")
- return
-
- cfile = d.getVar('SYSLINUX_CFG')
- if not cfile:
- bb.fatal('Unable to read SYSLINUX_CFG')
-
- try:
- cfgfile = open(cfile, 'w')
- except OSError:
- bb.fatal('Unable to open %s' % cfile)
-
- cfgfile.write('# Automatically created by OE\n')
-
- opts = d.getVar('SYSLINUX_OPTS')
-
- if opts:
- for opt in opts.split(';'):
- cfgfile.write('%s\n' % opt)
-
- allowoptions = d.getVar('SYSLINUX_ALLOWOPTIONS')
- if allowoptions:
- cfgfile.write('ALLOWOPTIONS %s\n' % allowoptions)
- else:
- cfgfile.write('ALLOWOPTIONS 1\n')
-
- syslinux_default_console = d.getVar('SYSLINUX_DEFAULT_CONSOLE')
- syslinux_serial_tty = d.getVar('SYSLINUX_SERIAL_TTY')
- syslinux_serial = d.getVar('SYSLINUX_SERIAL')
- if syslinux_serial:
- cfgfile.write('SERIAL %s\n' % syslinux_serial)
-
- menu = (d.getVar('AUTO_SYSLINUXMENU') == "1")
-
- if menu and syslinux_serial:
- cfgfile.write('DEFAULT Graphics console %s\n' % (labels.split()[0]))
- else:
- cfgfile.write('DEFAULT %s\n' % (labels.split()[0]))
-
- timeout = d.getVar('SYSLINUX_TIMEOUT')
-
- if timeout:
- cfgfile.write('TIMEOUT %s\n' % timeout)
- else:
- cfgfile.write('TIMEOUT 50\n')
-
- prompt = d.getVar('SYSLINUX_PROMPT')
- if prompt:
- cfgfile.write('PROMPT %s\n' % prompt)
- else:
- cfgfile.write('PROMPT 1\n')
-
- if menu:
- cfgfile.write('ui vesamenu.c32\n')
- cfgfile.write('menu title Select kernel options and boot kernel\n')
- cfgfile.write('menu tabmsg Press [Tab] to edit, [Return] to select\n')
- splash = d.getVar('SYSLINUX_SPLASH')
- if splash:
- cfgfile.write('menu background splash.lss\n')
-
- for label in labels.split():
- localdata = bb.data.createCopy(d)
-
- overrides = localdata.getVar('OVERRIDES')
- if not overrides:
- bb.fatal('OVERRIDES not defined')
-
- localdata.setVar('OVERRIDES', label + ':' + overrides)
-
- btypes = [ [ "", syslinux_default_console ] ]
- if menu and syslinux_serial:
- btypes = [ [ "Graphics console ", syslinux_default_console ],
- [ "Serial console ", syslinux_serial_tty ] ]
-
- root= d.getVar('SYSLINUX_ROOT')
- if not root:
- bb.fatal('SYSLINUX_ROOT not defined')
-
- kernel = localdata.getVar('KERNEL_IMAGETYPE')
- for btype in btypes:
- cfgfile.write('LABEL %s%s\nKERNEL /%s\n' % (btype[0], label, kernel))
-
- exargs = d.getVar('SYSLINUX_KERNEL_ARGS')
- if exargs:
- btype[1] += " " + exargs
-
- append = localdata.getVar('APPEND')
- initrd = localdata.getVar('INITRD')
-
- append = root + " " + append
- cfgfile.write('APPEND ')
-
- if initrd:
- cfgfile.write('initrd=/initrd ')
-
- cfgfile.write('LABEL=%s '% (label))
- append = replace_rootfs_uuid(d, append)
- cfgfile.write('%s %s\n' % (append, btype[1]))
-
- cfgfile.close()
-}
-build_syslinux_cfg[dirs] = "${S}"
diff --git a/poky/meta/classes/systemd-boot-cfg.bbclass b/poky/meta/classes/systemd-boot-cfg.bbclass
deleted file mode 100644
index b3e0e6a..0000000
--- a/poky/meta/classes/systemd-boot-cfg.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
-SYSTEMD_BOOT_ENTRIES ?= ""
-SYSTEMD_BOOT_TIMEOUT ?= "10"
-
-# Uses MACHINE specific KERNEL_IMAGETYPE
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# Need UUID utility code.
-inherit fs-uuid
-
-python build_efi_cfg() {
- s = d.getVar("S")
- labels = d.getVar('LABELS')
- if not labels:
- bb.debug(1, "LABELS not defined, nothing to do")
- return
-
- if labels == []:
- bb.debug(1, "No labels, nothing to do")
- return
-
- cfile = d.getVar('SYSTEMD_BOOT_CFG')
- cdir = os.path.dirname(cfile)
- if not os.path.exists(cdir):
- os.makedirs(cdir)
- try:
- cfgfile = open(cfile, 'w')
- except OSError:
- bb.fatal('Unable to open %s' % cfile)
-
- cfgfile.write('# Automatically created by OE\n')
- cfgfile.write('default %s\n' % (labels.split()[0]))
- timeout = d.getVar('SYSTEMD_BOOT_TIMEOUT')
- if timeout:
- cfgfile.write('timeout %s\n' % timeout)
- else:
- cfgfile.write('timeout 10\n')
- cfgfile.close()
-
- for label in labels.split():
- localdata = d.createCopy()
-
- entryfile = "%s/%s.conf" % (s, label)
- if not os.path.exists(s):
- os.makedirs(s)
- d.appendVar("SYSTEMD_BOOT_ENTRIES", " " + entryfile)
- try:
- entrycfg = open(entryfile, "w")
- except OSError:
- bb.fatal('Unable to open %s' % entryfile)
-
- entrycfg.write('title %s\n' % label)
-
- kernel = localdata.getVar("KERNEL_IMAGETYPE")
- entrycfg.write('linux /%s\n' % kernel)
-
- append = localdata.getVar('APPEND')
- initrd = localdata.getVar('INITRD')
-
- if initrd:
- entrycfg.write('initrd /initrd\n')
- lb = label
- if label == "install":
- lb = "install-efi"
- entrycfg.write('options LABEL=%s ' % lb)
- if append:
- append = replace_rootfs_uuid(d, append)
- entrycfg.write('%s' % append)
- entrycfg.write('\n')
- entrycfg.close()
-}
diff --git a/poky/meta/classes/systemd-boot.bbclass b/poky/meta/classes/systemd-boot.bbclass
deleted file mode 100644
index 57ec0ac..0000000
--- a/poky/meta/classes/systemd-boot.bbclass
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2016 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-# systemd-boot.bbclass - The "systemd-boot" is essentially the gummiboot merged into systemd.
-# The original standalone gummiboot project is dead without any more
-# maintenance.
-#
-# Set EFI_PROVIDER = "systemd-boot" to use systemd-boot on your live images instead of grub-efi
-# (images built by image-live.bbclass)
-
-do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
-
-require conf/image-uefi.conf
-# Need UUID utility code.
-inherit fs-uuid
-
-efi_populate() {
- efi_populate_common "$1" systemd
-
- # systemd-boot requires these paths for configuration files
- # they are not customizable so no point in new vars
- install -d ${DEST}/loader
- install -d ${DEST}/loader/entries
- install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf
- for i in ${SYSTEMD_BOOT_ENTRIES}; do
- install -m 0644 ${i} ${DEST}/loader/entries
- done
-}
-
-efi_iso_populate:append() {
- cp -r $iso_dir/loader ${EFIIMGDIR}
-}
-
-inherit systemd-boot-cfg
diff --git a/poky/meta/classes/systemd.bbclass b/poky/meta/classes/systemd.bbclass
deleted file mode 100644
index 09ec527..0000000
--- a/poky/meta/classes/systemd.bbclass
+++ /dev/null
@@ -1,233 +0,0 @@
-# The list of packages that should have systemd packaging scripts added. For
-# each entry, optionally have a SYSTEMD_SERVICE:[package] that lists the service
-# files in this package. If this variable isn't set, [package].service is used.
-SYSTEMD_PACKAGES ?= "${PN}"
-SYSTEMD_PACKAGES:class-native ?= ""
-SYSTEMD_PACKAGES:class-nativesdk ?= ""
-
-# Whether to enable or disable the services on installation.
-SYSTEMD_AUTO_ENABLE ??= "enable"
-
-# This class will be included in any recipe that supports systemd init scripts,
-# even if systemd is not in DISTRO_FEATURES. As such don't make any changes
-# directly but check the DISTRO_FEATURES first.
-python __anonymous() {
- # If the distro features have systemd but not sysvinit, inhibit update-rcd
- # from doing any work so that pure-systemd images don't have redundant init
- # files.
- if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
- d.appendVar("DEPENDS", " systemd-systemctl-native")
- d.appendVar("PACKAGE_WRITE_DEPS", " systemd-systemctl-native")
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
-}
-
-systemd_postinst() {
-if systemctl >/dev/null 2>/dev/null; then
- OPTS=""
-
- if [ -n "$D" ]; then
- OPTS="--root=$D"
- fi
-
- if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
- for service in ${SYSTEMD_SERVICE_ESCAPED}; do
- systemctl ${OPTS} enable "$service"
- done
- fi
-
- if [ -z "$D" ]; then
- systemctl daemon-reload
- systemctl preset ${SYSTEMD_SERVICE_ESCAPED}
-
- if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
- systemctl --no-block restart ${SYSTEMD_SERVICE_ESCAPED}
- fi
- fi
-fi
-}
-
-systemd_prerm() {
-if systemctl >/dev/null 2>/dev/null; then
- if [ -z "$D" ]; then
- systemctl stop ${SYSTEMD_SERVICE_ESCAPED}
-
- systemctl disable ${SYSTEMD_SERVICE_ESCAPED}
- fi
-fi
-}
-
-
-systemd_populate_packages[vardeps] += "systemd_prerm systemd_postinst"
-systemd_populate_packages[vardepsexclude] += "OVERRIDES"
-
-
-python systemd_populate_packages() {
- import re
- import shlex
-
- if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
- return
-
- def get_package_var(d, var, pkg):
- val = (d.getVar('%s:%s' % (var, pkg)) or "").strip()
- if val == "":
- val = (d.getVar(var) or "").strip()
- return val
-
- # Check if systemd-packages already included in PACKAGES
- def systemd_check_package(pkg_systemd):
- packages = d.getVar('PACKAGES')
- if not pkg_systemd in packages.split():
- bb.error('%s does not appear in package list, please add it' % pkg_systemd)
-
-
- def systemd_generate_package_scripts(pkg):
- bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)
-
- paths_escaped = ' '.join(shlex.quote(s) for s in d.getVar('SYSTEMD_SERVICE:' + pkg).split())
- d.setVar('SYSTEMD_SERVICE_ESCAPED:' + pkg, paths_escaped)
-
- # Add pkg to the overrides so that it finds the SYSTEMD_SERVICE:pkg
- # variable.
- localdata = d.createCopy()
- localdata.prependVar("OVERRIDES", pkg + ":")
-
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += localdata.getVar('systemd_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- prerm = d.getVar('pkg_prerm:%s' % pkg)
- if not prerm:
- prerm = '#!/bin/sh\n'
- prerm += localdata.getVar('systemd_prerm')
- d.setVar('pkg_prerm:%s' % pkg, prerm)
-
-
- # Add files to FILES:*-systemd if existent and not already done
- def systemd_append_file(pkg_systemd, file_append):
- appended = False
- if os.path.exists(oe.path.join(d.getVar("D"), file_append)):
- var_name = "FILES:" + pkg_systemd
- files = d.getVar(var_name, False) or ""
- if file_append not in files.split():
- d.appendVar(var_name, " " + file_append)
- appended = True
- return appended
-
- # Add systemd files to FILES:*-systemd, parse for Also= and follow recursive
- def systemd_add_files_and_parse(pkg_systemd, path, service, keys):
- # avoid infinite recursion
- if systemd_append_file(pkg_systemd, oe.path.join(path, service)):
- fullpath = oe.path.join(d.getVar("D"), path, service)
- if service.find('.service') != -1:
- # for *.service add *@.service
- service_base = service.replace('.service', '')
- systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service', keys)
- if service.find('.socket') != -1:
- # for *.socket add *.service and *@.service
- service_base = service.replace('.socket', '')
- systemd_add_files_and_parse(pkg_systemd, path, service_base + '.service', keys)
- systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service', keys)
- for key in keys.split():
- # recurse all dependencies found in keys ('Also';'Conflicts';..) and add to files
- cmd = "grep %s %s | sed 's,%s=,,g' | tr ',' '\\n'" % (key, shlex.quote(fullpath), key)
- pipe = os.popen(cmd, 'r')
- line = pipe.readline()
- while line:
- line = line.replace('\n', '')
- systemd_add_files_and_parse(pkg_systemd, path, line, keys)
- line = pipe.readline()
- pipe.close()
-
- # Check service-files and call systemd_add_files_and_parse for each entry
- def systemd_check_services():
- searchpaths = [oe.path.join(d.getVar("sysconfdir"), "systemd", "system"),]
- searchpaths.append(d.getVar("systemd_system_unitdir"))
- systemd_packages = d.getVar('SYSTEMD_PACKAGES')
-
- keys = 'Also'
- # scan for all in SYSTEMD_SERVICE[]
- for pkg_systemd in systemd_packages.split():
- for service in get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd).split():
- path_found = ''
-
- # Deal with adding, for example, 'ifplugd@eth0.service' from
- # 'ifplugd@.service'
- base = None
- at = service.find('@')
- if at != -1:
- ext = service.rfind('.')
- base = service[:at] + '@' + service[ext:]
-
- for path in searchpaths:
- if os.path.exists(oe.path.join(d.getVar("D"), path, service)):
- path_found = path
- break
- elif base is not None:
- if os.path.exists(oe.path.join(d.getVar("D"), path, base)):
- path_found = path
- break
-
- if path_found != '':
- systemd_add_files_and_parse(pkg_systemd, path_found, service, keys)
- else:
- bb.fatal("Didn't find service unit '{0}', specified in SYSTEMD_SERVICE:{1}. {2}".format(
- service, pkg_systemd, "Also looked for service unit '{0}'.".format(base) if base is not None else ""))
-
- def systemd_create_presets(pkg, action):
- presetf = oe.path.join(d.getVar("PKGD"), d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg)
- bb.utils.mkdirhier(os.path.dirname(presetf))
- with open(presetf, 'a') as fd:
- for service in d.getVar('SYSTEMD_SERVICE:%s' % pkg).split():
- fd.write("%s %s\n" % (action,service))
- d.appendVar("FILES:%s" % pkg, ' ' + oe.path.join(d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg))
-
- # Run all modifications once when creating package
- if os.path.exists(d.getVar("D")):
- for pkg in d.getVar('SYSTEMD_PACKAGES').split():
- systemd_check_package(pkg)
- if d.getVar('SYSTEMD_SERVICE:' + pkg):
- systemd_generate_package_scripts(pkg)
- action = get_package_var(d, 'SYSTEMD_AUTO_ENABLE', pkg)
- if action in ("enable", "disable"):
- systemd_create_presets(pkg, action)
- elif action not in ("mask", "preset"):
- bb.fatal("SYSTEMD_AUTO_ENABLE:%s '%s' is not 'enable', 'disable', 'mask' or 'preset'" % (pkg, action))
- systemd_check_services()
-}
-
-PACKAGESPLITFUNCS:prepend = "systemd_populate_packages "
-
-python rm_systemd_unitdir (){
- import shutil
- if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
- systemd_unitdir = oe.path.join(d.getVar("D"), d.getVar('systemd_unitdir'))
- if os.path.exists(systemd_unitdir):
- shutil.rmtree(systemd_unitdir)
- systemd_libdir = os.path.dirname(systemd_unitdir)
- if (os.path.exists(systemd_libdir) and not os.listdir(systemd_libdir)):
- os.rmdir(systemd_libdir)
-}
-
-python rm_sysvinit_initddir (){
- import shutil
- sysv_initddir = oe.path.join(d.getVar("D"), (d.getVar('INIT_D_DIR') or "/etc/init.d"))
-
- if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \
- not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \
- os.path.exists(sysv_initddir):
- systemd_system_unitdir = oe.path.join(d.getVar("D"), d.getVar('systemd_system_unitdir'))
-
- # If systemd_system_unitdir contains anything, delete sysv_initddir
- if (os.path.exists(systemd_system_unitdir) and os.listdir(systemd_system_unitdir)):
- shutil.rmtree(sysv_initddir)
-}
-
-do_install[postfuncs] += "${RMINITDIR} "
-RMINITDIR:class-target = " rm_sysvinit_initddir rm_systemd_unitdir "
-RMINITDIR:class-nativesdk = " rm_sysvinit_initddir rm_systemd_unitdir "
-RMINITDIR = ""
-
diff --git a/poky/meta/classes/terminal.bbclass b/poky/meta/classes/terminal.bbclass
index a564ee7..2dfc7db 100644
--- a/poky/meta/classes/terminal.bbclass
+++ b/poky/meta/classes/terminal.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
OE_TERMINAL ?= 'auto'
OE_TERMINAL[type] = 'choice'
OE_TERMINAL[choices] = 'auto none \
diff --git a/poky/meta/classes/testexport.bbclass b/poky/meta/classes/testexport.bbclass
index 1b0fb44..f7c5242 100644
--- a/poky/meta/classes/testexport.bbclass
+++ b/poky/meta/classes/testexport.bbclass
@@ -1,7 +1,6 @@
# Copyright (C) 2016 Intel Corporation
#
-# Released under the MIT license (see COPYING.MIT)
-#
+# SPDX-License-Identifier: MIT
#
# testexport.bbclass allows to execute runtime test outside OE environment.
# Most of the tests are commands run on target image over ssh.
@@ -23,10 +22,9 @@
TEST_TARGET_IP ?= ""
TEST_SERVER_IP ?= ""
-TEST_EXPORT_SDK_PACKAGES ?= ""
+require conf/testexport.conf
+
TEST_EXPORT_SDK_ENABLED ?= "0"
-TEST_EXPORT_SDK_NAME ?= "testexport-tools-nativesdk"
-TEST_EXPORT_SDK_DIR ?= "sdk"
TEST_EXPORT_DEPENDS = ""
TEST_EXPORT_DEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}"
@@ -179,4 +177,4 @@
tar.close()
os.chdir(current_dir)
-inherit testimage
+IMAGE_CLASSES += "testimage"
diff --git a/poky/meta/classes/testimage.bbclass b/poky/meta/classes/testimage.bbclass
deleted file mode 100644
index 7898223..0000000
--- a/poky/meta/classes/testimage.bbclass
+++ /dev/null
@@ -1,508 +0,0 @@
-# Copyright (C) 2013 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-inherit metadata_scm
-inherit image-artifact-names
-
-# testimage.bbclass enables testing of qemu images using python unittests.
-# Most of the tests are commands run on target image over ssh.
-# To use it add testimage to global inherit and call your target image with -c testimage
-# You can try it out like this:
-# - first add IMAGE_CLASSES += "testimage" in local.conf
-# - build a qemu core-image-sato
-# - then bitbake core-image-sato -c testimage. That will run a standard suite of tests.
-#
-# The tests can be run automatically each time an image is built if you set
-# TESTIMAGE_AUTO = "1"
-
-TESTIMAGE_AUTO ??= "0"
-
-# You can set (or append to) TEST_SUITES in local.conf to select the tests
-# which you want to run for your target.
-# The test names are the module names in meta/lib/oeqa/runtime/cases.
-# Each name in TEST_SUITES represents a required test for the image. (no skipping allowed)
-# Appending "auto" means that it will try to run all tests that are suitable for the image (each test decides that on it's own).
-# Note that order in TEST_SUITES is relevant: tests are run in an order such that
-# tests mentioned in @skipUnlessPassed run before the tests that depend on them,
-# but without such dependencies, tests run in the order in which they are listed
-# in TEST_SUITES.
-#
-# A layer can add its own tests in lib/oeqa/runtime, provided it extends BBPATH as normal in its layer.conf.
-
-# TEST_LOG_DIR contains a command ssh log and may contain infromation about what command is running, output and return codes and for qemu a boot log till login.
-# Booting is handled by this class, and it's not a test in itself.
-# TEST_QEMUBOOT_TIMEOUT can be used to set the maximum time in seconds the launch code will wait for the login prompt.
-# TEST_OVERALL_TIMEOUT can be used to set the maximum time in seconds the tests will be allowed to run (defaults to no limit).
-# TEST_QEMUPARAMS can be used to pass extra parameters to qemu, e.g. "-m 1024" for setting the amount of ram to 1 GB.
-# TEST_RUNQEMUPARAMS can be used to pass extra parameters to runqemu, e.g. "gl" to enable OpenGL acceleration.
-# QEMU_USE_KVM can be set to "" to disable the use of kvm (by default it is enabled if target_arch == build_arch or both of them are x86 archs)
-
-# TESTIMAGE_BOOT_PATTERNS can be used to override certain patterns used to communicate with the target when booting,
-# if a pattern is not specifically present on this variable a default will be used when booting the target.
-# TESTIMAGE_BOOT_PATTERNS[<flag>] overrides the pattern used for that specific flag, where flag comes from a list of accepted flags
-# e.g. normally the system boots and waits for a login prompt (login:), after that it sends the command: "root\n" to log as the root user
-# if we wanted to log in as the hypothetical "webserver" user for example we could set the following:
-# TESTIMAGE_BOOT_PATTERNS = "send_login_user search_login_succeeded"
-# TESTIMAGE_BOOT_PATTERNS[send_login_user] = "webserver\n"
-# TESTIMAGE_BOOT_PATTERNS[search_login_succeeded] = "webserver@[a-zA-Z0-9\-]+:~#"
-# The accepted flags are the following: search_reached_prompt, send_login_user, search_login_succeeded, search_cmd_finished.
-# They are prefixed with either search/send, to differentiate if the pattern is meant to be sent or searched to/from the target terminal
-
-TEST_LOG_DIR ?= "${WORKDIR}/testimage"
-
-TEST_EXPORT_DIR ?= "${TMPDIR}/testimage/${PN}"
-TEST_INSTALL_TMP_DIR ?= "${WORKDIR}/testimage/install_tmp"
-TEST_NEEDED_PACKAGES_DIR ?= "${WORKDIR}/testimage/packages"
-TEST_EXTRACTED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/extracted"
-TEST_PACKAGED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/packaged"
-
-BASICTESTSUITE = "\
- ping date df ssh scp python perl gi ptest parselogs \
- logrotate connman systemd oe_syslog pam stap ldd xorg \
- kernelmodule gcc buildcpio buildlzip buildgalculator \
- dnf rpm opkg apt weston go rust"
-
-DEFAULT_TEST_SUITES = "${BASICTESTSUITE}"
-
-# musl doesn't support systemtap
-DEFAULT_TEST_SUITES:remove:libc-musl = "stap"
-
-# qemumips is quite slow and has reached the timeout limit several times on the YP build cluster,
-# mitigate this by removing build tests for qemumips machines.
-MIPSREMOVE ??= "buildcpio buildlzip buildgalculator"
-DEFAULT_TEST_SUITES:remove:qemumips = "${MIPSREMOVE}"
-DEFAULT_TEST_SUITES:remove:qemumips64 = "${MIPSREMOVE}"
-
-TEST_SUITES ?= "${DEFAULT_TEST_SUITES}"
-
-QEMU_USE_KVM ?= "1"
-TEST_QEMUBOOT_TIMEOUT ?= "1000"
-TEST_OVERALL_TIMEOUT ?= ""
-TEST_TARGET ?= "qemu"
-TEST_QEMUPARAMS ?= ""
-TEST_RUNQEMUPARAMS ?= ""
-
-TESTIMAGE_BOOT_PATTERNS ?= ""
-
-TESTIMAGEDEPENDS = ""
-TESTIMAGEDEPENDS:append:qemuall = " qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot qemu-helper-native:do_addto_recipe_sysroot"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf-native:do_populate_sysroot', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'ipk', 'opkg-utils-native:do_populate_sysroot package-index:do_package_index', '', d)}"
-TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 'apt-native:do_populate_sysroot package-index:do_package_index', '', d)}"
-
-TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
-TESTIMAGELOCK:qemuall = ""
-
-TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
-
-TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR"
-
-testimage_dump_target () {
- top -bn1
- ps
- free
- df
- # The next command will export the default gateway IP
- export DEFAULT_GATEWAY=$(ip route | awk '/default/ { print $3}')
- ping -c3 $DEFAULT_GATEWAY
- dmesg
- netstat -an
- ip address
- # Next command will dump logs from /var/log/
- find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
-}
-
-testimage_dump_host () {
- top -bn1
- iostat -x -z -N -d -p ALL 20 2
- ps -ef
- free
- df
- memstat
- dmesg
- ip -s link
- netstat -an
-}
-
-testimage_dump_monitor () {
- query-status
- query-block
- dump-guest-memory {"paging":false,"protocol":"file:%s.img"}
-}
-
-python do_testimage() {
- testimage_main(d)
-}
-
-addtask testimage
-do_testimage[nostamp] = "1"
-do_testimage[network] = "1"
-do_testimage[depends] += "${TESTIMAGEDEPENDS}"
-do_testimage[lockfiles] += "${TESTIMAGELOCK}"
-
-def testimage_sanity(d):
- if (d.getVar('TEST_TARGET') == 'simpleremote'
- and (not d.getVar('TEST_TARGET_IP')
- or not d.getVar('TEST_SERVER_IP'))):
- bb.fatal('When TEST_TARGET is set to "simpleremote" '
- 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
-
-def get_testimage_configuration(d, test_type, machine):
- import platform
- from oeqa.utils.metadata import get_layers
- configuration = {'TEST_TYPE': test_type,
- 'MACHINE': machine,
- 'DISTRO': d.getVar("DISTRO"),
- 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
- 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
- 'STARTTIME': d.getVar("DATETIME"),
- 'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
- 'LAYERS': get_layers(d.getVar("BBLAYERS"))}
- return configuration
-get_testimage_configuration[vardepsexclude] = "DATETIME"
-
-def get_testimage_json_result_dir(d):
- json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
- custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
- if custom_json_result_dir:
- json_result_dir = custom_json_result_dir
- return json_result_dir
-
-def get_testimage_result_id(configuration):
- return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME'])
-
-def get_testimage_boot_patterns(d):
- from collections import defaultdict
- boot_patterns = defaultdict(str)
- # Only accept certain values
- accepted_patterns = ['search_reached_prompt', 'send_login_user', 'search_login_succeeded', 'search_cmd_finished']
- # Not all patterns need to be overriden, e.g. perhaps we only want to change the user
- boot_patterns_flags = d.getVarFlags('TESTIMAGE_BOOT_PATTERNS') or {}
- if boot_patterns_flags:
- patterns_set = [p for p in boot_patterns_flags.items() if p[0] in d.getVar('TESTIMAGE_BOOT_PATTERNS').split()]
- for flag, flagval in patterns_set:
- if flag not in accepted_patterns:
- bb.fatal('Testimage: The only accepted boot patterns are: search_reached_prompt,send_login_user, \
- search_login_succeeded,search_cmd_finished\n Make sure your TESTIMAGE_BOOT_PATTERNS=%s \
- contains an accepted flag.' % d.getVar('TESTIMAGE_BOOT_PATTERNS'))
- return
- # We know boot prompt is searched through in binary format, others might be expressions
- if flag == 'search_reached_prompt':
- boot_patterns[flag] = flagval.encode()
- else:
- boot_patterns[flag] = flagval.encode().decode('unicode-escape')
- return boot_patterns
-
-
-def testimage_main(d):
- import os
- import json
- import signal
- import logging
- import shutil
-
- from bb.utils import export_proxies
- from oeqa.runtime.context import OERuntimeTestContext
- from oeqa.runtime.context import OERuntimeTestContextExecutor
- from oeqa.core.target.qemu import supported_fstypes
- from oeqa.core.utils.test import getSuiteCases
- from oeqa.utils import make_logger_bitbake_compatible
-
- def sigterm_exception(signum, stackframe):
- """
- Catch SIGTERM from worker in order to stop qemu.
- """
- os.kill(os.getpid(), signal.SIGINT)
-
- def handle_test_timeout(timeout):
- bb.warn("Global test timeout reached (%s seconds), stopping the tests." %(timeout))
- os.kill(os.getpid(), signal.SIGINT)
-
- testimage_sanity(d)
-
- if (d.getVar('IMAGE_PKGTYPE') == 'rpm'
- and ('dnf' in d.getVar('TEST_SUITES') or 'auto' in d.getVar('TEST_SUITES'))):
- create_rpm_index(d)
-
- logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
- pn = d.getVar("PN")
-
- bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
-
- image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
- d.getVar('IMAGE_LINK_NAME')))
-
- tdname = "%s.testdata.json" % image_name
- try:
- with open(tdname, "r") as f:
- td = json.load(f)
- except FileNotFoundError as err:
- bb.fatal('File %s not found (%s).\nHave you built the image with INHERIT += "testimage" in the conf/local.conf?' % (tdname, err))
-
- # Some variables need to be updates (mostly paths) with the
- # ones of the current environment because some tests require them.
- for var in d.getVar('TESTIMAGE_UPDATE_VARS').split():
- td[var] = d.getVar(var)
-
- image_manifest = "%s.manifest" % image_name
- image_packages = OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
-
- extract_dir = d.getVar("TEST_EXTRACTED_DIR")
-
- # Get machine
- machine = d.getVar("MACHINE")
-
- # Get rootfs
- fstypes = d.getVar('IMAGE_FSTYPES').split()
- if d.getVar("TEST_TARGET") == "qemu":
- fstypes = [fs for fs in fstypes if fs in supported_fstypes]
- if not fstypes:
- bb.fatal('Unsupported image type built. Add a compatible image to '
- 'IMAGE_FSTYPES. Supported types: %s' %
- ', '.join(supported_fstypes))
- qfstype = fstypes[0]
- qdeffstype = d.getVar("QB_DEFAULT_FSTYPE")
- if qdeffstype:
- qfstype = qdeffstype
- rootfs = '%s.%s' % (image_name, qfstype)
-
- # Get tmpdir (not really used, just for compatibility)
- tmpdir = d.getVar("TMPDIR")
-
- # Get deploy_dir_image (not really used, just for compatibility)
- dir_image = d.getVar("DEPLOY_DIR_IMAGE")
-
- # Get bootlog
- bootlog = os.path.join(d.getVar("TEST_LOG_DIR"),
- 'qemu_boot_log.%s' % d.getVar('DATETIME'))
-
- # Get display
- display = d.getVar("BB_ORIGENV").getVar("DISPLAY")
-
- # Get kernel
- kernel_name = ('%s-%s.bin' % (d.getVar("KERNEL_IMAGETYPE"), machine))
- kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), kernel_name)
-
- # Get boottime
- boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT"))
-
- # Get use_kvm
- kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH'))
-
- # Get OVMF
- ovmf = d.getVar("QEMU_USE_OVMF")
-
- slirp = False
- if d.getVar("QEMU_USE_SLIRP"):
- slirp = True
-
- # TODO: We use the current implementation of qemu runner because of
- # time constrains, qemu runner really needs a refactor too.
- target_kwargs = { 'machine' : machine,
- 'rootfs' : rootfs,
- 'tmpdir' : tmpdir,
- 'dir_image' : dir_image,
- 'display' : display,
- 'kernel' : kernel,
- 'boottime' : boottime,
- 'bootlog' : bootlog,
- 'kvm' : kvm,
- 'slirp' : slirp,
- 'dump_dir' : d.getVar("TESTIMAGE_DUMP_DIR"),
- 'serial_ports': len(d.getVar("SERIAL_CONSOLES").split()),
- 'ovmf' : ovmf,
- 'tmpfsdir' : d.getVar("RUNQEMU_TMPFS_DIR"),
- }
-
- if d.getVar("TESTIMAGE_BOOT_PATTERNS"):
- target_kwargs['boot_patterns'] = get_testimage_boot_patterns(d)
-
- # hardware controlled targets might need further access
- target_kwargs['powercontrol_cmd'] = d.getVar("TEST_POWERCONTROL_CMD") or None
- target_kwargs['powercontrol_extra_args'] = d.getVar("TEST_POWERCONTROL_EXTRA_ARGS") or ""
- target_kwargs['serialcontrol_cmd'] = d.getVar("TEST_SERIALCONTROL_CMD") or None
- target_kwargs['serialcontrol_extra_args'] = d.getVar("TEST_SERIALCONTROL_EXTRA_ARGS") or ""
- target_kwargs['testimage_dump_monitor'] = d.getVar("testimage_dump_monitor") or ""
- target_kwargs['testimage_dump_target'] = d.getVar("testimage_dump_target") or ""
-
- def export_ssh_agent(d):
- import os
-
- variables = ['SSH_AGENT_PID', 'SSH_AUTH_SOCK']
- for v in variables:
- if v not in os.environ.keys():
- val = d.getVar(v)
- if val is not None:
- os.environ[v] = val
-
- export_ssh_agent(d)
-
- # runtime use network for download projects for build
- export_proxies(d)
-
- # we need the host dumper in test context
- host_dumper = OERuntimeTestContextExecutor.getHostDumper(
- d.getVar("testimage_dump_host"),
- d.getVar("TESTIMAGE_DUMP_DIR"))
-
- # the robot dance
- target = OERuntimeTestContextExecutor.getTarget(
- d.getVar("TEST_TARGET"), logger, d.getVar("TEST_TARGET_IP"),
- d.getVar("TEST_SERVER_IP"), **target_kwargs)
-
- # test context
- tc = OERuntimeTestContext(td, logger, target, host_dumper,
- image_packages, extract_dir)
-
- # Load tests before starting the target
- test_paths = get_runtime_paths(d)
- test_modules = d.getVar('TEST_SUITES').split()
- if not test_modules:
- bb.fatal('Empty test suite, please verify TEST_SUITES variable')
-
- tc.loadTests(test_paths, modules=test_modules)
-
- suitecases = getSuiteCases(tc.suites)
- if not suitecases:
- bb.fatal('Empty test suite, please verify TEST_SUITES variable')
- else:
- bb.debug(2, 'test suites:\n\t%s' % '\n\t'.join([str(c) for c in suitecases]))
-
- package_extraction(d, tc.suites)
-
- results = None
- complete = False
- orig_sigterm_handler = signal.signal(signal.SIGTERM, sigterm_exception)
- try:
- # We need to check if runqemu ends unexpectedly
- # or if the worker send us a SIGTERM
- tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS"))
- import threading
- try:
- threading.Timer(int(d.getVar("TEST_OVERALL_TIMEOUT")), handle_test_timeout, (int(d.getVar("TEST_OVERALL_TIMEOUT")),)).start()
- except ValueError:
- pass
- results = tc.runTests()
- complete = True
- except (KeyboardInterrupt, BlockingIOError) as err:
- if isinstance(err, KeyboardInterrupt):
- bb.error('testimage interrupted, shutting down...')
- else:
- bb.error('runqemu failed, shutting down...')
- if results:
- results.stop()
- results = tc.results
- finally:
- signal.signal(signal.SIGTERM, orig_sigterm_handler)
- tc.target.stop()
-
- # Show results (if we have them)
- if results:
- configuration = get_testimage_configuration(d, 'runtime', machine)
- results.logDetails(get_testimage_json_result_dir(d),
- configuration,
- get_testimage_result_id(configuration),
- dump_streams=d.getVar('TESTREPORT_FULLLOGS'))
- results.logSummary(pn)
-
- # Copy additional logs to tmp/log/oeqa so it's easier to find them
- targetdir = os.path.join(get_testimage_json_result_dir(d), d.getVar("PN"))
- os.makedirs(targetdir, exist_ok=True)
- os.symlink(bootlog, os.path.join(targetdir, os.path.basename(bootlog)))
- os.symlink(d.getVar("BB_LOGFILE"), os.path.join(targetdir, os.path.basename(d.getVar("BB_LOGFILE") + "." + d.getVar('DATETIME'))))
-
- if not results or not complete:
- bb.fatal('%s - FAILED - tests were interrupted during execution, check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
- if not results.wasSuccessful():
- bb.fatal('%s - FAILED - also check the logs in %s' % (pn, d.getVar("LOG_DIR")), forcelog=True)
-
-def get_runtime_paths(d):
- """
- Returns a list of paths where runtime test must reside.
-
- Runtime tests are expected in <LAYER_DIR>/lib/oeqa/runtime/cases/
- """
- paths = []
-
- for layer in d.getVar('BBLAYERS').split():
- path = os.path.join(layer, 'lib/oeqa/runtime/cases')
- if os.path.isdir(path):
- paths.append(path)
- return paths
-
-def create_index(arg):
- import subprocess
-
- index_cmd = arg
- try:
- bb.note("Executing '%s' ..." % index_cmd)
- result = subprocess.check_output(index_cmd,
- stderr=subprocess.STDOUT,
- shell=True)
- result = result.decode('utf-8')
- except subprocess.CalledProcessError as e:
- return("Index creation command '%s' failed with return code "
- '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8")))
- if result:
- bb.note(result)
- return None
-
-def create_rpm_index(d):
- import glob
- # Index RPMs
- rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c")
- index_cmds = []
- archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_')
-
- for arch in archs.split():
- rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch)
- idx_path = os.path.join(d.getVar('WORKDIR'), 'oe-testimage-repo', arch)
-
- if not os.path.isdir(rpm_dir):
- continue
-
- lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock')
- lf = bb.utils.lockfile(lockfilename, False)
- oe.path.copyhardlinktree(rpm_dir, idx_path)
- # Full indexes overload a 256MB image so reduce the number of rpms
- # in the feed by filtering to specific packages needed by the tests.
- package_list = glob.glob(idx_path + "*/*.rpm")
-
- for pkg in package_list:
- if os.path.basename(pkg).startswith(("curl-ptest")):
- bb.utils.remove(pkg)
-
- if not os.path.basename(pkg).startswith(("rpm", "run-postinsts", "busybox", "bash", "update-alternatives", "libc6", "curl", "musl")):
- bb.utils.remove(pkg)
-
- bb.utils.unlockfile(lf)
- cmd = '%s --update -q %s' % (rpm_createrepo, idx_path)
-
- # Create repodata
- result = create_index(cmd)
- if result:
- bb.fatal('%s' % ('\n'.join(result)))
-
-def package_extraction(d, test_suites):
- from oeqa.utils.package_manager import find_packages_to_extract
- from oeqa.utils.package_manager import extract_packages
-
- bb.utils.remove(d.getVar("TEST_NEEDED_PACKAGES_DIR"), recurse=True)
- packages = find_packages_to_extract(test_suites)
- if packages:
- bb.utils.mkdirhier(d.getVar("TEST_INSTALL_TMP_DIR"))
- bb.utils.mkdirhier(d.getVar("TEST_PACKAGED_DIR"))
- bb.utils.mkdirhier(d.getVar("TEST_EXTRACTED_DIR"))
- extract_packages(d, packages)
-
-testimage_main[vardepsexclude] += "BB_ORIGENV DATETIME"
-
-python () {
- if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
- bb.build.addtask("testimage", "do_build", "do_image_complete", d)
-}
-
-inherit testsdk
diff --git a/poky/meta/classes/testsdk.bbclass b/poky/meta/classes/testsdk.bbclass
deleted file mode 100644
index 8b2e74f..0000000
--- a/poky/meta/classes/testsdk.bbclass
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright (C) 2013 - 2016 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-# testsdk.bbclass enables testing for SDK and Extensible SDK
-#
-# To run SDK tests, run the commands:
-# $ bitbake <image-name> -c populate_sdk
-# $ bitbake <image-name> -c testsdk
-#
-# To run eSDK tests, run the commands:
-# $ bitbake <image-name> -c populate_sdk_ext
-# $ bitbake <image-name> -c testsdkext
-#
-# where "<image-name>" is an image like core-image-sato.
-
-TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK"
-TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt"
-
-def import_and_run(name, d):
- import importlib
-
- class_name = d.getVar(name)
- if class_name:
- module, cls = class_name.rsplit('.', 1)
- m = importlib.import_module(module)
- c = getattr(m, cls)()
- c.run(d)
- else:
- bb.warn('No tests were run because %s did not define a class' % name)
-
-import_and_run[vardepsexclude] = "DATETIME BB_ORIGENV"
-
-python do_testsdk() {
- import_and_run('TESTSDK_CLASS_NAME', d)
-}
-addtask testsdk
-do_testsdk[nostamp] = "1"
-do_testsdk[network] = "1"
-
-python do_testsdkext() {
- import_and_run('TESTSDKEXT_CLASS_NAME', d)
-}
-addtask testsdkext
-do_testsdkext[nostamp] = "1"
-do_testsdkext[network] = "1"
-
-python () {
- if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
- bb.build.addtask("testsdk", None, "do_populate_sdk", d)
- bb.build.addtask("testsdkext", None, "do_populate_sdk_ext", d)
-}
diff --git a/poky/meta/classes/texinfo.bbclass b/poky/meta/classes/texinfo.bbclass
deleted file mode 100644
index 68c9d4f..0000000
--- a/poky/meta/classes/texinfo.bbclass
+++ /dev/null
@@ -1,18 +0,0 @@
-# This class is inherited by recipes whose upstream packages invoke the
-# texinfo utilities at build-time. Native and cross recipes are made to use the
-# dummy scripts provided by texinfo-dummy-native, for improved performance.
-# Target architecture recipes use the genuine Texinfo utilities. By default,
-# they use the Texinfo utilities on the host system. If you want to use the
-# Texinfo recipe, you can remove texinfo-native from ASSUME_PROVIDED and
-# makeinfo from SANITY_REQUIRED_UTILITIES.
-
-TEXDEP = "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'texinfo-replacement-native', 'texinfo-dummy-native', d)}"
-TEXDEP:class-native = "texinfo-dummy-native"
-TEXDEP:class-cross = "texinfo-dummy-native"
-TEXDEP:class-crosssdk = "texinfo-dummy-native"
-TEXDEP:class-cross-canadian = "texinfo-dummy-native"
-DEPENDS:append = " ${TEXDEP}"
-
-# libtool-cross doesn't inherit cross
-TEXDEP:pn-libtool-cross = "texinfo-dummy-native"
-
diff --git a/poky/meta/classes/toaster.bbclass b/poky/meta/classes/toaster.bbclass
index f365c09..03c4f3a 100644
--- a/poky/meta/classes/toaster.bbclass
+++ b/poky/meta/classes/toaster.bbclass
@@ -3,7 +3,7 @@
#
# Copyright (C) 2013 Intel Corporation
#
-# Released under the MIT license (see COPYING.MIT)
+# SPDX-License-Identifier: MIT
#
# This bbclass is designed to extract data used by OE-Core during the build process,
# for recording in the Toaster system.
diff --git a/poky/meta/classes/toolchain-scripts-base.bbclass b/poky/meta/classes/toolchain-scripts-base.bbclass
deleted file mode 100644
index 2489b9d..0000000
--- a/poky/meta/classes/toolchain-scripts-base.bbclass
+++ /dev/null
@@ -1,11 +0,0 @@
-#This function create a version information file
-toolchain_create_sdk_version () {
- local versionfile=$1
- rm -f $versionfile
- touch $versionfile
- echo 'Distro: ${DISTRO}' >> $versionfile
- echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
- echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
- echo 'Timestamp: ${DATETIME}' >> $versionfile
-}
-toolchain_create_sdk_version[vardepsexclude] = "DATETIME"
diff --git a/poky/meta/classes/toolchain-scripts.bbclass b/poky/meta/classes/toolchain-scripts.bbclass
deleted file mode 100644
index 16f1e17..0000000
--- a/poky/meta/classes/toolchain-scripts.bbclass
+++ /dev/null
@@ -1,230 +0,0 @@
-inherit toolchain-scripts-base siteinfo kernel-arch
-
-# We want to be able to change the value of MULTIMACH_TARGET_SYS, because it
-# doesn't always match our expectations... but we default to the stock value
-REAL_MULTIMACH_TARGET_SYS ?= "${MULTIMACH_TARGET_SYS}"
-TARGET_CC_ARCH:append:libc-musl = " -mmusl"
-
-# default debug prefix map isn't valid in the SDK
-DEBUG_PREFIX_MAP = ""
-
-EXPORT_SDK_PS1 = "${@ 'export PS1=\\"%s\\"' % d.getVar('SDK_PS1') if d.getVar('SDK_PS1') else ''}"
-
-# This function creates an environment-setup-script for use in a deployable SDK
-toolchain_create_sdk_env_script () {
- # Create environment setup script. Remember that $SDKTARGETSYSROOT should
- # only be expanded on the target at runtime.
- base_sbindir=${10:-${base_sbindir_nativesdk}}
- base_bindir=${9:-${base_bindir_nativesdk}}
- sbindir=${8:-${sbindir_nativesdk}}
- sdkpathnative=${7:-${SDKPATHNATIVE}}
- prefix=${6:-${prefix_nativesdk}}
- bindir=${5:-${bindir_nativesdk}}
- libdir=${4:-${libdir}}
- sysroot=${3:-${SDKTARGETSYSROOT}}
- multimach_target_sys=${2:-${REAL_MULTIMACH_TARGET_SYS}}
- script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-$multimach_target_sys}
- rm -f $script
- touch $script
-
- echo '# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice' >> $script
- echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script
- echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script
- echo '# Only disable this check if you are absolutely know what you are doing!' >> $script
- echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script
- echo " echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script
- echo " echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script
- echo ' echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script
- echo ' echo "For more references see:"' >> $script
- echo ' echo " http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"' >> $script
- echo ' echo " http://xahlee.info/UnixResource_dir/_/ldpath.html"' >> $script
- echo ' return 1' >> $script
- echo 'fi' >> $script
-
- echo "${EXPORT_SDK_PS1}" >> $script
- echo 'export SDKTARGETSYSROOT='"$sysroot" >> $script
- EXTRAPATH=""
- for i in ${CANADIANEXTRAOS}; do
- EXTRAPATH="$EXTRAPATH:$sdkpathnative$bindir/${TARGET_ARCH}${TARGET_VENDOR}-$i"
- done
- echo "export PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':$PATH' >> $script
- echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script
- echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig' >> $script
- echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script
- echo "export OECORE_NATIVE_SYSROOT=\"$sdkpathnative\"" >> $script
- echo 'export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"' >> $script
- echo "export OECORE_ACLOCAL_OPTS=\"-I $sdkpathnative/usr/share/aclocal\"" >> $script
- echo 'export OECORE_BASELIB="${baselib}"' >> $script
- echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
- echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
-
- echo 'unset command_not_found_handle' >> $script
-
- toolchain_shared_env_script
-}
-
-# This function creates an environment-setup-script in B which enables
-# a OE-core IDE to integrate with the build tree
-# Caller must ensure CONFIG_SITE is setup
-toolchain_create_tree_env_script () {
- script=${B}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
- rm -f $script
- touch $script
- echo 'standalone_sysroot_target="${STAGING_DIR}/${MACHINE}"' >> $script
- echo 'standalone_sysroot_native="${STAGING_DIR}/${BUILD_ARCH}"' >> $script
- echo 'orig=`pwd`; cd ${COREBASE}; . ./oe-init-build-env ${TOPDIR}; cd $orig' >> $script
- echo 'export PATH=$standalone_sysroot_native/${bindir_native}:$standalone_sysroot_native/${bindir_native}/${TARGET_SYS}:$PATH' >> $script
- echo 'export PKG_CONFIG_SYSROOT_DIR=$standalone_sysroot_target' >> $script
- echo 'export PKG_CONFIG_PATH=$standalone_sysroot_target'"$libdir"'/pkgconfig:$standalone_sysroot_target'"$prefix"'/share/pkgconfig' >> $script
- echo 'export CONFIG_SITE="${CONFIG_SITE}"' >> $script
- echo 'export SDKTARGETSYSROOT=$standalone_sysroot_target' >> $script
- echo 'export OECORE_NATIVE_SYSROOT=$standalone_sysroot_native' >> $script
- echo 'export OECORE_TARGET_SYSROOT=$standalone_sysroot_target' >> $script
- echo 'export OECORE_ACLOCAL_OPTS="-I $standalone_sysroot_native/usr/share/aclocal"' >> $script
- echo 'export OECORE_BASELIB="${baselib}"' >> $script
- echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
- echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
-
- toolchain_shared_env_script
-
- cat >> $script <<EOF
-
-if [ -d "\$OECORE_NATIVE_SYSROOT/${datadir}/post-relocate-setup.d/" ]; then
- for s in \$OECORE_NATIVE_SYSROOT/${datadir}/post-relocate-setup.d/*; do
- if [ ! -x \$s ]; then
- continue
- fi
- \$s "\$1"
- status=\$?
- if [ \$status != 0 ]; then
- echo "post-relocate command \"\$s \$1\" failed with status \$status" >&2
- exit \$status
- fi
- done
-fi
-EOF
-}
-
-toolchain_shared_env_script () {
- echo 'export CC="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export CXX="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export CPP="${TARGET_PREFIX}gcc -E ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export AS="${TARGET_PREFIX}as ${TARGET_AS_ARCH}"' >> $script
- echo 'export LD="${TARGET_PREFIX}ld ${TARGET_LD_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export GDB=${TARGET_PREFIX}gdb' >> $script
- echo 'export STRIP=${TARGET_PREFIX}strip' >> $script
- echo 'export RANLIB=${TARGET_PREFIX}ranlib' >> $script
- echo 'export OBJCOPY=${TARGET_PREFIX}objcopy' >> $script
- echo 'export OBJDUMP=${TARGET_PREFIX}objdump' >> $script
- echo 'export READELF=${TARGET_PREFIX}readelf' >> $script
- echo 'export AR=${TARGET_PREFIX}ar' >> $script
- echo 'export NM=${TARGET_PREFIX}nm' >> $script
- echo 'export M4=m4' >> $script
- echo 'export TARGET_PREFIX=${TARGET_PREFIX}' >> $script
- echo 'export CONFIGURE_FLAGS="--target=${TARGET_SYS} --host=${TARGET_SYS} --build=${SDK_ARCH}-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export CFLAGS="${TARGET_CFLAGS}"' >> $script
- echo 'export CXXFLAGS="${TARGET_CXXFLAGS}"' >> $script
- echo 'export LDFLAGS="${TARGET_LDFLAGS}"' >> $script
- echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script
- echo 'export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
- echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script
- echo 'export ARCH=${ARCH}' >> $script
- echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script
- echo 'export OECORE_TUNE_CCARGS="${TUNE_CCARGS}"' >> $script
-
- cat >> $script <<EOF
-
-# Append environment subscripts
-if [ -d "\$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
- for envfile in \$OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
- . \$envfile
- done
-fi
-if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
- for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
- . \$envfile
- done
-fi
-EOF
-}
-
-toolchain_create_post_relocate_script() {
- relocate_script=$1
- env_dir=$2
- rm -f $relocate_script
- touch $relocate_script
-
- cat >> $relocate_script <<EOF
-if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
- # Source top-level SDK env scripts in case they are needed for the relocate
- # scripts.
- for env_setup_script in ${env_dir}/environment-setup-*; do
- . \$env_setup_script
- status=\$?
- if [ \$status != 0 ]; then
- echo "\$0: Failed to source \$env_setup_script with status \$status"
- exit \$status
- fi
-
- for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*; do
- if [ ! -x \$s ]; then
- continue
- fi
- \$s "\$1"
- status=\$?
- if [ \$status != 0 ]; then
- echo "post-relocate command \"\$s \$1\" failed with status \$status" >&2
- exit \$status
- fi
- done
- done
- rm -rf "${SDKPATHNATIVE}/post-relocate-setup.d"
-fi
-EOF
-}
-
-#we get the cached site config in the runtime
-TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files(d)[0])}"
-TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
-TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
-DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}"
-
-#This function create a site config file
-toolchain_create_sdk_siteconfig () {
- local siteconfig=$1
-
- rm -f $siteconfig
- touch $siteconfig
-
- for sitefile in ${TOOLCHAIN_CONFIGSITE_NOCACHE} ; do
- cat $sitefile >> $siteconfig
- done
-
- #get cached site config
- for sitefile in ${TOOLCHAIN_NEED_CONFIGSITE_CACHE}; do
- # Resolve virtual/* names to the real recipe name using sysroot-providers info
- case $sitefile in virtual/*)
- sitefile=`echo $sitefile | tr / _`
- sitefile=`cat ${STAGING_DIR_TARGET}/sysroot-providers/$sitefile`
- esac
-
- if [ -r ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config ]; then
- cat ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config >> $siteconfig
- fi
- done
-}
-# The immediate expansion above can result in unwanted path dependencies here
-toolchain_create_sdk_siteconfig[vardepsexclude] = "TOOLCHAIN_CONFIGSITE_SYSROOTCACHE"
-
-python __anonymous () {
- import oe.classextend
- deps = ""
- for dep in (d.getVar('TOOLCHAIN_NEED_CONFIGSITE_CACHE') or "").split():
- deps += " %s:do_populate_sysroot" % dep
- for variant in (d.getVar('MULTILIB_VARIANTS') or "").split():
- clsextend = oe.classextend.ClassExtender(variant, d)
- newdep = clsextend.extend_name(dep)
- deps += " %s:do_populate_sysroot" % newdep
- d.appendVarFlag('do_configure', 'depends', deps)
-}
diff --git a/poky/meta/classes/typecheck.bbclass b/poky/meta/classes/typecheck.bbclass
index 72da932..160f7a0 100644
--- a/poky/meta/classes/typecheck.bbclass
+++ b/poky/meta/classes/typecheck.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# Check types of bitbake configuration variables
#
# See oe.types for details.
diff --git a/poky/meta/classes/uboot-config.bbclass b/poky/meta/classes/uboot-config.bbclass
deleted file mode 100644
index e8da8c7..0000000
--- a/poky/meta/classes/uboot-config.bbclass
+++ /dev/null
@@ -1,130 +0,0 @@
-# Handle U-Boot config for a machine
-#
-# The format to specify it, in the machine, is:
-#
-# UBOOT_CONFIG ??= <default>
-# UBOOT_CONFIG[foo] = "config,images,binary"
-#
-# or
-#
-# UBOOT_MACHINE = "config"
-#
-# Copyright 2013, 2014 (C) O.S. Systems Software LTDA.
-
-def removesuffix(s, suffix):
- if suffix and s.endswith(suffix):
- return s[:-len(suffix)]
- return s
-
-# Some versions of u-boot use .bin and others use .img. By default use .bin
-# but enable individual recipes to change this value.
-UBOOT_SUFFIX ??= "bin"
-UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
-UBOOT_BINARYNAME ?= "${@os.path.splitext(d.getVar("UBOOT_BINARY"))[0]}"
-UBOOT_IMAGE ?= "${UBOOT_BINARYNAME}-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
-UBOOT_SYMLINK ?= "${UBOOT_BINARYNAME}-${MACHINE}.${UBOOT_SUFFIX}"
-UBOOT_MAKE_TARGET ?= "all"
-
-# Output the ELF generated. Some platforms can use the ELF file and directly
-# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging
-# purposes.
-UBOOT_ELF ?= ""
-UBOOT_ELF_SUFFIX ?= "elf"
-UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}"
-UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}"
-UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}"
-
-# Some versions of u-boot build an SPL (Second Program Loader) image that
-# should be packaged along with the u-boot binary as well as placed in the
-# deploy directory. For those versions they can set the following variables
-# to allow packaging the SPL.
-SPL_SUFFIX ?= ""
-SPL_BINARY ?= ""
-SPL_DELIMITER ?= "${@'.' if d.getVar("SPL_SUFFIX") else ''}"
-SPL_BINARYFILE ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}"
-SPL_BINARYNAME ?= "${@removesuffix(d.getVar("SPL_BINARYFILE"), "." + d.getVar("SPL_SUFFIX"))}"
-SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}${SPL_DELIMITER}${SPL_SUFFIX}"
-SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}${SPL_DELIMITER}${SPL_SUFFIX}"
-
-# Additional environment variables or a script can be installed alongside
-# u-boot to be used automatically on boot. This file, typically 'uEnv.txt'
-# or 'boot.scr', should be packaged along with u-boot as well as placed in the
-# deploy directory. Machine configurations needing one of these files should
-# include it in the SRC_URI and set the UBOOT_ENV parameter.
-UBOOT_ENV_SUFFIX ?= "txt"
-UBOOT_ENV ?= ""
-UBOOT_ENV_SRC_SUFFIX ?= "cmd"
-UBOOT_ENV_SRC ?= "${UBOOT_ENV}.${UBOOT_ENV_SRC_SUFFIX}"
-UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
-UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
-UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
-
-# Default name of u-boot initial env, but enable individual recipes to change
-# this value.
-UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
-
-# U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf
-# to find EXTLINUX conf file.
-UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux"
-UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf"
-UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}"
-
-# Options for the device tree compiler passed to mkimage '-D' feature:
-UBOOT_MKIMAGE_DTCOPTS ??= ""
-SPL_MKIMAGE_DTCOPTS ??= ""
-
-# mkimage command
-UBOOT_MKIMAGE ?= "uboot-mkimage"
-UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}"
-
-# Arguments passed to mkimage for signing
-UBOOT_MKIMAGE_SIGN_ARGS ?= ""
-SPL_MKIMAGE_SIGN_ARGS ?= ""
-
-# Options to deploy the u-boot device tree
-UBOOT_DTB ?= ""
-UBOOT_DTB_BINARY ??= ""
-
-python () {
- ubootmachine = d.getVar("UBOOT_MACHINE")
- ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
- ubootbinary = d.getVar('UBOOT_BINARY')
- ubootbinaries = d.getVar('UBOOT_BINARIES')
- # The "doc" varflag is special, we don't want to see it here
- ubootconfigflags.pop('doc', None)
- ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split()
-
- if not ubootmachine and not ubootconfig:
- PN = d.getVar("PN")
- FILE = os.path.basename(d.getVar("FILE"))
- bb.debug(1, "To build %s, see %s for instructions on \
- setting up your machine config" % (PN, FILE))
- raise bb.parse.SkipRecipe("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE"))
-
- if ubootmachine and ubootconfig:
- raise bb.parse.SkipRecipe("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.")
-
- if ubootconfigflags and ubootbinaries:
- raise bb.parse.SkipRecipe("You cannot use UBOOT_BINARIES as it is internal to uboot_config.bbclass.")
-
- if len(ubootconfig) > 0:
- for config in ubootconfig:
- for f, v in ubootconfigflags.items():
- if config == f:
- items = v.split(',')
- if items[0] and len(items) > 3:
- raise bb.parse.SkipRecipe('Only config,images,binary can be specified!')
- d.appendVar('UBOOT_MACHINE', ' ' + items[0])
- # IMAGE_FSTYPES appending
- if len(items) > 1 and items[1]:
- bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
- d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
- if len(items) > 2 and items[2]:
- bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % items[2])
- d.appendVar('UBOOT_BINARIES', ' ' + items[2])
- else:
- bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % ubootbinary)
- d.appendVar('UBOOT_BINARIES', ' ' + ubootbinary)
- return
- raise bb.parse.SkipRecipe("The selected UBOOT_CONFIG key %s has no match in %s." % (ubootconfig, ubootconfigflags.keys()))
-}
diff --git a/poky/meta/classes/uboot-extlinux-config.bbclass b/poky/meta/classes/uboot-extlinux-config.bbclass
deleted file mode 100644
index dcebe7f..0000000
--- a/poky/meta/classes/uboot-extlinux-config.bbclass
+++ /dev/null
@@ -1,158 +0,0 @@
-# uboot-extlinux-config.bbclass
-#
-# This class allow the extlinux.conf generation for U-Boot use. The
-# U-Boot support for it is given to allow the Generic Distribution
-# Configuration specification use by OpenEmbedded-based products.
-#
-# External variables:
-#
-# UBOOT_EXTLINUX_CONSOLE - Set to "console=ttyX" to change kernel boot
-# default console.
-# UBOOT_EXTLINUX_LABELS - A list of targets for the automatic config.
-# UBOOT_EXTLINUX_KERNEL_ARGS - Add additional kernel arguments.
-# UBOOT_EXTLINUX_KERNEL_IMAGE - Kernel image name.
-# UBOOT_EXTLINUX_FDTDIR - Device tree directory.
-# UBOOT_EXTLINUX_FDT - Device tree file.
-# UBOOT_EXTLINUX_INITRD - Indicates a list of filesystem images to
-# concatenate and use as an initrd (optional).
-# UBOOT_EXTLINUX_MENU_DESCRIPTION - Name to use as description.
-# UBOOT_EXTLINUX_ROOT - Root kernel cmdline.
-# UBOOT_EXTLINUX_TIMEOUT - Timeout before DEFAULT selection is made.
-# Measured in 1/10 of a second.
-# UBOOT_EXTLINUX_DEFAULT_LABEL - Target to be selected by default after
-# the timeout period
-#
-# If there's only one label system will boot automatically and menu won't be
-# created. If you want to use more than one labels, e.g linux and alternate,
-# use overrides to set menu description, console and others variables.
-#
-# Ex:
-#
-# UBOOT_EXTLINUX_LABELS ??= "default fallback"
-#
-# UBOOT_EXTLINUX_DEFAULT_LABEL ??= "Linux Default"
-# UBOOT_EXTLINUX_TIMEOUT ??= "30"
-#
-# UBOOT_EXTLINUX_KERNEL_IMAGE_default ??= "../zImage"
-# UBOOT_EXTLINUX_MENU_DESCRIPTION_default ??= "Linux Default"
-#
-# UBOOT_EXTLINUX_KERNEL_IMAGE_fallback ??= "../zImage-fallback"
-# UBOOT_EXTLINUX_MENU_DESCRIPTION_fallback ??= "Linux Fallback"
-#
-# Results:
-#
-# menu title Select the boot mode
-# TIMEOUT 30
-# DEFAULT Linux Default
-# LABEL Linux Default
-# KERNEL ../zImage
-# FDTDIR ../
-# APPEND root=/dev/mmcblk2p2 rootwait rw console=${console}
-# LABEL Linux Fallback
-# KERNEL ../zImage-fallback
-# FDTDIR ../
-# APPEND root=/dev/mmcblk2p2 rootwait rw console=${console}
-#
-# Copyright (C) 2016, O.S. Systems Software LTDA. All Rights Reserved
-# Released under the MIT license (see packages/COPYING)
-#
-# The kernel has an internal default console, which you can override with
-# a console=...some_tty...
-UBOOT_EXTLINUX_CONSOLE ??= "console=${console},${baudrate}"
-UBOOT_EXTLINUX_LABELS ??= "linux"
-UBOOT_EXTLINUX_FDT ??= ""
-UBOOT_EXTLINUX_FDTDIR ??= "../"
-UBOOT_EXTLINUX_KERNEL_IMAGE ??= "../${KERNEL_IMAGETYPE}"
-UBOOT_EXTLINUX_KERNEL_ARGS ??= "rootwait rw"
-UBOOT_EXTLINUX_MENU_DESCRIPTION:linux ??= "${DISTRO_NAME}"
-
-UBOOT_EXTLINUX_CONFIG = "${B}/extlinux.conf"
-
-python do_create_extlinux_config() {
- if d.getVar("UBOOT_EXTLINUX") != "1":
- return
-
- if not d.getVar('WORKDIR'):
- bb.error("WORKDIR not defined, unable to package")
-
- labels = d.getVar('UBOOT_EXTLINUX_LABELS')
- if not labels:
- bb.fatal("UBOOT_EXTLINUX_LABELS not defined, nothing to do")
-
- if not labels.strip():
- bb.fatal("No labels, nothing to do")
-
- cfile = d.getVar('UBOOT_EXTLINUX_CONFIG')
- if not cfile:
- bb.fatal('Unable to read UBOOT_EXTLINUX_CONFIG')
-
- localdata = bb.data.createCopy(d)
-
- try:
- with open(cfile, 'w') as cfgfile:
- cfgfile.write('# Generic Distro Configuration file generated by OpenEmbedded\n')
-
- if len(labels.split()) > 1:
- cfgfile.write('menu title Select the boot mode\n')
-
- timeout = localdata.getVar('UBOOT_EXTLINUX_TIMEOUT')
- if timeout:
- cfgfile.write('TIMEOUT %s\n' % (timeout))
-
- if len(labels.split()) > 1:
- default = localdata.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL')
- if default:
- cfgfile.write('DEFAULT %s\n' % (default))
-
- # Need to deconflict the labels with existing overrides
- label_overrides = labels.split()
- default_overrides = localdata.getVar('OVERRIDES').split(':')
- # We're keeping all the existing overrides that aren't used as a label
- # an override for that label will be added back in while we're processing that label
- keep_overrides = list(filter(lambda x: x not in label_overrides, default_overrides))
-
- for label in labels.split():
-
- localdata.setVar('OVERRIDES', ':'.join(keep_overrides + [label]))
-
- extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE')
-
- menu_description = localdata.getVar('UBOOT_EXTLINUX_MENU_DESCRIPTION')
- if not menu_description:
- menu_description = label
-
- root = localdata.getVar('UBOOT_EXTLINUX_ROOT')
- if not root:
- bb.fatal('UBOOT_EXTLINUX_ROOT not defined')
-
- kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE')
- fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR')
-
- fdt = localdata.getVar('UBOOT_EXTLINUX_FDT')
-
- if fdt:
- cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' %
- (menu_description, kernel_image, fdt))
- elif fdtdir:
- cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDTDIR %s\n' %
- (menu_description, kernel_image, fdtdir))
- else:
- cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image))
-
- kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS')
-
- initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD')
- if initrd:
- cfgfile.write('\tINITRD %s\n'% initrd)
-
- kernel_args = root + " " + kernel_args
- cfgfile.write('\tAPPEND %s %s\n' % (kernel_args, extlinux_console))
-
- except OSError:
- bb.fatal('Unable to open %s' % (cfile))
-}
-UBOOT_EXTLINUX_VARS = "CONSOLE MENU_DESCRIPTION ROOT KERNEL_IMAGE FDTDIR FDT KERNEL_ARGS INITRD"
-do_create_extlinux_config[vardeps] += "${@' '.join(['UBOOT_EXTLINUX_%s_%s' % (v, l) for v in d.getVar('UBOOT_EXTLINUX_VARS').split() for l in d.getVar('UBOOT_EXTLINUX_LABELS').split()])}"
-do_create_extlinux_config[vardepsexclude] += "OVERRIDES"
-
-addtask create_extlinux_config before do_install do_deploy after do_compile
diff --git a/poky/meta/classes/uboot-sign.bbclass b/poky/meta/classes/uboot-sign.bbclass
deleted file mode 100644
index eecdec9..0000000
--- a/poky/meta/classes/uboot-sign.bbclass
+++ /dev/null
@@ -1,499 +0,0 @@
-# This file is part of U-Boot verified boot support and is intended to be
-# inherited from u-boot recipe and from kernel-fitimage.bbclass.
-#
-# The signature procedure requires the user to generate an RSA key and
-# certificate in a directory and to define the following variable:
-#
-# UBOOT_SIGN_KEYDIR = "/keys/directory"
-# UBOOT_SIGN_KEYNAME = "dev" # keys name in keydir (eg. "dev.crt", "dev.key")
-# UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
-# UBOOT_SIGN_ENABLE = "1"
-#
-# As verified boot depends on fitImage generation, following is also required:
-#
-# KERNEL_CLASSES ?= " kernel-fitimage "
-# KERNEL_IMAGETYPE ?= "fitImage"
-#
-# The signature support is limited to the use of CONFIG_OF_SEPARATE in U-Boot.
-#
-# The tasks sequence is set as below, using DEPLOY_IMAGE_DIR as common place to
-# treat the device tree blob:
-#
-# * u-boot:do_install:append
-# Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for
-# signing, and kernel will deploy UBOOT_DTB_BINARY after signs it.
-#
-# * virtual/kernel:do_assemble_fitimage
-# Sign the image
-#
-# * u-boot:do_deploy[postfuncs]
-# Deploy files like UBOOT_DTB_IMAGE, UBOOT_DTB_SYMLINK and others.
-#
-# For more details on signature process, please refer to U-Boot documentation.
-
-# We need some variables from u-boot-config
-inherit uboot-config
-
-# Enable use of a U-Boot fitImage
-UBOOT_FITIMAGE_ENABLE ?= "0"
-
-# Signature activation - these require their respective fitImages
-UBOOT_SIGN_ENABLE ?= "0"
-SPL_SIGN_ENABLE ?= "0"
-
-# Default value for deployment filenames.
-UBOOT_DTB_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.dtb"
-UBOOT_DTB_BINARY ?= "u-boot.dtb"
-UBOOT_DTB_SYMLINK ?= "u-boot-${MACHINE}.dtb"
-UBOOT_NODTB_IMAGE ?= "u-boot-nodtb-${MACHINE}-${PV}-${PR}.bin"
-UBOOT_NODTB_BINARY ?= "u-boot-nodtb.bin"
-UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.bin"
-UBOOT_ITS_IMAGE ?= "u-boot-its-${MACHINE}-${PV}-${PR}"
-UBOOT_ITS ?= "u-boot.its"
-UBOOT_ITS_SYMLINK ?= "u-boot-its-${MACHINE}"
-UBOOT_FITIMAGE_IMAGE ?= "u-boot-fitImage-${MACHINE}-${PV}-${PR}"
-UBOOT_FITIMAGE_BINARY ?= "u-boot-fitImage"
-UBOOT_FITIMAGE_SYMLINK ?= "u-boot-fitImage-${MACHINE}"
-SPL_DIR ?= "spl"
-SPL_DTB_IMAGE ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.dtb"
-SPL_DTB_BINARY ?= "u-boot-spl.dtb"
-SPL_DTB_SYMLINK ?= "u-boot-spl-${MACHINE}.dtb"
-SPL_NODTB_IMAGE ?= "u-boot-spl-nodtb-${MACHINE}-${PV}-${PR}.bin"
-SPL_NODTB_BINARY ?= "u-boot-spl-nodtb.bin"
-SPL_NODTB_SYMLINK ?= "u-boot-spl-nodtb-${MACHINE}.bin"
-
-# U-Boot fitImage description
-UBOOT_FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
-
-# Kernel / U-Boot fitImage Hash Algo
-FIT_HASH_ALG ?= "sha256"
-UBOOT_FIT_HASH_ALG ?= "sha256"
-
-# Kernel / U-Boot fitImage Signature Algo
-FIT_SIGN_ALG ?= "rsa2048"
-UBOOT_FIT_SIGN_ALG ?= "rsa2048"
-
-# Kernel / U-Boot fitImage Padding Algo
-FIT_PAD_ALG ?= "pkcs-1.5"
-
-# Generate keys for signing Kernel / U-Boot fitImage
-FIT_GENERATE_KEYS ?= "0"
-UBOOT_FIT_GENERATE_KEYS ?= "0"
-
-# Size of private keys in number of bits
-FIT_SIGN_NUMBITS ?= "2048"
-UBOOT_FIT_SIGN_NUMBITS ?= "2048"
-
-# args to openssl genrsa (Default is just the public exponent)
-FIT_KEY_GENRSA_ARGS ?= "-F4"
-UBOOT_FIT_KEY_GENRSA_ARGS ?= "-F4"
-
-# args to openssl req (Default is -batch for non interactive mode and
-# -new for new certificate)
-FIT_KEY_REQ_ARGS ?= "-batch -new"
-UBOOT_FIT_KEY_REQ_ARGS ?= "-batch -new"
-
-# Standard format for public key certificate
-FIT_KEY_SIGN_PKCS ?= "-x509"
-UBOOT_FIT_KEY_SIGN_PKCS ?= "-x509"
-
-# Functions on this bbclass can apply to either U-boot or Kernel,
-# depending on the scenario
-UBOOT_PN = "${@d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'}"
-KERNEL_PN = "${@d.getVar('PREFERRED_PROVIDER_virtual/kernel')}"
-
-# We need u-boot-tools-native if we're creating a U-Boot fitImage
-python() {
- if d.getVar('UBOOT_FITIMAGE_ENABLE') == '1':
- depends = d.getVar("DEPENDS")
- depends = "%s u-boot-tools-native dtc-native" % depends
- d.setVar("DEPENDS", depends)
-}
-
-concat_dtb_helper() {
- if [ -e "${UBOOT_DTB_BINARY}" ]; then
- ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY}
- ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK}
- fi
-
- if [ -f "${UBOOT_NODTB_BINARY}" ]; then
- install ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}
- ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_SYMLINK}
- ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_BINARY}
- fi
-
- # If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
- # with public key (otherwise it will be deployed by the equivalent
- # concat_spl_dtb_helper function - cf. kernel-fitimage.bbclass for more details)
- if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then
- deployed_uboot_dtb_binary='${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_IMAGE}'
- if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
- [ -e "$deployed_uboot_dtb_binary" ]; then
- oe_runmake EXT_DTB=$deployed_uboot_dtb_binary
- install ${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
- elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
- cd ${DEPLOYDIR}
- cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
-
- if [ -n "${UBOOT_CONFIG}" ]
- then
- i=0
- j=0
- for config in ${UBOOT_MACHINE}; do
- i=$(expr $i + 1);
- for type in ${UBOOT_CONFIG}; do
- j=$(expr $j + 1);
- if [ $j -eq $i ]
- then
- cp ${UBOOT_IMAGE} ${B}/${CONFIG_B_PATH}/u-boot-$type.${UBOOT_SUFFIX}
- fi
- done
- done
- fi
- else
- bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
- fi
- fi
-}
-
-concat_spl_dtb_helper() {
-
- # We only deploy symlinks to the u-boot-spl.dtb,as the KERNEL_PN will
- # be responsible for deploying the real file
- if [ -e "${SPL_DIR}/${SPL_DTB_BINARY}" ] ; then
- ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_SYMLINK}
- ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_BINARY}
- fi
-
- # Concatenate the SPL nodtb binary and u-boot.dtb
- deployed_spl_dtb_binary='${DEPLOY_DIR_IMAGE}/${SPL_DTB_IMAGE}'
- if [ -e "${DEPLOYDIR}/${SPL_NODTB_IMAGE}" -a -e "$deployed_spl_dtb_binary" ] ; then
- cd ${DEPLOYDIR}
- cat ${SPL_NODTB_IMAGE} $deployed_spl_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${SPL_BINARY} > ${SPL_IMAGE}
- else
- bbwarn "Failure while adding public key to spl binary. Verified U-Boot boot won't be available."
- fi
-}
-
-
-concat_dtb() {
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" -a -n "${UBOOT_DTB_BINARY}" ]; then
- mkdir -p ${DEPLOYDIR}
- if [ -n "${UBOOT_CONFIG}" ]; then
- for config in ${UBOOT_MACHINE}; do
- CONFIG_B_PATH="$config"
- cd ${B}/$config
- concat_dtb_helper
- done
- else
- CONFIG_B_PATH=""
- cd ${B}
- concat_dtb_helper
- fi
- fi
-}
-
-concat_spl_dtb() {
- if [ "${SPL_SIGN_ENABLE}" = "1" -a "${PN}" = "${UBOOT_PN}" -a -n "${SPL_DTB_BINARY}" ]; then
- mkdir -p ${DEPLOYDIR}
- if [ -n "${UBOOT_CONFIG}" ]; then
- for config in ${UBOOT_MACHINE}; do
- CONFIG_B_PATH="$config"
- cd ${B}/$config
- concat_spl_dtb_helper
- done
- else
- CONFIG_B_PATH=""
- cd ${B}
- concat_spl_dtb_helper
- fi
- fi
-}
-
-
-# Install UBOOT_DTB_BINARY to datadir, so that kernel can use it for
-# signing, and kernel will deploy UBOOT_DTB_BINARY after signs it.
-install_helper() {
- if [ -f "${UBOOT_DTB_BINARY}" ]; then
- # UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we
- # need both of them.
- install -Dm 0644 ${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE}
- ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY}
- else
- bbwarn "${UBOOT_DTB_BINARY} not found"
- fi
-}
-
-# Install SPL dtb and u-boot nodtb to datadir,
-install_spl_helper() {
- if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then
- install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE}
- ln -sf ${SPL_DTB_IMAGE} ${D}${datadir}/${SPL_DTB_BINARY}
- else
- bbwarn "${SPL_DTB_BINARY} not found"
- fi
- if [ -f "${UBOOT_NODTB_BINARY}" ] ; then
- install -Dm 0644 ${UBOOT_NODTB_BINARY} ${D}${datadir}/${UBOOT_NODTB_IMAGE}
- ln -sf ${UBOOT_NODTB_IMAGE} ${D}${datadir}/${UBOOT_NODTB_BINARY}
- else
- bbwarn "${UBOOT_NODTB_BINARY} not found"
- fi
-
- # We need to install a 'stub' u-boot-fitimage + its to datadir,
- # so that the KERNEL_PN can use the correct filename when
- # assembling and deploying them
- touch ${D}/${datadir}/${UBOOT_FITIMAGE_IMAGE}
- touch ${D}/${datadir}/${UBOOT_ITS_IMAGE}
-}
-
-do_install:append() {
- if [ "${PN}" = "${UBOOT_PN}" ]; then
- if [ -n "${UBOOT_CONFIG}" ]; then
- for config in ${UBOOT_MACHINE}; do
- cd ${B}/$config
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -o "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
- [ -n "${UBOOT_DTB_BINARY}" ]; then
- install_helper
- fi
- if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
- install_spl_helper
- fi
- done
- else
- cd ${B}
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -o "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
- [ -n "${UBOOT_DTB_BINARY}" ]; then
- install_helper
- fi
- if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
- install_spl_helper
- fi
- fi
- fi
-}
-
-do_uboot_generate_rsa_keys() {
- if [ "${SPL_SIGN_ENABLE}" = "0" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
- bbwarn "UBOOT_FIT_GENERATE_KEYS is set to 1 eventhough SPL_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used."
- fi
-
- if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
-
- # Generate keys only if they don't already exist
- if [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key ] || \
- [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt ]; then
-
- # make directory if it does not already exist
- mkdir -p "${SPL_SIGN_KEYDIR}"
-
- echo "Generating RSA private key for signing U-Boot fitImage"
- openssl genrsa ${UBOOT_FIT_KEY_GENRSA_ARGS} -out \
- "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
- "${UBOOT_FIT_SIGN_NUMBITS}"
-
- echo "Generating certificate for signing U-Boot fitImage"
- openssl req ${FIT_KEY_REQ_ARGS} "${UBOOT_FIT_KEY_SIGN_PKCS}" \
- -key "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
- -out "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt
- fi
- fi
-
-}
-
-addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile
-
-# Create a ITS file for the U-boot FIT, for use when
-# we want to sign it so that the SPL can verify it
-uboot_fitimage_assemble() {
- uboot_its="$1"
- uboot_nodtb_bin="$2"
- uboot_dtb="$3"
- uboot_bin="$4"
- spl_dtb="$5"
- uboot_csum="${UBOOT_FIT_HASH_ALG}"
- uboot_sign_algo="${UBOOT_FIT_SIGN_ALG}"
- uboot_sign_keyname="${SPL_SIGN_KEYNAME}"
-
- rm -f $uboot_its $uboot_bin
-
- # First we create the ITS script
- cat << EOF >> $uboot_its
-/dts-v1/;
-
-/ {
- description = "${UBOOT_FIT_DESC}";
- #address-cells = <1>;
-
- images {
- uboot {
- description = "U-Boot image";
- data = /incbin/("$uboot_nodtb_bin");
- type = "standalone";
- os = "u-boot";
- arch = "${UBOOT_ARCH}";
- compression = "none";
- load = <${UBOOT_LOADADDRESS}>;
- entry = <${UBOOT_ENTRYPOINT}>;
-EOF
-
- if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
- cat << EOF >> $uboot_its
- signature {
- algo = "$uboot_csum,$uboot_sign_algo";
- key-name-hint = "$uboot_sign_keyname";
- };
-EOF
- fi
-
- cat << EOF >> $uboot_its
- };
- fdt {
- description = "U-Boot FDT";
- data = /incbin/("$uboot_dtb");
- type = "flat_dt";
- arch = "${UBOOT_ARCH}";
- compression = "none";
-EOF
-
- if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
- cat << EOF >> $uboot_its
- signature {
- algo = "$uboot_csum,$uboot_sign_algo";
- key-name-hint = "$uboot_sign_keyname";
- };
-EOF
- fi
-
- cat << EOF >> $uboot_its
- };
- };
-
- configurations {
- default = "conf";
- conf {
- description = "Boot with signed U-Boot FIT";
- loadables = "uboot";
- fdt = "fdt";
- };
- };
-};
-EOF
-
- #
- # Assemble the U-boot FIT image
- #
- ${UBOOT_MKIMAGE} \
- ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
- -f $uboot_its \
- $uboot_bin
-
- if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
- #
- # Sign the U-boot FIT image and add public key to SPL dtb
- #
- ${UBOOT_MKIMAGE_SIGN} \
- ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
- -F -k "${SPL_SIGN_KEYDIR}" \
- -K "$spl_dtb" \
- -r $uboot_bin \
- ${SPL_MKIMAGE_SIGN_ARGS}
- fi
-
-}
-
-do_uboot_assemble_fitimage() {
- # This function runs in KERNEL_PN context. The reason for that is that we need to
- # support the scenario where UBOOT_SIGN_ENABLE is placing the Kernel fitImage's
- # pubkey in the u-boot.dtb file, so that we can use it when building the U-Boot
- # fitImage itself.
- if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] && \
- [ -n "${SPL_DTB_BINARY}" -a "${PN}" = "${KERNEL_PN}" ] ; then
- if [ "${UBOOT_SIGN_ENABLE}" != "1" ]; then
- # If we're not signing the Kernel fitImage, that means
- # we need to copy the u-boot.dtb from staging ourselves
- cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
- fi
- # As we are in the kernel context, we need to copy u-boot-spl.dtb from staging first.
- # Unfortunately, need to glob on top of ${SPL_DTB_BINARY} since _IMAGE and _SYMLINK
- # will contain U-boot's PV
- # Similarly, we need to get the filename for the 'stub' u-boot-fitimage + its in
- # staging so that we can use it for creating the image with the correct filename
- # in the KERNEL_PN context.
- # As for the u-boot.dtb (with fitimage's pubkey), it should come from the dependent
- # do_assemble_fitimage task
- cp -P ${STAGING_DATADIR}/u-boot-spl*.dtb ${B}
- cp -P ${STAGING_DATADIR}/u-boot-nodtb*.bin ${B}
- rm -rf ${B}/u-boot-fitImage-* ${B}/u-boot-its-*
- kernel_uboot_fitimage_name=`basename ${STAGING_DATADIR}/u-boot-fitImage-*`
- kernel_uboot_its_name=`basename ${STAGING_DATADIR}/u-boot-its-*`
- cd ${B}
- uboot_fitimage_assemble $kernel_uboot_its_name ${UBOOT_NODTB_BINARY} \
- ${UBOOT_DTB_BINARY} $kernel_uboot_fitimage_name \
- ${SPL_DTB_BINARY}
- fi
-}
-
-addtask uboot_assemble_fitimage before do_deploy after do_compile
-
-do_deploy:prepend:pn-${UBOOT_PN}() {
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
- concat_dtb
- fi
-
- if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
- # Deploy the u-boot-nodtb binary and symlinks...
- if [ -f "${SPL_DIR}/${SPL_NODTB_BINARY}" ] ; then
- echo "Copying u-boot-nodtb binary..."
- install -m 0644 ${SPL_DIR}/${SPL_NODTB_BINARY} ${DEPLOYDIR}/${SPL_NODTB_IMAGE}
- ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_SYMLINK}
- ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_BINARY}
- fi
-
-
- # We only deploy the symlinks to the uboot-fitImage and uboot-its
- # images, as the KERNEL_PN will take care of deploying the real file
- ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_BINARY}
- ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_SYMLINK}
- ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS}
- ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS_SYMLINK}
- fi
-
- if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
- concat_spl_dtb
- fi
-
-
-}
-
-do_deploy:append:pn-${UBOOT_PN}() {
- # If we're creating a u-boot fitImage, point u-boot.bin
- # symlink since it might get used by image recipes
- if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
- ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_BINARY}
- ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_SYMLINK}
- fi
-}
-
-python () {
- if ( (d.getVar('UBOOT_SIGN_ENABLE') == '1'
- or d.getVar('UBOOT_FITIMAGE_ENABLE') == '1')
- and d.getVar('PN') == d.getVar('UBOOT_PN')
- and d.getVar('UBOOT_DTB_BINARY')):
-
- # Make "bitbake u-boot -cdeploy" deploys the signed u-boot.dtb
- # and/or the U-Boot fitImage
- d.appendVarFlag('do_deploy', 'depends', ' %s:do_deploy' % d.getVar('KERNEL_PN'))
-
- if d.getVar('UBOOT_FITIMAGE_ENABLE') == '1' and d.getVar('PN') == d.getVar('KERNEL_PN'):
- # As the U-Boot fitImage is created by the KERNEL_PN, we need
- # to make sure that the u-boot-spl.dtb and u-boot-spl-nodtb.bin
- # files are in the staging dir for it's use
- d.appendVarFlag('do_uboot_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % d.getVar('UBOOT_PN'))
-
- # If the Kernel fitImage is being signed, we need to
- # create the U-Boot fitImage after it
- if d.getVar('UBOOT_SIGN_ENABLE') == '1':
- d.appendVarFlag('do_uboot_assemble_fitimage', 'depends', ' %s:do_assemble_fitimage' % d.getVar('KERNEL_PN'))
- d.appendVarFlag('do_uboot_assemble_fitimage', 'depends', ' %s:do_assemble_fitimage_initramfs' % d.getVar('KERNEL_PN'))
-
-}
diff --git a/poky/meta/classes/uninative.bbclass b/poky/meta/classes/uninative.bbclass
deleted file mode 100644
index 6a9e862..0000000
--- a/poky/meta/classes/uninative.bbclass
+++ /dev/null
@@ -1,171 +0,0 @@
-UNINATIVE_LOADER ?= "${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux/lib/${@bb.utils.contains('BUILD_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', '', d)}${@bb.utils.contains('BUILD_ARCH', 'i686', 'ld-linux.so.2', '', d)}${@bb.utils.contains('BUILD_ARCH', 'aarch64', 'ld-linux-aarch64.so.1', '', d)}${@bb.utils.contains('BUILD_ARCH', 'ppc64le', 'ld64.so.2', '', d)}"
-UNINATIVE_STAGING_DIR ?= "${STAGING_DIR}"
-
-UNINATIVE_URL ?= "unset"
-UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc-${UNINATIVE_VERSION}.tar.xz"
-# Example checksums
-#UNINATIVE_CHECKSUM[aarch64] = "dead"
-#UNINATIVE_CHECKSUM[i686] = "dead"
-#UNINATIVE_CHECKSUM[x86_64] = "dead"
-UNINATIVE_DLDIR ?= "${DL_DIR}/uninative/"
-
-# Enabling uninative will change the following variables so they need to go the parsing ignored variables list to prevent multiple recipe parsing
-BB_HASHCONFIG_IGNORE_VARS += "NATIVELSBSTRING SSTATEPOSTUNPACKFUNCS BUILD_LDFLAGS"
-
-addhandler uninative_event_fetchloader
-uninative_event_fetchloader[eventmask] = "bb.event.BuildStarted"
-
-addhandler uninative_event_enable
-uninative_event_enable[eventmask] = "bb.event.ConfigParsed"
-
-python uninative_event_fetchloader() {
- """
- This event fires on the parent and will try to fetch the tarball if the
- loader isn't already present.
- """
-
- chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH"))
- if not chksum:
- bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH"))
-
- loader = d.getVar("UNINATIVE_LOADER")
- loaderchksum = loader + ".chksum"
- if os.path.exists(loader) and os.path.exists(loaderchksum):
- with open(loaderchksum, "r") as f:
- readchksum = f.read().strip()
- if readchksum == chksum:
- return
-
- import subprocess
- try:
- # Save and restore cwd as Fetch.download() does a chdir()
- olddir = os.getcwd()
-
- tarball = d.getVar("UNINATIVE_TARBALL")
- tarballdir = os.path.join(d.getVar("UNINATIVE_DLDIR"), chksum)
- tarballpath = os.path.join(tarballdir, tarball)
-
- if not os.path.exists(tarballpath + ".done"):
- bb.utils.mkdirhier(tarballdir)
- if d.getVar("UNINATIVE_URL") == "unset":
- bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
-
- localdata = bb.data.createCopy(d)
- localdata.setVar('FILESPATH', "")
- localdata.setVar('DL_DIR', tarballdir)
- # Our games with path manipulation of DL_DIR mean standard PREMIRRORS don't work
- # and we can't easily put 'chksum' into the url path from a url parameter with
- # the current fetcher url handling
- premirrors = bb.fetch2.mirror_from_string(localdata.getVar("PREMIRRORS"))
- for line in premirrors:
- try:
- (find, replace) = line
- except ValueError:
- continue
- if find.startswith("http"):
- localdata.appendVar("PREMIRRORS", " ${UNINATIVE_URL}${UNINATIVE_TARBALL} %s/uninative/%s/${UNINATIVE_TARBALL}" % (replace, chksum))
-
- srcuri = d.expand("${UNINATIVE_URL}${UNINATIVE_TARBALL};sha256sum=%s" % chksum)
- bb.note("Fetching uninative binary shim %s (will check PREMIRRORS first)" % srcuri)
-
- fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
- fetcher.download()
- localpath = fetcher.localpath(srcuri)
- if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
- # Follow the symlink behavior from the bitbake fetch2.
- # This will cover the case where an existing symlink is broken
- # as well as if there are two processes trying to create it
- # at the same time.
- if os.path.islink(tarballpath):
- # Broken symbolic link
- os.unlink(tarballpath)
-
- # Deal with two processes trying to make symlink at once
- try:
- os.symlink(localpath, tarballpath)
- except FileExistsError:
- pass
-
- # ldd output is "ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23", extract last option from first line
- glibcver = subprocess.check_output(["ldd", "--version"]).decode('utf-8').split('\n')[0].split()[-1]
- if bb.utils.vercmp_string(d.getVar("UNINATIVE_MAXGLIBCVERSION"), glibcver) < 0:
- raise RuntimeError("Your host glibc version (%s) is newer than that in uninative (%s). Disabling uninative so that sstate is not corrupted." % (glibcver, d.getVar("UNINATIVE_MAXGLIBCVERSION")))
-
- cmd = d.expand("\
-mkdir -p ${UNINATIVE_STAGING_DIR}-uninative; \
-cd ${UNINATIVE_STAGING_DIR}-uninative; \
-tar -xJf ${UNINATIVE_DLDIR}/%s/${UNINATIVE_TARBALL}; \
-${UNINATIVE_STAGING_DIR}-uninative/relocate_sdk.py \
- ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux \
- ${UNINATIVE_LOADER} \
- ${UNINATIVE_LOADER} \
- ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux/${bindir_native}/patchelf-uninative \
- ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux${base_libdir_native}/libc*.so*" % chksum)
- subprocess.check_output(cmd, shell=True)
-
- with open(loaderchksum, "w") as f:
- f.write(chksum)
-
- enable_uninative(d)
-
- except RuntimeError as e:
- bb.warn(str(e))
- except bb.fetch2.BBFetchException as exc:
- bb.warn("Disabling uninative as unable to fetch uninative tarball: %s" % str(exc))
- bb.warn("To build your own uninative loader, please bitbake uninative-tarball and set UNINATIVE_TARBALL appropriately.")
- except subprocess.CalledProcessError as exc:
- bb.warn("Disabling uninative as unable to install uninative tarball: %s" % str(exc))
- bb.warn("To build your own uninative loader, please bitbake uninative-tarball and set UNINATIVE_TARBALL appropriately.")
- finally:
- os.chdir(olddir)
-}
-
-python uninative_event_enable() {
- """
- This event handler is called in the workers and is responsible for setting
- up uninative if a loader is found.
- """
- enable_uninative(d)
-}
-
-def enable_uninative(d):
- loader = d.getVar("UNINATIVE_LOADER")
- if os.path.exists(loader):
- bb.debug(2, "Enabling uninative")
- d.setVar("NATIVELSBSTRING", "universal%s" % oe.utils.host_gcc_version(d))
- d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
- d.appendVarFlag("SSTATEPOSTUNPACKFUNCS", "vardepvalueexclude", "| uninative_changeinterp")
- d.appendVar("BUILD_LDFLAGS", " -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=${UNINATIVE_LOADER}")
- d.appendVarFlag("BUILD_LDFLAGS", "vardepvalueexclude", "| -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=${UNINATIVE_LOADER}")
- d.appendVarFlag("BUILD_LDFLAGS", "vardepsexclude", "UNINATIVE_LOADER")
- d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
-
-python uninative_changeinterp () {
- import subprocess
- import stat
- import oe.qa
-
- if not (bb.data.inherits_class('native', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross', d)):
- return
-
- sstateinst = d.getVar('SSTATE_INSTDIR')
- for walkroot, dirs, files in os.walk(sstateinst):
- for file in files:
- if file.endswith(".so") or ".so." in file:
- continue
- f = os.path.join(walkroot, file)
- if os.path.islink(f):
- continue
- s = os.stat(f)
- if not ((s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH)):
- continue
- elf = oe.qa.ELFFile(f)
- try:
- elf.open()
- except oe.qa.NotELFFileError:
- continue
- if not elf.isDynamic():
- continue
-
- subprocess.check_output(("patchelf-uninative", "--set-interpreter", d.getVar("UNINATIVE_LOADER"), f), stderr=subprocess.STDOUT)
-}
diff --git a/poky/meta/classes/update-alternatives.bbclass b/poky/meta/classes/update-alternatives.bbclass
deleted file mode 100644
index fc1ffd8..0000000
--- a/poky/meta/classes/update-alternatives.bbclass
+++ /dev/null
@@ -1,327 +0,0 @@
-# This class is used to help the alternatives system which is useful when
-# multiple sources provide same command. You can use update-alternatives
-# command directly in your recipe, but in most cases this class simplifies
-# that job.
-#
-# To use this class a number of variables should be defined:
-#
-# List all of the alternatives needed by a package:
-# ALTERNATIVE:<pkg> = "name1 name2 name3 ..."
-#
-# i.e. ALTERNATIVE:busybox = "sh sed test bracket"
-#
-# The pathname of the link
-# ALTERNATIVE_LINK_NAME[name] = "target"
-#
-# This is the name of the binary once it's been installed onto the runtime.
-# This name is global to all split packages in this recipe, and should match
-# other recipes with the same functionality.
-# i.e. ALTERNATIVE_LINK_NAME[bracket] = "/usr/bin/["
-#
-# NOTE: If ALTERNATIVE_LINK_NAME is not defined, it defaults to ${bindir}/name
-#
-# The default link to create for all targets
-# ALTERNATIVE_TARGET = "target"
-#
-# This is useful in a multicall binary case
-# i.e. ALTERNATIVE_TARGET = "/bin/busybox"
-#
-# A non-default link to create for a target
-# ALTERNATIVE_TARGET[name] = "target"
-#
-# This is the name of the binary as it's been install by do_install
-# i.e. ALTERNATIVE_TARGET[sh] = "/bin/bash"
-#
-# A package specific link for a target
-# ALTERNATIVE_TARGET_<pkg>[name] = "target"
-#
-# This is useful when a recipe provides multiple alternatives for the
-# same item.
-#
-# NOTE: If ALTERNATIVE_TARGET is not defined, it will inherit the value
-# from ALTERNATIVE_LINK_NAME.
-#
-# NOTE: If the ALTERNATIVE_LINK_NAME and ALTERNATIVE_TARGET are the same,
-# ALTERNATIVE_TARGET will have '.{BPN}' appended to it. If the file
-# referenced has not been renamed, it will also be renamed. (This avoids
-# the need to rename alternative files in the do_install step, but still
-# supports it if necessary for some reason.)
-#
-# The default priority for any alternatives
-# ALTERNATIVE_PRIORITY = "priority"
-#
-# i.e. default is ALTERNATIVE_PRIORITY = "10"
-#
-# The non-default priority for a specific target
-# ALTERNATIVE_PRIORITY[name] = "priority"
-#
-# The package priority for a specific target
-# ALTERNATIVE_PRIORITY_<pkg>[name] = "priority"
-
-ALTERNATIVE_PRIORITY = "10"
-
-# We need special processing for vardeps because it can not work on
-# modified flag values. So we aggregate the flags into a new variable
-# and include that vairable in the set.
-UPDALTVARS = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_PRIORITY"
-
-PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
-
-def gen_updatealternativesvardeps(d):
- pkgs = (d.getVar("PACKAGES") or "").split()
- vars = (d.getVar("UPDALTVARS") or "").split()
-
- # First compute them for non_pkg versions
- for v in vars:
- for flag in sorted((d.getVarFlags(v) or {}).keys()):
- if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
- continue
- d.appendVar('%s_VARDEPS' % (v), ' %s:%s' % (flag, d.getVarFlag(v, flag, False)))
-
- for p in pkgs:
- for v in vars:
- for flag in sorted((d.getVarFlags("%s_%s" % (v,p)) or {}).keys()):
- if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
- continue
- d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s_%s' % (v,p), flag, False)))
-
-def ua_extend_depends(d):
- if not 'virtual/update-alternatives' in d.getVar('PROVIDES'):
- d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives')
-
-def update_alternatives_enabled(d):
- # Update Alternatives only works on target packages...
- if bb.data.inherits_class('native', d) or \
- bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \
- bb.data.inherits_class('cross-canadian', d):
- return False
-
- # Disable when targeting mingw32 (no target support)
- if d.getVar("TARGET_OS") == "mingw32":
- return False
-
- return True
-
-python __anonymous() {
- if not update_alternatives_enabled(d):
- return
-
- # compute special vardeps
- gen_updatealternativesvardeps(d)
-
- # extend the depends to include virtual/update-alternatives
- ua_extend_depends(d)
-}
-
-def gen_updatealternativesvars(d):
- ret = []
- pkgs = (d.getVar("PACKAGES") or "").split()
- vars = (d.getVar("UPDALTVARS") or "").split()
-
- for v in vars:
- ret.append(v + "_VARDEPS")
-
- for p in pkgs:
- for v in vars:
- ret.append(v + ":" + p)
- ret.append(v + "_VARDEPS_" + p)
- return " ".join(ret)
-
-# Now the new stuff, we use a custom function to generate the right values
-populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
-
-# We need to do the rename after the image creation step, but before
-# the split and strip steps.. PACKAGE_PREPROCESS_FUNCS is the right
-# place for that.
-PACKAGE_PREPROCESS_FUNCS += "apply_update_alternative_renames"
-python apply_update_alternative_renames () {
- if not update_alternatives_enabled(d):
- return
-
- import re
-
- def update_files(alt_target, alt_target_rename, pkg, d):
- f = d.getVar('FILES:' + pkg)
- if f:
- f = re.sub(r'(^|\s)%s(\s|$)' % re.escape (alt_target), r'\1%s\2' % alt_target_rename, f)
- d.setVar('FILES:' + pkg, f)
-
- # Check for deprecated usage...
- pn = d.getVar('BPN')
- if d.getVar('ALTERNATIVE_LINKS') != None:
- bb.fatal('%s: Use of ALTERNATIVE_LINKS/ALTERNATIVE_PATH/ALTERNATIVE_NAME is no longer supported, please convert to the updated syntax, see update-alternatives.bbclass for more info.' % pn)
-
- # Do actual update alternatives processing
- pkgdest = d.getVar('PKGD')
- for pkg in (d.getVar('PACKAGES') or "").split():
- # If the src == dest, we know we need to rename the dest by appending ${BPN}
- link_rename = []
- for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split():
- alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
- if not alt_link:
- alt_link = "%s/%s" % (d.getVar('bindir'), alt_name)
- d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link)
- if alt_link.startswith(os.path.join(d.getVar('sysconfdir'), 'init.d')):
- # Managing init scripts does not work (bug #10433), foremost
- # because of a race with update-rc.d
- bb.fatal("Using update-alternatives for managing SysV init scripts is not supported")
-
- alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name)
- alt_target = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link
- # Sometimes alt_target is specified as relative to the link name.
- alt_target = os.path.join(os.path.dirname(alt_link), alt_target)
-
- # If the link and target are the same name, we need to rename the target.
- if alt_link == alt_target:
- src = '%s/%s' % (pkgdest, alt_target)
- alt_target_rename = '%s.%s' % (alt_target, pn)
- dest = '%s/%s' % (pkgdest, alt_target_rename)
- if os.path.lexists(dest):
- bb.note('%s: Already renamed: %s' % (pn, alt_target_rename))
- elif os.path.lexists(src):
- if os.path.islink(src):
- # Delay rename of links
- link_rename.append((alt_target, alt_target_rename))
- else:
- bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename))
- bb.utils.rename(src, dest)
- update_files(alt_target, alt_target_rename, pkg, d)
- else:
- bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename))
- continue
- d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name, alt_target_rename)
-
- # Process delayed link names
- # Do these after other renames so we can correct broken links
- for (alt_target, alt_target_rename) in link_rename:
- src = '%s/%s' % (pkgdest, alt_target)
- dest = '%s/%s' % (pkgdest, alt_target_rename)
- link_target = oe.path.realpath(src, pkgdest, True)
-
- if os.path.lexists(link_target):
- # Ok, the link_target exists, we can rename
- bb.note('%s: Rename (link) %s -> %s' % (pn, alt_target, alt_target_rename))
- bb.utils.rename(src, dest)
- else:
- # Try to resolve the broken link to link.${BPN}
- link_maybe = '%s.%s' % (os.readlink(src), pn)
- if os.path.lexists(os.path.join(os.path.dirname(src), link_maybe)):
- # Ok, the renamed link target exists.. create a new link, and remove the original
- bb.note('%s: Creating new link %s -> %s' % (pn, alt_target_rename, link_maybe))
- os.symlink(link_maybe, dest)
- os.unlink(src)
- else:
- bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
- continue
- update_files(alt_target, alt_target_rename, pkg, d)
-}
-
-def update_alternatives_alt_targets(d, pkg):
- """
- Returns the update-alternatives metadata for a package.
-
- The returned format is a list of tuples where the tuple contains:
- alt_name: The binary name
- alt_link: The path for the binary (Shared by different packages)
- alt_target: The path for the renamed binary (Unique per package)
- alt_priority: The priority of the alt_target
-
- All the alt_targets will be installed into the sysroot. The alt_link is
- a symlink pointing to the alt_target with the highest priority.
- """
-
- pn = d.getVar('BPN')
- pkgdest = d.getVar('PKGD')
- updates = list()
- for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split():
- alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
- alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or \
- d.getVarFlag('ALTERNATIVE_TARGET', alt_name) or \
- d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or \
- d.getVar('ALTERNATIVE_TARGET') or \
- alt_link
- alt_priority = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name) or \
- d.getVarFlag('ALTERNATIVE_PRIORITY', alt_name) or \
- d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg) or \
- d.getVar('ALTERNATIVE_PRIORITY')
-
- # This shouldn't trigger, as it should have been resolved earlier!
- if alt_link == alt_target:
- bb.note('alt_link == alt_target: %s == %s -- correcting, this should not happen!' % (alt_link, alt_target))
- alt_target = '%s.%s' % (alt_target, pn)
-
- if not os.path.lexists('%s/%s' % (pkgdest, alt_target)):
- bb.warn('%s: NOT adding alternative provide %s: %s does not exist' % (pn, alt_link, alt_target))
- continue
-
- alt_target = os.path.normpath(alt_target)
- updates.append( (alt_name, alt_link, alt_target, alt_priority) )
-
- return updates
-
-PACKAGESPLITFUNCS:prepend = "populate_packages_updatealternatives "
-
-python populate_packages_updatealternatives () {
- if not update_alternatives_enabled(d):
- return
-
- # Do actual update alternatives processing
- for pkg in (d.getVar('PACKAGES') or "").split():
- # Create post install/removal scripts
- alt_setup_links = ""
- alt_remove_links = ""
- updates = update_alternatives_alt_targets(d, pkg)
- for alt_name, alt_link, alt_target, alt_priority in updates:
- alt_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority)
- alt_remove_links += '\tupdate-alternatives --remove %s %s\n' % (alt_name, alt_target)
-
- if alt_setup_links:
- # RDEPENDS setup
- provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives')
- if provider:
- #bb.note('adding runtime requirement for update-alternatives for %s' % pkg)
- d.appendVar('RDEPENDS:%s' % pkg, ' ' + d.getVar('MLPREFIX', False) + provider)
-
- bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg)
- bb.note('%s' % alt_setup_links)
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if postinst:
- postinst = alt_setup_links + postinst
- else:
- postinst = '#!/bin/sh\n' + alt_setup_links
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- bb.note('%s' % alt_remove_links)
- prerm = d.getVar('pkg_prerm:%s' % pkg) or '#!/bin/sh\n'
- prerm += alt_remove_links
- d.setVar('pkg_prerm:%s' % pkg, prerm)
-}
-
-python package_do_filedeps:append () {
- if update_alternatives_enabled(d):
- apply_update_alternative_provides(d)
-}
-
-def apply_update_alternative_provides(d):
- pn = d.getVar('BPN')
- pkgdest = d.getVar('PKGDEST')
-
- for pkg in d.getVar('PACKAGES').split():
- for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split():
- alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
- alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name)
- alt_target = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link
-
- if alt_link == alt_target:
- bb.warn('%s: alt_link == alt_target: %s == %s' % (pn, alt_link, alt_target))
- alt_target = '%s.%s' % (alt_target, pn)
-
- if not os.path.lexists('%s/%s/%s' % (pkgdest, pkg, alt_target)):
- continue
-
- # Add file provide
- trans_target = oe.package.file_translate(alt_target)
- d.appendVar('FILERPROVIDES:%s:%s' % (trans_target, pkg), " " + alt_link)
- if not trans_target in (d.getVar('FILERPROVIDESFLIST:%s' % pkg) or ""):
- d.appendVar('FILERPROVIDESFLIST:%s' % pkg, " " + trans_target)
-
diff --git a/poky/meta/classes/update-rc.d.bbclass b/poky/meta/classes/update-rc.d.bbclass
deleted file mode 100644
index 0a3a608..0000000
--- a/poky/meta/classes/update-rc.d.bbclass
+++ /dev/null
@@ -1,123 +0,0 @@
-UPDATERCPN ?= "${PN}"
-
-DEPENDS:append:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', ' update-rc.d initscripts', '', d)}"
-
-UPDATERCD = "update-rc.d"
-UPDATERCD:class-cross = ""
-UPDATERCD:class-native = ""
-UPDATERCD:class-nativesdk = ""
-
-INITSCRIPT_PARAMS ?= "defaults"
-
-INIT_D_DIR = "${sysconfdir}/init.d"
-
-def use_updatercd(d):
- # If the distro supports both sysvinit and systemd, and the current recipe
- # supports systemd, only call update-rc.d on rootfs creation or if systemd
- # is not running. That's because systemctl enable/disable will already call
- # update-rc.d if it detects initscripts.
- if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and bb.data.inherits_class('systemd', d):
- return '[ -n "$D" -o ! -d /run/systemd/system ]'
- return 'true'
-
-PACKAGE_WRITE_DEPS += "update-rc.d-native"
-
-updatercd_postinst() {
-if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then
- if [ -n "$D" ]; then
- OPT="-r $D"
- else
- OPT="-s"
- fi
- update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
-fi
-}
-
-updatercd_prerm() {
-if ${@use_updatercd(d)} && [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
- ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || :
-fi
-}
-
-updatercd_postrm() {
-if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then
- if [ -n "$D" ]; then
- OPT="-f -r $D"
- else
- OPT="-f"
- fi
- update-rc.d $OPT ${INITSCRIPT_NAME} remove
-fi
-}
-
-
-def update_rc_after_parse(d):
- if d.getVar('INITSCRIPT_PACKAGES', False) == None:
- if d.getVar('INITSCRIPT_NAME', False) == None:
- bb.fatal("%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % d.getVar('FILE', False))
- if d.getVar('INITSCRIPT_PARAMS', False) == None:
- bb.fatal("%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % d.getVar('FILE', False))
-
-python __anonymous() {
- update_rc_after_parse(d)
-}
-
-PACKAGESPLITFUNCS:prepend = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'populate_packages_updatercd ', '', d)}"
-PACKAGESPLITFUNCS:remove:class-nativesdk = "populate_packages_updatercd "
-
-populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_postinst"
-populate_packages_updatercd[vardepsexclude] += "OVERRIDES"
-
-python populate_packages_updatercd () {
- def update_rcd_auto_depend(pkg):
- import subprocess
- import os
- path = d.expand("${D}${INIT_D_DIR}/${INITSCRIPT_NAME}")
- if not os.path.exists(path):
- return
- statement = "grep -q -w '/etc/init.d/functions' %s" % path
- if subprocess.call(statement, shell=True) == 0:
- mlprefix = d.getVar('MLPREFIX') or ""
- d.appendVar('RDEPENDS:' + pkg, ' %sinitd-functions' % (mlprefix))
-
- def update_rcd_package(pkg):
- bb.debug(1, 'adding update-rc.d calls to postinst/prerm/postrm for %s' % pkg)
-
- localdata = bb.data.createCopy(d)
- overrides = localdata.getVar("OVERRIDES")
- localdata.setVar("OVERRIDES", "%s:%s" % (pkg, overrides))
-
- update_rcd_auto_depend(pkg)
-
- postinst = d.getVar('pkg_postinst:%s' % pkg)
- if not postinst:
- postinst = '#!/bin/sh\n'
- postinst += localdata.getVar('updatercd_postinst')
- d.setVar('pkg_postinst:%s' % pkg, postinst)
-
- prerm = d.getVar('pkg_prerm:%s' % pkg)
- if not prerm:
- prerm = '#!/bin/sh\n'
- prerm += localdata.getVar('updatercd_prerm')
- d.setVar('pkg_prerm:%s' % pkg, prerm)
-
- postrm = d.getVar('pkg_postrm:%s' % pkg)
- if not postrm:
- postrm = '#!/bin/sh\n'
- postrm += localdata.getVar('updatercd_postrm')
- d.setVar('pkg_postrm:%s' % pkg, postrm)
-
- d.appendVar('RRECOMMENDS:' + pkg, " ${MLPREFIX}${UPDATERCD}")
-
- # Check that this class isn't being inhibited (generally, by
- # systemd.bbclass) before doing any work.
- if not d.getVar("INHIBIT_UPDATERCD_BBCLASS"):
- pkgs = d.getVar('INITSCRIPT_PACKAGES')
- if pkgs == None:
- pkgs = d.getVar('UPDATERCPN')
- packages = (d.getVar('PACKAGES') or "").split()
- if not pkgs in packages and packages != []:
- pkgs = packages[0]
- for pkg in pkgs.split():
- update_rcd_package(pkg)
-}
diff --git a/poky/meta/classes/upstream-version-is-even.bbclass b/poky/meta/classes/upstream-version-is-even.bbclass
deleted file mode 100644
index 256c752..0000000
--- a/poky/meta/classes/upstream-version-is-even.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-# This class ensures that the upstream version check only
-# accepts even minor versions (i.e. 3.0.x, 3.2.x, 3.4.x, etc.)
-# This scheme is used by Gnome and a number of other projects
-# to signify stable releases vs development releases.
-UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>\d+\.(\d*[02468])+(\.\d+)+)\.tar"
diff --git a/poky/meta/classes/useradd-staticids.bbclass b/poky/meta/classes/useradd-staticids.bbclass
index 3acf59c..abe484e 100644
--- a/poky/meta/classes/useradd-staticids.bbclass
+++ b/poky/meta/classes/useradd-staticids.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# In order to support a deterministic set of 'dynamic' users/groups,
# we need a function to reformat the params based on a static file
def update_useradd_static_config(d):
diff --git a/poky/meta/classes/useradd.bbclass b/poky/meta/classes/useradd.bbclass
index 20771a0..4d3bd9a 100644
--- a/poky/meta/classes/useradd.bbclass
+++ b/poky/meta/classes/useradd.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
inherit useradd_base
# base-passwd-cross provides the default passwd and group files in the
diff --git a/poky/meta/classes/useradd_base.bbclass b/poky/meta/classes/useradd_base.bbclass
index 7f5b9b7..863cb7b 100644
--- a/poky/meta/classes/useradd_base.bbclass
+++ b/poky/meta/classes/useradd_base.bbclass
@@ -1,3 +1,9 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
# This bbclass provides basic functionality for user/group settings.
# This bbclass is intended to be inherited by useradd.bbclass and
# extrausers.bbclass.
diff --git a/poky/meta/classes/utility-tasks.bbclass b/poky/meta/classes/utility-tasks.bbclass
deleted file mode 100644
index 0466325..0000000
--- a/poky/meta/classes/utility-tasks.bbclass
+++ /dev/null
@@ -1,54 +0,0 @@
-addtask listtasks
-do_listtasks[nostamp] = "1"
-python do_listtasks() {
- taskdescs = {}
- maxlen = 0
- for e in d.keys():
- if d.getVarFlag(e, 'task'):
- maxlen = max(maxlen, len(e))
- if e.endswith('_setscene'):
- desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
- else:
- desc = d.getVarFlag(e, 'doc') or ''
- taskdescs[e] = desc
-
- tasks = sorted(taskdescs.keys())
- for taskname in tasks:
- bb.plain("%s %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
-}
-
-CLEANFUNCS ?= ""
-
-T:task-clean = "${LOG_DIR}/cleanlogs/${PN}"
-addtask clean
-do_clean[nostamp] = "1"
-python do_clean() {
- """clear the build and temp directories"""
- dir = d.expand("${WORKDIR}")
- bb.note("Removing " + dir)
- oe.path.remove(dir)
-
- dir = "%s.*" % d.getVar('STAMP')
- bb.note("Removing " + dir)
- oe.path.remove(dir)
-
- for f in (d.getVar('CLEANFUNCS') or '').split():
- bb.build.exec_func(f, d)
-}
-
-addtask checkuri
-do_checkuri[nostamp] = "1"
-do_checkuri[network] = "1"
-python do_checkuri() {
- src_uri = (d.getVar('SRC_URI') or "").split()
- if len(src_uri) == 0:
- return
-
- try:
- fetcher = bb.fetch2.Fetch(src_uri, d)
- fetcher.checkstatus()
- except bb.fetch2.BBFetchException as e:
- bb.fatal(str(e))
-}
-
-
diff --git a/poky/meta/classes/utils.bbclass b/poky/meta/classes/utils.bbclass
deleted file mode 100644
index e6f7f95..0000000
--- a/poky/meta/classes/utils.bbclass
+++ /dev/null
@@ -1,364 +0,0 @@
-
-oe_soinstall() {
- # Purpose: Install shared library file and
- # create the necessary links
- # Example: oe_soinstall libfoo.so.1.2.3 ${D}${libdir}
- libname=`basename $1`
- case "$libname" in
- *.so)
- bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3)"
- ;;
- esac
- install -m 755 $1 $2/$libname
- sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
- if [ -z $sonamelink ]; then
- bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'."
- fi
- solink=`echo $libname | sed -e 's/\.so\..*/.so/'`
- ln -sf $libname $2/$sonamelink
- ln -sf $libname $2/$solink
-}
-
-oe_libinstall() {
- # Purpose: Install a library, in all its forms
- # Example
- #
- # oe_libinstall libltdl ${STAGING_LIBDIR}/
- # oe_libinstall -C src/libblah libblah ${D}/${libdir}/
- dir=""
- libtool=""
- silent=""
- require_static=""
- require_shared=""
- while [ "$#" -gt 0 ]; do
- case "$1" in
- -C)
- shift
- dir="$1"
- ;;
- -s)
- silent=1
- ;;
- -a)
- require_static=1
- ;;
- -so)
- require_shared=1
- ;;
- -*)
- bbfatal "oe_libinstall: unknown option: $1"
- ;;
- *)
- break;
- ;;
- esac
- shift
- done
-
- libname="$1"
- shift
- destpath="$1"
- if [ -z "$destpath" ]; then
- bbfatal "oe_libinstall: no destination path specified"
- fi
-
- __runcmd () {
- if [ -z "$silent" ]; then
- echo >&2 "oe_libinstall: $*"
- fi
- $*
- }
-
- if [ -z "$dir" ]; then
- dir=`pwd`
- fi
-
- dotlai=$libname.lai
-
- # Sanity check that the libname.lai is unique
- number_of_files=`(cd $dir; find . -name "$dotlai") | wc -l`
- if [ $number_of_files -gt 1 ]; then
- bbfatal "oe_libinstall: $dotlai is not unique in $dir"
- fi
-
-
- dir=$dir`(cd $dir;find . -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"`
- olddir=`pwd`
- __runcmd cd $dir
-
- lafile=$libname.la
-
- # If such file doesn't exist, try to cut version suffix
- if [ ! -f "$lafile" ]; then
- libname1=`echo "$libname" | sed 's/-[0-9.]*$//'`
- lafile1=$libname.la
- if [ -f "$lafile1" ]; then
- libname=$libname1
- lafile=$lafile1
- fi
- fi
-
- if [ -f "$lafile" ]; then
- # libtool archive
- eval `cat $lafile|grep "^library_names="`
- libtool=1
- else
- library_names="$libname.so* $libname.dll.a $libname.*.dylib"
- fi
-
- __runcmd install -d $destpath/
- dota=$libname.a
- if [ -f "$dota" -o -n "$require_static" ]; then
- rm -f $destpath/$dota
- __runcmd install -m 0644 $dota $destpath/
- fi
- if [ -f "$dotlai" -a -n "$libtool" ]; then
- rm -f $destpath/$libname.la
- __runcmd install -m 0644 $dotlai $destpath/$libname.la
- fi
-
- for name in $library_names; do
- files=`eval echo $name`
- for f in $files; do
- if [ ! -e "$f" ]; then
- if [ -n "$libtool" ]; then
- bbfatal "oe_libinstall: $dir/$f not found."
- fi
- elif [ -L "$f" ]; then
- __runcmd cp -P "$f" $destpath/
- elif [ ! -L "$f" ]; then
- libfile="$f"
- rm -f $destpath/$libfile
- __runcmd install -m 0755 $libfile $destpath/
- fi
- done
- done
-
- if [ -z "$libfile" ]; then
- if [ -n "$require_shared" ]; then
- bbfatal "oe_libinstall: unable to locate shared library"
- fi
- elif [ -z "$libtool" ]; then
- # special case hack for non-libtool .so.#.#.# links
- baselibfile=`basename "$libfile"`
- if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
- sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
- solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
- if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
- __runcmd ln -sf $baselibfile $destpath/$sonamelink
- fi
- __runcmd ln -sf $baselibfile $destpath/$solink
- fi
- fi
-
- __runcmd cd "$olddir"
-}
-
-create_cmdline_wrapper () {
- # Create a wrapper script where commandline options are needed
- #
- # These are useful to work around relocation issues, by passing extra options
- # to a program
- #
- # Usage: create_cmdline_wrapper FILENAME <extra-options>
-
- cmd=$1
- shift
-
- echo "Generating wrapper script for $cmd"
-
- mv $cmd $cmd.real
- cmdname=`basename $cmd`
- dirname=`dirname $cmd`
- cmdoptions=$@
- if [ "${base_prefix}" != "" ]; then
- relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
- cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
- fi
- cat <<END >$cmd
-#!/bin/bash
-realpath=\`readlink -fn \$0\`
-realdir=\`dirname \$realpath\`
-exec -a \$realdir/$cmdname \$realdir/$cmdname.real $cmdoptions "\$@"
-END
- chmod +x $cmd
-}
-
-create_cmdline_shebang_wrapper () {
- # Create a wrapper script where commandline options are needed
- #
- # These are useful to work around shebang relocation issues, where shebangs are too
- # long or have arguments in them, thus preventing them from using the /usr/bin/env
- # shebang
- #
- # Usage: create_cmdline_wrapper FILENAME <extra-options>
-
- cmd=$1
- shift
-
- echo "Generating wrapper script for $cmd"
-
- # Strip #! and get remaining interpreter + arg
- argument="$(sed -ne 's/^#! *//p;q' $cmd)"
- # strip the shebang from the real script as we do not want it to be usable anyway
- tail -n +2 $cmd > $cmd.real
- chown --reference=$cmd $cmd.real
- chmod --reference=$cmd $cmd.real
- rm -f $cmd
- cmdname=$(basename $cmd)
- dirname=$(dirname $cmd)
- cmdoptions=$@
- if [ "${base_prefix}" != "" ]; then
- relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
- cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
- fi
- cat <<END >$cmd
-#!/usr/bin/env bash
-realpath=\`readlink -fn \$0\`
-realdir=\`dirname \$realpath\`
-exec -a \$realdir/$cmdname $argument \$realdir/$cmdname.real $cmdoptions "\$@"
-END
- chmod +x $cmd
-}
-
-create_wrapper () {
- # Create a wrapper script where extra environment variables are needed
- #
- # These are useful to work around relocation issues, by setting environment
- # variables which point to paths in the filesystem.
- #
- # Usage: create_wrapper FILENAME [[VAR=VALUE]..]
-
- cmd=$1
- shift
-
- echo "Generating wrapper script for $cmd"
-
- mv $cmd $cmd.real
- cmdname=`basename $cmd`
- dirname=`dirname $cmd`
- exportstring=$@
- if [ "${base_prefix}" != "" ]; then
- relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
- exportstring=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
- fi
- cat <<END >$cmd
-#!/bin/bash
-realpath=\`readlink -fn \$0\`
-realdir=\`dirname \$realpath\`
-export $exportstring
-exec -a "\$0" \$realdir/$cmdname.real "\$@"
-END
- chmod +x $cmd
-}
-
-# Copy files/directories from $1 to $2 but using hardlinks
-# (preserve symlinks)
-hardlinkdir () {
- from=$1
- to=$2
- (cd $from; find . -print0 | cpio --null -pdlu $to)
-}
-
-
-def check_app_exists(app, d):
- app = d.expand(app).split()[0].strip()
- path = d.getVar('PATH')
- return bool(bb.utils.which(path, app))
-
-def explode_deps(s):
- return bb.utils.explode_deps(s)
-
-def base_set_filespath(path, d):
- filespath = []
- extrapaths = (d.getVar("FILESEXTRAPATHS") or "")
- # Remove default flag which was used for checking
- extrapaths = extrapaths.replace("__default:", "")
- # Don't prepend empty strings to the path list
- if extrapaths != "":
- path = extrapaths.split(":") + path
- # The ":" ensures we have an 'empty' override
- overrides = (":" + (d.getVar("FILESOVERRIDES") or "")).split(":")
- overrides.reverse()
- for o in overrides:
- for p in path:
- if p != "":
- filespath.append(os.path.join(p, o))
- return ":".join(filespath)
-
-def extend_variants(d, var, extend, delim=':'):
- """Return a string of all bb class extend variants for the given extend"""
- variants = []
- whole = d.getVar(var) or ""
- for ext in whole.split():
- eext = ext.split(delim)
- if len(eext) > 1 and eext[0] == extend:
- variants.append(eext[1])
- return " ".join(variants)
-
-def multilib_pkg_extend(d, pkg):
- variants = (d.getVar("MULTILIB_VARIANTS") or "").split()
- if not variants:
- return pkg
- pkgs = pkg
- for v in variants:
- pkgs = pkgs + " " + v + "-" + pkg
- return pkgs
-
-def get_multilib_datastore(variant, d):
- return oe.utils.get_multilib_datastore(variant, d)
-
-def all_multilib_tune_values(d, var, unique = True, need_split = True, delim = ' '):
- """Return a string of all ${var} in all multilib tune configuration"""
- values = []
- variants = (d.getVar("MULTILIB_VARIANTS") or "").split() + ['']
- for item in variants:
- localdata = get_multilib_datastore(item, d)
- # We need WORKDIR to be consistent with the original datastore
- localdata.setVar("WORKDIR", d.getVar("WORKDIR"))
- value = localdata.getVar(var) or ""
- if value != "":
- if need_split:
- for item in value.split(delim):
- values.append(item)
- else:
- values.append(value)
- if unique:
- #we do this to keep order as much as possible
- ret = []
- for value in values:
- if not value in ret:
- ret.append(value)
- else:
- ret = values
- return " ".join(ret)
-
-def all_multilib_tune_list(vars, d):
- """
- Return a list of ${VAR} for each variable VAR in vars from each
- multilib tune configuration.
- Is safe to be called from a multilib recipe/context as it can
- figure out the original tune and remove the multilib overrides.
- """
- values = {}
- for v in vars:
- values[v] = []
- values['ml'] = ['']
-
- variants = (d.getVar("MULTILIB_VARIANTS") or "").split() + ['']
- for item in variants:
- localdata = get_multilib_datastore(item, d)
- values[v].append(localdata.getVar(v))
- values['ml'].append(item)
- return values
-all_multilib_tune_list[vardepsexclude] = "OVERRIDES"
-
-# If the user hasn't set up their name/email, set some defaults
-check_git_config() {
- if ! git config user.email > /dev/null ; then
- git config --local user.email "${PATCH_GIT_USER_EMAIL}"
- fi
- if ! git config user.name > /dev/null ; then
- git config --local user.name "${PATCH_GIT_USER_NAME}"
- fi
-}
diff --git a/poky/meta/classes/vala.bbclass b/poky/meta/classes/vala.bbclass
deleted file mode 100644
index bfcceff..0000000
--- a/poky/meta/classes/vala.bbclass
+++ /dev/null
@@ -1,24 +0,0 @@
-# Everyone needs vala-native and targets need vala, too,
-# because that is where target builds look for .vapi files.
-#
-VALADEPENDS = ""
-VALADEPENDS:class-target = "vala"
-DEPENDS:append = " vala-native ${VALADEPENDS}"
-
-# Our patched version of Vala looks in STAGING_DATADIR for .vapi files
-export STAGING_DATADIR
-# Upstream Vala >= 0.11 looks in XDG_DATA_DIRS for .vapi files
-export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
-
-# Package additional files
-FILES:${PN}-dev += "\
- ${datadir}/vala/vapi/*.vapi \
- ${datadir}/vala/vapi/*.deps \
- ${datadir}/gir-1.0 \
-"
-
-# Remove vapigen.m4 that is bundled with tarballs
-# because it does not yet have our cross-compile fixes
-do_configure:prepend() {
- rm -f ${S}/m4/vapigen.m4
-}
diff --git a/poky/meta/classes/waf.bbclass b/poky/meta/classes/waf.bbclass
deleted file mode 100644
index 464564a..0000000
--- a/poky/meta/classes/waf.bbclass
+++ /dev/null
@@ -1,75 +0,0 @@
-# avoids build breaks when using no-static-libs.inc
-DISABLE_STATIC = ""
-
-# What Python interpretter to use. Defaults to Python 3 but can be
-# overridden if required.
-WAF_PYTHON ?= "python3"
-
-B = "${WORKDIR}/build"
-do_configure[cleandirs] += "${B}"
-
-EXTRA_OECONF:append = " ${PACKAGECONFIG_CONFARGS}"
-
-EXTRA_OEWAF_BUILD ??= ""
-# In most cases, you want to pass the same arguments to `waf build` and `waf
-# install`, but you can override it if necessary
-EXTRA_OEWAF_INSTALL ??= "${EXTRA_OEWAF_BUILD}"
-
-def waflock_hash(d):
- # Calculates the hash used for the waf lock file. This should include
- # all of the user controllable inputs passed to waf configure. Note
- # that the full paths for ${B} and ${S} are used; this is OK and desired
- # because a change to either of these should create a unique lock file
- # to prevent collisions.
- import hashlib
- h = hashlib.sha512()
- def update(name):
- val = d.getVar(name)
- if val is not None:
- h.update(val.encode('utf-8'))
- update('S')
- update('B')
- update('prefix')
- update('EXTRA_OECONF')
- return h.hexdigest()
-
-# Use WAFLOCK to specify a separate lock file. The build is already
-# sufficiently isolated by setting the output directory, this ensures that
-# bitbake won't step on toes of any other configured context in the source
-# directory (e.g. if the source is coming from externalsrc and was previously
-# configured elsewhere).
-export WAFLOCK = ".lock-waf_oe_${@waflock_hash(d)}_build"
-BB_BASEHASH_IGNORE_VARS += "WAFLOCK"
-
-python waf_preconfigure() {
- import subprocess
- subsrcdir = d.getVar('S')
- python = d.getVar('WAF_PYTHON')
- wafbin = os.path.join(subsrcdir, 'waf')
- try:
- result = subprocess.check_output([python, wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
- version = result.decode('utf-8').split()[1]
- if bb.utils.vercmp_string_op(version, "1.8.7", ">="):
- d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
- except subprocess.CalledProcessError as e:
- bb.warn("Unable to execute waf --version, exit code %d. Assuming waf version without bindir/libdir support." % e.returncode)
- except FileNotFoundError:
- bb.fatal("waf does not exist in %s" % subsrcdir)
-}
-
-do_configure[prefuncs] += "waf_preconfigure"
-
-waf_do_configure() {
- (cd ${S} && ${WAF_PYTHON} ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
-}
-
-do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
-waf_do_compile() {
- (cd ${S} && ${WAF_PYTHON} ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
-}
-
-waf_do_install() {
- (cd ${S} && ${WAF_PYTHON} ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
-}
-
-EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/poky/meta/classes/xmlcatalog.bbclass b/poky/meta/classes/xmlcatalog.bbclass
deleted file mode 100644
index be155b7..0000000
--- a/poky/meta/classes/xmlcatalog.bbclass
+++ /dev/null
@@ -1,26 +0,0 @@
-DEPENDS = "libxml2-native"
-
-# A whitespace-separated list of XML catalogs to be registered, for example
-# "${sysconfdir}/xml/docbook-xml.xml".
-XMLCATALOGS ?= ""
-
-SYSROOT_PREPROCESS_FUNCS:append = " xmlcatalog_sstate_postinst"
-
-xmlcatalog_complete() {
- ROOTCATALOG="${STAGING_ETCDIR_NATIVE}/xml/catalog"
- if [ ! -f $ROOTCATALOG ]; then
- mkdir --parents $(dirname $ROOTCATALOG)
- xmlcatalog --noout --create $ROOTCATALOG
- fi
- for CATALOG in ${XMLCATALOGS}; do
- xmlcatalog --noout --add nextCatalog unused file://$CATALOG $ROOTCATALOG
- done
-}
-
-xmlcatalog_sstate_postinst() {
- mkdir -p ${SYSROOT_DESTDIR}${bindir}
- dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}-xmlcatalog
- echo '#!/bin/sh' > $dest
- echo '${xmlcatalog_complete}' >> $dest
- chmod 0755 $dest
-}
diff --git a/poky/meta/classes/yocto-check-layer.bbclass b/poky/meta/classes/yocto-check-layer.bbclass
index 329d3f8..404f5fd 100644
--- a/poky/meta/classes/yocto-check-layer.bbclass
+++ b/poky/meta/classes/yocto-check-layer.bbclass
@@ -1,4 +1,10 @@
#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
# This class is used by yocto-check-layer script for additional per-recipe tests
# The first test ensures that the layer has no recipes skipping 'installed-vs-shipped' QA checks
#