[gnome-build-meta/abderrahim/xz-image: 2/2] vm/image.bst: generate xz compressed raw image instead of qcow2



commit c3cc24b63c9a91308a5e1518c854f39daa57b0f1
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Wed Jul 1 12:24:05 2020 +0100

    vm/image.bst: generate xz compressed raw image instead of qcow2
    
    The resulting image is smaller to download, can be reused for the iso images,
    and xz can recreate sparse files when unpacking.

 elements/vm/image.bst | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/elements/vm/image.bst b/elements/vm/image.bst
index 6d8d7900..2922ec25 100644
--- a/elements/vm/image.bst
+++ b/elements/vm/image.bst
@@ -22,13 +22,15 @@ variables:
 
 environment:
   OSTREE_REPO: "%{sysroot}/ostree/repo"
+  XZFLAGS: -T%{max-jobs}
+
+environment-nocache:
+- XZFLAGS
 
 config:
   layout:
   - element: ''
     destination: '/sysroot'
-  - element: ''
-    destination: '/genimage'
   - element: vm/repo.bst
     destination: '/source-repo'
   - element: core-deps/libostree.bst
@@ -70,7 +72,7 @@ config:
     cp -r "%{sysroot}"/ostree/boot.1/gnome-os/*/*/boot/EFI/ "%{sysroot}/boot/"
 
   - |
-    cat >/genimage/genimage.cfg <<EOF
+    cat > %{install-root}/genimage.cfg <<EOF
     image efi.img {
         vfat {
             extraargs = "-F32 -n EFI"
@@ -102,13 +104,12 @@ config:
     EOF
 
   - |
-    cd /genimage
+    cd %{install-root}
     genimage --rootpath "%{sysroot}"
+    mv images/disk.img .
+    rm -rf genimage.cfg images/ tmp/
 
   # FIXME: Propose support for part attrs in genimage project
-  - sfdisk --part-attrs /genimage/images/disk.img 2 55
+  - sfdisk --part-attrs %{install-root}/disk.img 2 55
 
-  - |
-    qemu-img convert -f raw -O qcow2 \
-        /genimage/images/disk.img \
-        "%{install-root}/disk.qcow2"
+  - xz ${XZFLAGS} %{install-root}/disk.img


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]