# for MD5/SHA handling
def base_chk_load_parser(config_paths):
- import ConfigParser, os, bb
+ import ConfigParser
parser = ConfigParser.ConfigParser()
if len(parser.read(config_paths)) < 1:
raise ValueError("no ini files could be found")
return parser
def base_chk_file(parser, pn, pv, src_uri, localpath, data):
- import os, bb
no_checksum = False
# Try PN-PV-SRC_URI first and then try PN-SRC_URI
# we rely on the get method to create errors
def base_dep_prepend(d):
- import bb
#
# Ideally this will check a flag so we will operate properly in
# the case where host == build == target, for now we don't work in
return deps
def base_read_file(filename):
- import bb
try:
f = file( filename, "r" )
except IOError, reason:
return iffalse
def base_conditional(variable, checkvalue, truevalue, falsevalue, d):
- import bb
if bb.data.getVar(variable,d,1) == checkvalue:
return truevalue
else:
return falsevalue
def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
- import bb
if float(bb.data.getVar(variable,d,1)) <= float(checkvalue):
return truevalue
else:
return falsevalue
def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
- import bb
result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue)
if result <= 0:
return truevalue
return falsevalue
def base_contains(variable, checkvalues, truevalue, falsevalue, d):
- import bb
matches = 0
if type(checkvalues).__name__ == "str":
checkvalues = [checkvalues]
return falsevalue
def base_both_contain(variable1, variable2, checkvalue, d):
- import bb
if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1:
return checkvalue
else:
# Returns PN with various suffixes removed
# or PN if no matching suffix was found.
def base_package_name(d):
- import bb;
-
pn = bb.data.getVar('PN', d, 1)
if pn.endswith("-native"):
pn = pn[0:-7]
return pn
def base_set_filespath(path, d):
- import os, bb
bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1))
filespath = []
# The ":" ensures we have an 'empty' override
}
def package_stagefile(file, d):
- import bb, os
if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1":
destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1))
do_distclean[nostamp] = "1"
python base_do_distclean() {
"""clear downloaded sources, build and temp directories"""
- import os
bb.build.exec_func('do_clean', d)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
def oe_unpack_file(file, data, url = None):
- import bb, os, subprocess
+ import subprocess
if not url:
url = "file://%s" % file
dots = file.split(".")
addtask unpack after do_fetch
do_unpack[dirs] = "${WORKDIR}"
python base_do_unpack() {
- import re, os
+ import re
localdata = bb.data.createCopy(d)
bb.data.update_data(localdata)
METADATA_BRANCH = "${@base_get_scm_branch(d)}"
def base_get_scm(d):
- import os
from bb import which
baserepo = os.path.dirname(os.path.dirname(which(d.getVar("BBPATH", 1), "classes/base.bbclass")))
for (scm, scmpath) in {"svn": ".svn",
return revision
def base_get_metadata_git_branch(path, d):
- import os
branch = os.popen('cd %s; PATH=%s git symbolic-ref HEAD 2>/dev/null' % (path, d.getVar("PATH", 1))).read().rstrip()
if len(branch) != 0:
return "<unknown>"
def base_get_metadata_git_revision(path, d):
- import os
rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("PATH", 1))).read().split(" ")[0].rstrip()
if len(rev) != 0:
return rev
python base_eventhandler() {
from bb import note, error, data
from bb.event import Handled, NotHandled, getName
- import os
+
name = getName(e)
if name == "TaskCompleted":
return pkgdata
def get_subpkgedata_fn(pkg, d):
- import bb, os
archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ")
archs.reverse()
pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d)
return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d)
def has_subpkgdata(pkg, d):
- import bb, os
return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
def read_subpkgdata(pkg, d):
- import bb
return read_pkgdatafile(get_subpkgedata_fn(pkg, d))
def has_pkgdata(pn, d):
- import bb, os
fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
return os.access(fn, os.R_OK)
def read_pkgdata(pn, d):
- import bb
fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
return read_pkgdatafile(fn)
python read_subpackage_metadata () {
- import bb
data = read_pkgdata(bb.data.getVar('PN', d, 1), d)
for key in data.keys():
# Collapse FOO_pkg variables into FOO
#
def read_subpkgdata_dict(pkg, d):
- import bb
ret = {}
subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d))
for var in subd:
def base_after_parse(d):
- import bb, os, exceptions
+ import exceptions
source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0)
if not source_mirror_fetch:
bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
python () {
- import bb
base_after_parse(d)
}