buildscript: Put binaries in seperate folders per variant.

Submitted by Fabian Blaese on Dec. 14, 2019, 8:16 p.m.

Details

Message ID 20191214201654.3858498-1-fabian@blaese.de
State Accepted
Headers show

Commit Message

Fabian Blaese Dec. 14, 2019, 8:16 p.m.
To make it easier to find the correct binary, this creates
a seperate folder for every variant and copies the binaries
appropriately.

The folder is created with "-p" to suppress errors, if it already
exists. This means the misplaced creation of the "bin"-folder inside
the build function can be ommited.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 buildscript | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/buildscript b/buildscript
index 5f0aa76..8e73944 100755
--- a/buildscript
+++ b/buildscript
@@ -246,10 +246,6 @@  build() {
 
     cd "$opath"
 
-    if [ ! -d bin ]; then
-        mkdir bin
-    fi
-
     cp_firmware
 }
 
@@ -294,17 +290,19 @@  rm_firmware() {
 cp_firmware() {
     [ -n "$subtarget" ] || subtarget="generic"
 
+    mkdir -p "bin/$variant"
+
     for image in ${images[@]}; do
         filename_build=${image//openwrt/fff-${version}}
         filename_build=${filename_build//squashfs-/}
         filename_build=${filename_build//${chipset}-${subtarget}-/}
-        cp "$builddir/bin/targets/${chipset}/${subtarget}/$image" "./bin/$filename_build"
+        cp "$builddir/bin/targets/${chipset}/${subtarget}/$image" "./bin/$variant/$filename_build"
 
         for region in "" "-eu" "-us"; do
             image_factory=${image/sysupgrade/factory$region}
             if [[ -f "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" ]]; then
               filename_build_factory=${filename_build/sysupgrade/factory$region}
-              cp "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" "./bin/$filename_build_factory"
+              cp "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" "./bin/$variant/$filename_build_factory"
             fi
         done
     done
@@ -329,13 +327,13 @@  buildrelease() {
         build $fast
     fi
 
-    cd bin
+    cd bin/$variant
     for binary in *.bin; do
         md5sum "$binary" > ./"$binary".md5
         sha256sum "$binary" > ./"$binary".sha256
     done
-    cd ..
-    echo -e "VERSION:$version" > ./bin/release.nfo
+    echo -e "VERSION:$version" > release.nfo
+    cd ../..
 }
 
 clean() {

Comments

Robert Langhammer Dec. 14, 2019, 8:41 p.m.
Hi Fabian,

ja, das bringt Ordnung rein.

Reviewed-by: Robert Langhammer <rlanghammer@web.de>


Am 14.12.19 um 21:16 schrieb Fabian Bläse:
> To make it easier to find the correct binary, this creates
> a seperate folder for every variant and copies the binaries
> appropriately.
>
> The folder is created with "-p" to suppress errors, if it already
> exists. This means the misplaced creation of the "bin"-folder inside
> the build function can be ommited.
>
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  buildscript | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/buildscript b/buildscript
> index 5f0aa76..8e73944 100755
> --- a/buildscript
> +++ b/buildscript
> @@ -246,10 +246,6 @@ build() {
>  
>      cd "$opath"
>  
> -    if [ ! -d bin ]; then
> -        mkdir bin
> -    fi
> -
>      cp_firmware
>  }
>  
> @@ -294,17 +290,19 @@ rm_firmware() {
>  cp_firmware() {
>      [ -n "$subtarget" ] || subtarget="generic"
>  
> +    mkdir -p "bin/$variant"
> +
>      for image in ${images[@]}; do
>          filename_build=${image//openwrt/fff-${version}}
>          filename_build=${filename_build//squashfs-/}
>          filename_build=${filename_build//${chipset}-${subtarget}-/}
> -        cp "$builddir/bin/targets/${chipset}/${subtarget}/$image" "./bin/$filename_build"
> +        cp "$builddir/bin/targets/${chipset}/${subtarget}/$image" "./bin/$variant/$filename_build"
>  
>          for region in "" "-eu" "-us"; do
>              image_factory=${image/sysupgrade/factory$region}
>              if [[ -f "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" ]]; then
>                filename_build_factory=${filename_build/sysupgrade/factory$region}
> -              cp "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" "./bin/$filename_build_factory"
> +              cp "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" "./bin/$variant/$filename_build_factory"
>              fi
>          done
>      done
> @@ -329,13 +327,13 @@ buildrelease() {
>          build $fast
>      fi
>  
> -    cd bin
> +    cd bin/$variant
>      for binary in *.bin; do
>          md5sum "$binary" > ./"$binary".md5
>          sha256sum "$binary" > ./"$binary".sha256
>      done
> -    cd ..
> -    echo -e "VERSION:$version" > ./bin/release.nfo
> +    echo -e "VERSION:$version" > release.nfo
> +    cd ../..
>  }
>  
>  clean() {
Fabian Blaese Dec. 24, 2019, 11:53 a.m.
applied