Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #190 from Villemoes/ravi/useflag
Browse files Browse the repository at this point in the history
Prepare for saner use flag handling
  • Loading branch information
esben authored Nov 23, 2016
2 parents 18dc0d9 + 31c7db1 commit c7c62d7
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 29 deletions.
8 changes: 4 additions & 4 deletions classes/chrpath.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ CHRPATH_DIRS = "${base_bindir} ${bindir} ${base_sbindir} ${sbindir} \
CHRPATH_REPLACE_DIRS = "${CHRPATH_DIRS}"
CHRPATH_STRIP_DIRS = ""

## @useflag chrpath_machine_strip When this flag is set, rpaths will be
## stripped from elf files of machine recipes. When this flag is not
## set, rpath in elf files of machine recipes will be replaced with
## @useflag chrpath_machine_strip When this flag is True, rpaths will be
## stripped from elf files of machine recipes. When this flag is
## False, rpath in elf files of machine recipes will be replaced with
## $ORIGIN relative paths.
CLASS_FLAGS += "chrpath_machine_strip"
DEFAULT_USE_chrpath_machine_strip = "1"
DEFAULT_USE_chrpath_machine_strip = True
MACHINE_CHRPATH_REPLACE_DIRS:USE_chrpath_machine_strip = ""
MACHINE_CHRPATH_STRIP_DIRS:USE_chrpath_machine_strip = "${CHRPATH_DIRS}"
MACHINE_CHRPATH_REPLACE_DIRS = "${CHRPATH_DIRS}"
Expand Down
2 changes: 1 addition & 1 deletion classes/cpio-image.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inherit image image_mdev image_inetd image_crontab image_makedevs image_inittab

CLASS_FLAGS += "ramdisk_image \
ramdisk_image_name ramdisk_image_compression"
DEFAULT_USE_ramdisk_image = "0"
DEFAULT_USE_ramdisk_image = False
DEFAULT_USE_ramdisk_image_name = "${IMAGE_BASENAME}"
DEFAULT_USE_ramdisk_image_compression = "none"

Expand Down
7 changes: 3 additions & 4 deletions classes/crontab.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ require conf/crontab.conf
CRONTAB_DEPENDS = " crond"
RDEPENDS_${PN}:>USE_crontab = "${CRONTAB_DEPENDS}"

