[elbe-devel] [PATCH 7/9] finetuning: implement ImageFinetuningAction <extract_partition>

Torben Hohn torben.hohn at linutronix.de
Tue Dec 4 17:00:32 CET 2018


On Fri, Nov 30, 2018 at 03:25:02PM +0100, Manuel Traut wrote:
> On 17:29 Wed 28 Nov     , Torben Hohn wrote:
> > extract partition extracts a single partition image from
> > the "currently mounted" (using <mount_drive>) loop device.
> > 
> > The extracted partition image is marked for gzip compression.
> 
> Ack - however if i merge it, i would open an issue, that we make the
> compression configurable with an attribute for all kind of images.

The plan is actually to add an action to <project-finetuning>
to allow to modify entries in target.image_packers.
This would make the packers configurable...

> 
> > ---
> >  elbepack/finetuning.py | 26 ++++++++++++++++++++++++++
> >  schema/dbsfed.xsd      | 22 ++++++++++++++++++++++
> >  2 files changed, 48 insertions(+)
> > 
> > diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
> > index c53b13c6..3e395722 100644
> > --- a/elbepack/finetuning.py
> > +++ b/elbepack/finetuning.py
> > @@ -569,6 +569,32 @@ class MountDriveImageAction(FinetuningAction):
> >  FinetuningAction.register(MountDriveImageAction)
> >  
> >  
> > +class ExtractPartitionAction(ImageFinetuningAction):
> > +
> > +    tag = 'extract_partition'
> > +
> > +    def __init__(self, node):
> > +        ImageFinetuningAction.__init__(self, node)
> > +
> > +    def execute(self, _log, _buildenv, _target):
> > +        raise NotImplementedError("<extract_partition> may only be "
> > +                                  "used in <mount_drive>")
> > +
> > +    def execute_img(self, log, _buildenv, target, builddir, loop_dev):
> > +        part_nr = self.node.et.attrib['part']
> > +        imgname = os.path.join(builddir, self.node.et.text)
> > +
> > +        cmd = 'dd if=%sp%s of="%s"' % (loop_dev, part_nr, imgname)
> > +
> > +        log.do(cmd)
> > +
> > +        target.images.append(self.node.et.text)
> > +        target.image_packers[self.node.et.text] = ('gzip -f', '.gz')
> > +
> > +
> > +FinetuningAction.register(ExtractPartitionAction)
> > +
> > +
> >  def do_finetuning(xml, log, buildenv, target):
> >  
> >      if not xml.has('target/finetuning'):
> > diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
> > index d9317c72..bb3a7cdf 100644
> > --- a/schema/dbsfed.xsd
> > +++ b/schema/dbsfed.xsd
> > @@ -1923,9 +1923,31 @@
> >        </documentation>
> >      </annotation>
> >      <choice>
> > +      <element name="extract_partition" type="rfs:extract_partition" minOccurs="0">
> > +        <annotation>
> > +          <documentation>
> > +            Extract a Partition from the currently mounted loop device.
> > +          </documentation>
> > +        </annotation>
> > +      </element>
> >      </choice>
> >    </group>
> >  
> > +  <complexType name="extract_partition">
> > +    <annotation>
> > +      <documentation>
> > +        Describe the partition to be extracted (nr) and the destination filename.
> > +	The value of the tag describes the filename of the generated Imagefile.
> > +	The Image is per default compressed with gzip afterwards.
> > +      </documentation>
> > +    </annotation>
> > +    <simpleContent>
> > +      <extension base="rfs:string">
> > +        <attribute name="part" type="integer" use="required" />
> > +      </extension>
> > +    </simpleContent>
> > +  </complexType>
> > +
> >    <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

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20181204/03961d6f/attachment.sig>


More information about the elbe-devel mailing list