[PATCH 02/16] meta: classes: use base.bbclass from bitbake

102 views
Skip to first unread message

Henning Schild

unread,
Aug 1, 2017, 6:16:00 AM8/1/17
to isar-...@googlegroups.com, Henning Schild
Do not use our own copy of that class and move local deviations into
isar-base. That also fixes the default tasks "showdata" and "listtasks",
which probably never worked.

Signed-off-by: Henning Schild <henning...@siemens.com>
---
meta/classes/base.bbclass | 81 +-----------------------------------------
meta/classes/dpkg.bbclass | 2 ++
meta/classes/ext4-img.bbclass | 2 ++
meta/classes/isar-base.bbclass | 15 ++++++++
4 files changed, 20 insertions(+), 80 deletions(-)
mode change 100644 => 120000 meta/classes/base.bbclass
create mode 100644 meta/classes/isar-base.bbclass

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
deleted file mode 100644
index 48b6bac..0000000
--- a/meta/classes/base.bbclass
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright (C) 2003 Chris Larson
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-
-THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}"
-
-die() {
- bbfatal "$*"
-}
-
-bbnote() {
- echo "NOTE:" "$*"
-}
-
-bbwarn() {
- echo "WARNING:" "$*"
-}
-
-bbfatal() {
- echo "FATAL:" "$*"
- exit 1
-}
-
-bbdebug() {
- test $# -ge 2 || {
- echo "Usage: bbdebug level \"message\""
- exit 1
- }
-
- test ${@bb.msg.debug_level['default']} -ge $1 && {
- shift
- echo "DEBUG:" $*
- }
-}
-
-addtask showdata
-do_showdata[nostamp] = "1"
-python do_showdata() {
- import sys
- # emit variables and shell functions
- bb.data.emit_env(sys.__stdout__, d, True)
- # emit the metadata which isnt valid shell
- for e in bb.data.keys(d):
- if bb.data.getVarFlag(e, 'python', d):
- sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
-}
-
-addtask listtasks
-do_listtasks[nostamp] = "1"
-python do_listtasks() {
- import sys
- for e in bb.data.keys(d):
- if bb.data.getVarFlag(e, 'task', d):
- sys.__stdout__.write("%s\n" % e)
-}
-
-addtask build
-do_build[dirs] = "${TOPDIR}"
-python base_do_build () {
- bb.note("The included, default BB base.bbclass does not define a useful default task.")
- bb.note("Try running the 'listtasks' task against a .bb to see what tasks are defined.")
-}
-
-EXPORT_FUNCTIONS do_clean do_mrproper do_build
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
new file mode 120000
index 0000000..11fe0a4
--- /dev/null
+++ b/meta/classes/base.bbclass
@@ -0,0 +1 @@
+../../bitbake/classes/base.bbclass
\ No newline at end of file
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index a0446d7..3d7aafb 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -1,6 +1,8 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2016 ilbers GmbH

+inherit isar-base
+
# Add dependency from buildchroot creation
DEPENDS += "buildchroot"
do_unpack[deptask] = "do_build"
diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass
index 6dc2039..eb23d06 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -1,6 +1,8 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2016 ilbers GmbH

+inherit isar-base
+
# Extra space for rootfs in MB
ROOTFS_EXTRA ?= "64"

diff --git a/meta/classes/isar-base.bbclass b/meta/classes/isar-base.bbclass
new file mode 100644
index 0000000..0432880
--- /dev/null
+++ b/meta/classes/isar-base.bbclass
@@ -0,0 +1,15 @@
+THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}"
+
+bbdebug() {
+ test $# -ge 2 || {
+ echo "Usage: bbdebug level \"message\""
+ exit 1
+ }
+
+ test ${@bb.msg.debug_level['default']} -ge $1 && {
+ shift
+ echo "DEBUG:" $*
+ }
+}
+
+do_build[nostamp] = "0"
--
2.13.0

Alexander Smirnov

unread,
Aug 2, 2017, 4:21:08 AM8/2/17
to Henning Schild, isar-...@googlegroups.com
Added list to Cc.