do_install[postfuncs] += "do_install_crontab"
DO_INSTALL_CRONTAB = ""
DO_INSTALL_CRONTAB:USE_crontab = "do_install_crontab"
do_install[postfuncs] += "${DO_INSTALL_CRONTAB}"
python do_install_crontab () {
import os

if not d.get('USE_crontab'):
return

options = ((d.get('RECIPE_FLAGS') or "").split() +
(d.get('CLASS_FLAGS') or "").split())
ddir = d.get('D')
Expand Down
2 changes: 1 addition & 1 deletion classes/gettext.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DEPENDS_GETTEXT_NLS:USE_nls = "${DEPENDS_GETTEXT}"
DEPENDS_GETTEXT = "host:gettext native:gettext-utils host:libiconv host:libintl"

CLASS_FLAGS += "nls"
DEFAULT_USE_nls = "0"
DEFAULT_USE_nls = False
EXTRA_OECONF_GETTEXT = "--disable-nls"
EXTRA_OECONF_GETTEXT:USE_nls = "--enable-nls"

Expand Down
2 changes: 1 addition & 1 deletion classes/kernel.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ KERNEL_UIMAGE_DEPENDS = "${@['', 'native:util/mkimage']['${USE_kernel_imagetype}
CLASS_FLAGS += "kernel_uimage \
kernel_uimage_entrypoint kernel_uimage_loadaddress kernel_uimage_name"
KERNEL_UIMAGE_DEPENDS:USE_kernel_uimage = "native:util/mkimage"
DEFAULT_USE_kernel_uimage = "0"
DEFAULT_USE_kernel_uimage = False
DEFAULT_USE_kernel_uimage_name = "${DISTRO}/${PV}/${MACHINE}"

KERNEL_COMPILE_POSTFUNCS:>USE_kernel_uimage = " do_compile_kernel_uimage"
Expand Down
7 changes: 3 additions & 4 deletions classes/runit.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ CLASS_FLAGS += "runit"
RDEPENDS_RUNIT ?= "runit"
RDEPENDS_${PN}:>USE_runit = " ${RDEPENDS_RUNIT}"

do_install[postfuncs] += "do_install_runit"
DO_INSTALL_RUNIT = ""
DO_INSTALL_RUNIT:USE_runit = "do_install_runit"
do_install[postfuncs] += "${DO_INSTALL_RUNIT}"
python do_install_runit () {
import stat
path = d.get("D")
os.chdir(path)

if not bb.data.getVar('USE_runit', d, True):
return

options = ((d.get("RECIPE_FLAGS") or "").split() +
(d.get("CLASS_FLAGS") or "").split())
runitservicedir = bb.data.getVar('runitservicedir', d, True)
Expand Down
6 changes: 3 additions & 3 deletions classes/sdk-image.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ RDEPENDS_SDK_LIBC_EXTRA = "target:libnss-files-dev target:libnss-dns-dev"
RDEPENDS_SDK_LIBC_EXTRA:TARGET_LIBC_uclibc = ""

CLASS_FLAGS += "sdk_cxx"
DEFAULT_USE_sdk_cxx = "1"
DEFAULT_USE_sdk_cxx = True
RDEPENDS_SDK += "${RDEPENDS_SDK_CXX}"
RDEPENDS_SDK_CXX = ""
RDEPENDS_SDK_CXX:USE_sdk_cxx = "gcc-g++ target:libstdc++-dev"

CLASS_FLAGS += "sdk_gdb"
DEFAULT_USE_sdk_gdb = "1"
DEFAULT_USE_sdk_gdb = True
RDEPENDS_SDK += "${RDEPENDS_SDK_GDB}"
RDEPENDS_SDK_GDB = ""
RDEPENDS_SDK_GDB:USE_sdk_gdb = "gdb"

CLASS_FLAGS += "sdk_uboot_mkimage"
DEFAULT_USE_sdk_uboot_mkimage = "1"
DEFAULT_USE_sdk_uboot_mkimage = True
RDEPENDS_SDK += "${RDEPENDS_SDK_UBOOT_MKIMAGE}"
RDEPENDS_SDK_UBOOT_MKIMAGE = ""
RDEPENDS_SDK_UBOOT_MKIMAGE:USE_sdk_uboot_mkimage = "${UBOOT_MKIMAGE}"
Expand Down
26 changes: 22 additions & 4 deletions classes/sysvinit.oeclass
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
## <chosen name> (declare this to RECIPE_FLAGS)
## SYSVINIT_SCRIPT_<chosen name> Set this to the name of your initscript.
## <chosen name>_sysvinit_start Set this to the start level.
## <chosen name>_sysvinit_stop (optional) Set this to the stop level.
## <chosen name>_sysvinit_stop Set this to the stop level.
##
## The level must be a two-digit string. To omit the start/stop
## script, set <chosen name>_sysvinit_start / <chosen
## name>_sysvinit_stop to False, e.g.
##
## DEFAULT_USE_sshd_sysvinit_stop = False
##
## @useflag sysvinit Enable or disable sysvinit. Enabled by default by base
## distro conf.
Expand All @@ -25,14 +31,15 @@ RDEPENDS_${PN}:>USE_sysvinit = " ${RDEPENDS_SYSVINIT}"

CLASS_FLAGS += "sysvinit"

do_install[postfuncs] += "do_install_sysvinit"
DO_INSTALL_SYSVINIT = ""
DO_INSTALL_SYSVINIT:USE_sysvinit = "do_install_sysvinit"
do_install[postfuncs] += "${DO_INSTALL_SYSVINIT}"
python do_install_sysvinit () {
import os
import re

path = d.get("D")
os.chdir(path)
if not d.get("USE_sysvinit"):
return

options = ((d.get("RECIPE_FLAGS") or "").split() +
(d.get("CLASS_FLAGS") or "").split())
Expand All @@ -49,6 +56,17 @@ python do_install_sysvinit () {
prio = d.get("USE_" + option)
if not prio:
continue
# "0" is the legacy way of disabling, and also what the token
# False currently translates to.
if prio == "0":
continue

# Anything but a two-digit string (or False, or "0") is a hard
# error.
if not re.match("[0-9][0-9]$", prio):
bb.error("Invalid value of 'USE_%s': %s" % (option, prio))
bb.error("Must be two-digit string or False")
return False

if start_symlink:
name = option[0:-len("_sysvinit_start")]
Expand Down
4 changes: 2 additions & 2 deletions conf/distro/uclibc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ def uclinux_arch_fixup(d):
if d.get("MACHINE_CPU").startswith("m68k-mcf"):
d.set("MACHINE_OS", "uclinux-uclibc")

DISTRO_USE_busybox_ash = "0"
DISTRO_USE_busybox_hush = "1"
DISTRO_USE_busybox_ash = False
DISTRO_USE_busybox_hush = True
2 changes: 1 addition & 1 deletion conf/fstab.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fstabfixupdir = "${sysconfdir}/fstab.d"

CLASS_FLAGS += "fstab"
DEFAULT_USE_fstab = "1"
DEFAULT_USE_fstab = True
2 changes: 1 addition & 1 deletion conf/inittab.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
inittabfixupdir = "${sysconfdir}/inittab.d"

CLASS_FLAGS += "inittab"
DEFAULT_USE_inittab = "1"
DEFAULT_USE_inittab = True
2 changes: 1 addition & 1 deletion conf/makedevs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ devtabledir = "${sysconfdir}/devtable.d"
MAKDEVS_FILES ?= ""

CLASS_FLAGS += "makedevs"
DEFAULT_USE_makedevs = "1"
DEFAULT_USE_makedevs = True
2 changes: 1 addition & 1 deletion lib/oelite/cookbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def compatible_use_flags(meta):
return True
for name in flags.split():
val = meta.get("USE_"+name)
if not val:
if not val or val == "0":
debug("skipping %s:%s_%s (required %s USE flag not set)"%(
recipe_type, meta.get("PN"), meta.get("PV"),
name))
Expand Down
2 changes: 1 addition & 1 deletion recipes/base-version/base-version.oe
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ OESTACK_VERSION[nohash] = "1"
RECIPE_FLAGS += "basefiles_manifest_version"
BASE_VERSION:USE_basefiles_manifest_version = "${OESTACK_VERSION}"

DEFAULT_USE_basefiles_manifest_version = "1"
DEFAULT_USE_basefiles_manifest_version = True

RECIPE_FLAGS += "basefiles_version"
BASE_VERSION_POSTFUNCS:>USE_basefiles_version = " do_install_basefiles_version"
Expand Down

0 comments on commit c7c62d7

Please sign in to comment.