aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/swupd-server/swupd-server-2.53/0008-Clean-up-tar-commands-always-put-files-after-options.patch
blob: 3dabcc8e19bbee3b9e9f29631295327062e834a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 9ecb744f0ca6faca02cc7be7539802c040cd2922 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Date: Tue, 23 Feb 2016 15:01:25 +0200
Subject: [PATCH] Clean up tar commands: always put files after options

Unify tar commands to have files enumerated always at the end of
the commands. This would follow the scheme used in tar's man page
and simplify adoption of other tar implementation should the need
arise.

Upstream-Status: Accepted

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
---
 src/fullfiles.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/fullfiles.c b/src/fullfiles.c
index fa78293..23e95db 100644
--- a/src/fullfiles.c
+++ b/src/fullfiles.c
@@ -93,7 +93,7 @@ static void create_fullfile(struct file *file)
 			assert(0);
 		}
 
-		string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -cf - '%s' --exclude='%s'/* 2> /dev/null | "
+		string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -cf - --exclude='%s'/* '%s' 2> /dev/null | "
 			"tar -C %s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null",
 			 dir, base, base, rename_tmpdir);
 		if (system(tarcommand) != 0) {
@@ -111,8 +111,8 @@ static void create_fullfile(struct file *file)
 		free(rename_source);
 
 		/* for a directory file, tar up simply with gzip */
-		string_or_die(&tarcommand, "tar -C %s %s " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar",
-			      rename_tmpdir, file->hash, outdir, file->last_change, file->hash);
+		string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar %s",
+			      rename_tmpdir, outdir, file->last_change, file->hash, file->hash);
 		if (system(tarcommand) != 0) {
 			LOG(NULL, "Failed to run command:", "%s", tarcommand);
 			assert(0);
-- 
2.5.0