Patchwork bitbake-prserv-tool: show error when export file does not exist

login
register
mail settings
Submitter Martin Jansa
Date Feb. 6, 2013, 2:23 p.m.
Message ID <1360160618-13505-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/44211/
State Accepted
Commit 65b2f068719f4cd6e1bd438e8714c2977bd93535
Headers show

Comments

Martin Jansa - Feb. 6, 2013, 2:23 p.m.
* otherwise it shows error about failing import

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 scripts/bitbake-prserv-tool | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Martin Jansa - Feb. 6, 2013, 2:29 p.m.
On Wed, Feb 06, 2013 at 03:23:38PM +0100, Martin Jansa wrote:
> * otherwise it shows error about failing import

It fails like this e.g. when someone tries to migrate_localcount without
any entries in cache/bb_persist_data.sqlite3

> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  scripts/bitbake-prserv-tool | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/bitbake-prserv-tool b/scripts/bitbake-prserv-tool
> index 4654e6d..96a3470 100755
> --- a/scripts/bitbake-prserv-tool
> +++ b/scripts/bitbake-prserv-tool
> @@ -61,8 +61,16 @@ do_migrate_localcount ()
>      clean_cache
>      echo "Exporting LOCALCOUNT to AUTOINCs..."
>      bitbake -R conf/migrate_localcount.conf -p
> -    [ ! $? -eq 0 ] && echo "Exporting failed!" && exit 1
> +    [ ! $? -eq 0 ] && echo "Exporting to file $df failed!" && exit 1
>  
> +    if [ -e $df ];
> +    then
> +        echo "Exporting to file $df succeeded!"
> +    else
> +        echo "Exporting to file $df failed!"
> +        exit 1
> +    fi
> +    
>      echo "Importing generated AUTOINC entries..."
>      [ -e $df ] && do_import $df
>  
> -- 
> 1.8.1.2
>

Patch

diff --git a/scripts/bitbake-prserv-tool b/scripts/bitbake-prserv-tool
index 4654e6d..96a3470 100755
--- a/scripts/bitbake-prserv-tool
+++ b/scripts/bitbake-prserv-tool
@@ -61,8 +61,16 @@  do_migrate_localcount ()
     clean_cache
     echo "Exporting LOCALCOUNT to AUTOINCs..."
     bitbake -R conf/migrate_localcount.conf -p
-    [ ! $? -eq 0 ] && echo "Exporting failed!" && exit 1
+    [ ! $? -eq 0 ] && echo "Exporting to file $df failed!" && exit 1
 
+    if [ -e $df ];
+    then
+        echo "Exporting to file $df succeeded!"
+    else
+        echo "Exporting to file $df failed!"
+        exit 1
+    fi
+    
     echo "Importing generated AUTOINC entries..."
     [ -e $df ] && do_import $df