From 604d46c686d06d62d5a07b9c7f4fa170f99307d8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 11 Jul 2012 17:33:43 +0000 Subject: Convert tab indentation in python functions into four-space Signed-off-by: Richard Purdie --- meta/classes/autotools.bbclass | 38 +- meta/classes/base.bbclass | 227 +- meta/classes/boot-directdisk.bbclass | 4 +- meta/classes/bootimg.bbclass | 26 +- meta/classes/cpan-base.bbclass | 38 +- meta/classes/debian.bbclass | 184 +- meta/classes/gconf.bbclass | 56 +- meta/classes/gnomebase.bbclass | 6 +- meta/classes/gtk-icon-cache.bbclass | 52 +- meta/classes/image.bbclass | 30 +- meta/classes/image_types.bbclass | 2 +- meta/classes/kernel-arch.bbclass | 42 +- meta/classes/kernel-yocto.bbclass | 52 +- meta/classes/kernel.bbclass | 342 +-- meta/classes/libc-common.bbclass | 18 +- meta/classes/libc-package.bbclass | 526 ++-- meta/classes/license.bbclass | 2 +- meta/classes/metadata_scm.bbclass | 102 +- meta/classes/mime.bbclass | 54 +- meta/classes/package.bbclass | 2930 ++++++++++---------- meta/classes/package_deb.bbclass | 4 +- meta/classes/package_rpm.bbclass | 1180 ++++---- meta/classes/packagedata.bbclass | 16 +- meta/classes/patch.bbclass | 274 +- meta/classes/pkg_metainfo.bbclass | 36 +- meta/classes/populate_sdk_base.bbclass | 34 +- meta/classes/qemu.bbclass | 14 +- meta/classes/sstate.bbclass | 104 +- meta/classes/staging.bbclass | 2 +- meta/classes/syslinux.bbclass | 278 +- meta/classes/update-alternatives.bbclass | 286 +- meta/classes/update-rc.d.bbclass | 68 +- meta/classes/useradd.bbclass | 86 +- meta/classes/utility-tasks.bbclass | 56 +- meta/classes/utils.bbclass | 126 +- meta/recipes-connectivity/connman/connman.inc | 27 +- .../recipes-core/base-passwd/base-passwd_3.5.24.bb | 30 +- meta/recipes-core/busybox/busybox.inc | 26 +- .../eglibc/cross-localedef-native_2.15.bb | 2 +- .../eglibc/cross-localedef-native_2.16.bb | 2 +- meta/recipes-core/eglibc/eglibc-ld.inc | 90 +- meta/recipes-core/eglibc/eglibc-options.inc | 20 +- meta/recipes-core/eglibc/eglibc_2.15.bb | 6 +- meta/recipes-core/eglibc/eglibc_2.16.bb | 4 +- meta/recipes-core/libxml/libxml2.inc | 6 +- meta/recipes-core/ncurses/ncurses.inc | 16 +- meta/recipes-devtools/apt/apt-native.inc | 28 +- meta/recipes-devtools/apt/apt-package.inc | 30 +- meta/recipes-devtools/perl/perl_5.14.2.bb | 10 +- meta/recipes-devtools/qemu/qemu-targets.inc | 4 +- meta/recipes-extended/cups/cups14.inc | 8 +- meta/recipes-extended/lighttpd/lighttpd_1.4.31.bb | 4 +- meta/recipes-extended/ltp/ltp_20120401.bb | 2 +- .../net-tools/net-tools_1.60-23.bb | 4 +- meta/recipes-extended/pam/libpam_1.1.5.bb | 44 +- meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb | 6 +- meta/recipes-gnome/gtk+/gtk+_2.12.7.bb | 24 +- meta/recipes-gnome/gtk+/gtk+_2.16.6.bb | 24 +- meta/recipes-gnome/gtk+/gtk+_2.24.8.bb | 18 +- .../gtk-engines/gtk-engines_2.20.2.bb | 12 +- meta/recipes-graphics/cairo/cairo-fpu.inc | 6 +- meta/recipes-graphics/clutter/clutter-fpu.inc | 6 +- meta/recipes-graphics/mesa/mesa-dri.inc | 6 +- meta/recipes-graphics/pango/pango.inc | 6 +- meta/recipes-kernel/perf/perf.inc | 2 +- .../gstreamer/gst-plugins-package.inc | 40 +- meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 12 +- meta/recipes-qt/qt-apps/qmmp_0.5.2.bb | 22 +- meta/recipes-qt/qt4/qt4.inc | 100 +- meta/recipes-sato/web/web_git.bb | 2 +- meta/recipes-support/libpcre/libpcre_8.30.bb | 4 +- 71 files changed, 3973 insertions(+), 3975 deletions(-) diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass index 02b984db63..4c4bf8775d 100644 --- a/meta/classes/autotools.bbclass +++ b/meta/classes/autotools.bbclass @@ -1,23 +1,23 @@ def autotools_dep_prepend(d): - if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True): - return '' + if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True): + return '' - pn = d.getVar('PN', True) - deps = '' + pn = d.getVar('PN', True) + deps = '' - if pn in ['autoconf-native', 'automake-native', 'help2man-native']: - return deps - deps += 'autoconf-native automake-native ' + if pn in ['autoconf-native', 'automake-native', 'help2man-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) \ + 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', True): - deps += 'libtool-cross ' + deps += 'libtool-cross ' - return deps + 'gnu-config-native ' + return deps + 'gnu-config-native ' EXTRA_OEMAKE = "" @@ -35,15 +35,15 @@ EXTRA_AUTORECONF = "--exclude=autopoint" export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}" def autotools_set_crosscompiling(d): - if not bb.data.inherits_class('native', d): - return " cross_compiling=yes" - return "" + if not bb.data.inherits_class('native', d): + return " cross_compiling=yes" + return "" 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 "" + # 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 "" # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}" diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index f69179943b..f3587bcbef 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -33,7 +33,7 @@ def oe_import(d): python oe_import_eh () { if isinstance(e, bb.event.ConfigParsed): - oe_import(e.data) + oe_import(e.data) } addhandler oe_import_eh @@ -50,21 +50,20 @@ oe_runmake() { def base_dep_prepend(d): - # - # 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 - # that case though. - # - - deps = "" - # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not - # we need that built is the responsibility of the patch function / class, not - # the application. - if not d.getVar('INHIBIT_DEFAULT_DEPS'): - if (d.getVar('HOST_SYS', True) != - d.getVar('BUILD_SYS', True)): - deps += " virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc " - return deps + # + # 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 + # that case though. + # + + deps = "" + # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not + # we need that built is the responsibility of the patch function / class, not + # the application. + if not d.getVar('INHIBIT_DEFAULT_DEPS'): + if (d.getVar('HOST_SYS', True) != d.getVar('BUILD_SYS', True)): + deps += " virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc " + return deps BASEDEPENDS = "${@base_dep_prepend(d)}" @@ -80,61 +79,61 @@ do_fetch[dirs] = "${DL_DIR}" do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}" python base_do_fetch() { - src_uri = (d.getVar('SRC_URI', True) or "").split() - if len(src_uri) == 0: - return + src_uri = (d.getVar('SRC_URI', True) or "").split() + if len(src_uri) == 0: + return - localdata = bb.data.createCopy(d) - bb.data.update_data(localdata) + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) - try: - fetcher = bb.fetch2.Fetch(src_uri, localdata) - fetcher.download() - except bb.fetch2.BBFetchException, e: - raise bb.build.FuncFailed(e) + try: + fetcher = bb.fetch2.Fetch(src_uri, localdata) + fetcher.download() + except bb.fetch2.BBFetchException, e: + raise bb.build.FuncFailed(e) } addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" do_unpack[cleandirs] = "${S}/patches" python base_do_unpack() { - src_uri = (d.getVar('SRC_URI', True) or "").split() - if len(src_uri) == 0: - return + src_uri = (d.getVar('SRC_URI', True) or "").split() + if len(src_uri) == 0: + return - localdata = bb.data.createCopy(d) - bb.data.update_data(localdata) + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) - rootdir = localdata.getVar('WORKDIR', True) + rootdir = localdata.getVar('WORKDIR', True) - try: - fetcher = bb.fetch2.Fetch(src_uri, localdata) - fetcher.unpack(rootdir) - except bb.fetch2.BBFetchException, e: - raise bb.build.FuncFailed(e) + try: + fetcher = bb.fetch2.Fetch(src_uri, localdata) + fetcher.unpack(rootdir) + except bb.fetch2.BBFetchException, e: + raise bb.build.FuncFailed(e) } GIT_CONFIG_PATH = "${STAGING_DIR_NATIVE}/etc" GIT_CONFIG = "${GIT_CONFIG_PATH}/gitconfig" def generate_git_config(e): - from bb import data + from bb import data - if data.getVar('GIT_CORE_CONFIG', e.data, True): - gitconfig_path = e.data.getVar('GIT_CONFIG', True) - proxy_command = " gitProxy = %s\n" % data.getVar('OE_GIT_PROXY_COMMAND', e.data, True) + if data.getVar('GIT_CORE_CONFIG', e.data, True): + gitconfig_path = e.data.getVar('GIT_CONFIG', True) + proxy_command = " gitProxy = %s\n" % data.getVar('OE_GIT_PROXY_COMMAND', e.data, True) - bb.mkdirhier(e.data.expand("${GIT_CONFIG_PATH}")) - if (os.path.exists(gitconfig_path)): - os.remove(gitconfig_path) + bb.mkdirhier(e.data.expand("${GIT_CONFIG_PATH}")) + if (os.path.exists(gitconfig_path)): + os.remove(gitconfig_path) - f = open(gitconfig_path, 'w') - f.write("[core]\n") - ignore_hosts = data.getVar('GIT_PROXY_IGNORE', e.data, True).split() - for ignore_host in ignore_hosts: - f.write(" gitProxy = none for %s\n" % ignore_host) - f.write(proxy_command) - f.close + f = open(gitconfig_path, 'w') + f.write("[core]\n") + ignore_hosts = data.getVar('GIT_PROXY_IGNORE', e.data, True).split() + for ignore_host in ignore_hosts: + f.write(" gitProxy = none for %s\n" % ignore_host) + f.write(proxy_command) + f.close def pkgarch_mapping(d): # Compatibility mappings of TUNE_PKGARCH (opt in) @@ -205,69 +204,69 @@ def preferred_ml_updates(d): def get_layers_branch_rev(d): - layers = (d.getVar("BBLAYERS", True) or "").split() - layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ - base_get_metadata_git_branch(i, None).strip(), \ - base_get_metadata_git_revision(i, None)) \ - for i in layers] - 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 + layers = (d.getVar("BBLAYERS", True) or "").split() + layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ + base_get_metadata_git_branch(i, None).strip(), \ + base_get_metadata_git_revision(i, None)) \ + for i in layers] + 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, True) - if value is not None: - yield '%-17s = "%s"' % (var, value) + statusvars = oe.data.typed_value('BUILDCFG_VARS', d) + for var in statusvars: + value = d.getVar(var, True) + if value is not None: + yield '%-17s = "%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, True) - if not val or val == 'INVALID': - pesteruser.append(v) + needed_vars = oe.data.typed_value("BUILDCFG_NEEDEDVARS", d) + pesteruser = [] + for v in needed_vars: + val = d.getVar(v, True) + 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)) + 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 python base_eventhandler() { - if isinstance(e, bb.event.ConfigParsed): - e.data.setVar('BB_VERSION', bb.__version__) - generate_git_config(e) - pkgarch_mapping(e.data) - preferred_ml_updates(e.data) - - if isinstance(e, bb.event.BuildStarted): - statuslines = [] - for func in oe.data.typed_value('BUILDCFG_FUNCS', e.data): - g = globals() - if func not in g: - bb.warn("Build configuration function '%s' does not exist" % func) - else: - flines = g[func](e.data) - if flines: - statuslines.extend(flines) - - statusheader = e.data.getVar('BUILDCFG_HEADER', True) - bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) + if isinstance(e, bb.event.ConfigParsed): + e.data.setVar('BB_VERSION', bb.__version__) + generate_git_config(e) + pkgarch_mapping(e.data) + preferred_ml_updates(e.data) + + if isinstance(e, bb.event.BuildStarted): + statuslines = [] + for func in oe.data.typed_value('BUILDCFG_FUNCS', e.data): + g = globals() + if func not in g: + bb.warn("Build configuration function '%s' does not exist" % func) + else: + flines = g[func](e.data) + if flines: + statuslines.extend(flines) + + statusheader = e.data.getVar('BUILDCFG_HEADER', True) + bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) } addtask configure after do_patch @@ -546,18 +545,18 @@ python do_cleansstate() { addtask cleanall after do_cleansstate python do_cleanall() { - src_uri = (d.getVar('SRC_URI', True) or "").split() - if len(src_uri) == 0: - return - - localdata = bb.data.createCopy(d) - bb.data.update_data(localdata) - - try: - fetcher = bb.fetch2.Fetch(src_uri, localdata) - fetcher.clean() - except bb.fetch2.BBFetchException, e: - raise bb.build.FuncFailed(e) + src_uri = (d.getVar('SRC_URI', True) or "").split() + if len(src_uri) == 0: + return + + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) + + try: + fetcher = bb.fetch2.Fetch(src_uri, localdata) + fetcher.clean() + except bb.fetch2.BBFetchException, e: + raise bb.build.FuncFailed(e) } do_cleanall[nostamp] = "1" diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 1c601c60c3..d265485bb7 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -92,8 +92,8 @@ build_boot_dd() { } python do_bootdirectdisk() { - bb.build.exec_func('build_syslinux_cfg', d) - bb.build.exec_func('build_boot_dd', d) + bb.build.exec_func('build_syslinux_cfg', d) + bb.build.exec_func('build_boot_dd', d) } addtask bootdirectdisk before do_build diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index a4c0e8d931..11a29cdf2b 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass @@ -42,15 +42,15 @@ EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d) # contain "efi". This way legacy is supported by default if neither is # specified, maintaining the original behavior. def pcbios(d): - pcbios = base_contains("MACHINE_FEATURES", "pcbios", "1", "0", d) - if pcbios == "0": - pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) - return pcbios + pcbios = base_contains("MACHINE_FEATURES", "pcbios", "1", "0", d) + if pcbios == "0": + pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) + return pcbios def pcbios_class(d): - if d.getVar("PCBIOS", True) == "1": - return "syslinux" - return "dummy" + if d.getVar("PCBIOS", True) == "1": + return "syslinux" + return "dummy" PCBIOS = "${@pcbios(d)}" PCBIOS_CLASS = "${@pcbios_class(d)}" @@ -181,12 +181,12 @@ build_hddimg() { } python do_bootimg() { - if d.getVar("PCBIOS", True) == "1": - bb.build.exec_func('build_syslinux_cfg', d) - if d.getVar("EFI", True) == "1": - bb.build.exec_func('build_grub_cfg', d) - bb.build.exec_func('build_hddimg', d) - bb.build.exec_func('build_iso', d) + if d.getVar("PCBIOS", True) == "1": + bb.build.exec_func('build_syslinux_cfg', d) + if d.getVar("EFI", True) == "1": + bb.build.exec_func('build_grub_cfg', d) + bb.build.exec_func('build_hddimg', d) + bb.build.exec_func('build_iso', d) } addtask bootimg before do_build diff --git a/meta/classes/cpan-base.bbclass b/meta/classes/cpan-base.bbclass index b4b7b81d8d..660c15f549 100644 --- a/meta/classes/cpan-base.bbclass +++ b/meta/classes/cpan-base.bbclass @@ -11,28 +11,28 @@ PERL_OWN_DIR = "${@["", "/perl-native"][(bb.data.inherits_class('native', d))]}" # Determine the staged version of perl from the perl configuration file def get_perl_version(d): - import re - cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh') - try: - f = open(cfg, 'r') - except IOError: - return None - l = f.readlines(); - f.close(); - r = re.compile("^version='(\d*\.\d*\.\d*)'") - for s in l: - m = r.match(s) - if m: - return m.group(1) - return None + import re + cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh') + try: + f = open(cfg, 'r') + except IOError: + return None + l = f.readlines(); + f.close(); + r = re.compile("^version='(\d*\.\d*\.\d*)'") + for s in l: + m = r.match(s) + if m: + return m.group(1) + return None # Determine where the library directories are def perl_get_libdirs(d): - libdir = d.getVar('libdir', True) - if is_target(d) == "no": - libdir += '/perl-native' - libdir += '/perl' - return libdir + libdir = d.getVar('libdir', True) + if is_target(d) == "no": + libdir += '/perl-native' + libdir += '/perl' + return libdir def is_target(d): if not bb.data.inherits_class('native', d): diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass index bb4ae11eca..2484003e37 100644 --- a/meta/classes/debian.bbclass +++ b/meta/classes/debian.bbclass @@ -20,105 +20,105 @@ python () { } python debian_package_name_hook () { - import glob, copy, stat, errno, re + import glob, copy, stat, errno, re - pkgdest = d.getVar('PKGDEST', True) - packages = d.getVar('PACKAGES', True) - bin_re = re.compile(".*/s?" + os.path.basename(d.getVar("bindir", True)) + "$") - lib_re = re.compile(".*/" + os.path.basename(d.getVar("libdir", True)) + "$") - so_re = re.compile("lib.*\.so") + pkgdest = d.getVar('PKGDEST', True) + packages = d.getVar('PACKAGES', True) + bin_re = re.compile(".*/s?" + os.path.basename(d.getVar("bindir", True)) + "$") + lib_re = re.compile(".*/" + os.path.basename(d.getVar("libdir", True)) + "$") + so_re = re.compile("lib.*\.so") - def socrunch(s): - s = s.lower().replace('_', '-') - m = re.match("^(.*)(.)\.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 socrunch(s): + s = s.lower().replace('_', '-') + m = re.match("^(.*)(.)\.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 isexec(path): + try: + s = os.stat(path) + except (os.error, AttributeError): + return 0 + return (s[stat.ST_MODE] & stat.S_IEXEC) - def auto_libname(packages, orig_pkg): - sonames = [] - has_bins = 0 - has_libs = 0 - pkg_dir = os.path.join(pkgdest, orig_pkg) - for root, dirs, files in os.walk(pkg_dir): - if bin_re.match(root) and files: - has_bins = 1 - if lib_re.match(root) and files: - has_libs = 1 - for f in files: - if so_re.match(f): - fp = os.path.join(root, f) - cmd = (d.getVar('TARGET_PREFIX', True) or "") + "objdump -p " + fp + " 2>/dev/null" - fd = os.popen(cmd) - lines = fd.readlines() - fd.close() - for l in lines: - m = re.match("\s+SONAME\s+([^\s]*)", l) - if m and not m.group(1) in sonames: - sonames.append(m.group(1)) + def auto_libname(packages, orig_pkg): + sonames = [] + has_bins = 0 + has_libs = 0 + pkg_dir = os.path.join(pkgdest, orig_pkg) + for root, dirs, files in os.walk(pkg_dir): + if bin_re.match(root) and files: + has_bins = 1 + if lib_re.match(root) and files: + has_libs = 1 + for f in files: + if so_re.match(f): + fp = os.path.join(root, f) + cmd = (d.getVar('TARGET_PREFIX', True) or "") + "objdump -p " + fp + " 2>/dev/null" + fd = os.popen(cmd) + lines = fd.readlines() + fd.close() + for l in lines: + m = re.match("\s+SONAME\s+([^\s]*)", l) + if m and not m.group(1) in sonames: + sonames.append(m.group(1)) - 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', True) - 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)) + 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', True) + 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) or d.getVar('DEBIAN_NOAUTONAME_' + pkg)): - continue - debian_pn = d.getVar('DEBIANNAME_' + pkg) - if debian_pn: - newpkg = debian_pn - elif pkg == orig_pkg: - newpkg = pkgname - else: - newpkg = pkg.replace(orig_pkg, devname, 1) - mlpre=d.getVar('MLPREFIX', True) - if mlpre: - if not newpkg.find(mlpre) == 0: - newpkg = mlpre + newpkg - if newpkg != pkg: - d.setVar('PKG_' + pkg, newpkg) + 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) or d.getVar('DEBIAN_NOAUTONAME_' + pkg)): + continue + debian_pn = d.getVar('DEBIANNAME_' + pkg) + if debian_pn: + newpkg = debian_pn + elif pkg == orig_pkg: + newpkg = pkgname + else: + newpkg = pkg.replace(orig_pkg, devname, 1) + mlpre=d.getVar('MLPREFIX', True) + if mlpre: + if not newpkg.find(mlpre) == 0: + newpkg = mlpre + newpkg + if newpkg != pkg: + d.setVar('PKG_' + pkg, newpkg) - # 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', True) or "").split(), reverse=True): - auto_libname(packages, pkg) + # 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', True) or "").split(), reverse=True): + auto_libname(packages, pkg) } EXPORT_FUNCTIONS package_name_hook diff --git a/meta/classes/gconf.bbclass b/meta/classes/gconf.bbclass index fb9f701b37..7a3ee3c28c 100644 --- a/meta/classes/gconf.bbclass +++ b/meta/classes/gconf.bbclass @@ -39,33 +39,33 @@ done } python populate_packages_append () { - import re - packages = d.getVar('PACKAGES', True).split() - pkgdest = d.getVar('PKGDEST', True) - - for pkg in packages: - schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg) - schemas = [] - schema_re = re.compile(".*\.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, True) or d.getVar('pkg_postinst', True) - if not postinst: - postinst = '#!/bin/sh\n' - postinst += d.getVar('gconf_postinst', True) - d.setVar('pkg_postinst_%s' % pkg, postinst) - prerm = d.getVar('pkg_prerm_%s' % pkg, True) or d.getVar('pkg_prerm', True) - if not prerm: - prerm = '#!/bin/sh\n' - prerm += d.getVar('gconf_prerm', True) - d.setVar('pkg_prerm_%s' % pkg, prerm) - rdepends = d.getVar("RDEPENDS_%s" % pkg, True) or "" - rdepends += ' ' + d.getVar('MLPREFIX') + 'gconf' - d.setVar("RDEPENDS_%s" % pkg, rdepends) + import re + packages = d.getVar('PACKAGES', True).split() + pkgdest = d.getVar('PKGDEST', True) + + for pkg in packages: + schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg) + schemas = [] + schema_re = re.compile(".*\.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, True) or d.getVar('pkg_postinst', True) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += d.getVar('gconf_postinst', True) + d.setVar('pkg_postinst_%s' % pkg, postinst) + prerm = d.getVar('pkg_prerm_%s' % pkg, True) or d.getVar('pkg_prerm', True) + if not prerm: + prerm = '#!/bin/sh\n' + prerm += d.getVar('gconf_prerm', True) + d.setVar('pkg_prerm_%s' % pkg, prerm) + rdepends = d.getVar("RDEPENDS_%s" % pkg, True) or "" + rdepends += ' ' + d.getVar('MLPREFIX') + 'gconf' + d.setVar("RDEPENDS_%s" % pkg, rdepends) } diff --git a/meta/classes/gnomebase.bbclass b/meta/classes/gnomebase.bbclass index 80b78be48d..19c7f7143d 100644 --- a/meta/classes/gnomebase.bbclass +++ b/meta/classes/gnomebase.bbclass @@ -1,7 +1,7 @@ def gnome_verdir(v): - import re - m = re.match("^([0-9]+)\.([0-9]+)", v) - return "%s.%s" % (m.group(1), m.group(2)) + import re + m = re.match("^([0-9]+)\.([0-9]+)", v) + return "%s.%s" % (m.group(1), m.group(2)) GNOME_COMPRESS_TYPE ?= "bz2" SECTION ?= "x11/gnome" diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass index 60e3401f4b..01fb2f3946 100644 --- a/meta/classes/gtk-icon-cache.bbclass +++ b/meta/classes/gtk-icon-cache.bbclass @@ -28,31 +28,31 @@ done } python populate_packages_append () { - packages = d.getVar('PACKAGES', True).split() - pkgdest = d.getVar('PKGDEST', True) - - for pkg in packages: - icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir', True)) - if not os.path.exists(icon_dir): - continue - - bb.note("adding hicolor-icon-theme dependency to %s" % pkg) - rdepends = d.getVar('RDEPENDS_%s' % pkg, True) - rdepends = rdepends + ' ' + d.getVar('MLPREFIX') + "hicolor-icon-theme" - d.setVar('RDEPENDS_%s' % pkg, rdepends) - - bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) - - postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) - if not postinst: - postinst = '#!/bin/sh\n' - postinst += d.getVar('gtk_icon_cache_postinst', True) - d.setVar('pkg_postinst_%s' % pkg, postinst) - - postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) - if not postrm: - postrm = '#!/bin/sh\n' - postrm += d.getVar('gtk_icon_cache_postrm', True) - d.setVar('pkg_postrm_%s' % pkg, postrm) + packages = d.getVar('PACKAGES', True).split() + pkgdest = d.getVar('PKGDEST', True) + + for pkg in packages: + icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir', True)) + if not os.path.exists(icon_dir): + continue + + bb.note("adding hicolor-icon-theme dependency to %s" % pkg) + rdepends = d.getVar('RDEPENDS_%s' % pkg, True) + rdepends = rdepends + ' ' + d.getVar('MLPREFIX') + "hicolor-icon-theme" + d.setVar('RDEPENDS_%s' % pkg, rdepends) + + bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) + + postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += d.getVar('gtk_icon_cache_postinst', True) + d.setVar('pkg_postinst_%s' % pkg, postinst) + + postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) + if not postrm: + postrm = '#!/bin/sh\n' + postrm += d.getVar('gtk_icon_cache_postrm', True) + d.setVar('pkg_postrm_%s' % pkg, postrm) } diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index f1b829fe18..1799bf1865 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -164,28 +164,28 @@ do_rootfs[umask] = "022" fakeroot do_rootfs () { #set -x - # When use the rpm incremental image generation, don't remove the rootfs - if [ "${INC_RPM_IMAGE_GEN}" != "1" -o "${IMAGE_PKGTYPE}" != "rpm" ]; then - rm -rf ${IMAGE_ROOTFS} - elif [ -d ${T}/saved_rpmlib/var/lib/rpm ]; then - # Move the rpmlib back - if [ ! -d ${IMAGE_ROOTFS}/var/lib/rpm ]; then - mkdir -p ${IMAGE_ROOTFS}/var/lib/ - mv ${T}/saved_rpmlib/var/lib/rpm ${IMAGE_ROOTFS}/var/lib/ - fi - fi + # When use the rpm incremental image generation, don't remove the rootfs + if [ "${INC_RPM_IMAGE_GEN}" != "1" -o "${IMAGE_PKGTYPE}" != "rpm" ]; then + rm -rf ${IMAGE_ROOTFS} + elif [ -d ${T}/saved_rpmlib/var/lib/rpm ]; then + # Move the rpmlib back + if [ ! -d ${IMAGE_ROOTFS}/var/lib/rpm ]; then + mkdir -p ${IMAGE_ROOTFS}/var/lib/ + mv ${T}/saved_rpmlib/var/lib/rpm ${IMAGE_ROOTFS}/var/lib/ + fi + fi rm -rf ${MULTILIB_TEMP_ROOTFS} mkdir -p ${IMAGE_ROOTFS} mkdir -p ${DEPLOY_DIR_IMAGE} cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOY_DIR_IMAGE}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt || true - # If "${IMAGE_ROOTFS}/dev" exists, then the device had been made by - # the previous build + # If "${IMAGE_ROOTFS}/dev" exists, then the device had been made by + # the previous build if [ "${USE_DEVFS}" != "1" -a ! -r "${IMAGE_ROOTFS}/dev" ]; then for devtable in ${@get_devtable_list(d)}; do - # Always return ture since there maybe already one when use the - # incremental image generation + # Always return ture since there maybe already one when use the + # incremental image generation makedevs -r ${IMAGE_ROOTFS} -D $devtable done fi @@ -398,7 +398,7 @@ rootfs_trim_schemas () { # Need this in case no files exist if [ -e $schema ]; then oe-trim-schemas $schema > $schema.new - mv $schema.new $schema + mv $schema.new $schema fi done } diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 727d8d6f8f..d286eeaea9 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -48,7 +48,7 @@ def get_imagecmds(d): types.remove("live") if d.getVar('IMAGE_LINK_NAME', True): - cmds += " rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" + cmds += "\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" for type in types: ccmd = [] diff --git a/meta/classes/kernel-arch.bbclass b/meta/classes/kernel-arch.bbclass index 4a30192c15..6446504845 100644 --- a/meta/classes/kernel-arch.bbclass +++ b/meta/classes/kernel-arch.bbclass @@ -7,38 +7,38 @@ valid_archs = "alpha cris ia64 \ i386 x86 \ m68knommu m68k ppc powerpc powerpc64 ppc64 \ - sparc sparc64 \ + sparc sparc64 \ arm \ m32r mips \ - sh sh64 um h8300 \ - parisc s390 v850 \ - avr32 blackfin \ - microblaze" + sh sh64 um h8300 \ + parisc s390 v850 \ + avr32 blackfin \ + microblaze" def map_kernel_arch(a, d): - import re + import re - valid_archs = d.getVar('valid_archs', True).split() + valid_archs = d.getVar('valid_archs', True).split() - if re.match('(i.86|athlon|x86.64)$', a): return 'x86' - elif re.match('armeb$', a): return 'arm' - elif re.match('mips(el|64|64el)$', a): return 'mips' - 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('microblazeel', a): return 'microblaze' - elif a in valid_archs: return a - else: - bb.error("cannot map '%s' to a linux kernel architecture" % a) + if re.match('(i.86|athlon|x86.64)$', a): return 'x86' + elif re.match('armeb$', a): return 'arm' + elif re.match('mips(el|64|64el)$', a): return 'mips' + 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('microblazeel', a): return 'microblaze' + elif a in valid_archs: return a + else: + bb.error("cannot map '%s' to a linux kernel architecture" % a) export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH', True), d)}" def map_uboot_arch(a, d): - import re + import re - if re.match('p(pc|owerpc)(|64)', a): return 'ppc' - elif re.match('i.86$', a): return 'x86' - return a + 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', True), d)}" diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 48c8974257..ab59fc8f13 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass @@ -6,41 +6,41 @@ SRCTREECOVEREDTASKS += "do_kernel_link_vmlinux do_kernel_configme do_validate_br # returns local (absolute) path names for all valid patches in the # src_uri def find_patches(d): - patches=src_patches(d) - patch_list=[] - for p in patches: - _, _, local, _, _, _ = bb.decodeurl(p) - patch_list.append(local) + patches = src_patches(d) + patch_list=[] + for p in patches: + _, _, local, _, _, _ = bb.decodeurl(p) + patch_list.append(local) - return patch_list + 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 base in 'defconfig': - sources_list.append(s) + 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 base in 'defconfig': + sources_list.append(s) - return sources_list + return sources_list # this is different from find_patches, in that it returns a colon separated # list of : instead of just a list of patches def find_urls(d): - patches=src_patches(d) - fetch = bb.fetch2.Fetch([], d) - patch_list=[] - for p in patches: - _, _, local, _, _, _ = bb.decodeurl(p) - for url in fetch.urls: - urldata = fetch.ud[url] - if urldata.localpath == local: - patch_list.append(local+':'+urldata.path) - - return patch_list + patches=src_patches(d) + fetch = bb.fetch2.Fetch([], d) + patch_list=[] + for p in patches: + _, _, local, _, _, _ = bb.decodeurl(p) + for url in fetch.urls: + urldata = fetch.ud[url] + if urldata.localpath == local: + patch_list.append(local+':'+urldata.path) + + return patch_list do_patch() { diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index fd744e7ea3..08b5e61fbe 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -310,177 +310,177 @@ module_conf_sco = "alias bt-proto-2 sco" module_conf_rfcomm = "alias bt-proto-3 rfcomm" python populate_packages_prepend () { - def extract_modinfo(file): - import tempfile, re, subprocess - tempfile.tempdir = d.getVar("WORKDIR", True) - tf = tempfile.mkstemp() - tmpfile = tf[1] - cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", True), d.getVar("HOST_PREFIX", True) or "", file, tmpfile) - subprocess.call(cmd, shell=True) - f = open(tmpfile) - l = f.read().split("\000") - f.close() - os.close(tf[0]) - os.unlink(tmpfile) - exp = re.compile("([^=]+)=(.*)") - vals = {} - for i in l: - m = exp.match(i) - if not m: - continue - vals[m.group(1)] = m.group(2) - return vals - - def parse_depmod(): - import re - - dvar = d.getVar('PKGD', True) - if not dvar: - bb.error("PKGD not defined") - return - - kernelver = d.getVar('KERNEL_VERSION', True) - kernelver_stripped = kernelver - m = re.match('^(.*-hh.*)[\.\+].*$', kernelver) - if m: - kernelver_stripped = m.group(1) - path = d.getVar("PATH", True) - - cmd = "PATH=\"%s\" depmod -n -a -b %s -F %s/boot/System.map-%s %s" % (path, dvar, dvar, kernelver, kernelver_stripped) - f = os.popen(cmd, 'r') - - deps = {} - pattern0 = "^(.*\.k?o):..*$" - pattern1 = "^(.*\.k?o):\s*(.*\.k?o)\s*$" - pattern2 = "^(.*\.k?o):\s*(.*\.k?o)\s*\\\$" - pattern3 = "^\t(.*\.k?o)\s*\\\$" - pattern4 = "^\t(.*\.k?o)\s*$" - - line = f.readline() - while line: - if not re.match(pattern0, line): - line = f.readline() - continue - m1 = re.match(pattern1, line) - if m1: - deps[m1.group(1)] = m1.group(2).split() - else: - m2 = re.match(pattern2, line) - if m2: - deps[m2.group(1)] = m2.group(2).split() - line = f.readline() - m3 = re.match(pattern3, line) - while m3: - deps[m2.group(1)].extend(m3.group(1).split()) - line = f.readline() - m3 = re.match(pattern3, line) - m4 = re.match(pattern4, line) - deps[m2.group(1)].extend(m4.group(1).split()) - line = f.readline() - f.close() - return deps - - def get_dependencies(file, pattern, format): - # file no longer includes PKGD - file = file.replace(d.getVar('PKGD', True) or '', '', 1) - # instead is prefixed with /lib/modules/${KERNEL_VERSION} - file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1) - - if module_deps.has_key(file): - import re - dependencies = [] - for i in module_deps[file]: - m = re.match(pattern, os.path.basename(i)) - if not m: - continue - on = legitimize_package_name(m.group(1)) - dependency_pkg = format % on - dependencies.append(dependency_pkg) - return dependencies - return [] - - def frob_metadata(file, pkg, pattern, format, basename): - import re - vals = extract_modinfo(file) - - dvar = d.getVar('PKGD', True) - - # If autoloading is requested, output /etc/modules-load.d/.conf and append - # appropriate modprobe commands to the postinst - autoload = d.getVar('module_autoload_%s' % basename, True) - if autoload: - name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename) - f = open(name, 'w') - for m in autoload.split(): - f.write('%s\n' % m) - f.close() - postinst = d.getVar('pkg_postinst_%s' % pkg, True) - if not postinst: - bb.fatal("pkg_postinst_%s not defined" % pkg) - postinst += d.getVar('autoload_postinst_fragment', True) % autoload - d.setVar('pkg_postinst_%s' % pkg, postinst) - - # Write out any modconf fragment - modconf = d.getVar('module_conf_%s' % basename, True) - if modconf: - name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) - f = open(name, 'w') - f.write("%s\n" % modconf) - f.close() - - files = d.getVar('FILES_%s' % pkg, True) - files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) - d.setVar('FILES_%s' % pkg, files) - - if vals.has_key("description"): - old_desc = d.getVar('DESCRIPTION_' + pkg, True) or "" - d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"]) - - rdepends_str = d.getVar('RDEPENDS_' + pkg, True) - if rdepends_str: - rdepends = rdepends_str.split() - else: - rdepends = [] - rdepends.extend(get_dependencies(file, pattern, format)) - d.setVar('RDEPENDS_' + pkg, ' '.join(rdepends)) - - module_deps = parse_depmod() - module_regex = '^(.*)\.k?o$' - module_pattern = 'kernel-module-%s' - - postinst = d.getVar('pkg_postinst_modules', True) - postrm = d.getVar('pkg_postrm_modules', True) - do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') - do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') - do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') - do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True)) - - # 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', True) - 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) - - import re - metapkg = "kernel-modules" - d.setVar('ALLOW_EMPTY_' + metapkg, "1") - d.setVar('FILES_' + metapkg, "") - blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux' ] - for l in module_deps.values(): - for i in l: - pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) - blacklist.append(pkg) - metapkg_rdepends = [] - packages = d.getVar('PACKAGES', True).split() - for pkg in packages[1:]: - if not pkg in blacklist and not pkg in metapkg_rdepends: - metapkg_rdepends.append(pkg) - d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends)) - d.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package') - packages.append(metapkg) - d.setVar('PACKAGES', ' '.join(packages)) + def extract_modinfo(file): + import tempfile, re, subprocess + tempfile.tempdir = d.getVar("WORKDIR", True) + tf = tempfile.mkstemp() + tmpfile = tf[1] + cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", True), d.getVar("HOST_PREFIX", True) or "", file, tmpfile) + subprocess.call(cmd, shell=True) + f = open(tmpfile) + l = f.read().split("\000") + f.close() + os.close(tf[0]) + os.unlink(tmpfile) + exp = re.compile("([^=]+)=(.*)") + vals = {} + for i in l: + m = exp.match(i) + if not m: + continue + vals[m.group(1)] = m.group(2) + return vals + + def parse_depmod(): + import re + + dvar = d.getVar('PKGD', True) + if not dvar: + bb.error("PKGD not defined") + return + + kernelver = d.getVar('KERNEL_VERSION', True) + kernelver_stripped = kernelver + m = re.match('^(.*-hh.*)[\.\+].*$', kernelver) + if m: + kernelver_stripped = m.group(1) + path = d.getVar("PATH", True) + + cmd = "PATH=\"%s\" depmod -n -a -b %s -F %s/boot/System.map-%s %s" % (path, dvar, dvar, kernelver, kernelver_stripped) + f = os.popen(cmd, 'r') + + deps = {} + pattern0 = "^(.*\.k?o):..*$" + pattern1 = "^(.*\.k?o):\s*(.*\.k?o)\s*$" + pattern2 = "^(.*\.k?o):\s*(.*\.k?o)\s*\\\$" + pattern3 = "^\t(.*\.k?o)\s*\\\$" + pattern4 = "^\t(.*\.k?o)\s*$" + + line = f.readline() + while line: + if not re.match(pattern0, line): + line = f.readline() + continue + m1 = re.match(pattern1, line) + if m1: + deps[m1.group(1)] = m1.group(2).split() + else: + m2 = re.match(pattern2, line) + if m2: + deps[m2.group(1)] = m2.group(2).split() + line = f.readline() + m3 = re.match(pattern3, line) + while m3: + deps[m2.group(1)].extend(m3.group(1).split()) + line = f.readline() + m3 = re.match(pattern3, line) + m4 = re.match(pattern4, line) + deps[m2.group(1)].extend(m4.group(1).split()) + line = f.readline() + f.close() + return deps + + def get_dependencies(file, pattern, format): + # file no longer includes PKGD + file = file.replace(d.getVar('PKGD', True) or '', '', 1) + # instead is prefixed with /lib/modules/${KERNEL_VERSION} + file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1) + + if module_deps.has_key(file): + import re + dependencies = [] + for i in module_deps[file]: + m = re.match(pattern, os.path.basename(i)) + if not m: + continue + on = legitimize_package_name(m.group(1)) + dependency_pkg = format % on + dependencies.append(dependency_pkg) + return dependencies + return [] + + def frob_metadata(file, pkg, pattern, format, basename): + import re + vals = extract_modinfo(file) + + dvar = d.getVar('PKGD', True) + + # If autoloading is requested, output /etc/modules-load.d/.conf and append + # appropriate modprobe commands to the postinst + autoload = d.getVar('module_autoload_%s' % basename, True) + if autoload: + name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename) + f = open(name, 'w') + for m in autoload.split(): + f.write('%s\n' % m) + f.close() + postinst = d.getVar('pkg_postinst_%s' % pkg, True) + if not postinst: + bb.fatal("pkg_postinst_%s not defined" % pkg) + postinst += d.getVar('autoload_postinst_fragment', True) % autoload + d.setVar('pkg_postinst_%s' % pkg, postinst) + + # Write out any modconf fragment + modconf = d.getVar('module_conf_%s' % basename, True) + if modconf: + name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) + f = open(name, 'w') + f.write("%s\n" % modconf) + f.close() + + files = d.getVar('FILES_%s' % pkg, True) + files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) + d.setVar('FILES_%s' % pkg, files) + + if vals.has_key("description"): + old_desc = d.getVar('DESCRIPTION_' + pkg, True) or "" + d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"]) + + rdepends_str = d.getVar('RDEPENDS_' + pkg, True) + if rdepends_str: + rdepends = rdepends_str.split() + else: + rdepends = [] + rdepends.extend(get_dependencies(file, pattern, format)) + d.setVar('RDEPENDS_' + pkg, ' '.join(rdepends)) + + module_deps = parse_depmod() + module_regex = '^(.*)\.k?o$' + module_pattern = 'kernel-module-%s' + + postinst = d.getVar('pkg_postinst_modules', True) + postrm = d.getVar('pkg_postrm_modules', True) + do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') + do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') + do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') + do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True)) + + # 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', True) + 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) + + import re + metapkg = "kernel-modules" + d.setVar('ALLOW_EMPTY_' + metapkg, "1") + d.setVar('FILES_' + metapkg, "") + blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux' ] + for l in module_deps.values(): + for i in l: + pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) + blacklist.append(pkg) + metapkg_rdepends = [] + packages = d.getVar('PACKAGES', True).split() + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends: + metapkg_rdepends.append(pkg) + d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends)) + d.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package') + packages.append(metapkg) + d.setVar('PACKAGES', ' '.join(packages)) } # Support checking the kernel size since some kernels need to reside in partitions diff --git a/meta/classes/libc-common.bbclass b/meta/classes/libc-common.bbclass index 8145d64e29..06d520164e 100644 --- a/meta/classes/libc-common.bbclass +++ b/meta/classes/libc-common.bbclass @@ -23,13 +23,13 @@ def get_libc_fpu_setting(bb, d): return "" python populate_packages_prepend () { - if d.getVar('DEBIAN_NAMES', True): - bpn = d.getVar('BPN', True) - d.setVar('PKG_'+bpn, 'libc6') - d.setVar('PKG_'+bpn+'-dev', 'libc6-dev') - d.setVar('PKG_'+bpn+'-dbg', 'libc6-dbg') - # For backward compatibility with old -dbg package - d.appendVar('RPROVIDES_' + bpn + '-dbg', ' libc-dbg') - d.appendVar('RCONFLICTS_' + bpn + '-dbg', ' libc-dbg') - d.appendVar('RREPLACES_' + bpn + '-dbg', ' libc-dbg') + if d.getVar('DEBIAN_NAMES', True): + bpn = d.getVar('BPN', True) + d.setVar('PKG_'+bpn, 'libc6') + d.setVar('PKG_'+bpn+'-dev', 'libc6-dev') + d.setVar('PKG_'+bpn+'-dbg', 'libc6-dbg') + # For backward compatibility with old -dbg package + d.appendVar('RPROVIDES_' + bpn + '-dbg', ' libc-dbg') + d.appendVar('RCONFLICTS_' + bpn + '-dbg', ' libc-dbg') + d.appendVar('RREPLACES_' + bpn + '-dbg', ' libc-dbg') } diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index 9df3c17116..e3214a68a2 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass @@ -28,10 +28,10 @@ python __anonymous () { if r.match(target_arch): depends = d.getVar("DEPENDS", True) - if use_cross_localedef == "1" : - depends = "%s cross-localedef-native" % depends - else: - depends = "%s qemu-native" % 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 @@ -118,270 +118,270 @@ do_collect_bins_from_locale_tree() { inherit qemu python package_do_split_gconvs () { - import os, re - if (d.getVar('PACKAGE_NO_GCONV', True) == '1'): - bb.note("package requested not splitting gconvs") - return - - if not d.getVar('PACKAGES', True): - return - - mlprefix = d.getVar("MLPREFIX", True) or "" - - bpn = d.getVar('BPN', True) - libdir = d.getVar('libdir', True) - if not libdir: - bb.error("libdir not defined") - return - datadir = d.getVar('datadir', True) - if not datadir: - bb.error("datadir not defined") - return - - gconv_libdir = base_path_join(libdir, "gconv") - charmap_dir = base_path_join(datadir, "i18n", "charmaps") - locales_dir = base_path_join(datadir, "i18n", "locales") - binary_locales_dir = base_path_join(libdir, "locale") - - def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group): - deps = [] - f = open(fn, "r") - c_re = re.compile('^copy "(.*)"') - i_re = re.compile('^include "(\w+)".*') - for l in f.readlines(): - 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='^(.*)\.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, "r") - c_re = re.compile('^copy "(.*)"') - i_re = re.compile('^include "(\w+)".*') - for l in f.readlines(): - 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='^(.*)\.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, "r") - c_re = re.compile('^copy "(.*)"') - i_re = re.compile('^include "(\w+)".*') - for l in f.readlines(): - 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='(.*)', output_pattern=bpn+'-localedata-%s', \ - description='locale definition for %s', hook=calc_locale_deps, extra_depends='') - d.setVar('PACKAGES', d.getVar('PACKAGES') + ' ' + d.getVar('MLPREFIX') + bpn + '-gconv') - - use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", True) - - dot_re = re.compile("(.*)\.(.*)") - - # Read in supported locales and associated encodings - supported = {} - with open(base_path_join(d.getVar('WORKDIR', True), "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', True) - if not to_generate or to_generate == 'all': - to_generate = 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, 'localedef %s-localedata-%s %s-charmap-%s' % \ - (mlprefix+bpn, legitimize_package_name(locale), mlprefix+bpn, legitimize_package_name(encoding))) - d.setVar('pkg_postinst_%s' % pkgname, d.getVar('locale_base_postinst', True) \ - % (locale, encoding, locale)) - d.setVar('pkg_postrm_%s' % pkgname, d.getVar('locale_base_postrm', True) % \ - (locale, encoding, locale)) - - def output_locale_binary_rdepends(name, pkgname, locale, encoding): - m = re.match("(.*)\.(.*)", name) - if m: - libc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-","")) - else: - libc_name = name - d.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('%s-binary-localedata-%s' \ - % (mlprefix+bpn, libc_name))) - - commands = {} - - def output_locale_binary(name, pkgname, locale, encoding): - treedir = base_path_join(d.getVar("WORKDIR", True), "locale-tree") - ldlibdir = base_path_join(treedir, d.getVar("base_libdir", True)) - path = d.getVar("PATH", True) - i18npath = base_path_join(treedir, datadir, "i18n") - gconvpath = base_path_join(treedir, "iconvdata") - outputpath = base_path_join(treedir, libdir, "locale") - - use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF", True) or "0" - if use_cross_localedef == "1": - target_arch = d.getVar('TARGET_ARCH', True) - locale_arch_options = { \ - "arm": " --uint32-align=4 --little-endian ", \ - "sh4": " --uint32-align=4 --big-endian ", \ - "powerpc": " --uint32-align=4 --big-endian ", \ - "powerpc64": " --uint32-align=4 --big-endian ", \ - "mips": " --uint32-align=4 --big-endian ", \ - "mips64": " --uint32-align=4 --big-endian ", \ - "mipsel": " --uint32-align=4 --little-endian ", \ - "mips64el":" --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) - raise bb.build.FuncFailed("unknown arch:" + target_arch + " for locale_arch_options") - - localedef_opts += " --force --old-style --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, g