diff mbox

[1/1] dupdate-image.oeclass: Extend to support packing into zip

Message ID 1513b54ef87e133b6863a8ed01b539339d67c5b7.1399971768.git.Svend.Vedstesen@prevas.dk
State Changes Requested
Delegated to: Esben Haabendal
Headers show

Commit Message

Svend Aage Vedstesen May 13, 2014, 9:14 a.m. UTC
---
 classes/dupdate-image.oeclass | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

Comments

Esben Haabendal May 13, 2014, 12:42 p.m. UTC | #1
Svend Aage Vedstesen <Svend.Vedstesen@prevas.dk> writes:

> ---
>  classes/dupdate-image.oeclass | 30 +++++++++++++++++++++++-------
>  1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/classes/dupdate-image.oeclass b/classes/dupdate-image.oeclass
> index f8af6a2..962b1c9 100644
> --- a/classes/dupdate-image.oeclass
> +++ b/classes/dupdate-image.oeclass
> @@ -1,4 +1,4 @@
> -## Used for creating dupdate tarballs containing multiple files.
> +## Used for creating dupdate tarballs/zip containing multiple files.
>  ##
>  ## A dupdate file is a tarball containing: A VERSION, a runscript, a number of
>  ## images, and a checksum of all the files.
> @@ -6,6 +6,7 @@
>  ## @useflag dupdate_script Set it to the name of dupdate script.
>  ## @useflag dupdate_version Set it to the dupdate version (will be placed in
>  ##          the VERSION file.
> +## @useflag dupdate_archiveformat  Set it to the dupdate archive format to use, tar or zip
>  ## @var IMAGE_BASENAME Set to a different basename.
>  ## @var IMAGE_FULLNAME Set to a different fullname.
>  
> @@ -18,16 +19,31 @@ DUPDATE_IMAGE_EXT = '.dupdate'
>  
>  IMAGE_CREATE_FUNCS += "dupdate_image"
>  
> -dupdate_image() {
> -	(
> -	sha256sum * > sha256sum.txt
> -	tar chf ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} .
> -	)
> +dupdate_image_tar(){
> +    tar chf ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} .
>  }

While it might have been a bad idea to hardcode the sha256sum.txt
generation here, removing it is not backwards compatible.

Please post the removal of sha256sum.txt as a seperate patch, so I can
cherry pick just the zip archive patch for 3.x.

You don't have to add sha256sum.txt to dupdate_image_zip.  Support for
zip archive is new, and therefore does not have to be backwards
compatible with anything.

> -CLASS_FLAGS += "dupdate_script dupdate_version"
> +dupdate_image_zip(){
> +    zip ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} *
> +}
> +
> +dupdate_image(){
> +    sha256sum * > sha256sum.txt
> +
> +    case "${USE_dupdate_archiveformat}" in
> +    "tar") dupdate_image_tar
> +           ;;
> +    "zip") dupdate_image_zip
> +           ;;
> +    *) echo "ERROR: Unsupported archive format (${USE_dupdate_archiveformat})"
> +       exit 1
> +    esac
> +}
> +
> +CLASS_FLAGS += "dupdate_script dupdate_version dupdate_archiveformat"
>  DEFAULT_USE_dupdate_script = ""
>  DEFAULT_USE_dupdate_version = ""
> +DEFAULT_USE_dupdate_archiveformat = "tar"
>  
>  CLASS_FLAGS += "dupdate_exefile"
>  require conf/dupdate.conf

As said, please resend as 2 patches, one for adding dupdate zip archive
support, and one for removing sha256sum.txt.

/Esben
Svend Aage Vedstesen May 13, 2014, 1:15 p.m. UTC | #2
sha256sum * > sha256sum.txt was not deleted.
Your properly diffed " dupdate_image" with " dupdate_image_tar" which does not hold it anymore. 
Please re-check the diffs

/Svend


-----Original Message-----
From: Esben Haabendal [mailto:esben.haabendal@dev.prevas.dk] 
Sent: 13. maj 2014 14:43
To: Svend Aage Vedstesen
Cc: dev@oe-lite.org
Subject: Re: [PATCH 1/1] dupdate-image.oeclass: Extend to support packing into zip

Svend Aage Vedstesen <Svend.Vedstesen@prevas.dk> writes:

