purecap-sysroot: override path variables for purecap sysroot purecap-user-add: to be able to add users in purecap sysroot perl-hacks: to account for lack of perl in purecap sysroot
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- classes/perl-hacks.bbclass | 53 +++++++++++++++++++++++++++++ classes/purecap-sysroot.bbclass | 59 +++++++++++++++++++++++++++++++++ classes/purecap-useradd.bbclass | 1 + 3 files changed, 113 insertions(+) create mode 100644 classes/perl-hacks.bbclass create mode 100644 classes/purecap-sysroot.bbclass create mode 100644 classes/purecap-useradd.bbclass
diff --git a/classes/perl-hacks.bbclass b/classes/perl-hacks.bbclass new file mode 100644 index 0000000..b105a3a --- /dev/null +++ b/classes/perl-hacks.bbclass @@ -0,0 +1,53 @@ +# Sourced from poky/meta/classes/perl-version.bbclass - MIT license + +# We do not have perl in the purecap sysroot, thus we use hacks. + +# 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_DIR_HOST}/usr/lib${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_DIR_HOST}/usr/lib${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] = "" + + +STAGING_LIBDIR_HACK="${STAGING_DIR_HOST}/usr/lib" +STAGING_BASELIBDIR_HACK="${STAGING_DIR_HOST}/lib" \ No newline at end of file diff --git a/classes/purecap-sysroot.bbclass b/classes/purecap-sysroot.bbclass new file mode 100644 index 0000000..3295d40 --- /dev/null +++ b/classes/purecap-sysroot.bbclass @@ -0,0 +1,59 @@ +# Prefix all of the paths (root AND usr) with ${PURECAP_SYSROOT_DIR}, apart from the systemd. +# We allow non purecap systemd app to manage purecap packages for now (which with further hacks is achievable) + +# Path prefixes +export base_prefix = "${PURECAP_SYSROOT_DIR}" +export prefix = "${PURECAP_SYSROOT_DIR}/usr" +export exec_prefix = "${prefix}" + +root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}', '${base_prefix}', d)}" + +# Base paths +export base_bindir = "${root_prefix}/bin" +export base_sbindir = "${root_prefix}/sbin" +export base_libdir = "${root_prefix}/${baselib}" +export nonarch_base_libdir = "${root_prefix}/lib" + +# Architecture independent paths +export sysconfdir = "${base_prefix}/etc" +export servicedir = "${base_prefix}/srv" +export sharedstatedir = "${base_prefix}/com" +export localstatedir = "${base_prefix}/var" +export datadir = "${prefix}/share" +export infodir = "${datadir}/info" +export mandir = "${datadir}/man" +export docdir = "${datadir}/doc" + +export nonarch_libdir = "${exec_prefix}/lib" + +export systemd_user_unitdir = "/lib/systemd/user" +export systemd_unitdir = "/lib/systemd" +export systemd_system_unitdir = "/lib/systemd/system" + +# Architecture dependent paths +export bindir = "${exec_prefix}/bin" +export sbindir = "${exec_prefix}/sbin" +export libdir = "${exec_prefix}/${baselib}" +export libexecdir = "${exec_prefix}/libexec" +export includedir = "${exec_prefix}/include" +export oldincludedir = "${exec_prefix}/include" + +# Disable QA for now +INSANE_SKIP:${PN} += "file-rdeps" +EXCLUDE_FROM_SHLIBS = "1" +do_package_qa[noexec] = "1" + +# Stop debian class creating pkg duplicates +AUTO_LIBNAME_PKGS = "" + +# Debug purecap, worth double checking linkage etc. +PURECAP_DEBUGDIR = "/morello-debug" + +do_install:append:class-target() { + install -d ${D}${PURECAP_DEBUGDIR} +} + +FILES:${PN}-dbg += "${PURECAP_DEBUGDIR}" + +OBJDUMP_COMMAND = "${OBJDUMP} -D" +READELF_COMMAND = "${READELF} -a" diff --git a/classes/purecap-useradd.bbclass b/classes/purecap-useradd.bbclass new file mode 100644 index 0000000..2a0e0da --- /dev/null +++ b/classes/purecap-useradd.bbclass @@ -0,0 +1 @@ +DEPENDS += "base-passwd-morello" \ No newline at end of file