From e1f0471875cf50014feebf89dfb0d8f5d4e135cb Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Mon, 20 Aug 2018 17:31:27 +0200
Subject: [PATCH] ospack,sysroot: Append file extension automatically

Make ospack and sysroot recipes take a generic basename for the output
artifacts, to which the `.tar.gz` file extension is appended by the
recipe itself. The recipes for the images already works this way as it
works better when generating multiple artifacts.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 Jenkinsfile                      | 15 ++++++++-------
 apertis-image-mx6qsabrelite.yaml |  4 ++--
 apertis-image-sdk.yaml           |  4 ++--
 apertis-image-uboot.yaml         |  4 ++--
 apertis-image-uefi.yaml          |  4 ++--
 apertis-ospack.yaml              |  4 ++--
 apertis-ostree-commit.yaml       |  4 ++--
 apertis-ostree-pack.yaml         |  4 ++--
 apertis-sysroot.yaml             |  8 ++++----
 lxc/readme.md                    |  2 +-
 10 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index a7ab8f71..cab39788 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -137,7 +137,7 @@ def buildOStree(architecture, type, board, debosarguments = "", repo = "repo") {
         -t type:$type \
         -t board:$board \
         -t suite:$release \
-        -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \
+        -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION} \
         -t message:${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION} \
         -t ostree:${repo} \
         ${WORKSPACE}/${osname}-ostree-commit.yaml""")
@@ -169,7 +169,7 @@ def buildOSpack(architecture, type, debosarguments = "") {
             -t suite:${release} \
             -t timestamp:${PIPELINE_VERSION} \
             -t demopack:${demopack} \
-            -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \
+            -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION} \
             ${WORKSPACE}/${osname}-ospack.yaml""")
     }
 }
@@ -185,7 +185,7 @@ def buildImage(architecture, type, board, debosarguments = "") {
             --show-boot \
             -t architecture:${architecture} \
             -t type:${type} \
-            -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \
+            -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION} \
             -t image:${image_name} \
             ${WORKSPACE}/${osname}-image-${board}.yaml""")
     }
@@ -206,7 +206,7 @@ def buildOStreeImage(architecture, type, board, debosarguments = "") {
             -t type:$type \
             -t board:$board \
             -t suite:$release \
-            -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \
+            -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION} \
             -t image:${image_name} \
             -t message:${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION} \
             -t ostree:${repo} \
@@ -229,7 +229,7 @@ def buildContainer(architecture, type, board, debosarguments = "") {
              -t repourl:${ostree_pull_url} \
              -t osname:${osname} \
              -t branch:${osname}/$release/${architecture}-${board}/${type} \
-             -t ospack:${osname}_ostree_${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION}.tar.gz \
+             -t ospack:${osname}_ostree_${release}-${type}-${architecture}-${board}_${PIPELINE_VERSION} \
              -t message:${release}-${type}-${architecture}-${type}-${board}_${PIPELINE_VERSION} \
              -t ostree:${repo} \
              ${WORKSPACE}/${osname}-ostree-pack.yaml""")