> ---
>  classes/dupdate-image.oeclass | 30 +++++++++++++++++++++++-------
>  1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/classes/dupdate-image.oeclass 
> b/classes/dupdate-image.oeclass index f8af6a2..962b1c9 100644
> --- a/classes/dupdate-image.oeclass
> +++ b/classes/dupdate-image.oeclass
> @@ -1,4 +1,4 @@
> -## Used for creating dupdate tarballs containing multiple files.
> +## Used for creating dupdate tarballs/zip containing multiple files.
>  ##
>  ## A dupdate file is a tarball containing: A VERSION, a runscript, a 
> number of  ## images, and a checksum of all the files.
> @@ -6,6 +6,7 @@
>  ## @useflag dupdate_script Set it to the name of dupdate script.
>  ## @useflag dupdate_version Set it to the dupdate version (will be placed in
>  ##          the VERSION file.
> +## @useflag dupdate_archiveformat  Set it to the dupdate archive 
> +format to use, tar or zip
>  ## @var IMAGE_BASENAME Set to a different basename.
>  ## @var IMAGE_FULLNAME Set to a different fullname.
>  
> @@ -18,16 +19,31 @@ DUPDATE_IMAGE_EXT = '.dupdate'
>  
>  IMAGE_CREATE_FUNCS += "dupdate_image"
>  
> -dupdate_image() {
> -	(
> -	sha256sum * > sha256sum.txt
> -	tar chf ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} .
> -	)
> +dupdate_image_tar(){
> +    tar chf ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} .
>  }

While it might have been a bad idea to hardcode the sha256sum.txt generation here, removing it is not backwards compatible.

Please post the removal of sha256sum.txt as a seperate patch, so I can cherry pick just the zip archive patch for 3.x.

You don't have to add sha256sum.txt to dupdate_image_zip.  Support for zip archive is new, and therefore does not have to be backwards compatible with anything.

> -CLASS_FLAGS += "dupdate_script dupdate_version"
> +dupdate_image_zip(){
> +    zip ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} * }
> +
> +dupdate_image(){
> +    sha256sum * > sha256sum.txt
> +
> +    case "${USE_dupdate_archiveformat}" in
> +    "tar") dupdate_image_tar
> +           ;;
> +    "zip") dupdate_image_zip
> +           ;;
> +    *) echo "ERROR: Unsupported archive format (${USE_dupdate_archiveformat})"
> +       exit 1
> +    esac
> +}
> +
> +CLASS_FLAGS += "dupdate_script dupdate_version dupdate_archiveformat"
>  DEFAULT_USE_dupdate_script = ""
>  DEFAULT_USE_dupdate_version = ""
> +DEFAULT_USE_dupdate_archiveformat = "tar"
>  
>  CLASS_FLAGS += "dupdate_exefile"
>  require conf/dupdate.conf

As said, please resend as 2 patches, one for adding dupdate zip archive support, and one for removing sha256sum.txt.

/Esben
Esben Haabendal May 13, 2014, 1:53 p.m. UTC | #3
Svend Aage Vedstesen <Svend.Vedstesen@prevas.dk> writes:

> sha256sum * > sha256sum.txt was not deleted.
> Your properly diffed " dupdate_image" with " dupdate_image_tar" which does not hold it anymore. 
> Please re-check the diffs

Sorry about that.  Looks fine :)

Merged to master, thanks.

/Esben
diff mbox

Patch

diff --git a/classes/dupdate-image.oeclass b/classes/dupdate-image.oeclass
index f8af6a2..962b1c9 100644
--- a/classes/dupdate-image.oeclass
+++ b/classes/dupdate-image.oeclass
@@ -1,4 +1,4 @@ 
-## Used for creating dupdate tarballs containing multiple files.
+## Used for creating dupdate tarballs/zip containing multiple files.
 ##
 ## A dupdate file is a tarball containing: A VERSION, a runscript, a number of
 ## images, and a checksum of all the files.
@@ -6,6 +6,7 @@ 
 ## @useflag dupdate_script Set it to the name of dupdate script.
 ## @useflag dupdate_version Set it to the dupdate version (will be placed in
 ##          the VERSION file.
+## @useflag dupdate_archiveformat  Set it to the dupdate archive format to use, tar or zip
 ## @var IMAGE_BASENAME Set to a different basename.
 ## @var IMAGE_FULLNAME Set to a different fullname.
 
@@ -18,16 +19,31 @@  DUPDATE_IMAGE_EXT = '.dupdate'
 
 IMAGE_CREATE_FUNCS += "dupdate_image"
 
-dupdate_image() {
-	(
-	sha256sum * > sha256sum.txt
-	tar chf ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} .
-	)
+dupdate_image_tar(){
+    tar chf ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} .
 }
 
-CLASS_FLAGS += "dupdate_script dupdate_version"
+dupdate_image_zip(){
+    zip ${B}/${IMAGE_BASENAME}${DUPDATE_IMAGE_EXT} *
+}
+
+dupdate_image(){
+    sha256sum * > sha256sum.txt
+
+    case "${USE_dupdate_archiveformat}" in
+    "tar") dupdate_image_tar
+           ;;
+    "zip") dupdate_image_zip
+           ;;
+    *) echo "ERROR: Unsupported archive format (${USE_dupdate_archiveformat})"
+       exit 1
+    esac
+}
+
+CLASS_FLAGS += "dupdate_script dupdate_version dupdate_archiveformat"
 DEFAULT_USE_dupdate_script = ""
 DEFAULT_USE_dupdate_version = ""
+DEFAULT_USE_dupdate_archiveformat = "tar"
 
 CLASS_FLAGS += "dupdate_exefile"
 require conf/dupdate.conf