2017-08-02 11:05 GMT+03:00 Alexander Smirnov <alex.blues...@gmail.com>:
Hi,

2017-08-01 13:17 GMT+03:00 Henning Schild <henning...@siemens.com>:
Do not use our own copy of that class and move local deviations into
isar-base. That also fixes the default tasks "showdata" and "listtasks",
which probably never worked.


Good point! Initially we forked from original base class with thougths, that we will completely rework it, but now I see that this didn't happen.
Could you please add your copyright and mention MIT license.
 
+THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}"
+
+bbdebug() {
+       test $# -ge 2 || {
+               echo "Usage: bbdebug level \"message\""
+               exit 1
+       }
+
+       test ${@bb.msg.debug_level['default']} -ge $1 && {
+               shift
+               echo "DEBUG:" $*
+       }
+}
+
+do_build[nostamp] = "0"
--
2.13.0

--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To post to this group, send email to isar-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/179751c2d650bde36808d0a0cfe6cdf840b171e3.1501582237.git.henning.schild%40siemens.com.
For more options, visit https://groups.google.com/d/optout.


Henning Schild

unread,
Aug 3, 2017, 7:54:05 AM8/3/17
to isar-...@googlegroups.com, Alexander Smirnov, Henning Schild
Do not use our own copy of that class and move local deviations into
isar-base. That also fixes the default tasks "showdata" and "listtasks",
which probably never worked.

Signed-off-by: Henning Schild <henning...@siemens.com>
---
meta/classes/base.bbclass | 81 +-----------------------------------------
meta/classes/dpkg.bbclass | 2 ++
meta/classes/ext4-img.bbclass | 2 ++
meta/classes/isar-base.bbclass | 36 +++++++++++++++++++
4 files changed, 41 insertions(+), 80 deletions(-)
index 65d4c11..1486c3e 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -1,6 +1,8 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2016 ilbers GmbH

+inherit isar-base
+
# Extra space for rootfs in MB
ROOTFS_EXTRA ?= "64"

diff --git a/meta/classes/isar-base.bbclass b/meta/classes/isar-base.bbclass
new file mode 100644
index 0000000..67d38a1
--- /dev/null
+++ b/meta/classes/isar-base.bbclass
@@ -0,0 +1,36 @@
+# This software is a part of ISAR.
+# Copyright (C) 2017 Siemens AG
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+

Alexander Smirnov

unread,
Aug 7, 2017, 12:27:44 PM8/7/17
to Henning Schild, isar-...@googlegroups.com
Hi Henning,

thank you for the series! I'm trying to build Isar with your patches but got an error:

ERROR: buildchroot-1.0-r0 do_build: Build of do_build failed
ERROR: buildchroot-1.0-r0 do_build: Traceback (most recent call last):
  File "/home/asmirnov/Work/isar/isar/bitbake/lib/bb/data_smart.py", line 388, in expandWithRefs
    s = __expand_python_regexp__.sub(varparse.python_sub, s)
  File "/home/asmirnov/Work/isar/isar/bitbake/lib/bb/data_smart.py", line 138, in python_sub
    value = utils.better_eval(codeobj, DataContext(self.d), {'d' : self.d})                                                                                                                                       
  File "/home/asmirnov/Work/isar/isar/bitbake/lib/bb/utils.py", line 424, in better_eval                                                                                                                          
    return eval(source, ctx, locals)                                                                                                                                                                              
  File "FILESDIR", line 1, in <module>                                                                                                                                                                            
AttributeError: 'module' object has no attribute 'which'                                                                                                                                                          

The above exception was the direct cause of the following exception:
...

From the internet I got that this problem caused by old python which doesn have 'which' method in 'module' object.
Which python version do you use? My version is python 3.4.2 - this is standard one for Debian-8.

Alexander Smirnov

unread,
Aug 7, 2017, 3:18:37 PM8/7/17
to Henning Schild, isar-...@googlegroups.com
Hi again,

