[v2,0/4] Rewrite the image-account-extension in python

Message ID 20230509074412.86392-1-tobias.schaffner@siemens.com
Headers show
Series Rewrite the image-account-extension in python | expand

Message

Tobias Schaffner May 9, 2023, 7:44 a.m. UTC
From: Tobias Schaffner <tobias.schaffner@siemens.com>

This allows us to drop a lot of encoding and parsing code that was used
to transition to shell and therefore makes it easier to read and maintain.

Using python functions for more complex tasks allows us the usage of
unittests. A very basic infrastructure for unittesting using the build
in python unittest and the bb.parse module was added. This was used to
test the re-implementation of the image-account-extension as a first
showcase.

This is a rebased version of the refactoring part of the "allow creation
of users/groups before rootfs creation" patch series to decouple the
merge of the simplifications.

Changes since v1:
- Fix wrong yeaar in copyright of image-account-extension

Tobias Schaffner (4):
  simplify image-account-extension
  create a minimal python unittest infrastructure
  add unittests for the image-account-extension
  set minimal python version in user_manual to 3.5

 doc/user_manual.md                            |   2 +-
 meta/classes/image-account-extension.bbclass  | 368 ++++++------------
 testsuite/unittests/README.md                 |  28 ++
 testsuite/unittests/bitbake.py                |  37 ++
 testsuite/unittests/rootfs.py                 |  45 +++
 .../unittests/test_image_account_extension.py | 145 +++++++
 6 files changed, 380 insertions(+), 245 deletions(-)
 create mode 100644 testsuite/unittests/README.md
 create mode 100644 testsuite/unittests/bitbake.py
 create mode 100644 testsuite/unittests/rootfs.py
 create mode 100644 testsuite/unittests/test_image_account_extension.py

Comments

Uladzimir Bely May 22, 2023, 4:41 a.m. UTC | #1
On Tue, 2023-05-09 at 09:44 +0200, 'T. Schaffner' via isar-users wrote:
> From: Tobias Schaffner <tobias.schaffner@siemens.com>
> 
> This allows us to drop a lot of encoding and parsing code that was
> used
> to transition to shell and therefore makes it easier to read and
> maintain.
> 
> Using python functions for more complex tasks allows us the usage of
> unittests. A very basic infrastructure for unittesting using the
> build
> in python unittest and the bb.parse module was added. This was used
> to
> test the re-implementation of the image-account-extension as a first
> showcase.
> 
> This is a rebased version of the refactoring part of the "allow
> creation
> of users/groups before rootfs creation" patch series to decouple the
> merge of the simplifications.
> 
> Changes since v1:
> - Fix wrong yeaar in copyright of image-account-extension
> 
> Tobias Schaffner (4):
>   simplify image-account-extension
>   create a minimal python unittest infrastructure
>   add unittests for the image-account-extension
>   set minimal python version in user_manual to 3.5
> 
>  doc/user_manual.md                            |   2 +-
>  meta/classes/image-account-extension.bbclass  | 368 ++++++----------
> --
>  testsuite/unittests/README.md                 |  28 ++
>  testsuite/unittests/bitbake.py                |  37 ++
>  testsuite/unittests/rootfs.py                 |  45 +++
>  .../unittests/test_image_account_extension.py | 145 +++++++
>  6 files changed, 380 insertions(+), 245 deletions(-)
>  create mode 100644 testsuite/unittests/README.md
>  create mode 100644 testsuite/unittests/bitbake.py
>  create mode 100644 testsuite/unittests/rootfs.py
>  create mode 100644
> testsuite/unittests/test_image_account_extension.py
> 
> -- 
> 2.34.1
> 


While testing this in CI, got the following error while building any
targets:

/usr/sbin/groupmod: unrecognized option '--system'

I didn't deeply debug why exactly this arg comes to gropmod. The
strange thing is that there are no visible errors in
do_image_postprocess log, while build in general fails. See the
attachments.
Uladzimir Bely May 22, 2023, 4:57 a.m. UTC | #2
On Mon, 2023-05-22 at 07:41 +0300, Uladzimir Bely wrote:
> 
> 
> While testing this in CI, got the following error while building any
> targets:
> 
> /usr/sbin/groupmod: unrecognized option '--system'
> 
> I didn't deeply debug why exactly this arg comes to gropmod. The
> strange thing is that there are no visible errors in
> do_image_postprocess log, while build in general fails. See the
> attachments.
> 

P.S. It seems, `groupadd` has "--system" option, since `groupmod`
doesn't have it. I guess, this should be handled in the new version of
the patch.
Tobias Schaffner May 22, 2023, 6:52 a.m. UTC | #3
On 22.05.23 06:57, Uladzimir Bely wrote:
> On Mon, 2023-05-22 at 07:41 +0300, Uladzimir Bely wrote:
>>
>>
>> While testing this in CI, got the following error while building any
>> targets:
>>
>> /usr/sbin/groupmod: unrecognized option '--system'
>>
>> I didn't deeply debug why exactly this arg comes to gropmod. The
>> strange thing is that there are no visible errors in
>> do_image_postprocess log, while build in general fails. See the
>> attachments.
>>
> 
> P.S. It seems, `groupadd` has "--system" option, since `groupmod`
> doesn't have it. I guess, this should be handled in the new version of
> the patch.

Good catch. Thanks!