Skip to contentSkip to conversation

remove True option to getVar calls

PATCH In review André Draszik 2 participants 2 messages Jan 13, 2019 – Dec 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove True option to getVar calls

From: André Draszik <[email protected]>

getVar() has been defaulting to expanding by default for a long time (2016), thus remove the True option from getVar() calls with a regex search and replace.

Search & replace made using the following command:

    sed -e 's|\(d\.getVar \?\)( \?\([^,()]*\), \?True)|\1(\2)|g' \
        -i $(git grep -E 'getVar ?\( ?([^,()]*), ?True\)' \
             | cut -d':' -f1 \
             | sort -u)
---
 classes/java-library.bbclass              |  4 ++--
 classes/openjdk-build-helper.bbclass      | 10 +++++-----
 recipes-core/openjdk/openjdk-7-common.inc |  2 +-
 recipes-core/openjdk/openjdk-8-common.inc |  4 ++--
 recipes-core/openjdk/openjdk-8-cross.inc  | 10 +++++-----
 5 files changed, 15 insertions(+), 15 deletions(-)
classes/java-library.bbclass +2 -2
index e0159ba..d801930 100644
@@ -27,8 +27,8 @@ def java_package_name(d):
   pre=""
   post=""
 
-  bpn = d.getVar('BPN', True)
-  ml = d.getVar('MLPREFIX', True)
+  bpn = d.getVar('BPN')
+  ml = d.getVar('MLPREFIX')
   if not bpn.startswith("lib"):
     pre='lib'
 
classes/openjdk-build-helper.bbclass +5 -5
index 01ed591..8d83e02 100644
@@ -9,7 +9,7 @@ EXTRA_OEMAKE_remove_task-install = "${PARALLEL_MAKEINST}"
 # In OE we have PARALLEL_MAKE which is the actual option passed to make,
 # e.g. "-j 4".
 def openjdk_build_helper_get_parallel_make(d):
-    pm = d.getVar('PARALLEL_MAKE', True);
+    pm = d.getVar('PARALLEL_MAKE');
     if not pm or '-j' not in pm:
         return 1
 
@@ -55,7 +55,7 @@ def openjdk_build_helper_get_target_cflags(d):
 def openjdk_build_helper_get_jdk_arch(d):
     import bb
 
-    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH')
     if jdk_arch == "x86-64":
         jdk_arch = "amd64"
     elif jdk_arch == "powerpc":
@@ -73,7 +73,7 @@ def openjdk_build_helper_get_jdk_arch(d):
 def openjdk_build_helper_get_llvm_configure_arch(d):
     import bb;
 
-    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    arch = d.getVar('TRANSLATED_TARGET_ARCH')
     if arch in ['i386', 'i486', 'i586', 'i686', 'x86-64']:
         arch = "x86"
     elif arch in ['mipsel', 'mips']:
@@ -84,7 +84,7 @@ def openjdk_build_helper_get_llvm_configure_arch(d):
         arch = "arm"
     else:
         if 'shark' in d.getVar('PACKAGECONFIG').split():
-            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN', True), arch) );
+            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN'), arch) );
 
     return arch
 
@@ -93,7 +93,7 @@ def openjdk_build_helper_get_llvm_configure_arch(d):
 def openjdk_build_helper_get_icedtea_arch(d):
     import bb;
 
-    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    arch = d.getVar('TRANSLATED_TARGET_ARCH')
     if arch == "x86-64":
         arch = "amd64"
     elif arch in ['i386', 'i486', 'i586', 'i686']:
recipes-core/openjdk/openjdk-7-common.inc +1 -1
index 794bf58..d59a57a 100644
@@ -93,7 +93,7 @@ export ALT_CUPS_HEADERS_PATH = "${STAGING_INCDIR}"
 export ALT_FREETYPE_HEADERS_PATH = "${STAGING_INCDIR}/freetype2"
 export ALT_FREETYPE_LIB_PATH = "${STAGING_LIBDIR}"
 export CACAO_CONFIGURE_ARGS = " \
-    ${@['','--enable-softfloat'][d.getVar('TARGET_FPU', True) == 'soft']}"
+    ${@['','--enable-softfloat'][d.getVar('TARGET_FPU') == 'soft']}"
 
 JAVA_HOME[unexport] = "1"
 
