You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/07/04 04:48:10 UTC

[incubator-nuttx-apps] 04/04: make/import: support import zip use relative path

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit c723283340bd371db8375fff64f754d91cf56cfc
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Jul 1 17:04:53 2020 +0800

    make/import: support import zip use relative path
    
    mkimport.sh failure if using relative path:
    
    $ ./tools/mkimport.sh -x ../incubator-nuttx/nuttx-export-9.1.0.zip
    unzip:  cannot find or open ../incubator-nuttx/nuttx-export-9.1.0.zip, ../incubator-nuttx/nuttx-export-9.1.0.zip.zip or ../incubator-nuttx/nuttx-export-9.1.0.zip.ZIP.
    ERROR: unzip ../incubator-nuttx/nuttx-export-9.1.0.zip failed
    
    Change-Id: Ifc93c5e4dac95ec79a4e909b22ef646fbfe4484d
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 tools/mkimport.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/mkimport.sh b/tools/mkimport.sh
index 1c7a7a6..7ce1948 100755
--- a/tools/mkimport.sh
+++ b/tools/mkimport.sh
@@ -114,19 +114,19 @@ rm -rf ${DALLDIRS}
 mkdir ${TMPDIR} || \
 	{ echo "ERROR: Failed to create ${TMPDIR}"; exit 1; }
 
-# Unpack the export package into the temporary directory
-
-cd ${TMPDIR} || \
-	{ echo "ERROR: Failed to cd to ${TMPDIR}"; exit 1; }
-
 if [ "X${TGZ}" == "Xy" ]; then
-	tar zxf ${EXPORT} || \
+	tar zxf ${EXPORT} -C ${TMPDIR} || \
 		{ echo "ERROR: tar zxf ${EXPORT} failed"; exit 1; }
 else
-	unzip ${EXPORT} || \
+	unzip ${EXPORT} -d ${TMPDIR} || \
 		{ echo "ERROR: unzip ${EXPORT} failed"; exit 1; }
 fi
 
+# Unpack the export package into the temporary directory
+
+cd ${TMPDIR} || \
+	{ echo "ERROR: Failed to cd to ${TMPDIR}"; exit 1; }
+
 EXPORTDIR=`ls`
 
 if [ -z "${EXPORTDIR}" ]; then