@@ -237,7 +237,8 @@ def buildContainer(architecture, type, board, debosarguments = "") {
 }
 
 def buildSysroot(architecture, type, debosarguments = "") {
-    sysrootfile = "sysroot-${osname}-${release}-${architecture}-${env.PIPELINE_VERSION}.tar.gz"
+    sysrootname = "sysroot-${osname}-${release}-${architecture}-${env.PIPELINE_VERSION}"
+    sysrootfile = "${sysrootname}.tar.gz"
       stage("${architecture} sysroot tarball") {
         sh(script: """
             mkdir -p sysroot/${release}
@@ -246,7 +247,7 @@ def buildSysroot(architecture, type, debosarguments = "") {
             debos ${debosarguments} \
               --show-boot \
               -t architecture:${architecture} \
-              -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION}.tar.gz \
+              -t ospack:ospack_${release}-${architecture}-${type}_${PIPELINE_VERSION} \
               -t sysroot:${sysrootfile} \
               ${WORKSPACE}/${osname}-sysroot.yaml; \
             rm ospack*""")
diff --git a/apertis-image-mx6qsabrelite.yaml b/apertis-image-mx6qsabrelite.yaml
index 14f41fa4..509b5078 100644
--- a/apertis-image-mx6qsabrelite.yaml
+++ b/apertis-image-mx6qsabrelite.yaml
@@ -3,7 +3,7 @@
 {{ $mirror := or .mirror "https://repositories.apertis.org/apertis/" }}
 {{ $suite := or .suite "18.06" }}
 {{ $timestamp := or .timestamp "00000000.0" }}
-{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s.tar.gz" $suite $architecture $type $timestamp) }}
+{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s" $suite $architecture $type $timestamp) }}
 {{ $image := or .image (printf "apertis-%s-%s-%s_%s" $suite  $type $architecture $timestamp) }}
 
 {{ $cmdline := or .cmdline " console=tty0 console=ttymxc1,115200n8 plymouth.ignore-serial-consoles" }}
@@ -14,7 +14,7 @@ actions:
   - action: unpack
     description: Unpack {{ $ospack }}
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
 
   - action: image-partition
     imagename: {{ $image }}.img
diff --git a/apertis-image-sdk.yaml b/apertis-image-sdk.yaml
index 8839ad2d..882f23f1 100644
--- a/apertis-image-sdk.yaml
+++ b/apertis-image-sdk.yaml
@@ -3,7 +3,7 @@
 {{ $mirror := or .mirror "https://repositories.apertis.org/apertis/" }}
 {{ $suite := or .suite "18.06" }}
 {{ $timestamp := or .timestamp "00000000.0" }}
-{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s.tar.gz" $suite $architecture $type $timestamp) }}
+{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s" $suite $architecture $type $timestamp) }}
 {{ $image := or .image (printf "apertis-%s-%s-%s_%s" $suite  $type $architecture $timestamp) }}
 
 {{ $cmdline := or .cmdline "console=tty0 console=ttyS0,115200n8 rootwait ro quiet splash plymouth.ignore-serial-consoles" }}
@@ -18,7 +18,7 @@ actions:
   - action: unpack
     description: Unpack {{ $ospack }}
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
 
   - action: image-partition
     imagename: {{ $image }}.img
diff --git a/apertis-image-uboot.yaml b/apertis-image-uboot.yaml
index b35faed0..310c9dfc 100644
--- a/apertis-image-uboot.yaml
+++ b/apertis-image-uboot.yaml
@@ -3,7 +3,7 @@
 {{ $mirror := or .mirror "https://repositories.apertis.org/apertis/" }}
 {{ $suite := or .suite "18.06" }}
 {{ $timestamp := or .timestamp "00000000.0" }}
-{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s.tar.gz" $suite $architecture $type $timestamp) }}
+{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s" $suite $architecture $type $timestamp) }}
 {{ $image := or .image (printf "apertis-%s-%s-%s_%s" $suite  $type $architecture $timestamp) }}
 
 {{ $cmdline := or .cmdline " rootwait ro" }}
@@ -14,7 +14,7 @@ actions:
   - action: unpack
     description: Unpack {{ $ospack }}
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
 
   - action: image-partition
     imagename: {{ $image }}.img
diff --git a/apertis-image-uefi.yaml b/apertis-image-uefi.yaml
index e4a1e2f2..504ac82c 100644
--- a/apertis-image-uefi.yaml
+++ b/apertis-image-uefi.yaml
@@ -3,7 +3,7 @@
 {{ $mirror := or .mirror "https://repositories.apertis.org/apertis/" }}
 {{ $suite := or .suite "18.06" }}
 {{ $timestamp := or .timestamp "00000000.0" }}
-{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s.tar.gz" $suite $architecture $type $timestamp) }}
+{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s" $suite $architecture $type $timestamp) }}
 {{ $image := or .image (printf "apertis-%s-%s-%s_%s" $suite  $type $architecture $timestamp) }}
 
 {{ $cmdline := or .cmdline "console=tty0 console=ttyS0,115200n8 rootwait ro quiet splash plymouth.ignore-serial-consoles" }}
@@ -14,7 +14,7 @@ actions:
   - action: unpack
     description: Unpack {{ $ospack }}
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
 
   - action: image-partition
     imagename: {{ $image }}.img
diff --git a/apertis-ospack.yaml b/apertis-ospack.yaml
index 6ca7fd87..0d27bb18 100644
--- a/apertis-ospack.yaml
+++ b/apertis-ospack.yaml
@@ -3,7 +3,7 @@
 {{- $mirror := or .mirror "https://repositories.apertis.org/apertis/" -}}
 {{- $suite := or .suite "18.06" -}}
 {{- $timestamp := or .timestamp "00000000.0" -}}
-{{- $ospack := or .ospack (printf "ospack_%s-%s-%s_%s.tar.gz" $suite $architecture $type $timestamp) -}}
+{{- $ospack := or .ospack (printf "ospack_%s-%s-%s_%s" $suite $architecture $type $timestamp) -}}
 {{- $demopack := or .demopack "disabled" -}}
 {{- $ivitools := or .ivitools "enabled" -}}
 {{- $lxc := or .lxc "enabled" -}}
@@ -787,4 +787,4 @@ actions:
 
   - action: pack
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
diff --git a/apertis-ostree-commit.yaml b/apertis-ostree-commit.yaml
index 8385c4db..25eedbb1 100644
--- a/apertis-ostree-commit.yaml
+++ b/apertis-ostree-commit.yaml
@@ -2,7 +2,7 @@
 {{ $type := or .type "minimal" }}
 {{ $suite := or .suite "18.06" }}
 {{ $timestamp := or .timestamp "00000000.0" }}
-{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s.tar.gz" $suite $architecture $type $timestamp) }}
+{{ $ospack := or .ospack (printf "ospack_%s-%s-%s_%s" $suite $architecture $type $timestamp) }}
 
 {{ $board := or .board "lxc" }}
 {{ $branch := or .branch (printf "apertis/%s/%s-%s/%s" $suite $architecture $board $type) }}
@@ -13,7 +13,7 @@ architecture: {{ $architecture }}
 
 actions:
   - action: unpack
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
 
   - action: overlay
     description: "Install ostree feature"
diff --git a/apertis-ostree-pack.yaml b/apertis-ostree-pack.yaml
index 96d2dcce..ae2456dd 100644
--- a/apertis-ostree-pack.yaml
+++ b/apertis-ostree-pack.yaml
@@ -1,7 +1,7 @@
 {{- $architecture := or .architecture "amd64" }}
 {{- $type := or .type "minimal" -}}
 {{- $suite := or .suite "18.06" -}}
-{{- $ospack := or .ospack (printf "ostree-pack_%s-%s-%s.tar.gz" $suite $architecture $type) -}}
+{{- $ospack := or .ospack (printf "ostree-pack_%s-%s-%s" $suite $architecture $type) -}}
 {{- $board := or .board "lxc" -}}
 {{- $repourl := or .repourl "https://images.apertis.org/ostree/repo" -}}
 {{- $osname := or .osname "apertis" -}}
@@ -19,4 +19,4 @@ actions:
 
   - action: pack
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
diff --git a/apertis-sysroot.yaml b/apertis-sysroot.yaml
index 40b6f0fc..f981f8a6 100644
--- a/apertis-sysroot.yaml
+++ b/apertis-sysroot.yaml
@@ -1,6 +1,6 @@
 {{ $architecture := or .architecture "armhf" }}
-{{ $ospack := or .ospack (printf "ospack-%s.tar.gz" $architecture) }}
-{{ $sysroot := or .sysroot (printf "sysroot-%s.tar.gz" $architecture) }}
+{{ $ospack := or .ospack (printf "ospack-%s" $architecture) }}
+{{ $sysroot := or .sysroot (printf "sysroot-%s" $architecture) }}
 
 architecture: {{ $architecture }}
 
@@ -9,7 +9,7 @@ actions:
   - action: unpack
     description: Unpack {{ $ospack }}
     compression: gz
-    file: {{ $ospack }}
+    file: {{ $ospack }}.tar.gz
 
   - action: run
     chroot: true
@@ -21,4 +21,4 @@ actions:
 
   - action: pack
     compression: gz
-    file: {{ $sysroot }}
+    file: {{ $sysroot }}.tar.gz
diff --git a/lxc/readme.md b/lxc/readme.md
index e4d32f85..011a4584 100644
--- a/lxc/readme.md
+++ b/lxc/readme.md
@@ -2,7 +2,7 @@ LXC template generates configuration file for container, pre-mount hook and AppA
 Template is compatible with LXC upstream, so tools from LXC should be used to create/start/stop/destroy the container.
 
 # Create container:
- sudo lxc-create -t $PWD/lxc-apertis-ostree --name apertis-test -- --ospack "https://images.apertis.org/lxc/17.12/20171230.0/lxc-ostree-17.12-amd64-minimal_20171230.0.tar.gz"
+ sudo lxc-create -t $PWD/lxc-apertis-ostree --name apertis-test -- --ospack "https://images.apertis.org/lxc/17.12/20171230.0/lxc-ostree-17.12-amd64-minimal_20171230.0"
 
 options:
  - -t -- use template named `lxc-apertis-ostree` from current directory
-- 
GitLab