* [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D}
[not found] <cover.1418337489.git.alejandro.hernandez@linux.intel.com>
@ 2014-12-11 22:40 ` Alejandro Hernandez
2015-01-07 18:27 ` Burton, Ross
2015-01-07 22:02 ` Randy Witt
0 siblings, 2 replies; 5+ messages in thread
From: Alejandro Hernandez @ 2014-12-11 22:40 UTC (permalink / raw)
To: openembedded-core
Checks in FILES and pkg_* variables, solves common mistake of
using ${D} instead of $D and warns the user accordingly.
[YOCTO #6642]
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
---
meta/classes/insane.bbclass | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 0b45374..8224124 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -34,7 +34,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
split-strip packages-list pkgv-undefined var-undefined \
- version-going-backwards \
+ version-going-backwards expanded_d \
"
ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -906,6 +906,34 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
return sane
+QAPATHTEST[expanded_d] = "package_qa_check_expanded_d"
+def package_qa_check_expanded_d(path,name,d,elf,messages):
+ """
+ Check for the expanded D (${D}) value in pkg_* and FILES
+ variables, warn the user to use it correctly.
+ """
+
+ sane = True
+ expanded_d = d.getVar('D',True)
+
+ # Get packages for current recipe and iterate
+ packages = d.getVar('PACKAGES', True).split(" ")
+ for pak in packages:
+ # Go through all variables and check if expanded D is found, warn the user accordingly
+ for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
+ # Variables are actually var_${PN}
+ bbvar = d.getVar(var + "_" + pak)
+ if bbvar:
+ # Bitbake expands ${D} within bbvar during the previous step, so we check for its expanded value
+ if expanded_d in bbvar:
+ if var == 'FILES':
+ messages["expanded_d"] = "FILES should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference"
+ sane = False
+ else:
+ messages["expanded_d"] = "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, pak)
+ sane = False
+ return sane
+
# The PACKAGE FUNC to scan each package
python do_package_qa () {
import subprocess
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D}
2014-12-11 22:40 ` [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D} Alejandro Hernandez
@ 2015-01-07 18:27 ` Burton, Ross
2015-01-13 22:49 ` Alejandro Hernandez
2015-01-07 22:02 ` Randy Witt
1 sibling, 1 reply; 5+ messages in thread
From: Burton, Ross @ 2015-01-07 18:27 UTC (permalink / raw)
To: Alejandro Hernandez; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 832 bytes --]
Hi Alejandro,
Looks good, but some small points:
On 11 December 2014 at 22:40, Alejandro Hernandez <
alejandro.hernandez@linux.intel.com> wrote:
> - version-going-backwards \
> + version-going-backwards expanded_d \
>
+QAPATHTEST[expanded_d] = "package_qa_check_expanded_d"
>
Rename this to expanded-d for consistency with the other symbols that use -
instead of _.
> + # Variables are actually var_${PN}
>
No need to document idioms, remove this comment.
> + messages["expanded_d"] = "FILES should not
> contain the ${D} variable as it references the local build directory not
> the target filesystem, best solution is to remove the ${D} reference"
>
This doesn't name the package which makes it tricky to find in large builds.
Ross
[-- Attachment #2: Type: text/html, Size: 1917 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D}
2014-12-11 22:40 ` [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D} Alejandro Hernandez
2015-01-07 18:27 ` Burton, Ross
@ 2015-01-07 22:02 ` Randy Witt
2015-01-07 23:04 ` Burton, Ross
1 sibling, 1 reply; 5+ messages in thread
From: Randy Witt @ 2015-01-07 22:02 UTC (permalink / raw)
To: Alejandro Hernandez, openembedded-core
On 12/11/2014 02:40 PM, Alejandro Hernandez wrote:
> Checks in FILES and pkg_* variables, solves common mistake of
>
> using ${D} instead of $D and warns the user accordingly.
>
> [YOCTO #6642]
>
> Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
> ---
> meta/classes/insane.bbclass | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index 0b45374..8224124 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -34,7 +34,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
> ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
> perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
> split-strip packages-list pkgv-undefined var-undefined \
> - version-going-backwards \
> + version-going-backwards expanded_d \
> "
>
> ALL_QA = "${WARN_QA} ${ERROR_QA}"
> @@ -906,6 +906,34 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
>
> return sane
>
> +QAPATHTEST[expanded_d] = "package_qa_check_expanded_d"
> +def package_qa_check_expanded_d(path,name,d,elf,messages):
> + """
> + Check for the expanded D (${D}) value in pkg_* and FILES
> + variables, warn the user to use it correctly.
> + """
> +
> + sane = True
> + expanded_d = d.getVar('D',True)
> +
> + # Get packages for current recipe and iterate
> + packages = d.getVar('PACKAGES', True).split(" ")
> + for pak in packages:
> + # Go through all variables and check if expanded D is found, warn the user accordingly
> + for var in 'FILES','pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm':
> + # Variables are actually var_${PN}
> + bbvar = d.getVar(var + "_" + pak)
Would it be simpler to do "bbvar = d.getVar(var + "_" + pak, False)" so you
don't get the expanded value, and then just check for ${D}? I suppose it would
save one extra variable and a couple of expansions.
> + if bbvar:
> + # Bitbake expands ${D} within bbvar during the previous step, so we check for its expanded value
> + if expanded_d in bbvar:
> + if var == 'FILES':
> + messages["expanded_d"] = "FILES should not contain the ${D} variable as it references the local build directory not the target filesystem, best solution is to remove the ${D} reference"
> + sane = False
> + else:
> + messages["expanded_d"] = "%s in %s recipe contains ${D}, it should be replaced by $D instead" % (var, pak)
> + sane = False
> + return sane
> +
> # The PACKAGE FUNC to scan each package
> python do_package_qa () {
> import subprocess
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D}
2015-01-07 22:02 ` Randy Witt
@ 2015-01-07 23:04 ` Burton, Ross
0 siblings, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2015-01-07 23:04 UTC (permalink / raw)
To: Randy Witt; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 584 bytes --]
On 7 January 2015 at 22:02, Randy Witt <randy.e.witt@linux.intel.com> wrote:
> Would it be simpler to do "bbvar = d.getVar(var + "_" + pak, False)" so
> you don't get the expanded value, and then just check for ${D}? I suppose
> it would save one extra variable and a couple of expansions.
>
Alejandro answered this point in the original thread:
"using the existing package variable handling infrastructure within the
class, ends up expanding the variables before being able to check them ,
using getVar('FOO', False) is useless in this case, any suggestions?"
Ross
[-- Attachment #2: Type: text/html, Size: 1324 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D}
2015-01-07 18:27 ` Burton, Ross
@ 2015-01-13 22:49 ` Alejandro Hernandez
0 siblings, 0 replies; 5+ messages in thread
From: Alejandro Hernandez @ 2015-01-13 22:49 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]
Thank Ross, sending new patch soon.
On 07/01/15 12:27, Burton, Ross wrote:
> Hi Alejandro,
>
> Looks good, but some small points:
>
> On 11 December 2014 at 22:40, Alejandro Hernandez
> <alejandro.hernandez@linux.intel.com
> <mailto:alejandro.hernandez@linux.intel.com>> wrote:
>
> - version-going-backwards \
> + version-going-backwards expanded_d \
>
> +QAPATHTEST[expanded_d] = "package_qa_check_expanded_d"
>
>
> Rename this to expanded-d for consistency with the other symbols that
> use - instead of _.
>
> + # Variables are actually var_${PN}
>
>
> No need to document idioms, remove this comment.
>
> + messages["expanded_d"] = "FILES should not
> contain the ${D} variable as it references the local build
> directory not the target filesystem, best solution is to remove
> the ${D} reference"
>
>
> This doesn't name the package which makes it tricky to find in large
> builds.
>
> Ross
>
[-- Attachment #2: Type: text/html, Size: 3022 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-13 22:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1418337489.git.alejandro.hernandez@linux.intel.com>
2014-12-11 22:40 ` [PATCH 1/1] insane.bbclass: Added QA test for expanded ${D} Alejandro Hernandez
2015-01-07 18:27 ` Burton, Ross
2015-01-13 22:49 ` Alejandro Hernandez
2015-01-07 22:02 ` Randy Witt
2015-01-07 23:04 ` Burton, Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox