[elbe-devel] [PATCH] Add squashfs support

Richard Weinberger richard at nod.at
Mon Apr 20 15:45:49 CEST 2015


Signed-off-by: Richard Weinberger <richard at nod.at>
---
 debian/control         |  3 ++-
 elbepack/dbsfed.xsd    | 26 +++++++++++++++++++++++++-
 elbepack/filesystem.py | 12 ++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index ed13ef7..23925c8 100644
--- a/debian/control
+++ b/debian/control
@@ -85,7 +85,8 @@ Depends: ${misc:Depends},
   qemu-user-static,
   reprepro,
   rsync,
-  kpartx
+  kpartx,
+  squashfs-tools
 Recommends: elbe-daemon (= ${binary:Version}),
   elbe-soap (= ${binary:Version})
 Description: ELBE build environment
diff --git a/elbepack/dbsfed.xsd b/elbepack/dbsfed.xsd
index 21b158b..5d3e9ac 100644
--- a/elbepack/dbsfed.xsd
+++ b/elbepack/dbsfed.xsd
@@ -667,7 +667,7 @@
       <element name="package" type="rfs:package" minOccurs="0" maxOccurs="1">
         <annotation>
           <documentation>
-            package rootfilesystem as a tarball or cpio image
+            package rootfilesystem as a tarball, cpio or a squashfs image
           </documentation>
         </annotation>
       </element>
@@ -1192,6 +1192,13 @@
           </documentation>
         </annotation>
       </element>
+      <element name="squashfs" type="rfs:squashfs" minOccurs="0">
+        <annotation>
+          <documentation>
+             squashfs image of the rootfilesystem
+          </documentation>
+        </annotation>
+      </element>
     </sequence>
   </complexType>
 
@@ -1236,6 +1243,23 @@
     </sequence>
   </complexType>
 
+  <complexType name="squashfs">
+    <annotation>
+      <documentation>
+         describes a squashfs image
+      </documentation>
+    </annotation>
+    <sequence>
+      <element name="name" type="string" minOccurs="0">
+        <annotation>
+          <documentation>
+             filename of the squashfs image
+          </documentation>
+        </annotation>
+      </element>
+    </sequence>
+  </complexType>
+
   <complexType name="partition">
     <annotation>
       <documentation>
diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index f34fb34..49c64b8 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -441,6 +441,18 @@ class TargetFs(ChRootFilesystem):
                 # error was logged; continue
                 pass
 
+        if self.xml.has("target/package/squashfs"):
+            oldwd = os.getcwd()
+            sfs_name = self.xml.text("target/package/squashfs/name")
+            os.chdir(self.fname(''))
+            try:
+                self.log.do("mksquashfs %s %s/%s -noappend -no-progress" % (self.fname(''), targetdir, sfs_name))
+                # only append filename if creating mksquashfs was successful
+                self.images.append (sfs_name)
+            except CommandError as e:
+                # error was logged; continue
+                pass
+
 class BuildImgFs(ChRootFilesystem):
     def __init__(self, path, interpreter):
         ChRootFilesystem.__init__(self, path, interpreter)
-- 
2.3.5





More information about the elbe-devel mailing list