it looks like this patch doesn't work for Isar. 'base.bbclass' is the one which is included by default to any bitbake operation. In the default 'base.bbclass' there is one very bad line:

bitbake/classes/base.bbclass:
51: do_build[nostamp] = "1"

This line disables stamps for build tasks, it completely destroys the pipeline. In your patch you move the line: do_build[nostamp] = "0" to 'isar-base.bbclass'. But to have this construction working you have to explicitely include this class to *every* recipe in Isar, what looks for me as huge overhead.

2017-08-03 14:55 GMT+03:00 Henning Schild <henning...@siemens.com>:

Henning Schild

unread,
Aug 8, 2017, 4:41:36 AM8/8/17
to Alexander Smirnov, isar-...@googlegroups.com
Am Mon, 7 Aug 2017 22:18:36 +0300
schrieb Alexander Smirnov <alex.blues...@gmail.com>:

> Hi again,
>
> it looks like this patch doesn't work for Isar. 'base.bbclass' is the
> one which is included by default to any bitbake operation. In the
> default 'base.bbclass' there is one very bad line:
>
> bitbake/classes/base.bbclass:
> 51: do_build[nostamp] = "1"
>
> This line disables stamps for build tasks, it completely destroys the
> pipeline. In your patch you move the line: do_build[nostamp] = "0" to
> 'isar-base.bbclass'. But to have this construction working you have to
> explicitely include this class to *every* recipe in Isar, what looks
> for me as huge overhead.

Ok i did not know what that line does but since i moved it to isar-base
and every class and recipe includes that, the semantics is kept.

Making sure local changes are always included is less of a problem than
copying files from bitbake and ending up with an outdated copy again.

Every recipe in isar will probably include dpdk-bin or dpdk-src, which
both inherit isar-base. The images also include isar-base.

Henning

Henning Schild

unread,
Aug 8, 2017, 4:50:42 AM8/8/17
to Alexander Smirnov, isar-...@googlegroups.com
Am Mon, 7 Aug 2017 19:27:43 +0300
schrieb Alexander Smirnov <alex.blues...@gmail.com>:

> Hi Henning,
>
> thank you for the series! I'm trying to build Isar with your patches
> but got an error:

Thanks for merging some of the stuff!

> ERROR: buildchroot-1.0-r0 do_build: Build of do_build failed
> ERROR: buildchroot-1.0-r0 do_build: Traceback (most recent call last):
> File "/home/asmirnov/Work/isar/isar/bitbake/lib/bb/data_smart.py",
> line 388, in expandWithRefs
> s = __expand_python_regexp__.sub(varparse.python_sub, s)
> File "/home/asmirnov/Work/isar/isar/bitbake/lib/bb/data_smart.py",
> line 138, in python_sub
> value = utils.better_eval(codeobj, DataContext(self.d), {'d' :
> self.d})
>
>
> File "/home/asmirnov/Work/isar/isar/bitbake/lib/bb/utils.py", line
> 424, in better_eval
>
> return eval(source, ctx, locals)
>
>
> File "FILESDIR", line 1, in <module>
>
>
> AttributeError: 'module' object has no attribute 'which'
>
>
>
> The above exception was the direct cause of the following exception:
> ...
>
> From the internet I got that this problem caused by old python which
> doesn have 'which' method in 'module' object.
> Which python version do you use? My version is python 3.4.2 - this is
> standard one for Debian-8.

I am using 3.4.2 in a Debian-8 container, it just contains a few
Debian-9 packages to fix multistrap host-leakage.
Docker: jankiszka/kas-isar/base

Maybe we build it differently? Could you try the unmodified q on master
as well?

Henning

Alexander Smirnov

unread,
Aug 8, 2017, 5:39:48 AM8/8/17
to Henning Schild, isar-...@googlegroups.com
2017-08-08 11:52 GMT+03:00 Henning Schild <henning...@siemens.com>:
Am Mon, 7 Aug 2017 19:27:43 +0300
schrieb Alexander Smirnov <alex.bluesman.smirnov@gmail.com>:

What I've tried:

