[elbe-devel] [PATCH 3/5] finetuning: first implementation of <set_packer>

Torben Hohn torben.hohn at linutronix.de
Mon Jan 28 10:01:14 CET 2019


Add <set_packer> to <project-finetuning>.
This allows to configure different packer algorithms for different
artifacts.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/finetuning.py | 23 ++++++++++++++++++++++-
 schema/dbsfed.xsd      | 23 +++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 896713fa..a7a7a672 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -21,7 +21,7 @@ from elbepack.repomanager import UpdateRepo
 from elbepack.rpcaptcache import get_rpcaptcache
 from elbepack.shellhelper import CommandError
 from elbepack.filesystem import ImgMountFilesystem
-from elbepack.packers import default_packer
+from elbepack.packers import default_packer, packers
 
 
 class FinetuningException(Exception):
@@ -607,6 +607,27 @@ class ImgConvertAction(FinetuningAction):
 FinetuningAction.register(ImgConvertAction)
 
 
+class SetPackerAction(FinetuningAction):
+
+    tag = 'set_packer'
+
+    def __init__(self, node):
+        FinetuningAction.__init__(self, node)
+
+    def execute(self, _log, _buildenv, _target):
+        raise NotImplementedError("<set_packer> may only be "
+                                  "used in <project-finetuning>")
+
+    def execute_prj(self, _log, _buildenv, target, _builddir):
+        img = self.node.et.text
+        packer = self.node.et.attrib['packer']
+
+        target.image_packers[img] = packers[packer]
+
+
+FinetuningAction.register(SetPackerAction)
+
+
 class ExtractPartitionAction(ImageFinetuningAction):
 
     tag = 'extract_partition'
diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index bdd3d013..4740a436 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -1912,6 +1912,13 @@
           </documentation>
         </annotation>
       </element>
+      <element name="set_packer" type="rfs:set_packer" minOccurs="0">
+        <annotation>
+          <documentation>
+	    Specify the packer to use for an artifact.
+          </documentation>
+        </annotation>
+      </element>
     </choice>
   </group>
 
@@ -2048,6 +2055,22 @@
     </simpleContent>
   </complexType>
 
+  <complexType name="set_packer">
+    <annotation>
+      <documentation>
+        Set the packer to use for an artifaxct.
+	The value of the tag describes the filename of the Imagefile.
+	The packer attribute may take the following values:
+	(none, gzip, tar, targz, tarxz)
+      </documentation>
+    </annotation>
+    <simpleContent>
+      <extension base="rfs:string">
+        <attribute name="packer" type="string" use="required" />
+      </extension>
+    </simpleContent>
+  </complexType>
+
   <complexType name="adduser">
     <annotation>
       <documentation>
-- 
2.11.0




More information about the elbe-devel mailing list