[elbe-devel] [PATCH 1/9] finetuning: basic implementation of project-finetuning

Manuel Traut manut at linutronix.de
Fri Nov 30 11:06:53 CET 2018


On 17:28 Wed 28 Nov     , Torben Hohn wrote:
> <project-finetuning> is a set of commands, that run after
> image generation.

Wouldn't be image-tuning be the better name?
(some more comments are inline)

> Possible Usecases are:
> 
> - sign images
> - crypt setup
> - extract partition from image and mark as build artifact.
> - modify images (iE remove some modules from /boot/grub)
> - UEFI / secureboot: make_lxtrainer_secureboot.sh
> - mark files as build artifacts

This is already mentioned in the cover letter and not content of
this change.

Please describe the 'dual' use of finetuning here. And that this
reuses the t2p_mv command.

> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
>  elbepack/elbeproject.py |  7 +++++++
>  elbepack/finetuning.py  | 19 +++++++++++++++++++
>  schema/dbsfed.xsd       | 37 +++++++++++++++++++++++++++++++++++++
>  3 files changed, 63 insertions(+)
> 
> diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
> index 98c0c63a..cc8922e4 100644
> --- a/elbepack/elbeproject.py
> +++ b/elbepack/elbeproject.py
> @@ -37,6 +37,7 @@ from elbepack.repomanager import ProjectRepo
>  from elbepack.config import cfg
>  from elbepack.pkgutils import extract_pkg
>  from elbepack.templates import write_pack_template
> +from elbepack.finetuning import do_prj_finetuning
>  
>  
>  class IncompatibleArchitectureException(Exception):
> @@ -580,6 +581,12 @@ class ElbeProject (object):
>                  self.xml.text("project/name")),
>                  allow_fail=True)
>  
> +        do_prj_finetuning(self.xml,
> +                          self.log,
> +                          self.buildenv,
> +                          self.targetfs,
> +                          self.builddir)
> +
>          os.system('cat "%s"' % self.validationpath)
>  
>      def pdebuild_init(self):
> diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
> index ddce159e..e4f889a2 100644
> --- a/elbepack/finetuning.py
> +++ b/elbepack/finetuning.py
> @@ -40,6 +40,10 @@ class FinetuningAction(object):
>      def execute(self, _log, _buildenv, _target):
>          raise NotImplementedError('execute() not implemented')
>  
> +    def execute_prj(self, log, buildenv, target, _builddir):
> +        self.execute(log, buildenv, target)
> +
> +
>  class RmAction(FinetuningAction):
>  
>      tag = 'rm'
> @@ -481,3 +485,18 @@ def do_finetuning(xml, log, buildenv, target):
>              print("Unimplemented finetuning action '%s'" % (i.et.tag))
>          except CommandError:
>              log.printo("Finetuning Error, trying to continue anyways")
> +
> +
> +def do_prj_finetuning(xml, log, buildenv, target, builddir):
> +
> +    if not xml.has('target/project-finetuning'):
> +        return
> +
> +    for i in xml.node('target/project-finetuning'):
> +        try:
> +            action = FinetuningAction(i)
> +            action.execute_prj(log, buildenv, target, builddir)
> +        except KeyError:
> +            print("Unimplemented finetuning action '%s'" % (i.et.tag))
> +        except CommandError:
> +            log.printo("Finetuning Error, trying to continue anyways")

Please be more clear in the error messages. The code that runs _before_
image generation is called 'finetuning'.

> diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
> index 17aa6283..85cbaff0 100644
> --- a/schema/dbsfed.xsd
> +++ b/schema/dbsfed.xsd
> @@ -830,6 +830,13 @@
>            </documentation>
>          </annotation>
>        </element>
> +      <element name="project-finetuning" type="rfs:project-finetuning" minOccurs="0">
> +        <annotation>
> +          <documentation>
> +            apply the given commands to the target rootfilesystem

after the image was generated.

> +          </documentation>
> +        </annotation>
> +      </element>
>        <element name="pbuilder" type="rfs:pbuilder" minOccurs="0" maxOccurs="1">
>          <annotation>
>            <documentation>
> @@ -1824,6 +1831,36 @@
>      </choice>
>    </group>
>  
> +  <complexType name="project-finetuning">
> +    <annotation>
> +      <documentation>
> +         container for project-finetuning commands; these commands are executed in the
> +         project directory, after the images have been generated.

This can be used for (see your cover letter)..

> +      </documentation>
> +    </annotation>
> +    <sequence>
> +      <group ref="rfs:project-action" minOccurs="0" maxOccurs="unbounded" />
> +    </sequence>
> +    <attribute ref="xml:base"/>
> +  </complexType>
> +
> +  <group name="project-action">
> +    <annotation>
> +      <documentation>
> +        definition of finetuning commands
> +      </documentation>
> +    </annotation>
> +    <choice>
> +      <element name="t2p_mv" type="rfs:cpmv" minOccurs="0">
> +        <annotation>
> +          <documentation>
> +            move a file from the target to the project directory
> +          </documentation>
> +        </annotation>
> +      </element>
> +    </choice>
> +  </group>
> +
>    <complexType name="addgroup">
>      <annotation>
>        <documentation>
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel



More information about the elbe-devel mailing list