recipes-core/openjdk/openjdk-8-common.inc +2 -2
index 4d8f935..1fbe7fe 100644
@@ -163,8 +163,8 @@ export DEBUG_BINARIES = "true"
 
 ALTERNATIVE_PRIORITY = "50"
 
-OPENJDK_UPDATE_VERSION = "${@d.getVar('PV', True).split('b')[0]}"
-OPENJDK_BUILD_NUMBER = "b${@d.getVar('PV', True).split('b')[1]}"
+OPENJDK_UPDATE_VERSION = "${@d.getVar('PV').split('b')[0]}"
+OPENJDK_BUILD_NUMBER = "b${@d.getVar('PV').split('b')[1]}"
 EXTRA_OECONF_append = "\
         --with-build-number=${OPENJDK_BUILD_NUMBER} \
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
recipes-core/openjdk/openjdk-8-cross.inc +5 -5
index d04b0d3..7d6c1a5 100644
@@ -108,14 +108,14 @@ EXTRA_OEMAKE_append = '\
 '
 
 python remove_debuglink() {
-    dvar = d.getVar('PKGD', True)
-    objcopy = d.getVar("OBJCOPY", True)
+    dvar = d.getVar('PKGD')
+    objcopy = d.getVar("OBJCOPY")
 
     # Remove the previous debuglink if it has existed, because it has a different file name with that we will add.
-    if d.getVar('PN', True).find("jre") != -1:
-        file = dvar + d.getVar("JRE_HOME", True) + "/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+    if d.getVar('PN').find("jre") != -1:
+        file = dvar + d.getVar("JRE_HOME") + "/lib/" + d.getVar("JDK_ARCH") + "/server/libjvm.so"
     else:
-        file = dvar + d.getVar("JDK_HOME", True) + "/jre/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+        file = dvar + d.getVar("JDK_HOME") + "/jre/lib/" + d.getVar("JDK_ARCH") + "/server/libjvm.so"
 
     cmd = "'%s' --remove-section .gnu_debuglink '%s'" % (objcopy, file)
     oe.utils.getstatusoutput(cmd)
Signature · 1 line
2.20.1
#1 lore raw

Hi,
this is a note to let you know that I've just added this patch to the master-next branch of the meta-java repository at
git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

Quoted 138 lines · André Draszik

From: André Draszik <[email protected]>

getVar() has been defaulting to expanding by default for a long time (2016), thus remove the True option from getVar() calls with a regex search and replace.

Search & replace made using the following command:

     sed -e 's|\(d\.getVar \?\)( \?\([^,()]*\), \?True)|\1(\2)|g' \
         -i $(git grep -E 'getVar ?\( ?([^,()]*), ?True\)' \
              | cut -d':' -f1 \
              | sort -u)
---
  classes/java-library.bbclass              |  4 ++--
  classes/openjdk-build-helper.bbclass      | 10 +++++-----
  recipes-core/openjdk/openjdk-7-common.inc |  2 +-
  recipes-core/openjdk/openjdk-8-common.inc |  4 ++--
  recipes-core/openjdk/openjdk-8-cross.inc  | 10 +++++-----
  5 files changed, 15 insertions(+), 15 deletions(-)
classes/java-library.bbclass +2 -2
index e0159ba..d801930 100644
@@ -27,8 +27,8 @@ def java_package_name(d):
    pre=""
    post=""
 
-  bpn = d.getVar('BPN', True)
-  ml = d.getVar('MLPREFIX', True)
+  bpn = d.getVar('BPN')
+  ml = d.getVar('MLPREFIX')
    if not bpn.startswith("lib"):
      pre='lib'
 
classes/openjdk-build-helper.bbclass +5 -5
index 01ed591..8d83e02 100644
@@ -9,7 +9,7 @@ EXTRA_OEMAKE_remove_task-install = "${PARALLEL_MAKEINST}"
  # In OE we have PARALLEL_MAKE which is the actual option passed to make,
  # e.g. "-j 4".
  def openjdk_build_helper_get_parallel_make(d):
-    pm = d.getVar('PARALLEL_MAKE', True);
+    pm = d.getVar('PARALLEL_MAKE');
      if not pm or '-j' not in pm:
          return 1
 
@@ -55,7 +55,7 @@ def openjdk_build_helper_get_target_cflags(d):
  def openjdk_build_helper_get_jdk_arch(d):
      import bb
 
-    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH')
      if jdk_arch == "x86-64":
          jdk_arch = "amd64"
      elif jdk_arch == "powerpc":
@@ -73,7 +73,7 @@ def openjdk_build_helper_get_jdk_arch(d):
  def openjdk_build_helper_get_llvm_configure_arch(d):
      import bb;
 
-    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    arch = d.getVar('TRANSLATED_TARGET_ARCH')
      if arch in ['i386', 'i486', 'i586', 'i686', 'x86-64']:
          arch = "x86"
      elif arch in ['mipsel', 'mips']:
@@ -84,7 +84,7 @@ def openjdk_build_helper_get_llvm_configure_arch(d):
          arch = "arm"
      else:
          if 'shark' in d.getVar('PACKAGECONFIG').split():
-            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN', True), arch) );
+            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN'), arch) );
 
      return arch
 
@@ -93,7 +93,7 @@ def openjdk_build_helper_get_llvm_configure_arch(d):
  def openjdk_build_helper_get_icedtea_arch(d):
      import bb;
 
-    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    arch = d.getVar('TRANSLATED_TARGET_ARCH')
      if arch == "x86-64":
          arch = "amd64"
      elif arch in ['i386', 'i486', 'i586', 'i686']:
recipes-core/openjdk/openjdk-7-common.inc +1 -1
index 794bf58..d59a57a 100644
@@ -93,7 +93,7 @@ export ALT_CUPS_HEADERS_PATH = "${STAGING_INCDIR}"
  export ALT_FREETYPE_HEADERS_PATH = "${STAGING_INCDIR}/freetype2"
  export ALT_FREETYPE_LIB_PATH = "${STAGING_LIBDIR}"
  export CACAO_CONFIGURE_ARGS = " \
-    ${@['','--enable-softfloat'][d.getVar('TARGET_FPU', True) == 'soft']}"
+    ${@['','--enable-softfloat'][d.getVar('TARGET_FPU') == 'soft']}"
 
  JAVA_HOME[unexport] = "1"
 
recipes-core/openjdk/openjdk-8-common.inc +2 -2
index 4d8f935..1fbe7fe 100644
@@ -163,8 +163,8 @@ export DEBUG_BINARIES = "true"
 
  ALTERNATIVE_PRIORITY = "50"
 
-OPENJDK_UPDATE_VERSION = "${@d.getVar('PV', True).split('b')[0]}"
-OPENJDK_BUILD_NUMBER = "b${@d.getVar('PV', True).split('b')[1]}"
+OPENJDK_UPDATE_VERSION = "${@d.getVar('PV').split('b')[0]}"
+OPENJDK_BUILD_NUMBER = "b${@d.getVar('PV').split('b')[1]}"
  EXTRA_OECONF_append = "\
          --with-build-number=${OPENJDK_BUILD_NUMBER} \
          --with-update-version=${OPENJDK_UPDATE_VERSION} \
recipes-core/openjdk/openjdk-8-cross.inc +5 -5
index d04b0d3..7d6c1a5 100644
@@ -108,14 +108,14 @@ EXTRA_OEMAKE_append = '\
  '
 
  python remove_debuglink() {
-    dvar = d.getVar('PKGD', True)
-    objcopy = d.getVar("OBJCOPY", True)
+    dvar = d.getVar('PKGD')
+    objcopy = d.getVar("OBJCOPY")
 
      # Remove the previous debuglink if it has existed, because it has a different file name with that we will add.
-    if d.getVar('PN', True).find("jre") != -1:
-        file = dvar + d.getVar("JRE_HOME", True) + "/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+    if d.getVar('PN').find("jre") != -1:
+        file = dvar + d.getVar("JRE_HOME") + "/lib/" + d.getVar("JDK_ARCH") + "/server/libjvm.so"
      else:
-        file = dvar + d.getVar("JDK_HOME", True) + "/jre/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+        file = dvar + d.getVar("JDK_HOME") + "/jre/lib/" + d.getVar("JDK_ARCH") + "/server/libjvm.so"
 
      cmd = "'%s' --remove-section .gnu_debuglink '%s'" % (objcopy, file)
      oe.utils.getstatusoutput(cmd)