<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>6316</bug_id>
          
          <creation_ts>2014-05-12 16:13:29 +0000</creation_ts>
          <short_desc>Running bitbake without a MACHINE set leads to stupid &quot;error message&quot;</short_desc>
          <delta_ts>2014-08-08 11:52:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.7 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Phlip Balister">philip</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
          
          <qa_contact name="Mihail Stanciu">stanciux.mihail</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>43258</commentid>
    <comment_count>0</comment_count>
    <who name="Phlip Balister">philip</who>
    <bug_when>2014-05-12 16:13:29 +0000</bug_when>
    <thetext>I do not set any MACHINE in local.conf. Forgetting to set MACHINE and running bitbake leads to the following message. Checked against bitbake master.

[balister@localhost build]$ unset MACHINE
[balister@localhost build]$ bitbake gnuradio-demo-image
ERROR: Error parsing configuration files
Traceback (most recent call last):
  File &quot;/home/balister/src/oe-core/bitbake/lib/bb/data_smart.py&quot;, line 331, in DataSmart.expandWithRefs(s=&apos;def __anon_651__home_balister_src_oe_core_oe_core_meta_classes_base_bbclass(d):\n    import string, re\n\n    # Handle PACKAGECONFIG\n    #\n    # These take the form:\n    #\n    # PACKAGECONFIG ??= &quot;&lt;default options&gt;&quot;\n    # PACKAGECONFIG[foo] = &quot;--enable-foo,--disable-foo,foo_depends,foo_runtime_depends&quot;\n    pkgconfigflags = d.getVarFlags(&quot;PACKAGECONFIG&quot;) or {}\n    if pkgconfigflags:\n        pkgconfig = (d.getVar(\&apos;PACKAGECONFIG\&apos;, True) or &quot;&quot;).split()\n        pn = d.getVar(&quot;PN&quot;, True)\n        mlprefix = d.getVar(&quot;MLPREFIX&quot;, True)\n\n        def expandFilter(appends, extension, prefix):\n            appends = bb.utils.explode_deps(d.expand(&quot; &quot;.join(appends)))\n            newappends = []\n            for a in appends:\n                if a.endswith(&quot;-native&quot;) or (&quot;-cross-&quot; in a):\n                    newappends.append(a)\n                elif a.startswith(&quot;virtual/&quot;):\n                    subs = a.split(&quot;/&quot;, 1)[1]\n                    newappends.append(&quot;virtual/&quot; + prefix + subs + extension)\n                else:\n                    if a.startswith(prefix):\n                        newappends.append(a + extension)\n                    else:\n                        newappends.append(prefix + a + extension)\n            return newappends\n\n        def appendVar(varname, appends):\n            if not appends:\n                return\n            if varname.find(&quot;DEPENDS&quot;) != -1:\n                if pn.startswith(&quot;nativesdk-&quot;):\n                    appends = expandFilter(appends, &quot;&quot;, &quot;nativesdk-&quot;)\n                if pn.endswith(&quot;-native&quot;):\n                    appends = expandFilter(appends, &quot;-native&quot;, &quot;&quot;)\n                if mlprefix:\n                    appends = expandFilter(appends, &quot;&quot;, mlprefix)\n            varname = d.expand(varname)\n            d.appendVar(varname, &quot; &quot; + &quot; &quot;.join(appends))\n\n        extradeps = []\n        extrardeps = []\n        extraconf = []\n        for flag, flagval in sorted(pkgconfigflags.items()):\n            if flag == &quot;defaultval&quot;:\n                continue\n            items = flagval.split(&quot;,&quot;)\n            num = len(items)\n            if num &gt; 4:\n                bb.error(&quot;Only enable,disable,depend,rdepend can be specified!&quot;)\n\n            if flag in pkgconfig:\n                if num &gt;= 3 and items[2]:\n                    extradeps.append(items[2])\n                if num &gt;= 4 and items[3]:\n                    extrardeps.append(items[3])\n                if num &gt;= 1 and items[0]:\n                    extraconf.append(items[0])\n            elif num &gt;= 2 and items[1]:\n                    extraconf.append(items[1])\n        appendVar(\&apos;DEPENDS\&apos;, extradeps)\n        appendVar(\&apos;RDEPENDS_${PN}\&apos;, extrardeps)\n        if bb.data.inherits_class(\&apos;cmake\&apos;, d):\n            appendVar(\&apos;EXTRA_OECMAKE\&apos;, extraconf)\n        else:\n            appendVar(\&apos;EXTRA_OECONF\&apos;, extraconf)\n\n    # If PRINC is set, try and increase the PR value by the amount specified\n    # The PR server is now the preferred way to handle PR changes based on\n    # the checksum of the recipe (including bbappend).  The PRINC is now\n    # obsolete.  Return a warning to the user.\n    princ = d.getVar(\&apos;PRINC\&apos;, True)\n    if princ and princ != &quot;0&quot;:\n        bb.warn(&quot;Use of PRINC %s was detected in the recipe %s (or one of its .bbappends)\\nUse of PRINC is deprecated.  The PR server should be used to automatically increment the PR.  See: https://wiki.yoctoproject.org/wiki/PR_Service.&quot; % (princ, d.getVar(&quot;FILE&quot;, True)))\n        pr = d.getVar(\&apos;PR\&apos;, True)\n        pr_prefix = re.search(&quot;\\D+&quot;,pr)\n        prval = re.search(&quot;\\d+&quot;,pr)\n        if pr_prefix is None or prval is None:\n            bb.error(&quot;Unable to analyse format of PR variable: %s&quot; % pr)\n        nval = int(prval.group(0)) + int(princ)\n        pr = pr_prefix.group(0) + str(nval) + pr[prval.end():]\n        d.setVar(\&apos;PR\&apos;, pr)\n\n    pn = d.getVar(\&apos;PN\&apos;, True)\n    license = d.getVar(\&apos;LICENSE\&apos;, True)\n    if license == &quot;INVALID&quot;:\n        bb.fatal(\&apos;This recipe does not have the LICENSE field set (%s)\&apos; % pn)\n\n    if bb.data.inherits_class(\&apos;license\&apos;, d):\n        unmatched_license_flag = check_license_flags(d)\n        if unmatched_license_flag:\n            bb.debug(1, &quot;Skipping %s because it has a restricted license not&quot;\n                 &quot; whitelisted in LICENSE_FLAGS_WHITELIST&quot; % pn)\n            raise bb.parse.SkipPackage(&quot;because it has a restricted license not&quot;\n                 &quot; whitelisted in LICENSE_FLAGS_WHITELIST&quot;)\n\n    # If we\&apos;re building a target package we need to use fakeroot (pseudo)\n    # in order to capture permissions, owners, groups and special files\n    if not bb.data.inherits_class(\&apos;native\&apos;, d) and not bb.data.inherits_class(\&apos;cross\&apos;, d):\n        d.setVarFlag(\&apos;do_unpack\&apos;, \&apos;umask\&apos;, \&apos;022\&apos;)\n        d.setVarFlag(\&apos;do_configure\&apos;, \&apos;umask\&apos;, \&apos;022\&apos;)\n        d.setVarFlag(\&apos;do_compile\&apos;, \&apos;umask\&apos;, \&apos;022\&apos;)\n        d.appendVarFlag(\&apos;do_install\&apos;, \&apos;depends\&apos;, \&apos; virtual/fakeroot-native:do_populate_sysroot\&apos;)\n        d.setVarFlag(\&apos;do_install\&apos;, \&apos;fakeroot\&apos;, 1)\n        d.setVarFlag(\&apos;do_install\&apos;, \&apos;umask\&apos;, \&apos;022\&apos;)\n        d.appendVarFlag(\&apos;do_package\&apos;, \&apos;depends\&apos;, \&apos; virtual/fakeroot-native:do_populate_sysroot\&apos;)\n        d.setVarFlag(\&apos;do_package\&apos;, \&apos;fakeroot\&apos;, 1)\n        d.setVarFlag(\&apos;do_package\&apos;, \&apos;umask\&apos;, \&apos;022\&apos;)\n        d.setVarFlag(\&apos;do_package_setscene\&apos;, \&apos;fakeroot\&apos;, 1)\n        d.appendVarFlag(\&apos;do_package_setscene\&apos;, \&apos;depends\&apos;, \&apos; virtual/fakeroot-native:do_populate_sysroot\&apos;)\n        d.setVarFlag(\&apos;do_devshell\&apos;, \&apos;fakeroot\&apos;, 1)\n        d.appendVarFlag(\&apos;do_devshell\&apos;, \&apos;depends\&apos;, \&apos; virtual/fakeroot-native:do_populate_sysroot\&apos;)\n    source_mirror_fetch = d.getVar(\&apos;SOURCE_MIRROR_FETCH\&apos;, 0)\n    if not source_mirror_fetch:\n        need_host = d.getVar(\&apos;COMPATIBLE_HOST\&apos;, True)\n        if need_host:\n            import re\n            this_host = d.getVar(\&apos;HOST_SYS\&apos;, True)\n            if not re.match(need_host, this_host):\n                raise bb.parse.SkipPackage(&quot;incompatible with host %s (not in COMPATIBLE_HOST)&quot; % this_host)\n\n        need_machine = d.getVar(\&apos;COMPATIBLE_MACHINE\&apos;, True)\n        if need_machine:\n            import re\n            compat_machines = (d.getVar(\&apos;MACHINEOVERRIDES\&apos;, True) or &quot;&quot;).split(&quot;:&quot;)\n            for m in compat_machines:\n                if re.match(need_machine, m):\n                    break\n            else:\n                raise bb.parse.SkipPackage(&quot;incompatible with machine %s (not in COMPATIBLE_MACHINE)&quot; % d.getVar(\&apos;MACHINE\&apos;, True))\n\n\n        bad_licenses = (d.getVar(\&apos;INCOMPATIBLE_LICENSE\&apos;, True) or &quot;&quot;).split()\n\n        check_license = False if pn.startswith(&quot;nativesdk-&quot;) else True\n        for t in [&quot;-native&quot;, &quot;-cross-${TARGET_ARCH}&quot;, &quot;-cross-initial-${TARGET_ARCH}&quot;,\n              &quot;-crosssdk-${SDK_ARCH}&quot;, &quot;-crosssdk-initial-${SDK_ARCH}&quot;,\n              &quot;-cross-canadian-${TRANSLATED_TARGET_ARCH}&quot;]:\n            if pn.endswith(d.expand(t)):\n                check_license = False\n\n        if check_license and bad_licenses:\n            whitelist = []\n            for lic in bad_licenses:\n                for w in [&quot;HOSTTOOLS_WHITELIST_&quot;, &quot;LGPLv2_WHITELIST_&quot;, &quot;WHITELIST_&quot;]:\n                    whitelist.extend((d.getVar(w + lic, True) or &quot;&quot;).split())\n                spdx_license = return_spdx(d, lic)\n                if spdx_license:\n                    whitelist.extend((d.getVar(\&apos;HOSTTOOLS_WHITELIST_%s\&apos; % spdx_license, True) or &quot;&quot;).split())\n            if not pn in whitelist:\n                recipe_license = d.getVar(\&apos;LICENSE\&apos;, True)\n                pkgs = d.getVar(\&apos;PACKAGES\&apos;, True).split()\n                skipped_pkgs = []\n                unskipped_pkgs = []\n                for pkg in pkgs:\n                    if incompatible_license(d, bad_licenses, pkg):\n                        skipped_pkgs.append(pkg)\n                    else:\n                        unskipped_pkgs.append(pkg)\n                all_skipped = skipped_pkgs and not unskipped_pkgs\n                if unskipped_pkgs:\n                    for pkg in skipped_pkgs:\n                        bb.debug(1, &quot;SKIPPING the package &quot; + pkg + &quot; at do_rootfs because it\&apos;s &quot; + recipe_license)\n                        d.setVar(\&apos;LICENSE_EXCLUSION-\&apos; + pkg, 1)\n                    for pkg in unskipped_pkgs:\n                        bb.debug(1, &quot;INCLUDING the package &quot; + pkg)\n                elif all_skipped or incompatible_license(d, bad_licenses):\n                    bb.debug(1, &quot;SKIPPING recipe %s because it\&apos;s %s&quot; % (pn, recipe_license))\n                    raise bb.parse.SkipPackage(&quot;incompatible with license %s&quot; % recipe_license)\n\n    srcuri = d.getVar(\&apos;SRC_URI\&apos;, True)\n    # Svn packages should DEPEND on subversion-native\n    if &quot;svn://&quot; in srcuri:\n        d.appendVarFlag(\&apos;do_fetch\&apos;, \&apos;depends\&apos;, \&apos; subversion-native:do_populate_sysroot\&apos;)\n\n    # Git packages should DEPEND on git-native\n    if &quot;git://&quot; in srcuri:\n        d.appendVarFlag(\&apos;do_fetch\&apos;, \&apos;depends\&apos;, \&apos; git-native:do_populate_sysroot\&apos;)\n\n    # Mercurial packages should DEPEND on mercurial-native\n    elif &quot;hg://&quot; in srcuri:\n        d.appendVarFlag(\&apos;do_fetch\&apos;, \&apos;depends\&apos;, \&apos; mercurial-native:do_populate_sysroot\&apos;)\n\n    # OSC packages should DEPEND on osc-native\n    elif &quot;osc://&quot; in srcuri:\n        d.appendVarFlag(\&apos;do_fetch\&apos;, \&apos;depends\&apos;, \&apos; osc-native:do_populate_sysroot\&apos;)\n\n    # *.lz4 should depends on lz4-native for unpacking\n    # Not endswith because of &quot;*.patch.lz4;patch=1&quot;. Need bb.fetch.decodeurl in future\n    if \&apos;.lz4\&apos; in srcuri:\n        d.appendVarFlag(\&apos;do_unpack\&apos;, \&apos;depends\&apos;, \&apos; lz4-native:do_populate_sysroot\&apos;)\n\n    # *.xz should depends on xz-native for unpacking\n    # Not endswith because of &quot;*.patch.xz;patch=1&quot;. Need bb.fetch.decodeurl in future\n    if \&apos;.xz\&apos; in srcuri:\n        d.appendVarFlag(\&apos;do_unpack\&apos;, \&apos;depends\&apos;, \&apos; xz-native:do_populate_sysroot\&apos;)\n\n    # unzip-native should already be staged before unpacking ZIP recipes\n    if &quot;.zip&quot; in srcuri:\n        d.appendVarFlag(\&apos;do_unpack\&apos;, \&apos;depends\&apos;, \&apos; unzip-native:do_populate_sysroot\&apos;)\n\n    # file is needed by rpm2cpio.sh\n    if &quot;.src.rpm&quot; in srcuri:\n        d.appendVarFlag(\&apos;do_unpack\&apos;, \&apos;depends\&apos;, \&apos; file-native:do_populate_sysroot\&apos;)\n\n    set_packagetriplet(d)\n\n    # \&apos;multimachine\&apos; handling\n    mach_arch = d.getVar(\&apos;MACHINE_ARCH\&apos;, True)\n    pkg_arch = d.getVar(\&apos;PACKAGE_ARCH\&apos;, True)\n\n    if (pkg_arch == mach_arch):\n        # Already machine specific - nothing further to do\n        return\n\n    #\n    # We always try to scan SRC_URI for urls with machine overrides\n    # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0\n    #\n    override = d.getVar(\&apos;SRC_URI_OVERRIDES_PACKAGE_ARCH\&apos;, True)\n    if override != \&apos;0\&apos;:\n        paths = []\n        fpaths = (d.getVar(\&apos;FILESPATH\&apos;, True) or \&apos;\&apos;).split(\&apos;:\&apos;)\n        machine = d.getVar(\&apos;MACHINE\&apos;, True)\n        for p in fpaths:\n            if os.path.basename(p) == machine and os.path.isdir(p):\n                paths.append(p)\n\n        if len(paths) != 0:\n            for s in srcuri.split():\n                if not s.startswith(&quot;file://&quot;):\n                    continue\n                fetcher = bb.fetch2.Fetch([s], d)\n                local = fetcher.localpath(s)\n                for mp in paths:\n                    if local.startswith(mp):\n                        #bb.note(&quot;overriding PACKAGE_ARCH from %s to %s for %s&quot; % (pkg_arch, mach_arch, pn))\n                        d.setVar(\&apos;PACKAGE_ARCH\&apos;, &quot;${MACHINE_ARCH}&quot;)\n                        return\n\n    packages = d.getVar(\&apos;PACKAGES\&apos;, True).split()\n    for pkg in packages:\n        pkgarch = d.getVar(&quot;PACKAGE_ARCH_%s&quot; % pkg, True)\n\n        # We could look for != PACKAGE_ARCH here but how to choose\n        # if multiple differences are present?\n        # Look through PACKAGE_ARCHS for the priority order?\n        if pkgarch and pkgarch == mach_arch:\n            d.setVar(\&apos;PACKAGE_ARCH\&apos;, &quot;${MACHINE_ARCH}&quot;)\n            bb.warn(&quot;Recipe %s is marked as only being architecture specific but seems to have machine specific packages?! The recipe may as well mark itself as machine specific directly.&quot; % d.getVar(&quot;PN&quot;, True))\n&apos;, varname=&apos;__anon_651__home_balister_src_oe_core_oe_core_meta_classes_base_bbclass&apos;):
                 try:
    &gt;                s = __expand_var_regexp__.sub(varparse.var_sub, s)
                     s = __expand_python_regexp__.sub(varparse.python_sub, s)
  File &quot;/home/balister/src/oe-core/bitbake/lib/bb/data_smart.py&quot;, line 102, in VariableParse.var_sub(match=&lt;_sre.SRE_Match object at 0x2914bf8&gt;):
                 else:
    &gt;                var = self.d.getVarFlag(key, &quot;_content&quot;, True)
                 self.references.add(key)
  File &quot;/home/balister/src/oe-core/bitbake/lib/bb/data_smart.py&quot;, line 617, in DataSmart.getVarFlag(var=&apos;MACHINE_ARCH&apos;, flag=&apos;_content&apos;, expand=True, noweakdefault=False):
                     cachename = var + &quot;[&quot; + flag + &quot;]&quot;
    &gt;            value = self.expand(value, cachename)
             if value is not None and flag == &quot;_content&quot; and local_var is not None and &quot;_removeactive&quot; in local_var:
  File &quot;/home/balister/src/oe-core/bitbake/lib/bb/data_smart.py&quot;, line 350, in DataSmart.expand(s=&quot;${@[d.getVar(&apos;TUNE_PKGARCH&apos;, True), d.getVar(&apos;MACHINE&apos;, True)][bool(d.getVar(&apos;MACHINE&apos;, True))].replace(&apos;-&apos;, &apos;_&apos;)}&quot;, varname=&apos;MACHINE_ARCH&apos;):
         def expand(self, s, varname = None):
    &gt;        return self.expandWithRefs(s, varname).value
     
  File &quot;/home/balister/src/oe-core/bitbake/lib/bb/data_smart.py&quot;, line 340, in DataSmart.expandWithRefs(s=&quot;${@[d.getVar(&apos;TUNE_PKGARCH&apos;, True), d.getVar(&apos;MACHINE&apos;, True)][bool(d.getVar(&apos;MACHINE&apos;, True))].replace(&apos;-&apos;, &apos;_&apos;)}&quot;, varname=&apos;MACHINE_ARCH&apos;):
                 except Exception as exc:
    &gt;                raise ExpansionError(varname, s, exc)
     
ExpansionError: Failure expanding variable MACHINE_ARCH, expression was ${@[d.getVar(&apos;TUNE_PKGARCH&apos;, True), d.getVar(&apos;MACHINE&apos;, True)][bool(d.getVar(&apos;MACHINE&apos;, True))].replace(&apos;-&apos;, &apos;_&apos;)} which triggered exception AttributeError: &apos;NoneType&apos; object has no attribute &apos;replace&apos;

[balister@localhost build]$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43691</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2014-05-30 15:44:29 +0000</bug_when>
    <thetext>Patches out for review for this issue on the list(s). Its a multifaceted problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43729</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2014-06-03 11:01:59 +0000</bug_when>
    <thetext>Fixed by a combination of:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=4489f20b6fa83ac0ab55cfd1e951fe80da98cca1

and the bitbake changes ending at:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=8a43a6a32bafc654046250f5362509fd92dd4d10</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45043</commentid>
    <comment_count>3</comment_count>
    <who name="Mihail Stanciu">stanciux.mihail</who>
    <bug_when>2014-08-08 11:52:07 +0000</bug_when>
    <thetext>Verified on master: 2d1660112e54653f7bb763939d0416472c49fe01</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>