diff options
author | Lihong Sun <lihongx.sun@intel.com> | 2014-12-11 01:56:25 -0500 |
---|---|---|
committer | admin <yuhuan.yang@samsung.com> | 2016-02-04 18:32:27 +0800 |
commit | b2acba1e55b9631b67aba80d40d23435aae3b891 (patch) | |
tree | b8e178df9d82392c525027bbaac2108294c7c221 | |
parent | 66124967651d00df7761ca32096592d1f2e85d85 (diff) | |
download | mic-b2acba1e55b9631b67aba80d40d23435aae3b891.tar.gz mic-b2acba1e55b9631b67aba80d40d23435aae3b891.tar.bz2 mic-b2acba1e55b9631b67aba80d40d23435aae3b891.zip |
Update tar command option
List whole files to the tar command instead of giving a dir
Change-Id: I1916924eaf63876c9d4fe0bcfa64f4f8e142a42e
-rw-r--r-- | mic/archive.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mic/archive.py b/mic/archive.py index 35571ce..a612389 100644 --- a/mic/archive.py +++ b/mic/archive.py @@ -248,16 +248,18 @@ def _do_tar(archive_name, target_name): @target_name: the name of the target to tar @retval: the path of the archived file """ + file_list = [] if os.path.isdir(target_name): target_dir = target_name target_name = "." + for target_file in os.listdir(target_dir): + file_list.append(target_file) else: target_dir = os.path.dirname(target_name) target_name = os.path.basename(target_name) - - cmdln = ["tar", "-S", "-C", target_dir, "-cf", archive_name, target_name] - - + file_list.append(target_name) + cmdln = ["tar", "-S", "-C", target_dir, "-cf", archive_name] + cmdln.extend(file_list) _call_external(cmdln) return archive_name @@ -271,9 +273,7 @@ def _do_untar(archive_name, target_dir=None): """ if not target_dir: target_dir = os.getcwd() - cmdln = ["tar", "-S", "-C", target_dir, "-xf", archive_name] - (returncode, stdout, stderr) = _call_external(cmdln) if returncode != 0: raise OSError, os.linesep.join([stdout, stderr]) |