* [PATCH 0/1][PULL] Multilib: add sanity check script
@ 2012-07-02 22:09 Dongxiao Xu
2012-07-02 22:09 ` [PATCH 1/1] scripts/multilib-check: Check for multilib build results Dongxiao Xu
2012-07-05 1:36 ` [PATCH 0/1][PULL] Multilib: add sanity check script Xu, Dongxiao
0 siblings, 2 replies; 6+ messages in thread
From: Dongxiao Xu @ 2012-07-02 22:09 UTC (permalink / raw)
To: poky
Hi Richard,
This pull request is to add sanity check for multilib, please help to review and pull.
Thanks,
Dongxiao
The following changes since commit 644ad4bf1e30fcee4b9d5abb819046d1f2193d27:
documentation/bsp-guide/bsp.xml: Yocto term paring (2012-07-02 16:47:45 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib dxu4/multilib-check
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/multilib-check
Dongxiao Xu (1):
scripts/multilib-check: Check for multilib build results
scripts/multilib-check | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 117 insertions(+), 0 deletions(-)
create mode 100755 scripts/multilib-check
--
1.7.4.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] scripts/multilib-check: Check for multilib build results
2012-07-02 22:09 [PATCH 0/1][PULL] Multilib: add sanity check script Dongxiao Xu
@ 2012-07-02 22:09 ` Dongxiao Xu
2012-07-02 22:40 ` Saul Wold
2012-07-05 1:36 ` [PATCH 0/1][PULL] Multilib: add sanity check script Xu, Dongxiao
1 sibling, 1 reply; 6+ messages in thread
From: Dongxiao Xu @ 2012-07-02 22:09 UTC (permalink / raw)
To: poky
This script is used to check whether the multilib build for a certain
recipe outcomes the right files/directories.
The usage for the script is:
$ source oe-init-build-env
$ multilib-check recipeA recipeB ...
or
$ source oe-init-build-env
$ multilib-check world
This fixes [YOCTO #2038]
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
scripts/multilib-check | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 117 insertions(+), 0 deletions(-)
create mode 100755 scripts/multilib-check
diff --git a/scripts/multilib-check b/scripts/multilib-check
new file mode 100755
index 0000000..69a5dd3
--- /dev/null
+++ b/scripts/multilib-check
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+
+import os
+import os.path
+import sys
+
+# AAA: BBB
+# AAA is the multilib prefix, BBB is its DEFAULTTUNE.
+multilib_arch_tune = {"lib32": "x86", "lib64": "x86-64"}
+
+# The machine we now support is x86 and x86-64.
+machine = "qemux86"
+
+def usage():
+ print("Usage: multilib-check recipe_name1 recipe_name2 ... \n \
+ or multilib-check world")
+
+def generate_multilib_config():
+ os.system("cp -f conf/local.conf conf/local.conf.orig")
+ f = open("conf/local.conf", "a")
+ f.write('require conf/multilib.conf\n')
+ multilibs = ""
+ for i in multilib_arch_tune.keys():
+ f.write('DEFAULTTUNE_virtclass-multilib-%s="%s"\n' % (i, multilib_arch_tune[i]))
+ multilibs += "multilib:%s " % i
+ f.write('MULTILIBS="%s"\n' % multilibs.strip())
+ f.close()
+
+def restore_original_config():
+ os.system("mv -f conf/local.conf.orig conf/local.conf")
+
+def build_recipe(mach, recipe_name):
+ print("INFO: Building %s ..." % recipe_name)
+ return os.system("MACHINE=%s bitbake %s &> /dev/null" % (mach, recipe_name))
+
+def get_variable(mach, recipe_name, variable):
+ return os.popen('bitbake -e %s | grep "^%s="' % (recipe_name, variable)).readline().split("%s=" % variable)[1].strip("\"\n")
+
+# Check if dir2 contains the same set of files as in dir1.
+def compare_folders(dir1, dir2):
+ if not os.path.exists(dir1):
+ return
+ for i in os.listdir(dir1):
+ path_normal = os.path.join(dir1, i)
+ path_multilib = os.path.join(dir2, i)
+
+ if not os.path.exists(path_multilib):
+ print("ERROR: %s exists while %s doesn't" % (path_normal, path_multilib))
+ continue
+
+ if os.path.isdir(path_normal):
+ if not os.path.isdir(path_multilib):
+ print("ERROR: %s is a directory while %s is a file" % (path_normal, path_multilib))
+ continue
+ compare_folders(path_normal, path_multilib)
+ else:
+ if not os.path.isfile(path_multilib):
+ print("ERROR: %s is a file while %s is a directory" % (path_normal, path_multilib))
+
+def multilib_sanity_check(rootdir_normal, baselib_normal, rootdir_multilib, baselib_multilib):
+ compare_folders(rootdir_normal+"/usr/"+baselib_normal, rootdir_multilib+"/usr/"+baselib_multilib)
+ compare_folders(rootdir_normal+"/"+baselib_normal, rootdir_multilib+"/"+baselib_multilib)
+
+# Use bitbake -s to get the recipe list, for example "world"
+def get_recipe_list(name):
+ begin = False
+ recipe_list = []
+ fd = os.popen('bitbake -s %s' % name)
+ for i in fd:
+ if i.startswith("============"):
+ begin = True
+ continue
+ if begin and i.strip("\n"):
+ recipe_name = i.split()[0].strip()
+ if "native" in recipe_name:
+ continue
+ else:
+ recipe_list.append(recipe_name)
+
+ return recipe_list
+
+def main():
+ if len(sys.argv) <= 1:
+ usage()
+ exit(1)
+ elif len(sys.argv) == 2 and sys.argv[1] == "world":
+ recipe_list = get_recipe_list("world")
+ else:
+ recipe_list = sys.argv[1:]
+
+ mach = machine
+ generate_multilib_config()
+ try:
+ for i in range(0, len(recipe_list)):
+ print("INFO: checking for recipe %s ..." % recipe_list[i])
+ ret = build_recipe(mach, recipe_list[i])
+ if ret:
+ print("ERROR: Build %s failed" % recipe_list[i])
+ continue
+ rootdir_normal = get_variable(mach, recipe_list[i], "WORKDIR") + "/image"
+ baselib_normal = get_variable(mach, recipe_list[i], "baselib")
+
+ for j in multilib_arch_tune.keys():
+ ret = build_recipe(mach, j + "-" + recipe_list[i])
+ if ret:
+ print("ERROR: Build %s failed" % (j + "-" + recipe_list[i]))
+ continue
+ rootdir_multilib = get_variable(mach, j + "-" + recipe_list[i], "WORKDIR") + "/image"
+ baselib_multilib = get_variable(mach, j + "-" + recipe_list[i], "baselib")
+
+ multilib_sanity_check(rootdir_normal, baselib_normal, rootdir_multilib, baselib_multilib)
+ except Exception as e:
+ print "ERROR: %s" % e
+ finally:
+ restore_original_config()
+
+main()
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] scripts/multilib-check: Check for multilib build results
2012-07-02 22:09 ` [PATCH 1/1] scripts/multilib-check: Check for multilib build results Dongxiao Xu
@ 2012-07-02 22:40 ` Saul Wold
2012-07-02 22:50 ` Xu, Dongxiao
0 siblings, 1 reply; 6+ messages in thread
From: Saul Wold @ 2012-07-02 22:40 UTC (permalink / raw)
To: Dongxiao Xu; +Cc: poky
On 07/02/2012 03:09 PM, Dongxiao Xu wrote:
> This script is used to check whether the multilib build for a certain
> recipe outcomes the right files/directories.
>
> The usage for the script is:
>
> $ source oe-init-build-env
> $ multilib-check recipeA recipeB ...
>
> or
>
> $ source oe-init-build-env
> $ multilib-check world
>
Is there a reason that this is an external script rather than a default
test as part of insane.bbclass.
Maybe you have been in touch with RP about this?
Also I think this should be part of oe-core, not in poky only.
Thanks
Sau!
> This fixes [YOCTO #2038]
>
> Signed-off-by: Dongxiao Xu<dongxiao.xu@intel.com>
> ---
> scripts/multilib-check | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 117 insertions(+), 0 deletions(-)
> create mode 100755 scripts/multilib-check
>
> diff --git a/scripts/multilib-check b/scripts/multilib-check
> new file mode 100755
> index 0000000..69a5dd3
> --- /dev/null
> +++ b/scripts/multilib-check
> @@ -0,0 +1,117 @@
> +#!/usr/bin/env python
> +
> +import os
> +import os.path
> +import sys
> +
> +# AAA: BBB
> +# AAA is the multilib prefix, BBB is its DEFAULTTUNE.
> +multilib_arch_tune = {"lib32": "x86", "lib64": "x86-64"}
> +
> +# The machine we now support is x86 and x86-64.
> +machine = "qemux86"
> +
> +def usage():
> + print("Usage: multilib-check recipe_name1 recipe_name2 ... \n \
> + or multilib-check world")
> +
> +def generate_multilib_config():
> + os.system("cp -f conf/local.conf conf/local.conf.orig")
> + f = open("conf/local.conf", "a")
> + f.write('require conf/multilib.conf\n')
> + multilibs = ""
> + for i in multilib_arch_tune.keys():
> + f.write('DEFAULTTUNE_virtclass-multilib-%s="%s"\n' % (i, multilib_arch_tune[i]))
> + multilibs += "multilib:%s " % i
> + f.write('MULTILIBS="%s"\n' % multilibs.strip())
> + f.close()
> +
> +def restore_original_config():
> + os.system("mv -f conf/local.conf.orig conf/local.conf")
> +
> +def build_recipe(mach, recipe_name):
> + print("INFO: Building %s ..." % recipe_name)
> + return os.system("MACHINE=%s bitbake %s&> /dev/null" % (mach, recipe_name))
> +
> +def get_variable(mach, recipe_name, variable):
> + return os.popen('bitbake -e %s | grep "^%s="' % (recipe_name, variable)).readline().split("%s=" % variable)[1].strip("\"\n")
> +
> +# Check if dir2 contains the same set of files as in dir1.
> +def compare_folders(dir1, dir2):
> + if not os.path.exists(dir1):
> + return
> + for i in os.listdir(dir1):
> + path_normal = os.path.join(dir1, i)
> + path_multilib = os.path.join(dir2, i)
> +
> + if not os.path.exists(path_multilib):
> + print("ERROR: %s exists while %s doesn't" % (path_normal, path_multilib))
> + continue
> +
> + if os.path.isdir(path_normal):
> + if not os.path.isdir(path_multilib):
> + print("ERROR: %s is a directory while %s is a file" % (path_normal, path_multilib))
> + continue
> + compare_folders(path_normal, path_multilib)
> + else:
> + if not os.path.isfile(path_multilib):
> + print("ERROR: %s is a file while %s is a directory" % (path_normal, path_multilib))
> +
> +def multilib_sanity_check(rootdir_normal, baselib_normal, rootdir_multilib, baselib_multilib):
> + compare_folders(rootdir_normal+"/usr/"+baselib_normal, rootdir_multilib+"/usr/"+baselib_multilib)
> + compare_folders(rootdir_normal+"/"+baselib_normal, rootdir_multilib+"/"+baselib_multilib)
> +
> +# Use bitbake -s to get the recipe list, for example "world"
> +def get_recipe_list(name):
> + begin = False
> + recipe_list = []
> + fd = os.popen('bitbake -s %s' % name)
> + for i in fd:
> + if i.startswith("============"):
> + begin = True
> + continue
> + if begin and i.strip("\n"):
> + recipe_name = i.split()[0].strip()
> + if "native" in recipe_name:
> + continue
> + else:
> + recipe_list.append(recipe_name)
> +
> + return recipe_list
> +
> +def main():
> + if len(sys.argv)<= 1:
> + usage()
> + exit(1)
> + elif len(sys.argv) == 2 and sys.argv[1] == "world":
> + recipe_list = get_recipe_list("world")
> + else:
> + recipe_list = sys.argv[1:]
> +
> + mach = machine
> + generate_multilib_config()
> + try:
> + for i in range(0, len(recipe_list)):
> + print("INFO: checking for recipe %s ..." % recipe_list[i])
> + ret = build_recipe(mach, recipe_list[i])
> + if ret:
> + print("ERROR: Build %s failed" % recipe_list[i])
> + continue
> + rootdir_normal = get_variable(mach, recipe_list[i], "WORKDIR") + "/image"
> + baselib_normal = get_variable(mach, recipe_list[i], "baselib")
> +
> + for j in multilib_arch_tune.keys():
> + ret = build_recipe(mach, j + "-" + recipe_list[i])
> + if ret:
> + print("ERROR: Build %s failed" % (j + "-" + recipe_list[i]))
> + continue
> + rootdir_multilib = get_variable(mach, j + "-" + recipe_list[i], "WORKDIR") + "/image"
> + baselib_multilib = get_variable(mach, j + "-" + recipe_list[i], "baselib")
> +
> + multilib_sanity_check(rootdir_normal, baselib_normal, rootdir_multilib, baselib_multilib)
> + except Exception as e:
> + print "ERROR: %s" % e
> + finally:
> + restore_original_config()
> +
> +main()
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] scripts/multilib-check: Check for multilib build results
2012-07-02 22:40 ` Saul Wold
@ 2012-07-02 22:50 ` Xu, Dongxiao
2012-07-06 2:53 ` Xu, Dongxiao
0 siblings, 1 reply; 6+ messages in thread
From: Xu, Dongxiao @ 2012-07-02 22:50 UTC (permalink / raw)
To: Saul Wold; +Cc: poky@yoctoproject.org
> -----Original Message-----
> From: Saul Wold [mailto:sgw@linux.intel.com]
> Sent: Tuesday, July 03, 2012 6:41 AM
> To: Xu, Dongxiao
> Cc: poky@yoctoproject.org
> Subject: Re: [poky] [PATCH 1/1] scripts/multilib-check: Check for multilib build
> results
>
> On 07/02/2012 03:09 PM, Dongxiao Xu wrote:
> > This script is used to check whether the multilib build for a certain
> > recipe outcomes the right files/directories.
> >
> > The usage for the script is:
> >
> > $ source oe-init-build-env
> > $ multilib-check recipeA recipeB ...
> >
> > or
> >
> > $ source oe-init-build-env
> > $ multilib-check world
> >
> Is there a reason that this is an external script rather than a default test as
> part of insane.bbclass.
The method in my script is based on the comparison between a normal build "WORKDIR/image" and a multilib build "WORKDIR/image", and this is not easy to achieve in insane.bbclass.
Or do you have other ideas on how to perform this check? Suggestions are welcome. :-)
Another thought for adding it as a separate script is that, we don't need to run this script for each build, only recipe owner or multilib feature owner may need this script to check whether certain recipe is multilib enabled or not.
>
> Maybe you have been in touch with RP about this?
No, we haven't discussed it before, this is the first draft.
>
> Also I think this should be part of oe-core, not in poky only.
If we do it in a separate script, where we should put for OE-Core?
Thanks,
Dongxiao
>
> Thanks
>
> Sau!
>
> > This fixes [YOCTO #2038]
> >
> > Signed-off-by: Dongxiao Xu<dongxiao.xu@intel.com>
> > ---
> > scripts/multilib-check | 117
> ++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 117 insertions(+), 0 deletions(-)
> > create mode 100755 scripts/multilib-check
> >
> > diff --git a/scripts/multilib-check b/scripts/multilib-check new file
> > mode 100755 index 0000000..69a5dd3
> > --- /dev/null
> > +++ b/scripts/multilib-check
> > @@ -0,0 +1,117 @@
> > +#!/usr/bin/env python
> > +
> > +import os
> > +import os.path
> > +import sys
> > +
> > +# AAA: BBB
> > +# AAA is the multilib prefix, BBB is its DEFAULTTUNE.
> > +multilib_arch_tune = {"lib32": "x86", "lib64": "x86-64"}
> > +
> > +# The machine we now support is x86 and x86-64.
> > +machine = "qemux86"
> > +
> > +def usage():
> > + print("Usage: multilib-check recipe_name1 recipe_name2 ... \n \
> > + or multilib-check world")
> > +
> > +def generate_multilib_config():
> > + os.system("cp -f conf/local.conf conf/local.conf.orig")
> > + f = open("conf/local.conf", "a")
> > + f.write('require conf/multilib.conf\n')
> > + multilibs = ""
> > + for i in multilib_arch_tune.keys():
> > + f.write('DEFAULTTUNE_virtclass-multilib-%s="%s"\n' % (i,
> multilib_arch_tune[i]))
> > + multilibs += "multilib:%s " % i
> > + f.write('MULTILIBS="%s"\n' % multilibs.strip())
> > + f.close()
> > +
> > +def restore_original_config():
> > + os.system("mv -f conf/local.conf.orig conf/local.conf")
> > +
> > +def build_recipe(mach, recipe_name):
> > + print("INFO: Building %s ..." % recipe_name)
> > + return os.system("MACHINE=%s bitbake %s&> /dev/null" % (mach,
> > +recipe_name))
> > +
> > +def get_variable(mach, recipe_name, variable):
> > + return os.popen('bitbake -e %s | grep "^%s="' % (recipe_name,
> > +variable)).readline().split("%s=" % variable)[1].strip("\"\n")
> > +
> > +# Check if dir2 contains the same set of files as in dir1.
> > +def compare_folders(dir1, dir2):
> > + if not os.path.exists(dir1):
> > + return
> > + for i in os.listdir(dir1):
> > + path_normal = os.path.join(dir1, i)
> > + path_multilib = os.path.join(dir2, i)
> > +
> > + if not os.path.exists(path_multilib):
> > + print("ERROR: %s exists while %s doesn't" % (path_normal,
> path_multilib))
> > + continue
> > +
> > + if os.path.isdir(path_normal):
> > + if not os.path.isdir(path_multilib):
> > + print("ERROR: %s is a directory while %s is a file" %
> (path_normal, path_multilib))
> > + continue
> > + compare_folders(path_normal, path_multilib)
> > + else:
> > + if not os.path.isfile(path_multilib):
> > + print("ERROR: %s is a file while %s is a directory" %
> > + (path_normal, path_multilib))
> > +
> > +def multilib_sanity_check(rootdir_normal, baselib_normal, rootdir_multilib,
> baselib_multilib):
> > + compare_folders(rootdir_normal+"/usr/"+baselib_normal,
> rootdir_multilib+"/usr/"+baselib_multilib)
> > + compare_folders(rootdir_normal+"/"+baselib_normal,
> > +rootdir_multilib+"/"+baselib_multilib)
> > +
> > +# Use bitbake -s to get the recipe list, for example "world"
> > +def get_recipe_list(name):
> > + begin = False
> > + recipe_list = []
> > + fd = os.popen('bitbake -s %s' % name)
> > + for i in fd:
> > + if i.startswith("============"):
> > + begin = True
> > + continue
> > + if begin and i.strip("\n"):
> > + recipe_name = i.split()[0].strip()
> > + if "native" in recipe_name:
> > + continue
> > + else:
> > + recipe_list.append(recipe_name)
> > +
> > + return recipe_list
> > +
> > +def main():
> > + if len(sys.argv)<= 1:
> > + usage()
> > + exit(1)
> > + elif len(sys.argv) == 2 and sys.argv[1] == "world":
> > + recipe_list = get_recipe_list("world")
> > + else:
> > + recipe_list = sys.argv[1:]
> > +
> > + mach = machine
> > + generate_multilib_config()
> > + try:
> > + for i in range(0, len(recipe_list)):
> > + print("INFO: checking for recipe %s ..." % recipe_list[i])
> > + ret = build_recipe(mach, recipe_list[i])
> > + if ret:
> > + print("ERROR: Build %s failed" % recipe_list[i])
> > + continue
> > + rootdir_normal = get_variable(mach, recipe_list[i],
> "WORKDIR") + "/image"
> > + baselib_normal = get_variable(mach, recipe_list[i],
> > + "baselib")
> > +
> > + for j in multilib_arch_tune.keys():
> > + ret = build_recipe(mach, j + "-" + recipe_list[i])
> > + if ret:
> > + print("ERROR: Build %s failed" % (j + "-" +
> recipe_list[i]))
> > + continue
> > + rootdir_multilib = get_variable(mach, j + "-" +
> recipe_list[i], "WORKDIR") + "/image"
> > + baselib_multilib = get_variable(mach, j + "-" +
> > + recipe_list[i], "baselib")
> > +
> > + multilib_sanity_check(rootdir_normal, baselib_normal,
> rootdir_multilib, baselib_multilib)
> > + except Exception as e:
> > + print "ERROR: %s" % e
> > + finally:
> > + restore_original_config()
> > +
> > +main()
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1][PULL] Multilib: add sanity check script
2012-07-02 22:09 [PATCH 0/1][PULL] Multilib: add sanity check script Dongxiao Xu
2012-07-02 22:09 ` [PATCH 1/1] scripts/multilib-check: Check for multilib build results Dongxiao Xu
@ 2012-07-05 1:36 ` Xu, Dongxiao
1 sibling, 0 replies; 6+ messages in thread
From: Xu, Dongxiao @ 2012-07-05 1:36 UTC (permalink / raw)
To: poky@yoctoproject.org
Do you have any comment on this one?
Thanks,
Dongxiao
> -----Original Message-----
> From: poky-bounces@yoctoproject.org
> [mailto:poky-bounces@yoctoproject.org] On Behalf Of Dongxiao Xu
> Sent: Tuesday, July 03, 2012 6:09 AM
> To: poky@yoctoproject.org
> Subject: [poky] [PATCH 0/1][PULL] Multilib: add sanity check script
>
> Hi Richard,
>
> This pull request is to add sanity check for multilib, please help to review and
> pull.
>
> Thanks,
> Dongxiao
>
> The following changes since commit
> 644ad4bf1e30fcee4b9d5abb819046d1f2193d27:
>
> documentation/bsp-guide/bsp.xml: Yocto term paring (2012-07-02 16:47:45
> +0100)
>
> are available in the git repository at:
> git://git.pokylinux.org/poky-contrib dxu4/multilib-check
> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/multilib-check
>
> Dongxiao Xu (1):
> scripts/multilib-check: Check for multilib build results
>
> scripts/multilib-check | 117
> ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 117 insertions(+), 0 deletions(-) create mode 100755
> scripts/multilib-check
>
> --
> 1.7.4.1
>
> _______________________________________________
> poky mailing list
> poky@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] scripts/multilib-check: Check for multilib build results
2012-07-02 22:50 ` Xu, Dongxiao
@ 2012-07-06 2:53 ` Xu, Dongxiao
0 siblings, 0 replies; 6+ messages in thread
From: Xu, Dongxiao @ 2012-07-06 2:53 UTC (permalink / raw)
To: Saul Wold, Richard Purdie (richard.purdie@linuxfoundation.org)
Cc: poky@yoctoproject.org
Hi Richard,
Do you have specific comment on this one?
Thanks,
Dongxiao
> -----Original Message-----
> From: poky-bounces@yoctoproject.org
> [mailto:poky-bounces@yoctoproject.org] On Behalf Of Xu, Dongxiao
> Sent: Tuesday, July 03, 2012 6:50 AM
> To: Saul Wold
> Cc: poky@yoctoproject.org
> Subject: Re: [poky] [PATCH 1/1] scripts/multilib-check: Check for multilib build
> results
>
> > -----Original Message-----
> > From: Saul Wold [mailto:sgw@linux.intel.com]
> > Sent: Tuesday, July 03, 2012 6:41 AM
> > To: Xu, Dongxiao
> > Cc: poky@yoctoproject.org
> > Subject: Re: [poky] [PATCH 1/1] scripts/multilib-check: Check for
> > multilib build results
> >
> > On 07/02/2012 03:09 PM, Dongxiao Xu wrote:
> > > This script is used to check whether the multilib build for a
> > > certain recipe outcomes the right files/directories.
> > >
> > > The usage for the script is:
> > >
> > > $ source oe-init-build-env
> > > $ multilib-check recipeA recipeB ...
> > >
> > > or
> > >
> > > $ source oe-init-build-env
> > > $ multilib-check world
> > >
> > Is there a reason that this is an external script rather than a
> > default test as part of insane.bbclass.
>
> The method in my script is based on the comparison between a normal build
> "WORKDIR/image" and a multilib build "WORKDIR/image", and this is not easy
> to achieve in insane.bbclass.
> Or do you have other ideas on how to perform this check? Suggestions are
> welcome. :-)
>
> Another thought for adding it as a separate script is that, we don't need to run
> this script for each build, only recipe owner or multilib feature owner may need
> this script to check whether certain recipe is multilib enabled or not.
>
> >
> > Maybe you have been in touch with RP about this?
>
> No, we haven't discussed it before, this is the first draft.
>
> >
> > Also I think this should be part of oe-core, not in poky only.
>
> If we do it in a separate script, where we should put for OE-Core?
>
> Thanks,
> Dongxiao
>
> >
> > Thanks
> >
> > Sau!
> >
> > > This fixes [YOCTO #2038]
> > >
> > > Signed-off-by: Dongxiao Xu<dongxiao.xu@intel.com>
> > > ---
> > > scripts/multilib-check | 117
> > ++++++++++++++++++++++++++++++++++++++++++++++++
> > > 1 files changed, 117 insertions(+), 0 deletions(-)
> > > create mode 100755 scripts/multilib-check
> > >
> > > diff --git a/scripts/multilib-check b/scripts/multilib-check new
> > > file mode 100755 index 0000000..69a5dd3
> > > --- /dev/null
> > > +++ b/scripts/multilib-check
> > > @@ -0,0 +1,117 @@
> > > +#!/usr/bin/env python
> > > +
> > > +import os
> > > +import os.path
> > > +import sys
> > > +
> > > +# AAA: BBB
> > > +# AAA is the multilib prefix, BBB is its DEFAULTTUNE.
> > > +multilib_arch_tune = {"lib32": "x86", "lib64": "x86-64"}
> > > +
> > > +# The machine we now support is x86 and x86-64.
> > > +machine = "qemux86"
> > > +
> > > +def usage():
> > > + print("Usage: multilib-check recipe_name1 recipe_name2 ... \n \
> > > + or multilib-check world")
> > > +
> > > +def generate_multilib_config():
> > > + os.system("cp -f conf/local.conf conf/local.conf.orig")
> > > + f = open("conf/local.conf", "a")
> > > + f.write('require conf/multilib.conf\n')
> > > + multilibs = ""
> > > + for i in multilib_arch_tune.keys():
> > > + f.write('DEFAULTTUNE_virtclass-multilib-%s="%s"\n' % (i,
> > multilib_arch_tune[i]))
> > > + multilibs += "multilib:%s " % i
> > > + f.write('MULTILIBS="%s"\n' % multilibs.strip())
> > > + f.close()
> > > +
> > > +def restore_original_config():
> > > + os.system("mv -f conf/local.conf.orig conf/local.conf")
> > > +
> > > +def build_recipe(mach, recipe_name):
> > > + print("INFO: Building %s ..." % recipe_name)
> > > + return os.system("MACHINE=%s bitbake %s&> /dev/null" % (mach,
> > > +recipe_name))
> > > +
> > > +def get_variable(mach, recipe_name, variable):
> > > + return os.popen('bitbake -e %s | grep "^%s="' % (recipe_name,
> > > +variable)).readline().split("%s=" % variable)[1].strip("\"\n")
> > > +
> > > +# Check if dir2 contains the same set of files as in dir1.
> > > +def compare_folders(dir1, dir2):
> > > + if not os.path.exists(dir1):
> > > + return
> > > + for i in os.listdir(dir1):
> > > + path_normal = os.path.join(dir1, i)
> > > + path_multilib = os.path.join(dir2, i)
> > > +
> > > + if not os.path.exists(path_multilib):
> > > + print("ERROR: %s exists while %s doesn't" %
> > > + (path_normal,
> > path_multilib))
> > > + continue
> > > +
> > > + if os.path.isdir(path_normal):
> > > + if not os.path.isdir(path_multilib):
> > > + print("ERROR: %s is a directory while %s is a file"
> > > + %
> > (path_normal, path_multilib))
> > > + continue
> > > + compare_folders(path_normal, path_multilib)
> > > + else:
> > > + if not os.path.isfile(path_multilib):
> > > + print("ERROR: %s is a file while %s is a directory"
> > > + % (path_normal, path_multilib))
> > > +
> > > +def multilib_sanity_check(rootdir_normal, baselib_normal,
> > > +rootdir_multilib,
> > baselib_multilib):
> > > + compare_folders(rootdir_normal+"/usr/"+baselib_normal,
> > rootdir_multilib+"/usr/"+baselib_multilib)
> > > + compare_folders(rootdir_normal+"/"+baselib_normal,
> > > +rootdir_multilib+"/"+baselib_multilib)
> > > +
> > > +# Use bitbake -s to get the recipe list, for example "world"
> > > +def get_recipe_list(name):
> > > + begin = False
> > > + recipe_list = []
> > > + fd = os.popen('bitbake -s %s' % name)
> > > + for i in fd:
> > > + if i.startswith("============"):
> > > + begin = True
> > > + continue
> > > + if begin and i.strip("\n"):
> > > + recipe_name = i.split()[0].strip()
> > > + if "native" in recipe_name:
> > > + continue
> > > + else:
> > > + recipe_list.append(recipe_name)
> > > +
> > > + return recipe_list
> > > +
> > > +def main():
> > > + if len(sys.argv)<= 1:
> > > + usage()
> > > + exit(1)
> > > + elif len(sys.argv) == 2 and sys.argv[1] == "world":
> > > + recipe_list = get_recipe_list("world")
> > > + else:
> > > + recipe_list = sys.argv[1:]
> > > +
> > > + mach = machine
> > > + generate_multilib_config()
> > > + try:
> > > + for i in range(0, len(recipe_list)):
> > > + print("INFO: checking for recipe %s ..." % recipe_list[i])
> > > + ret = build_recipe(mach, recipe_list[i])
> > > + if ret:
> > > + print("ERROR: Build %s failed" % recipe_list[i])
> > > + continue
> > > + rootdir_normal = get_variable(mach, recipe_list[i],
> > "WORKDIR") + "/image"
> > > + baselib_normal = get_variable(mach, recipe_list[i],
> > > + "baselib")
> > > +
> > > + for j in multilib_arch_tune.keys():
> > > + ret = build_recipe(mach, j + "-" + recipe_list[i])
> > > + if ret:
> > > + print("ERROR: Build %s failed" % (j + "-" +
> > recipe_list[i]))
> > > + continue
> > > + rootdir_multilib = get_variable(mach, j + "-" +
> > recipe_list[i], "WORKDIR") + "/image"
> > > + baselib_multilib = get_variable(mach, j + "-" +
> > > + recipe_list[i], "baselib")
> > > +
> > > + multilib_sanity_check(rootdir_normal,
> > > + baselib_normal,
> > rootdir_multilib, baselib_multilib)
> > > + except Exception as e:
> > > + print "ERROR: %s" % e
> > > + finally:
> > > + restore_original_config()
> > > +
> > > +main()
> _______________________________________________
> poky mailing list
> poky@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-07-06 2:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 22:09 [PATCH 0/1][PULL] Multilib: add sanity check script Dongxiao Xu
2012-07-02 22:09 ` [PATCH 1/1] scripts/multilib-check: Check for multilib build results Dongxiao Xu
2012-07-02 22:40 ` Saul Wold
2012-07-02 22:50 ` Xu, Dongxiao
2012-07-06 2:53 ` Xu, Dongxiao
2012-07-05 1:36 ` [PATCH 0/1][PULL] Multilib: add sanity check script Xu, Dongxiao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.