1. I have clean Debian-8 in chroot with python 3.4.2 installed.
2. The current master at github.com works good.
3. The paster with your series applied (without any changes from my side) - fails with the error mentioned in this mail.
4. To build I use the following command: bitbake multiconfig:qemuarm-wheezy:isar-image-base

Could you please send the list of python plugins installed?

Alex

Jan Kiszka

unread,
Aug 8, 2017, 7:40:14 AM8/8/17
to [ext] Henning Schild, Alexander Smirnov, isar-...@googlegroups.com
The reference shall be kasproject/kas-isar:0.11.0 now. My repo only
contained test versions.

Jan

--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

Alexander Smirnov

unread,
Aug 8, 2017, 10:02:21 AM8/8/17
to Henning Schild, isar-...@googlegroups.com
2017-08-08 11:43 GMT+03:00 Henning Schild <henning...@siemens.com>:
Am Mon, 7 Aug 2017 22:18:36 +0300
schrieb Alexander Smirnov <alex.bluesman.smirnov@gmail.com>:


> Hi again,
>
> it looks like this patch doesn't work for Isar. 'base.bbclass' is the
> one which is included by default to any bitbake operation. In the
> default 'base.bbclass' there is one very bad line:
>
> bitbake/classes/base.bbclass:
> 51: do_build[nostamp] = "1"
>
> This line disables stamps for build tasks, it completely destroys the
> pipeline. In your patch you move the line: do_build[nostamp] = "0" to
> 'isar-base.bbclass'. But to have this construction working you have to
> explicitely include this class to *every* recipe in Isar, what looks
> for me as huge overhead.

Ok i did not know what that line does but since i moved it to isar-base
and every class and recipe includes that, the semantics is kept.

Making sure local changes are always included is less of a problem than
copying files from bitbake and ending up with an outdated copy again.

We are speaking about sample base class in bitbake tree which by default provides *nothing*. As I can understand, this is just an example which doesn't affect the bitbake functionality. Nor OE, nor Yocto doesn't use it and implement their own base classes. Also in bitbake manual: https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html chapter A4, document proposes you to create your base class.

I was OK with this idea because I assumed that the deafult base class provides correct settings, but now I realized that it doesn't. So keeping broken base class for some reasons and overwrite it in run-time looks too compicated for such simple things.


Every recipe in isar will probably include dpdk-bin or dpdk-src, which
both inherit isar-base. The images also include isar-base.

It's not a question about workaround. It's about knowingly keeping of broken base class and fix it from another class. Meanwhile nothing is used from original base class. I don't really understand why we need base class then...

Alex

Henning Schild

unread,
Aug 8, 2017, 10:13:48 AM8/8/17
to Alexander Smirnov, isar-...@googlegroups.com
Am Tue, 8 Aug 2017 17:02:19 +0300
schrieb Alexander Smirnov <alex.blues...@gmail.com>:

> 2017-08-08 11:43 GMT+03:00 Henning Schild
> <henning...@siemens.com>:
>
> > Am Mon, 7 Aug 2017 22:18:36 +0300
> > schrieb Alexander Smirnov <alex.blues...@gmail.com>:
It provides 'listtasks' and 'showdata' they never used to work but are
handy now that they do. And the logging functions ...

Henning

Henning Schild

unread,
Aug 9, 2017, 9:13:50 AM8/9/17
to Alexander Smirnov, isar-...@googlegroups.com
Am Tue, 8 Aug 2017 12:39:47 +0300
schrieb Alexander Smirnov <alex.blues...@gmail.com>:

> 2017-08-08 11:52 GMT+03:00 Henning Schild
> <henning...@siemens.com>:
>
> > Am Mon, 7 Aug 2017 19:27:43 +0300
> > schrieb Alexander Smirnov <alex.blues...@gmail.com>:
Well it can not be connected to your python version. What should be
called is bb.utils.which and that is implemented in

bitabake/lib/bb/utils.py:914

And not anything from python core. I guess that python is fine and
something else is borked. Can you use any of the other bb.utils in a
simple task?

Henning
Reply all
Reply to author
Forward
0 new messages