# # 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(faSUMMARY = "TCP / IP networking and traffic control utilities" DESCRIPTION = "Iproute2 is a collection of utilities for controlling \ TCP / IP networking and traffic control in Linux. Of the utilities ip \ and tc are the most important. ip controls IPv4 and IPv6 \ configuration and tc stands for traffic control." HOMEPAGE = "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2" SECTION = "base" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ file://ip/ip.c;md5=186731afa4b42e30b9b37efa4ec90b93" DEPENDS = "flex-native bison-native" inherit update-alternatives EXTRA_OEMAKE = "CC='${CC}' KERNEL_INCLUDE=${STAGING_KERNEL_DIR}/include DOCDIR=${docdir}/iproute2 SUBDIRS='lib tc ip' SBINDIR=/sbin" do_install () { oe_runmake DESTDIR=${D} install mv ${D}${base_sbindir}/ip ${D}${base_sbindir}/ip.iproute2 install -d ${D}${datadir} mv ${D}/share/* ${D}${datadir}/ || true rm ${D}/share -rf || true } FILES_${PN} += "/usr/lib/tc/*" FILES_${PN}-dbg += "/usr/lib/tc/.debug" ALTERNATIVE_NAME = "ip" ALTERNATIVE_PATH = "${base_sbindir}/ip.iproute2" ALTERNATIVE_LINK = "${base_bindir}/ip" ALTERNATIVE_PRIORITY = "100" PARALLEL_MAKE = ""
SUMMARY = "TCP / IP networking and traffic control utilities" DESCRIPTION = "Iproute2 is a collection of utilities for controlling \ TCP / IP networking and traffic control in Linux. Of the utilities ip \ and tc are the most important. ip controls IPv4 and IPv6 \ configuration and tc stands for traffic control." HOMEPAGE = "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2" SECTION = "base" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ file://ip/ip.c;md5=186731afa4b42e30b9b37efa4ec90b93" DEPENDS = "flex-native bison-native" inherit update-alternatives EXTRA_OEMAKE = "CC='${CC}' KERNEL_INCLUDE=${STAGING_KERNEL_DIR}/include DOCDIR=${docdir}/iproute2 SUBDIRS='lib tc ip' SBINDIR=/sbin" do_install () { oe_runmake DESTDIR=${D} install mv ${D}${base_sbindir}/ip ${D}${base_sbindir}/ip.iproute2 install -d ${D}${datadir} mv ${D}/share/* ${D}${datadir}/ || true rm ${D}/share -rf || true } FILES_${PN} += "/usr/lib/tc/*" FILES_${PN}-dbg += "/usr/lib/tc/.debug" ALTERNATIVE_NAME = "ip" ALTERNATIVE_PATH = "${base_sbindir}/ip.iproute2" ALTERNATIVE_LINK = "${base_bindir}/ip" ALTERNATIVE_PRIORITY = "100" PARALLEL_MAKE = ""