diff options
25 files changed, 0 insertions, 2503 deletions
diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-Add-configure-option-to-re-enable-updating-of-config.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-Add-configure-option-to-re-enable-updating-of-config.patch deleted file mode 100644 index ac16d06..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0001-Add-configure-option-to-re-enable-updating-of-config.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 1f2ad4cdff6b999fcd00193cdd1dc8a35e49c0b2 Mon Sep 17 00:00:00 2001 -From: Joshua Lock <joshua.g.lock@intel.com> -Date: Thu, 3 Mar 2016 19:55:41 +0000 -Subject: [PATCH] Add configure option to re-enable updating of config files - -Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> - -Upstream-Status: Pending - ---- - configure.ac | 7 +++++++ - src/heuristics.c | 5 +++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index f94a17d..0063463 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -78,6 +78,13 @@ AC_ARG_ENABLE( - enable_linux_rootfs_build="no" - ) - -+AC_ARG_ENABLE( -+ [stateless], -+ AS_HELP_STRING([--disable-stateless],[OS is not stateless, do not ignore configuration files (stateless by default)]), -+ AC_DEFINE(OS_IS_STATELESS,0,[OS is not stateless]), -+ AC_DEFINE(OS_IS_STATELESS,1,[OS is stateless]) -+) -+ - AS_IF([test "$enable_linux_btrfs_build" = "yes" -a "$enable_android_build" = "yes"], - [AC_MSG_ERROR([Cannot enable more than one build variant. Choose a single variant.])]) - -diff --git a/src/heuristics.c b/src/heuristics.c -index 12fb59c..92dbcdc 100644 ---- a/src/heuristics.c -+++ b/src/heuristics.c -@@ -27,6 +27,7 @@ - #include <string.h> - #include <assert.h> - -+#include <config.h> - #include <swupd.h> - - /* trailing slash is to indicate dir itself is expected to exist, but -@@ -113,8 +114,8 @@ void apply_heuristics(struct file *file) - - bool ignore(struct file *file) - { -- if ((file->is_config) || -- is_config(file->filename) || // ideally we trust the manifest but short term reapply check here -+ if ((OS_IS_STATELESS && file->is_config) || -+ (OS_IS_STATELESS && is_config(file->filename)) || // ideally we trust the manifest but short term reapply check here - (file->is_state) || - is_state(file->filename) || // ideally we trust the manifest but short term reapply check here - (file->is_boot && fix && file->is_deleted) || // shouldn't happen --- -2.5.0 - diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-Tolerate-quotes-in-os-release-files.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-Tolerate-quotes-in-os-release-files.patch deleted file mode 100644 index 2e9bd5b..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0001-Tolerate-quotes-in-os-release-files.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0ac7226645db1c7048863755a296e1e5f7d8319c Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@intel.com> -Date: Thu, 11 Feb 2016 12:49:30 +0200 -Subject: [PATCH] Tolerate quotes in os-release files - -Some systems like Yocto or OpenSUSE prefer to wrap values in -/etc/os-release file with quotes always and that still conforms -to the format defined in systemd. - -This patch removes quotes from the values before trying to -transform them into integer version id. - -Upstream-Status: Backport [v3.0.0+] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@intel.com> ---- - src/version.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/src/version.c b/src/version.c -index d8ad76b..1708a98 100644 ---- a/src/version.c -+++ b/src/version.c -@@ -95,6 +95,7 @@ int read_version_from_subvol_file(char *path_prefix) - FILE *file; - int v = -1; - char *buildstamp; -+ char *src, *dest; - - string_or_die(&buildstamp, "%s/usr/lib/os-release", path_prefix); - file = fopen(buildstamp, "rm"); -@@ -116,7 +117,22 @@ int read_version_from_subvol_file(char *path_prefix) - if (fgets(line, LINE_MAX, file) == NULL) - break; - -- if (strncmp(line,"VERSION_ID=", 11) == 0) { -+ if (strncmp(line, "VERSION_ID=", 11) == 0) { -+ src = &line[11]; -+ -+ /* Drop quotes and newline in value */ -+ dest = src; -+ while (*src) { -+ if (*src == '\'' || *src == '"' || *src == '\n') { -+ ++src; -+ } else { -+ *dest = *src; -+ ++dest; -+ ++src; -+ } -+ } -+ *dest = 0; -+ - v = strtoull(&line[11], NULL, 10); - break; - } --- -2.5.0 diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-globals.c-Use-fake-address-as-default-updates-url.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-globals.c-Use-fake-address-as-default-updates-url.patch deleted file mode 100644 index 491a115..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0001-globals.c-Use-fake-address-as-default-updates-url.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e7af0013dd550c72641ea841f1177d6b0af99dce Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Fri, 15 Apr 2016 10:02:45 +0300 -Subject: [PATCH] globals.c: Use fake address as default updates' url - -If a user forgets to provide its swupd server URL then -ClearLinux's default is used unconditionally which may -reult in a corrupted system. - -Upstream-Status: Inappropriate [latest code doesn't use hardcoded defaults] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - src/globals.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/globals.c b/src/globals.c -index 8ca3fd9..0e78f34 100644 ---- a/src/globals.c -+++ b/src/globals.c -@@ -62,11 +62,11 @@ bool have_network = false; /* assume no access until proved */ - #define URL_COUNT 2 - char *version_server_urls[URL_COUNT] = { - NULL, -- "https://download.clearlinux.org/update", -+ "https://example.com/update", - }; - char *content_server_urls[URL_COUNT] = { - NULL, -- "https://download.clearlinux.org/update", -+ "https://example.com/update", - }; - char *preferred_version_url; - char *preferred_content_url; --- -2.5.0 - diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch deleted file mode 100644 index 424a3bd..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 03ea6060f2992fffe242d0af769b7550a014c28f Mon Sep 17 00:00:00 2001 -From: Patrick Ohly <patrick.ohly@intel.com> -Date: Thu, 14 Apr 2016 11:01:10 +0200 -Subject: [PATCH 1/2] log.c: avoid segfault and show staging file name - -When downloading files, "file->filename" is not set, only -"file->staging" is. Now the code checks both, starting with -"file->filename", and proceeds if both are unset, instead of -segfaulting as before. - -Upstream-Status: Submitted [https://github.com/clearlinux/swupd-client/issues/37] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> ---- - src/log.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/log.c b/src/log.c -index 5e5b030..0549f29 100644 ---- a/src/log.c -+++ b/src/log.c -@@ -413,8 +413,11 @@ static char *format_log_message(int log_type, enum log_priority priority, struct - filebuf2[0] = 0; - strncpy(filebuf, filename, PATH_MAXLEN - 1); - if (file) { -- strncpy(filebuf2, file->filename, PATH_MAXLEN - 1); -- filebuf2[PATH_MAXLEN - 1] = 0; -+ const char *filename = file->filename ? file->filename : file->staging; -+ if (filename) { -+ strncpy(filebuf2, filename, PATH_MAXLEN - 1); -+ filebuf2[PATH_MAXLEN - 1] = 0; -+ } - } - while (strlen(filebuf) < 29) - strcat(filebuf, " "); --- -2.1.4 - diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-manifest.c-Always-initialize-preserver-pointer-of-fi.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-manifest.c-Always-initialize-preserver-pointer-of-fi.patch deleted file mode 100644 index 95a94e9..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0001-manifest.c-Always-initialize-preserver-pointer-of-fi.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ad26f092f1b2102bf6e298a2a6dd8115f4e88d99 Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Fri, 15 Apr 2016 18:36:57 +0300 -Subject: [PATCH] manifest.c: Always initialize preserver pointer of file list - -In case a bundle has nothing in common with any other installed -bundle (no files duplicated in different bundles) the preserver -pointer inside deduplicate_files_from_manifest() isn't -initialized which leads to NULL as output of the function. -As result no files of the deleted bundle get deleted at all. - -Upstream-Status: Backport [v3.0.0+] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - src/manifest.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/manifest.c b/src/manifest.c -index 7c356d7..10b7daa 100644 ---- a/src/manifest.c -+++ b/src/manifest.c -@@ -1326,7 +1326,7 @@ void deduplicate_files_from_manifest(struct manifest **m1, struct manifest *m2) - int count = 0; - - bmanifest = *m1; -- iter1 = list_head(bmanifest->files); -+ iter1 = preserver = list_head(bmanifest->files); - iter2 = list_head(m2->files); - - while (iter1 && iter2) { --- -2.5.0 diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-staging.c-Protect-tar-command-against-special-charac.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-staging.c-Protect-tar-command-against-special-charac.patch deleted file mode 100644 index 4b69b2f..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0001-staging.c-Protect-tar-command-against-special-charac.patch +++ /dev/null @@ -1,58 +0,0 @@ -From a0136d4c34c1710ae6b38667674f4db6f6eedb9c Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Mon, 18 Apr 2016 11:59:58 +0300 -Subject: [PATCH] staging.c: Protect tar command against special characters - -It may happen that a bundle contains a directory named '#' and -other files under this directory, thus not only target files -need to be escaped in tar commands, but also target directories -where the files get installed. - -Also a target file may have a name with '@' as its first symbol. -Since the symbol has a special meaning in case of bsdtar the -name needs to escaped in tar commands with the prefix './'. - -Upstream-Status: Backport [v3.5.2+] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - src/staging.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/staging.c b/src/staging.c -index 742e8a2..6f7eafb 100644 ---- a/src/staging.c -+++ b/src/staging.c -@@ -402,8 +402,8 @@ int do_staging(struct file *file) - ret = -errno; - goto out; - } -- string_or_die(&tarcommand, TAR_COMMAND " -C %s " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -- TAR_COMMAND " -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C '%s' " TAR_PERM_ATTR_ARGS " -cf - './%s' 2> /dev/null | " -+ TAR_COMMAND " -C '%s%s' " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", - rename_tmpdir, base, path_prefix, rel_dir); - LOG_DEBUG(file, "directory overwrite", class_osvol_staging, "%s", tarcommand); - ret = system(tarcommand); -@@ -440,8 +440,8 @@ int do_staging(struct file *file) - ret = -errno; - goto out; - } -- string_or_die(&tarcommand, TAR_COMMAND " -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - .update.%s 2> /dev/null | " -- TAR_COMMAND " -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C '%s/staged' " TAR_PERM_ATTR_ARGS " -cf - '.update.%s' 2> /dev/null | " -+ TAR_COMMAND " -C '%s%s' " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", - STATE_DIR, base, path_prefix, rel_dir); - LOG_DEBUG(file, "dotfile install", class_osvol_staging, "%s", tarcommand); - ret = system(tarcommand); -@@ -485,7 +485,7 @@ int do_staging(struct file *file) - /* For initial simplicity replace the file. Ideally this would be - * an intelligent btrfs reflink to maximize block level reuse. */ - //TODO: prove btrfs reflink ioctl works in general, then try using them here -- string_or_die(&tarcommand, TAR_COMMAND " -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -+ string_or_die(&tarcommand, TAR_COMMAND " -C '%s/staged' " TAR_PERM_ATTR_ARGS " -cf - './%s' 2> /dev/null | " - TAR_COMMAND " -C %s/%s " TAR_PERM_ATTR_ARGS " -xf - --transform=\"s/%s/%s/\" 2> /dev/null", - STATE_DIR, file->hash, STAGING_SUBVOL, rel_dir, file->hash, base); - ret = system(tarcommand); --- -2.5.0 diff --git a/recipes-core/swupd-client/swupd-client-2.87/0002-downloads-minimize-syscalls-to-improve-performance.patch b/recipes-core/swupd-client/swupd-client-2.87/0002-downloads-minimize-syscalls-to-improve-performance.patch deleted file mode 100644 index 0953fcd..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0002-downloads-minimize-syscalls-to-improve-performance.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 96d18d373436fda5c643abd8621d932002b2a007 Mon Sep 17 00:00:00 2001 -From: Patrick Ohly <patrick.ohly@intel.com> -Date: Thu, 14 Apr 2016 11:03:31 +0200 -Subject: [PATCH 2/2] downloads: minimize syscalls to improve performance - -The previous approach was to open/fdopen/fclose the file for each -chunk that gets passed from curl. This incurrs a huge performance hit -when close() triggers a hashing of the file content on systems where -integrity protection via IMA is enabled. - -Now the file is opened only once and kept open until the download is -complete. In addition, the unnecessary usage of C file IO is avoided. - -The semantic is changed as little as possible: -- file gets created only after the first chunk of data arrived -- file descriptors do not leak to child processes (O_CLOEXEC) -- data gets appended to existing files (via O_APPEND, used - to keep the code simple and avoid an additional lseek) -- data gets flushed explicitly for each chunk (via fdatasync(), - which somewhat approximates the effect that an explicit - close() may have had) - -As an additional improvement, failures during close() are checked when -downloading single files. However, perform_curl_io_and_complete() -still ignores the error. - -Upstream-Status: Submitted [https://github.com/clearlinux/swupd-client/issues/41] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> ---- - include/swupd.h | 3 +++ - src/curl.c | 69 ++++++++++++++++++++++++++++++++++++--------------------- - src/download.c | 7 ++++++ - 3 files changed, 54 insertions(+), 25 deletions(-) - -diff --git a/include/swupd.h b/include/swupd.h -index 554e795..fbaa5ae 100644 ---- a/include/swupd.h -+++ b/include/swupd.h -@@ -82,6 +82,7 @@ struct file { - int last_change; - struct update_stat stat; - -+ unsigned int fd_valid : 1; - unsigned int is_dir : 1; - unsigned int is_file : 1; - unsigned int is_link : 1; -@@ -101,6 +102,7 @@ struct file { - - char *staging; /* output name used during download & staging */ - CURL *curl; /* curl handle if downloading */ -+ int fd; /* file written into during downloading, unset when fd_valid is false */ - }; - - extern bool download_only; -@@ -183,6 +185,7 @@ extern void swupd_curl_cleanup(void); - extern void swupd_curl_set_current_version(int v); - extern void swupd_curl_set_requested_version(int v); - extern size_t swupd_download_file(void *ptr, size_t size, size_t nmemb, void *userdata); -+extern CURLcode swupd_download_file_complete(CURLcode curl_ret, struct file *file); - extern int swupd_curl_get_file(const char *url, char *filename, struct file *file, - char *tmp_version, bool pack); - #define SWUPD_CURL_LOW_SPEED_LIMIT 1 -diff --git a/src/curl.c b/src/curl.c -index c989426..c4e1398 100644 ---- a/src/curl.c -+++ b/src/curl.c -@@ -122,37 +122,54 @@ size_t swupd_download_file(void *ptr, size_t size, size_t nmemb, void *userdata) - const char *outfile; - int fd; - FILE *f; -- size_t written; -+ size_t written, remaining; - - outfile = file->staging; -+ if (file->fd_valid) { -+ fd = file->fd; -+ } else { -+ fd = open(outfile, O_CREAT | O_RDWR | O_CLOEXEC | O_APPEND, 00600); -+ if (fd < 0) { -+ LOG_ERROR(file, "Cannot open file for write", class_file_io, -+ "\\*outfile=\"%s\",strerror=\"%s\"*\\", outfile, strerror(errno)); -+ return -1; -+ } -+ file->fd = fd; -+ file->fd_valid = 1; -+ } -+ -+ /* handle short writes with repeated write() calls */ -+ for (remaining = size*nmemb; remaining; remaining -= written) { -+ written = write(fd, ptr, size*nmemb); -+ if (written < 0) { -+ LOG_ERROR(file, "write error", class_file_io, -+ "\\*outfile=\"%s\",strerror=\"%s\"*\\", outfile, strerror(errno)); -+ return -1; -+ } -+ } - -- fd = open(outfile, O_CREAT | O_RDWR , 00600); -- if (fd < 0) { -- LOG_ERROR(file, "Cannot open file for write", class_file_io, -- "\\*outfile=\"%s\",strerror=\"%s\"*\\", outfile, strerror(errno)); -+ if (fdatasync(fd)) { -+ LOG_ERROR(file, "fdatasync", class_file_io, -+ "\\*outfile=\"%s\",strerror=\"%s\"*\\", outfile, strerror(errno)); - return -1; -- } -+ } - -- f = fdopen(fd, "a"); -- if (!f) { -- LOG_ERROR(file, "Cannot fdopen file for write", class_file_io, -- "\\*outfile=\"%s\",strerror=\"%s\"*\\", outfile, strerror(errno)); -- close(fd); -- return -1; -- } -- -- written = fwrite(ptr, size*nmemb, 1, f); -- -- fflush(f); -- fclose(f); -+ return size*nmemb; -+} - -- if (written != 1) { -- LOG_ERROR(file, "short write", class_file_io, -- "\\*outfile=\"%s\",strerror=\"%s\"*\\", outfile, strerror(errno)); -- return -1; -+CURLcode swupd_download_file_complete(CURLcode curl_ret, struct file *file) -+{ -+ if (file->fd_valid) { -+ if (close(file->fd)) { -+ LOG_ERROR(file, "Cannot close file after write", class_file_io, -+ "\\*outfile=\"%s\",strerror=\"%s\"*\\", file->staging, strerror(errno)); -+ if (curl_ret == CURLE_OK) { -+ curl_ret = CURLE_WRITE_ERROR; -+ } -+ } -+ file->fd_valid = 0; - } -- -- return size*nmemb; -+ return curl_ret; - } - - /* Download a single file SYNCHRONOUSLY -@@ -193,7 +210,6 @@ int swupd_curl_get_file(const char *url, char *filename, struct file *file, - } - } - local->staging = filename; -- - if (lstat(filename, &stat) == 0) { - if (pack) { - curl_ret = curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t) stat.st_size); -@@ -263,6 +279,9 @@ int swupd_curl_get_file(const char *url, char *filename, struct file *file, - } - - exit: -+ if (local) { -+ curl_ret = swupd_download_file_complete(curl_ret, local); -+ } - if (curl_ret == CURLE_OK) { - /* curl command succeeded, download might've failed, let our caller LOG_ */ - switch (ret) { -diff --git a/src/download.c b/src/download.c -index 211ee24..2f88fb1 100644 ---- a/src/download.c -+++ b/src/download.c -@@ -165,6 +165,7 @@ static void free_curl_list_data(void *data) - struct file *file = (struct file*)data; - CURL *curl = file->curl; - -+ swupd_download_file_complete(CURLE_OK, file); - curl_multi_remove_handle(mcurl, curl); - curl_easy_cleanup(curl); - } -@@ -379,6 +380,12 @@ static int perform_curl_io_and_complete(int *left) - continue; - } - -+ curl_ret = swupd_download_file_complete(curl_ret, file); -+ /* -+ * Any error as logged already. Let's continue and -+ * hope for the best... or abort via "return -1"? -+ */ -+ - if (ret == 200) { - untar_full_download(file); - } else { --- -2.1.4 diff --git a/recipes-core/swupd-client/swupd-client-2.87/0005-swupd-client-Add-existence-check-to-staging-target.patch b/recipes-core/swupd-client/swupd-client-2.87/0005-swupd-client-Add-existence-check-to-staging-target.patch deleted file mode 100644 index 9779044..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0005-swupd-client-Add-existence-check-to-staging-target.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 1f37511e52754f7231c52489ba4f7d8f7de1e2af Mon Sep 17 00:00:00 2001 -From: "Brad T. Peters" <brad.t.peters@intel.com> -Date: Thu, 7 Jan 2016 14:37:17 -0800 -Subject: [PATCH] swupd-client: Add existence check to staging target - -Patch adds an stat() check to ensure that: -1. target path for a staged file exists, and -2. target path is indeed a directory - -Follow-on patch will add correct corrective behavior once -verify_fix_path() is implemented - -Upstream-Status: Backport [v3.0.0+] - -Signed-off-by: Brad T. Peters <brad.t.peters@intel.com> ---- - src/staging.c | 39 ++++++++++++++++++++++++++++++++------- - 1 file changed, 32 insertions(+), 7 deletions(-) - -diff --git a/src/staging.c b/src/staging.c -index 3a847e2..b8545c1 100644 ---- a/src/staging.c -+++ b/src/staging.c -@@ -277,9 +277,11 @@ int do_staging(struct file *file) - #if SWUPD_LINUX_ROOTFS - char *original = NULL; - char *target = NULL; -+ char *targetpath = NULL; -+ char *symbase = NULL; - #endif - int ret; -- struct stat stat; -+ struct stat s; - - tmp = strdup(file->filename); - tmp2 = strdup(file->filename); -@@ -294,6 +296,29 @@ int do_staging(struct file *file) - string_or_die(&original, "%s/staged/%s", STATE_DIR, file->hash); - - #if SWUPD_LINUX_ROOTFS -+ string_or_die(&targetpath, "%s%s", path_prefix, rel_dir); -+ ret = stat(targetpath, &s); -+ -+ if (S_ISLNK(s.st_mode)) { -+ /* Follow symlink to ultimate target and redo stat */ -+ symbase = realpath(targetpath, NULL); -+ if (symbase != NULL) { -+ free(targetpath); -+ targetpath = strdup(symbase); -+ ret = stat(targetpath, &s); -+ free(symbase); -+ } -+ } -+ -+ /* For now, just report on error conditions. Once we implement -+ * verify_fix_path(char *path, int targetversion), we'll want to call it here */ -+ if ((ret == -1) && (errno == ENOENT)) { -+ printf("Error: Update target directory does not exist: %s\n", targetpath); -+ } else if (!S_ISDIR(s.st_mode)) { -+ printf("Error: Update target exists but is NOT a directory: %s\n", targetpath); -+ } -+ -+ free(targetpath); - string_or_die(&target, "%s%s/.update.%s", path_prefix, rel_dir, base); - ret = swupd_rm(target); - if (ret == 0) -@@ -306,12 +331,12 @@ int do_staging(struct file *file) - string_or_die(&statfile, "%s/%s/%s", STAGING_SUBVOL, rel_dir, base); - #endif - -- memset(&stat, 0, sizeof(struct stat)); -- ret = lstat(statfile, &stat); -+ memset(&s, 0, sizeof(struct stat)); -+ ret = lstat(statfile, &s); - if (ret == 0) { -- if ((file->is_dir && !S_ISDIR(stat.st_mode)) || -- (file->is_link && !S_ISLNK(stat.st_mode)) || -- (file->is_file && !S_ISREG(stat.st_mode))) { -+ if ((file->is_dir && !S_ISDIR(s.st_mode)) || -+ (file->is_link && !S_ISLNK(s.st_mode)) || -+ (file->is_file && !S_ISREG(s.st_mode))) { - LOG_INFO(file, "Type changed!", class_osvol_staging, "%s", statfile); - //file type changed, move old out of the way for new - ret = swupd_rm(statfile); -@@ -325,7 +350,7 @@ int do_staging(struct file *file) - free(statfile); - - #if SWUPD_LINUX_ROOTFS -- if (file->is_dir || S_ISDIR(stat.st_mode)) { -+ if (file->is_dir || S_ISDIR(s.st_mode)) { - /* In the btrfs only scenario there is an implicit - * "create_or_update_dir()" via un-tar-ing a directory.tar after - * download and the untar happens in the staging subvolume which --- -2.5.0 diff --git a/recipes-core/swupd-client/swupd-client-2.87/0006-Backport-Use-rename-instead-of-tar-transform.patch b/recipes-core/swupd-client/swupd-client-2.87/0006-Backport-Use-rename-instead-of-tar-transform.patch deleted file mode 100644 index be4d908..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0006-Backport-Use-rename-instead-of-tar-transform.patch +++ /dev/null @@ -1,156 +0,0 @@ -From e9ad32a273efe2d177c1bbd394ae944ae598fd50 Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@intel.com> -Date: Mon, 8 Feb 2016 18:12:48 +0200 -Subject: [PATCH] Backport: Use rename instead of tar transform - -This patch is a backport from swupd-client v2.88 -Author: William Douglas <william.douglas@intel.com> -Subject: Use rename instead of tar transform - -In order to prevent issues with transform name escaping, update logic -for moving an object from staging. First rename the object in the -staging path to its final name (in case of a directory the rename places -it in a seperate directory first to avoid hash colisions), then use tar -to update or create the object in the filesystem. Once finished rename -the object back to the hash name so it can be reused as needed. - -This also fixes up some issues with the SWUPD_LINUX_ROOTFS checks not -always encapsulating variable use within the do_staging function. - -Note: the SWUPD_LINUX_ROOTFS checks have been removed entirely, since -they are not used anywhere in the code at present. - -Upstream-Status: Backported [v2.88+] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - src/staging.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 67 insertions(+), 6 deletions(-) - -diff --git a/src/staging.c b/src/staging.c -index b8545c1..16dafbb 100644 ---- a/src/staging.c -+++ b/src/staging.c -@@ -36,6 +36,31 @@ - #include "swupd-build-variant.h" - #include <swupd.h> - -+/* clean then recreate temporary folder for tar renames */ -+static int create_staging_renamedir(char *rename_tmpdir) -+{ -+ int ret; -+ char *rmcommand = NULL; -+ -+ string_or_die(&rmcommand, "rm -fr %s", rename_tmpdir); -+ if (!system(rmcommand)) { -+ /* Not fatal but pretty scary, likely to really fail at the -+ * next command too. Pass for now as printing may just cause -+ * confusion */ -+ ; -+ } -+ free(rmcommand); -+ -+ ret = mkdir(rename_tmpdir, S_IRWXU); -+ if (ret == -1 && errno != EEXIST) { -+ ret = -errno; -+ } else { -+ ret = 0; -+ } -+ -+ return ret; -+} -+ - #ifdef SWUPD_WITH_BTRFS - static int create_staging_subvol_from(const char *version) - { -@@ -269,6 +294,9 @@ int prepare(bool UNUSED_PARAM *is_corrupted, int UNUSED_PARAM current_version, i - #endif - - /* Do the staging of new files into the filesystem */ -+#warning do_staging is currently not able to be run in parallel -+/* Consider adding a remove_leftovers() that runs in verify/fix in order to -+ * allow this function to mkdtemp create folders for parallel build */ - int do_staging(struct file *file) - { - char *statfile = NULL, *tmp = NULL, *tmp2 = NULL; -@@ -280,6 +308,8 @@ int do_staging(struct file *file) - char *targetpath = NULL; - char *symbase = NULL; - #endif -+ char *rename_target = NULL; -+ char *rename_tmpdir = NULL; - int ret; - struct stat s; - -@@ -360,12 +390,28 @@ int do_staging(struct file *file) - * attributes and it includes internal logic that does the - * right thing to overlay a directory onto something - * pre-existing: */ -- string_or_die(&tarcommand, "tar -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -- "tar -C %s%s " TAR_PERM_ATTR_ARGS " -xf - --transform=\"s/%s/%s/\" 2> /dev/null", -- STATE_DIR, file->hash, path_prefix, rel_dir, file->hash, base); -+ /* In order to avoid tar transforms with directories, rename -+ * the directory before and after the tar command */ -+ string_or_die(&rename_tmpdir, "%s/tmprenamedir", STATE_DIR); -+ ret = create_staging_renamedir(rename_tmpdir); -+ if (ret) { -+ goto out; -+ } -+ string_or_die(&rename_target, "%s/%s", rename_tmpdir, base); -+ if (rename(original, rename_target)) { -+ ret = -errno; -+ goto out; -+ } -+ string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -+ "tar -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", -+ rename_tmpdir, base, path_prefix, rel_dir); - LOG_DEBUG(file, "directory overwrite", class_osvol_staging, "%s", tarcommand); - ret = system(tarcommand); - free(tarcommand); -+ if (rename(rename_target, original)) { -+ ret = -errno; -+ goto out; -+ } - if (ret < 0) { - LOG_ERROR(file, "Failed directory overwrite", class_osvol_staging, "%s", strerror(errno)); - ret = -EDIR_OVERWRITE; -@@ -386,12 +432,25 @@ int do_staging(struct file *file) - } - if (ret < 0) { - /* either the hardlink failed, or it was undesirable (config), do a tar-tar dance */ -- string_or_die(&tarcommand, "tar -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -- "tar -C %s%s " TAR_PERM_ATTR_ARGS " -xf - --transform=\"s/%s/.update.%s/\" 2> /dev/null", -- STATE_DIR, file->hash, path_prefix, rel_dir, file->hash, base); -+ /* In order to avoid tar transforms, rename the file -+ * before and after the tar command */ -+ string_or_die(&rename_target, "%s/staged/.update.%s", STATE_DIR, base); -+ ret = rename(original, rename_target); -+ if (ret) { -+ ret = -errno; -+ goto out; -+ } -+ string_or_die(&tarcommand, "tar -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - .update.%s 2> /dev/null | " -+ "tar -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", -+ STATE_DIR, base, path_prefix, rel_dir); - LOG_DEBUG(file, "dotfile install", class_osvol_staging, "%s", tarcommand); - ret = system(tarcommand); - free(tarcommand); -+ ret = rename(rename_target, original); -+ if (ret) { -+ ret = -errno; -+ goto out; -+ } - } - if (ret < 0) { - LOG_ERROR(file, "Failed tar dotfile install", class_osvol_staging, -@@ -436,6 +495,8 @@ int do_staging(struct file *file) - out: - free(target); - free(original); -+ free(rename_target); -+ free(rename_tmpdir); - free(tmp); - free(tmp2); - --- -2.5.0 diff --git a/recipes-core/swupd-client/swupd-client-2.87/0007-Add-compatibility-with-libarchive-s-bsdtar-command.patch b/recipes-core/swupd-client/swupd-client-2.87/0007-Add-compatibility-with-libarchive-s-bsdtar-command.patch deleted file mode 100644 index 5154a0e..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/0007-Add-compatibility-with-libarchive-s-bsdtar-command.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 29e2fefaf67bfd6db77db87d22782a31c7284982 Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@intel.com> -Date: Mon, 8 Feb 2016 16:42:23 +0200 -Subject: [PATCH] Add compatibility with libarchive's bsdtar command - -Since GNU tar fails to extract files with xattrs preserved when -Integrity Measurement Architecture (IMA) is enabled some vendors -may choose to install libarchive-based tar (bsdtar) on their embedded -devices, so the swupd server needs to be able to create archives -in its format. - -This patch adds one compile-time options --enable-bsdtar that is used -to enable/disable GNU tar specific options. - -Upstream-Status: Backport [3.1.0+] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - configure.ac | 9 +++++++++ - include/swupd-build-variant.h | 12 ++++++++++-- - src/download.c | 4 ++-- - src/esp.c | 4 ++-- - src/manifest.c | 3 ++- - src/packs.c | 2 +- - src/staging.c | 12 ++++++------ - 7 files changed, 32 insertions(+), 14 deletions(-) - -diff --git a/configure.ac b/configure.ac -index b11ef0a..930f64c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -29,6 +29,15 @@ AS_IF([test "x$enable_bzip2" = "xyes" ], - [AC_DEFINE(SWUPD_WITHOUT_BZIP2,1,[Do not use bzip2 compression])] - ) - -+AC_ARG_ENABLE( -+ [bsdtar], -+ AS_HELP_STRING([--enable-bsdtar], [Use alternative bsdtar command (uses tar by default)]) -+) -+AS_IF([test "x$enable_bsdtar" = "xyes" ], -+ [AC_DEFINE(SWUPD_WITH_BSDTAR, 1, [Use bsdtar])], -+ [AC_DEFINE(SWUPD_WITHOUT_BSDTAR, 1, [Use default tar])] -+) -+ - AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], - [path to systemd system service dir @<:@default=/usr/lib/systemd/system@:>@]), [unitpath=${withval}], - [unitpath="$($PKG_CONFIG --variable=systemdsystemunitdir systemd)"]) -diff --git a/include/swupd-build-variant.h b/include/swupd-build-variant.h -index f2103a2..0c15dca 100644 ---- a/include/swupd-build-variant.h -+++ b/include/swupd-build-variant.h -@@ -13,10 +13,18 @@ - #define VERIFY_FAILED_MAX_VERSIONS_COUNT 20 - #endif - -+#ifdef SWUPD_WITH_BSDTAR -+#define TAR_COMMAND "bsdtar" -+#define TAR_XATTR_ARGS "" -+#else -+#define TAR_COMMAND "tar" -+#define TAR_XATTR_ARGS "--xattrs --xattrs-include='*'" -+#endif -+ - #ifdef SWUPD_WITH_SELINUX --#define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs --xattrs-include='*' --selinux" -+#define TAR_PERM_ATTR_ARGS "--preserve-permissions --selinux " TAR_XATTR_ARGS - #else /* SWUPD_WITHOUT_SELINUX */ --#define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs --xattrs-include='*'" -+#define TAR_PERM_ATTR_ARGS "--preserve-permissions " TAR_XATTR_ARGS - #endif - - #ifdef SWUPD_WITH_REPAIR -diff --git a/src/download.c b/src/download.c -index cb6d1a2..211ee24 100644 ---- a/src/download.c -+++ b/src/download.c -@@ -194,7 +194,7 @@ static int check_tarfile_content(struct file *file, const char *tarfilename) - int count = 0; - - /* we're using -a because the server side has a choice between different compression methods */ -- string_or_die(&tarcommand, "tar -tf %s/download/%s.tar 2> /dev/null", STATE_DIR, file->hash); -+ string_or_die(&tarcommand, TAR_COMMAND " -tf %s/download/%s.tar 2> /dev/null", STATE_DIR, file->hash); - - err = access(tarfilename, R_OK); - if (err) { -@@ -300,7 +300,7 @@ static void untar_full_download(void *data) - } - - /* modern tar will automatically determine the compression type used */ -- string_or_die(&tarcommand, "tar -C %s/staged/ " TAR_PERM_ATTR_ARGS " -xf %s 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C %s/staged/ " TAR_PERM_ATTR_ARGS " -xf %s 2> /dev/null", - STATE_DIR, tarfile); - - LOG_DEBUG(file, "Doing tar operation", class_file_compression, "%s", tarcommand); -diff --git a/src/esp.c b/src/esp.c -index e2b2ae9..3483f55 100644 ---- a/src/esp.c -+++ b/src/esp.c -@@ -231,8 +231,8 @@ int copy_files_to_esp(int target_version) - - progress_step(PROGRESS_MSG_UPDATE_ESP); - -- string_or_die(&tarcommand, "tar -C %s/%d/system/vendor/intel/ -cf - esp 2> /dev/null | " -- "tar -C %s/ -xf - --no-same-permissions --no-same-owner --transform=\"s/esp//\" 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C %s/%d/system/vendor/intel/ -cf - esp 2> /dev/null | " -+ TAR_COMMAND " -C %s/ -xf - --no-same-permissions --no-same-owner --transform=\"s/esp//\" 2> /dev/null", - MOUNT_POINT, target_version, ESP_MOUNT); - - ret = system(tarcommand); -diff --git a/src/manifest.c b/src/manifest.c -index 5757e9f..7c356d7 100644 ---- a/src/manifest.c -+++ b/src/manifest.c -@@ -34,6 +34,7 @@ - #include <fcntl.h> - - #include "config.h" -+#include "swupd-build-variant.h" - #include <swupd.h> - #include <xattrs.h> - #include "progress.h" -@@ -519,7 +520,7 @@ static int retrieve_manifests(int current, int version, char *component, struct - goto out; - } - -- string_or_die(&tar, "tar -C %s/%i -xf %s/%i/Manifest.%s.tar 2> /dev/null", -+ string_or_die(&tar, TAR_COMMAND " -C %s/%i -xf %s/%i/Manifest.%s.tar 2> /dev/null", - STATE_DIR, version, STATE_DIR, version, component); - - LOG_DEBUG(NULL, "tar", class_file_compression, "running %s", tar); -diff --git a/src/packs.c b/src/packs.c -index b176b74..91a83c5 100644 ---- a/src/packs.c -+++ b/src/packs.c -@@ -83,7 +83,7 @@ static int download_pack(int oldversion, int newversion, char *module) - free(url); - - progress_step(PROGRESS_MSG_EXTRACTING_PACK); -- string_or_die(&tar, "tar -C %s " TAR_PERM_ATTR_ARGS " -xf %s/pack-%s-from-%i-to-%i.tar 2> /dev/null", -+ string_or_die(&tar, TAR_COMMAND " -C %s " TAR_PERM_ATTR_ARGS " -xf %s/pack-%s-from-%i-to-%i.tar 2> /dev/null", - STATE_DIR, STATE_DIR, module, oldversion, newversion); - - LOG_INFO(NULL, "Untar of delta pack", class_file_compression, "%s", tar); -diff --git a/src/staging.c b/src/staging.c -index 16dafbb..742e8a2 100644 ---- a/src/staging.c -+++ b/src/staging.c -@@ -402,8 +402,8 @@ int do_staging(struct file *file) - ret = -errno; - goto out; - } -- string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -- "tar -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C %s " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -+ TAR_COMMAND " -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", - rename_tmpdir, base, path_prefix, rel_dir); - LOG_DEBUG(file, "directory overwrite", class_osvol_staging, "%s", tarcommand); - ret = system(tarcommand); -@@ -440,8 +440,8 @@ int do_staging(struct file *file) - ret = -errno; - goto out; - } -- string_or_die(&tarcommand, "tar -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - .update.%s 2> /dev/null | " -- "tar -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - .update.%s 2> /dev/null | " -+ TAR_COMMAND " -C %s%s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", - STATE_DIR, base, path_prefix, rel_dir); - LOG_DEBUG(file, "dotfile install", class_osvol_staging, "%s", tarcommand); - ret = system(tarcommand); -@@ -485,8 +485,8 @@ int do_staging(struct file *file) - /* For initial simplicity replace the file. Ideally this would be - * an intelligent btrfs reflink to maximize block level reuse. */ - //TODO: prove btrfs reflink ioctl works in general, then try using them here -- string_or_die(&tarcommand, "tar -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -- "tar -C %s/%s " TAR_PERM_ATTR_ARGS " -xf - --transform=\"s/%s/%s/\" 2> /dev/null", -+ string_or_die(&tarcommand, TAR_COMMAND " -C %s/staged " TAR_PERM_ATTR_ARGS " -cf - %s 2> /dev/null | " -+ TAR_COMMAND " -C %s/%s " TAR_PERM_ATTR_ARGS " -xf - --transform=\"s/%s/%s/\" 2> /dev/null", - STATE_DIR, file->hash, STAGING_SUBVOL, rel_dir, file->hash, base); - ret = system(tarcommand); - free(tarcommand); --- -2.5.0 diff --git a/recipes-core/swupd-client/swupd-client-2.87/Change-systemctl-path-to-OE-systemctl-path.patch b/recipes-core/swupd-client/swupd-client-2.87/Change-systemctl-path-to-OE-systemctl-path.patch deleted file mode 100644 index 5ca6373..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/Change-systemctl-path-to-OE-systemctl-path.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 259d86e64146c3156eccfcce0351a9cdc4714766 Mon Sep 17 00:00:00 2001 -From: Jaska Uimonen <jaska.uimonen@intel.com> -Date: Thu, 14 Jan 2016 10:17:43 +0200 -Subject: [PATCH] change systemctl path to OE systemctl path - -Upstream-Status: Inappropriate - ---- - src/scripts.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/scripts.c b/src/scripts.c -index e426272..9bec0f5 100644 ---- a/src/scripts.c -+++ b/src/scripts.c -@@ -84,10 +84,10 @@ static void update_triggers(void) - int ret; - LOG_INFO(NULL, "calling systemd trigger", class_scripts, ""); - -- ret = system("/usr/bin/systemctl daemon-reload"); -+ ret = system("/bin/systemctl daemon-reload"); - if (ret != 0) - LOG_ERROR(NULL, "systemd daemon reload failed", class_scripts, "%d", ret); -- ret = system("/usr/bin/systemctl restart update-triggers.target"); -+ ret = system("/bin/systemctl restart update-triggers.target"); - if (ret != 0) - LOG_ERROR(NULL, "systemd update triggers failed", class_scripts, "%d", ret); - } --- -2.5.0 - diff --git a/recipes-core/swupd-client/swupd-client-2.87/Fix-build-failure-on-Yocto.patch b/recipes-core/swupd-client/swupd-client-2.87/Fix-build-failure-on-Yocto.patch deleted file mode 100644 index e7dada8..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/Fix-build-failure-on-Yocto.patch +++ /dev/null @@ -1,35 +0,0 @@ -From ccce73a2d703e6789ded87ca5aa9f3b7c506892a Mon Sep 17 00:00:00 2001 -From: Amarnath Valluri <amarnath.valluri@intel.com> -Date: Thu, 7 Jan 2016 16:19:34 +0200 -Subject: [PATCH] Fix build failure on Yocto - -On install phase certificate files are being installed twice as included in -_DATA twice. We can use EXTRA_DIST than dist_. - -Upstream-Status: Backport [v3.0.0+] - -Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> ---- - Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 1e65d3d..4d15c55 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -111,11 +111,11 @@ SWUPD_CERTS = certs/157753a5.0 \ - certs/d6325660.0 \ - certs/d6325660.1 - swupdcerts_DATA = $(SWUPD_CERTS) --dist_swupdcerts_DATA = $(SWUPD_CERTS) - - EXTRA_DIST += \ - data/check-update.service \ -- data/check-update.timer -+ data/check-update.timer \ -+ $(SWUPD_CERTS) - - DISTCHECK_CONFIGURE_FLAGS = \ - --with-systemdsystemunitdir=$$dc_install_base/$(systemdunitdir) --- -2.1.4 diff --git a/recipes-core/swupd-client/swupd-client-2.87/Right-usage-of-AC_ARG_ENABLE-on-bzip2.patch b/recipes-core/swupd-client/swupd-client-2.87/Right-usage-of-AC_ARG_ENABLE-on-bzip2.patch deleted file mode 100644 index 4e12369..0000000 --- a/recipes-core/swupd-client/swupd-client-2.87/Right-usage-of-AC_ARG_ENABLE-on-bzip2.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d80ae9954c5e5b720766274249dbf5309b7c70a9 Mon Sep 17 00:00:00 2001 -From: Amarnath Valluri <amarnath.valluri@intel.com> -Date: Wed, 13 Jan 2016 15:46:19 +0200 -Subject: [PATCH] Right usage of AC_ARG_ENABLE on bzip2 - -Upstream-Status: Pending - -Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> ---- - configure.ac | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/configure.ac b/configure.ac -index f94a17d..b11ef0a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -20,11 +20,13 @@ AC_CONFIG_HEADERS([config.h]) - PKG_CHECK_MODULES([lzma], [liblzma]) - PKG_CHECK_MODULES([zlib], [zlib]) - AC_ARG_ENABLE( -- bzip2, -- AS_HELP_STRING([--disable-bzip2],[Do not use bzip2 compression (uses bzip2 by default)]), -- AC_DEFINE(SWUPD_WITHOUT_BZIP2,1,[Do not use bzip2 compression]) , -- AC_DEFINE(SWUPD_WITH_BZIP2,1,[Use bzip2 compression]) -- AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress], [], [AC_MSG_ERROR([the libbz2 library is missing])]) -+ [bzip2], -+ AS_HELP_STRING([--disable-bzip2],[Do not use bzip2 compression (uses bzip2 by default)]) -+) -+AS_IF([test "x$enable_bzip2" = "xyes" ], -+ [AC_DEFINE(SWUPD_WITH_BZIP2,1,[Use bzip2 compression]) -+ AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress], [], [AC_MSG_ERROR([the libbz2 library is missing])])], -+ [AC_DEFINE(SWUPD_WITHOUT_BZIP2,1,[Do not use bzip2 compression])] - ) - - AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], --- -2.1.4 diff --git a/recipes-core/swupd-client/swupd-client_2.87.bb b/recipes-core/swupd-client/swupd-client_2.87.bb deleted file mode 100644 index 96e7a10..0000000 --- a/recipes-core/swupd-client/swupd-client_2.87.bb +++ /dev/null @@ -1,60 +0,0 @@ -SUMMARY = "swupd sofware update from Clear Linux - client component" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://COPYING;md5=04d0b48662817042d80393e7511fa41b \ - file://bsdiff/LICENSE;md5=0dbe7a50f028269750631fcbded3846a" - -SRC_URI = "\ - https://download.clearlinux.org/releases/5700/clear/source/SRPMS/${BPN}-${PV}-105.src.rpm;extract=${BP}.tar.gz \ - file://Fix-build-failure-on-Yocto.patch \ - file://Right-usage-of-AC_ARG_ENABLE-on-bzip2.patch \ - file://Change-systemctl-path-to-OE-systemctl-path.patch \ - file://0001-Tolerate-quotes-in-os-release-files.patch \ - file://0005-swupd-client-Add-existence-check-to-staging-target.patch \ - file://0006-Backport-Use-rename-instead-of-tar-transform.patch \ - file://0007-Add-compatibility-with-libarchive-s-bsdtar-command.patch \ - file://0001-log.c-avoid-segfault-and-show-staging-file-name.patch \ - file://0002-downloads-minimize-syscalls-to-improve-performance.patch \ - file://0001-globals.c-Use-fake-address-as-default-updates-url.patch \ - file://0001-manifest.c-Always-initialize-preserver-pointer-of-fi.patch \ - file://0001-Add-configure-option-to-re-enable-updating-of-config.patch \ - file://0001-staging.c-Protect-tar-command-against-special-charac.patch \ -" - -SRC_URI[md5sum] = "5d272c62edb8a9c576005ac5e1182ea3" -SRC_URI[sha256sum] = "45df259a7dc2fed985ee9961e112120fc46670dd75476c3262fc6804b1c66fb8" - -DEPENDS = "glib-2.0 curl openssl libarchive" -RDEPENDS_${PN}_append_class-target = " oe-swupd-helpers bsdtar" -# We check /etc/os-release for the current OS version number -RRECOMMENDS_${PN}_class-target = "os-release" - -inherit pkgconfig autotools-brokensep systemd - -EXTRA_OECONF = "--with-systemdsystemunitdir=${systemd_system_unitdir} --enable-bsdtar" - -PACKAGECONFIG ??= "stateless" -PACKAGECONFIG[stateless] = ",--disable-stateless" - -#TODO: create and install /var/lib/swupd/{delta,staged/download} -do_install_append () { - # swupd-client 2.87 doesn't (succesfully) create these and fails to update - # should they not exist. This is due to a bash-specific shell command - # called to create the directories 'mkdir -p /var/lib/{delta,staged,download}' - install -d ${D}/var/lib/swupd/delta - install -d ${D}/var/lib/swupd/download - install -d ${D}/var/lib/swupd/staged - - # TODO: This should be a less os-specific directory and not hard-code datadir - install -d ${D}/usr/share/clear/bundles -} - -FILES_${PN} += "\ - /usr/share/clear \ - ${systemd_system_unitdir}/multi-user.target.wants* \ - /var/lib/swupd \ -" - -SYSTEMD_SERVICE_${PN} = "check-update.timer check-update.service" -SYSTEMD_AUTO_ENABLE_${PN} = "disable" - -BBCLASSEXTEND = "native" diff --git a/recipes-core/swupd-server/swupd-server-2.53/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch b/recipes-core/swupd-server/swupd-server-2.53/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch deleted file mode 100644 index 4d387c1..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch +++ /dev/null @@ -1,781 +0,0 @@ -From 4a3c91466e0782885fe980b659a6f6ac4835fe8a Mon Sep 17 00:00:00 2001 -From: Joshua Lock <joshua.g.lock@intel.com> -Date: Thu, 28 Jan 2016 10:24:56 +0000 -Subject: [PATCH] Add option -S to take the state data dir as an argument - -The optional -S option expects a full path to a directory -swupd-server should use instead of the default /var/lib/update. - -Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> - -Upstream-Status: Backport [v3.0+] - ---- - include/swupd.h | 11 ++++++--- - src/analyze_fs.c | 4 ++-- - src/chroot.c | 13 ++++++----- - src/globals.c | 53 +++++++++++++++++++++++++++++++++++++++++ - src/main.c | 50 ++++++++++++++++++++++++++++++--------- - src/make_fullfiles.c | 63 +++++++++++++++++++++++++++++++++++++++++++++---- - src/make_packs.c | 66 ++++++++++++++++++++++++++++++++++++++++++++-------- - src/pack.c | 65 +++++++++++++++++++++++++++------------------------ - src/rename.c | 6 ++--- - src/versions.c | 6 ++--- - 10 files changed, 264 insertions(+), 73 deletions(-) - -diff --git a/include/swupd.h b/include/swupd.h -index 00b88d4..522ac2e 100644 ---- a/include/swupd.h -+++ b/include/swupd.h -@@ -16,9 +16,6 @@ - #define SWUPD_DEFAULT_FORMAT 3 - - #define SWUPD_SERVER_STATE_DIR "/var/lib/update" --#define PACKSTAGE_DIR SWUPD_SERVER_STATE_DIR "/packstage" --#define IMAGE_DIR SWUPD_SERVER_STATE_DIR "/image" --#define STAGING_DIR SWUPD_SERVER_STATE_DIR "/www" - - #if SWUPD_WITH_SELINUX - #define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs --xattrs-include='*' --selinux" -@@ -123,9 +120,17 @@ extern int newversion; - extern int minversion; - extern char *format_string; - -+extern char *state_dir; -+extern char *packstage_dir; -+extern char *image_dir; -+extern char *staging_dir; -+ - extern bool init_globals(void); - extern void free_globals(void); - extern bool set_format_string(char *); -+extern bool set_state_dir(char *); -+extern bool init_state_globals(void); -+extern void free_state_globals(void); - - extern int file_sort_hash(gconstpointer a, gconstpointer b); - extern int file_sort_filename(gconstpointer a, gconstpointer b); -diff --git a/src/analyze_fs.c b/src/analyze_fs.c -index 4d01ccf..f6cfa13 100644 ---- a/src/analyze_fs.c -+++ b/src/analyze_fs.c -@@ -389,7 +389,7 @@ struct manifest *full_manifest_from_directory(int version) - - manifest = alloc_manifest(version, "full"); - -- string_or_die(&dir, "%s/%i/full", IMAGE_DIR, version); -+ string_or_die(&dir, "%s/%i/full", image_dir, version); - - threadpool = g_thread_pool_new(get_hash, dir, 12, FALSE, NULL); - -@@ -413,7 +413,7 @@ struct manifest *sub_manifest_from_directory(char *component, int version) - - manifest = alloc_manifest(version, component); - -- string_or_die(&dir, "%s/%i/%s", IMAGE_DIR, version, component); -+ string_or_die(&dir, "%s/%i/%s", image_dir, version, component); - - iterate_directory(manifest, dir, "", false); - -diff --git a/src/chroot.c b/src/chroot.c -index d85b5f7..cb6a04a 100644 ---- a/src/chroot.c -+++ b/src/chroot.c -@@ -41,14 +41,15 @@ void chroot_create_full(int newversion) - struct stat buf; - char *full_dir; - -- string_or_die(&full_dir, "%s/%i/full/", IMAGE_DIR, newversion); -+ string_or_die(&full_dir, "%s/%i/full/ ", image_dir, newversion); - - g_mkdir_with_parents(full_dir, S_IRWXU); - - - /* start with base */ - LOG(NULL, "Copying chroot os-core to full", ""); -- string_or_die(&command, "rsync -aAX " IMAGE_DIR "/%i/os-core/ %s", newversion, full_dir); -+ string_or_die(&command, "rsync -aAX %s/%i/os-core/ %s", -+ image_dir, newversion, full_dir); - ret = system(command); - assert(ret==0); - free(command); -@@ -61,8 +62,8 @@ void chroot_create_full(int newversion) - } - - LOG(NULL, "Overlaying bundle chroot onto full", "%s", group); -- string_or_die(&command, "rsync -aAX --ignore-existing " IMAGE_DIR "/%i/%s/ %s", -- newversion, group, full_dir); -+ string_or_die(&command, "rsync -aAX --ignore-existing %s/%i/%s/ %s", -+ image_dir, newversion, group, full_dir); - ret = system(command); - assert(ret==0); - free(command); -@@ -81,8 +82,8 @@ void chroot_create_full(int newversion) - } - - LOG(NULL, "Recopy bundle chroot out of full", "%s", group); -- string_or_die(&command, "rsync -aAX --existing %s " IMAGE_DIR "/%i/%s", -- full_dir, newversion, group); -+ string_or_die(&command, "rsync -aAX --existing %s %s/%i/%s", -+ full_dir, image_dir, newversion, group); - ret = system(command); - assert(ret==0); - free(command); -diff --git a/src/globals.c b/src/globals.c -index 32dc793..ff6a3fa 100644 ---- a/src/globals.c -+++ b/src/globals.c -@@ -34,6 +34,11 @@ int newversion = -1; - int minversion = 0; - char *format_string = NULL; - -+char *state_dir = NULL; -+char *packstage_dir = NULL; -+char *image_dir = NULL; -+char *staging_dir = NULL; -+ - bool set_format_string(char *userinput) - { - int version; -@@ -52,12 +57,36 @@ bool set_format_string(char *userinput) - return true; - } - -+bool set_state_dir(char *dir) -+{ -+ if (dir == NULL || dir[0] == '\0') { -+ return false; -+ } -+ -+ /* TODO: more validation of input? */ -+ if (dir[0] != '/') { -+ printf("statedir must be a full path starting with '/', not '%c'\n", dir[0]); -+ return false; -+ } -+ -+ if (state_dir) { -+ free(state_dir); -+ } -+ string_or_die(&state_dir, "%s", dir); -+ -+ return true; -+} -+ - bool init_globals(void) - { - if (format_string == NULL) { - string_or_die(&format_string, "%d", SWUPD_DEFAULT_FORMAT); - } - -+ if (!init_state_globals()) { -+ return false; -+ } -+ - if (newversion == -1) { - printf("Missing version parameter: No new version number specified\n"); - return false; -@@ -71,4 +100,28 @@ bool init_globals(void) - void free_globals(void) - { - free(format_string); -+ free(state_dir); -+ free(packstage_dir); -+ free(image_dir); -+ free(staging_dir); -+} -+ -+bool init_state_globals(void) -+{ -+ if (state_dir == NULL) { -+ string_or_die(&state_dir, "%s", SWUPD_SERVER_STATE_DIR); -+ } -+ string_or_die(&packstage_dir, "%s/%s", state_dir, "packstage"); -+ string_or_die(&image_dir, "%s/%s", state_dir, "image"); -+ string_or_die(&staging_dir, "%s/%s", state_dir, "www"); -+ -+ return true; -+} -+ -+void free_state_globals(void) -+{ -+ free(state_dir); -+ free(packstage_dir); -+ free(image_dir); -+ free(staging_dir); - } -diff --git a/src/main.c b/src/main.c -index ccfedfd..9366cd9 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -55,6 +55,7 @@ static const struct option prog_opts[] = { - {"minversion", required_argument, 0, 'm'}, - {"format", required_argument, 0, 'F'}, - {"getformat", no_argument, 0, 'g'}, -+ {"statedir", required_argument, 0, 'S'}, - {0, 0, 0, 0} - }; - -@@ -70,6 +71,7 @@ static void print_help(const char *name) { - printf(" -m, --minversion Optional minimum file version to write into manifests per file\n"); - printf(" -F, --format Optional format string [ default:=%d ]\n", SWUPD_DEFAULT_FORMAT); - printf(" -g, --getformat Print current format string and exit\n"); -+ printf(" -S, --statedir Optional directory to use for state [ default:=%s ]\n", SWUPD_SERVER_STATE_DIR); - printf("\n"); - } - -@@ -77,7 +79,7 @@ static bool parse_options(int argc, char **argv) - { - int opt; - -- while ((opt = getopt_long(argc, argv, "hvo:m:F:g", prog_opts, NULL)) != -1) { -+ while ((opt = getopt_long(argc, argv, "hvo:m:F:g:S:", prog_opts, NULL)) != -1) { - switch (opt) { - case '?': - case 'h': -@@ -107,6 +109,12 @@ static bool parse_options(int argc, char **argv) - return false; - } - break; -+ case 'S': -+ if (!optarg || !set_state_dir(optarg)) { -+ printf("Invalid --statedir argument ''%s'\n\n", optarg); -+ return false; -+ } -+ break; - case 'g': - if (format_string == NULL) { - printf("%d\n", SWUPD_DEFAULT_FORMAT); -@@ -138,9 +146,14 @@ static void check_root(void) - static void populate_dirs(int version) - { - char *newversiondir; -- string_or_die(&newversiondir, "%s/%d", IMAGE_DIR, version); -+ -+ string_or_die(&newversiondir, "%s/%d", image_dir, version); - - if ((access(newversiondir, F_OK | R_OK) != 0) && (version == 0)) { -+ char *latestpath = NULL; -+ -+ string_or_die(&latestpath, "%s/latest.version", image_dir); -+ - printf("** %s does not exist... creating and populating\n", newversiondir); - if (mkdir(newversiondir, 0755) != 0) { - printf("Failed to create directory\n"); -@@ -151,14 +164,17 @@ static void populate_dirs(int version) - } - - FILE *latestver; -- latestver = fopen_exclusive(IMAGE_DIR "/latest.version"); -+ latestver = fopen_exclusive(latestpath); - if (latestver == NULL) { -- printf("Failed to create %s/latest.version\n", IMAGE_DIR); -+ printf("Failed to create %s\n", latestpath); -+ free(latestpath); - return; - } - if (fwrite("0\n", 2, 1, latestver) != 1) { - LOG(NULL, "Failed to write latestver", "errno: %d", errno); - } -+ -+ free(latestpath); - fclose(latestver); - } - /* groups don't exist in version 0 */ -@@ -170,7 +186,7 @@ static void populate_dirs(int version) - break; - } - -- string_or_die(&newversiondir, "%s/%d/%s", IMAGE_DIR, version, group); -+ string_or_die(&newversiondir, "%s/%d/%s", image_dir, version, group); - - /* Create the bundle directory(s) as needed */ - if (access(newversiondir, F_OK | R_OK) != 0) { -@@ -186,13 +202,18 @@ static void populate_dirs(int version) - - static int check_build_env(void) - { -- if (access(SWUPD_SERVER_STATE_DIR "/temp", F_OK | R_OK) != 0) { -- LOG(NULL, "/var/lib/update/temp does not exist...creating directory", ""); -- if (mkdir(SWUPD_SERVER_STATE_DIR "/temp", 0755) != 0) { -+ char *temp_dir = NULL; -+ string_or_die(&temp_dir, "%s/%s", state_dir, "/temp"); -+ -+ if (access(temp_dir, F_OK | R_OK) != 0) { -+ LOG(NULL, "%s", "does not exist...creating directory", temp_dir); -+ if (mkdir(temp_dir, 0755) != 0) { - printf("Failed to create build directory, EXITING\n"); -+ free(temp_dir); - return -errno; - } - } -+ free(temp_dir); - - return 0; - } -@@ -217,6 +238,8 @@ int main(int argc, char **argv) - int exit_status = EXIT_FAILURE; - int ret; - -+ char *file_path = NULL; -+ - /* keep valgrind working well */ - setenv("G_SLICE", "always-malloc", 0); - -@@ -240,12 +263,17 @@ int main(int argc, char **argv) - } - - -- if (!read_configuration_file(SWUPD_SERVER_STATE_DIR "/server.ini")) { -- printf("Failed to read " SWUPD_SERVER_STATE_DIR "/server.ini configuration file!\n"); -+ string_or_die(&file_path, "%s/server.ini", state_dir); -+ if (!read_configuration_file(file_path)) { -+ printf("Failed to read %s configuration file!\n", state_dir); -+ free(file_path); - goto exit; - } -+ free(file_path); - -- read_group_file(SWUPD_SERVER_STATE_DIR "/groups.ini"); -+ string_or_die(&file_path, "%s/groups.ini", state_dir); -+ read_group_file(file_path); -+ free(file_path); - - read_current_version("latest.version"); - printf("Last processed version is %i\n", current_version); -diff --git a/src/make_fullfiles.c b/src/make_fullfiles.c -index e755a33..bf97a1c 100644 ---- a/src/make_fullfiles.c -+++ b/src/make_fullfiles.c -@@ -27,8 +27,52 @@ - #include <string.h> - #include <assert.h> - -+#include <getopt.h> -+ - #include <swupd.h> - -+static const struct option prog_opts[] = { -+ {"help", no_argument, 0, 'h'}, -+ {"statedir", required_argument, 0, 'S'}, -+ {0, 0, 0, 0} -+}; -+ -+static void usage(const char *name) -+{ -+ printf("usage:\n"); -+ printf(" %s <version>\n\n", name); -+ printf("Help options:\n"); -+ printf(" -h, --help Show help options\n"); -+ printf(" -S, --statedir Optional directory to use for state [ default:=%s ]\n", SWUPD_SERVER_STATE_DIR); -+ printf("\n"); -+} -+ -+static bool parse_options(int argc, char **argv) -+{ -+ int opt; -+ -+ while ((opt = getopt_long(argc, argv, "hS:", prog_opts, NULL)) != -1) { -+ switch (opt) { -+ case '?': -+ case 'h': -+ usage(argv[0]); -+ return false; -+ case 'S': -+ if (!optarg || !set_state_dir(optarg)) { -+ printf("Invalid --statedir argument '%s'\n\n", optarg); -+ return false; -+ } -+ break; -+ } -+ } -+ -+ if (!init_state_globals()) { -+ return false; -+ } -+ -+ return true; -+} -+ - static void banner(void) - { - printf(PACKAGE_NAME " update creator -- fullfiles -- version " PACKAGE_VERSION "\n"); -@@ -51,20 +95,29 @@ int main(int argc, char **argv) - { - struct manifest *manifest; - int version; -+ char *file_path = NULL; - - /* keep valgrind working well */ - setenv("G_SLICE", "always-malloc", 0); - -+ if (!parse_options(argc, argv)) { -+ free_state_globals(); -+ return EXIT_FAILURE; -+ } - banner(); - check_root(); - -- read_configuration_file(SWUPD_SERVER_STATE_DIR "/server.ini"); -+ string_or_die(&file_path, "%s/server.ini", state_dir); -+ read_configuration_file(file_path); -+ free(file_path); - -- if (argc < 1) { -- printf("Usage:\n\tswupd_make_fullfiles <version>\n\n"); -+ if (argc - optind < 1) { -+ usage(argv[0]); -+ free_state_globals(); - exit(EXIT_FAILURE); - } -- version = strtoull(argv[1], NULL, 10); -+ -+ version = strtoull(argv[optind++], NULL, 10); - if (version < 0) { - printf("Usage:\n\tswupd_make_fullfiles <version>\n\n"); - exit(EXIT_FAILURE); -@@ -73,5 +126,7 @@ int main(int argc, char **argv) - manifest = manifest_from_file(version, "full"); - create_fullfiles(manifest); - -+ free_state_globals(); -+ - return EXIT_SUCCESS; - } -diff --git a/src/make_packs.c b/src/make_packs.c -index 20fbd67..2b62b8a 100644 ---- a/src/make_packs.c -+++ b/src/make_packs.c -@@ -33,6 +33,8 @@ - - #include <glib.h> - -+#include <getopt.h> -+ - #include <swupd.h> - - static void banner(void) -@@ -43,12 +45,47 @@ static void banner(void) - printf("\n"); - } - --static void usage(void) -+static const struct option prog_opts[] = { -+ {"help", no_argument, 0, 'h'}, -+ {"statedir", required_argument, 0, 'S'}, -+ {0, 0, 0, 0} -+}; -+ -+static void usage(const char *name) - { - printf("usage:\n"); -- printf(" swupd_make_pack <start version> <latest version> <bundle>\n"); -+ printf(" %s <start version> <latest version> <bundle>\n\n", name); -+ printf("Help options:\n"); -+ printf(" -h, --help Show help options\n"); -+ printf(" -S, --statedir Optional directory to use for state [ default:=%s ]\n", SWUPD_SERVER_STATE_DIR); - printf("\n"); -- exit(EXIT_FAILURE); -+} -+ -+static bool parse_options(int argc, char **argv) -+{ -+ int opt; -+ -+ while ((opt = getopt_long(argc, argv, "hS:", prog_opts, NULL)) != -1) { -+ switch (opt) { -+ case '?': -+ case 'h': -+ usage(argv[0]); -+ return false; -+ case 'S': -+ if (!optarg || !set_state_dir(optarg)) { -+ printf("Invalid --statedir argument ''%s'\n\n", optarg); -+ return false; -+ } -+ break; -+ } -+ } -+ -+ /* FIXME: *_state_globals() are ugly hacks */ -+ if (!init_state_globals()) { -+ return false; -+ } -+ -+ return true; - } - - int main(int argc, char **argv) -@@ -59,11 +96,17 @@ int main(int argc, char **argv) - char *module; - struct packdata *pack; - int exit_status = EXIT_FAILURE; -+ char *file_path = NULL; - -+ if (!parse_options(argc, argv)) { -+ free_state_globals(); -+ return EXIT_FAILURE; -+ } - banner(); - -- if (argc != 4) { -- usage(); -+ if (argc - optind != 3) { -+ usage(argv[0]); -+ exit(EXIT_FAILURE); - } - - /* FIXME: should use "end_version" not "0" and a unique filename -@@ -76,12 +119,13 @@ int main(int argc, char **argv) - return exit_status; - } - -- read_configuration_file(SWUPD_SERVER_STATE_DIR "/server.ini"); -- -+ string_or_die(&file_path, "%s/server.ini", state_dir); -+ read_configuration_file(file_path); -+ free(file_path); - -- start_version = strtoull(argv[1], NULL, 10); -- end_version = strtoull(argv[2], NULL, 10); -- module = argv[3]; -+ start_version = strtoull(argv[optind++], NULL, 10); -+ end_version = strtoull(argv[optind++], NULL, 10); -+ module = argv[optind++]; - - if ((start_version < 0) || - (end_version == 0) || -@@ -108,5 +152,7 @@ int main(int argc, char **argv) - printf("Pack creation %s (pack-%s %i to %li)\n", - exit_status == EXIT_SUCCESS ? "complete" : "failed", - module, start_version, end_version); -+ -+ free_state_globals(); - return exit_status; - } -diff --git a/src/pack.c b/src/pack.c -index f021af9..5bb99b8 100644 ---- a/src/pack.c -+++ b/src/pack.c -@@ -46,21 +46,21 @@ static void empty_pack_stage(int full, int version, char *module) - int ret; - - // clean any stale data (eg: re-run after a failure) -- string_or_die(&cmd, "rm -rf " PACKSTAGE_DIR "/%s/%i/", module, version); -+ string_or_die(&cmd, "rm -rf %s/%s/%i/", packstage_dir, module, version); - ret = system(cmd); - if (ret) { -- fprintf(stderr, "Failed to clean " PACKSTAGE_DIR "/%s/%i\n", -- module, version); -+ fprintf(stderr, "Failed to clean %s/%s/%i\n", -+ packstage_dir, module, version); - exit(EXIT_FAILURE); - } - free(cmd); - - if (!full) { - // (re)create module/version/{delta,staged} -- string_or_die(&path, PACKSTAGE_DIR "/%s/%i/delta", module, version); -+ string_or_die(&path, "%s/%s/%i/delta", packstage_dir, module, version); - g_mkdir_with_parents(path, S_IRWXU | S_IRWXG); - free(path); -- string_or_die(&path, PACKSTAGE_DIR "/%s/%i/staged", module, version); -+ string_or_die(&path, "%s/%s/%i/staged", packstage_dir, module, version); - g_mkdir_with_parents(path, S_IRWXU | S_IRWXG); - free(path); - } -@@ -76,7 +76,7 @@ static void explode_pack_stage(int version, char *module) - struct stat buf; - char *path; - -- string_or_die(&path, PACKSTAGE_DIR "/%s/%i/staged", module, version); -+ string_or_die(&path, "%s/%s/%i/staged", packstage_dir, module, version); - g_mkdir_with_parents(path, S_IRWXU | S_IRWXG); - dir = opendir(path); - if (!dir) { -@@ -99,7 +99,8 @@ static void explode_pack_stage(int version, char *module) - continue; - } - -- string_or_die(&path, PACKSTAGE_DIR "/%s/%i/staged/%s", module, version, entry->d_name); -+ string_or_die(&path, "%s/%s/%i/staged/%s", -+ packstage_dir, module, version, entry->d_name); - ret = stat(path, &buf); - if (ret) { - free(path); -@@ -112,8 +113,8 @@ static void explode_pack_stage(int version, char *module) - * the resulting pack is slightly smaller, and in addition, we're saving CPU - * time on the client... - */ -- string_or_die(&tar, "tar --directory=" PACKSTAGE_DIR "/%s/%i/staged --warning=no-timestamp " -- TAR_PERM_ATTR_ARGS " -axf %s", module, version, path); -+ string_or_die(&tar, "tar --directory=%s/%s/%i/staged --warning=no-timestamp " -+ TAR_PERM_ATTR_ARGS " -axf %s", packstage_dir, module, version, path); - ret = system(tar); - if (!ret) { - unlink(path); -@@ -162,8 +163,8 @@ static void make_pack_full_files(struct packdata *pack) - if ((!file->peer || file->peer->is_deleted) && !file->is_deleted && !file->rename_peer) { - char *from, *to; - /* hardlink each file that is in <end> but not in <X> */ -- string_or_die(&from, STAGING_DIR "/%i/files/%s.tar", file->last_change, file->hash); -- string_or_die(&to, PACKSTAGE_DIR "/%s/%i/staged/%s.tar", pack->module, pack->from, file->hash); -+ string_or_die(&from, "%s/%i/files/%s.tar", staging_dir, file->last_change, file->hash); -+ string_or_die(&to, "%s/%s/%i/staged/%s.tar", packstage_dir, pack->module, pack->from, file->hash); - ret = link(from, to); - if (ret) { - if (errno != EEXIST) { -@@ -228,8 +229,8 @@ static GList *consolidate_packs_delta_files(GList *files, struct packdata *pack) - continue; - } - -- string_or_die(&from, STAGING_DIR "/%i/delta/%i-%i-%s", file->last_change, -- file->peer->last_change, file->last_change, file->hash); -+ string_or_die(&from, "%s/%i/delta/%i-%i-%s", staging_dir, file->last_change, -+ file->peer->last_change, file->last_change, file->hash); - - ret = stat(from, &stat_delta); - if (ret && !find_file_in_list(files, file)) { -@@ -284,8 +285,8 @@ static int write_pack_signature(struct packdata *pack) - char *filename = NULL; - int ret = -1; - -- string_or_die(&filename, STAGING_DIR "/%i/pack-%s-from-%i.tar", -- pack->to, pack->module, pack->from); -+ string_or_die(&filename, "%s/%i/pack-%s-from-%i.tar", -+ staging_dir, pack->to, pack->module, pack->from); - if (!signature_sign(filename)) { - fprintf(stderr, "Creating signature for '%s' failed\n", filename); - goto exit; -@@ -324,12 +325,14 @@ static int make_final_pack(struct packdata *pack) - - /* for each file changed since <X> */ - /* locate delta, check if the diff it's from is >= <X> */ -- string_or_die(&from, STAGING_DIR "/%i/delta/%i-%i-%s", file->last_change, -- file->peer->last_change, file->last_change, file->hash); -- string_or_die(&to, PACKSTAGE_DIR "/%s/%i/delta/%i-%i-%s", pack->module, pack->from, -+ string_or_die(&from, "%s/%i/delta/%i-%i-%s", staging_dir, file->last_change, - file->peer->last_change, file->last_change, file->hash); -- string_or_die(&tarfrom, STAGING_DIR "/%i/files/%s.tar", file->last_change, file->hash); -- string_or_die(&tarto, PACKSTAGE_DIR "/%s/%i/staged/%s.tar", pack->module, pack->from, file->hash); -+ string_or_die(&to, "%s/%s/%i/delta/%i-%i-%s", packstage_dir, pack->module, -+ pack->from, file->peer->last_change, file->last_change, file->hash); -+ string_or_die(&tarfrom, "%s/%i/files/%s.tar", staging_dir, -+ file->last_change, file->hash); -+ string_or_die(&tarto, "%s/%s/%i/staged/%s.tar", packstage_dir, pack->module, -+ pack->from, file->hash); - - ret = stat(from, &stat_delta); - if (ret) { -@@ -388,8 +391,8 @@ static int make_final_pack(struct packdata *pack) - char *from, *to; - struct stat st; - -- string_or_die(&from, STAGING_DIR "/%i/Manifest-%s-delta-from-%i", -- pack->to, pack->module, pack->from); -+ string_or_die(&from, "%s/%i/Manifest-%s-delta-from-%i", -+ staging_dir, pack->to, pack->module, pack->from); - - ret = stat(from, &st); - if (ret) { -@@ -398,8 +401,8 @@ static int make_final_pack(struct packdata *pack) - } - - -- string_or_die(&to, PACKSTAGE_DIR "/%s/%i/Manifest-%s-delta-from-%i", -- pack->module, pack->from, pack->module, pack->from); -+ string_or_die(&to, "%s/%s/%i/Manifest-%s-delta-from-%i", -+ packstage_dir, pack->module, pack->from, pack->module, pack->from); - - ret = link(from, to); - if (ret) { -@@ -416,16 +419,16 @@ static int make_final_pack(struct packdata *pack) - char *from, *to; - struct stat st; - -- string_or_die(&from, STAGING_DIR "/%i/Manifest-%s-delta-from-%i", -- pack->to, "MoM", pack->from); -+ string_or_die(&from, "%s/%i/Manifest-%s-delta-from-%i", -+ staging_dir, pack->to, "MoM", pack->from); - ret = stat(from, &st); - if (ret) { - LOG(NULL, "Making extra manifest delta", "MoM: %i->%i", pack->from, pack->to); - create_manifest_delta(pack->from, pack->to, "MoM"); - } - -- string_or_die(&to, PACKSTAGE_DIR "/%s/%i/Manifest-%s-delta-from-%i", -- pack->module, pack->from, "MoM", pack->from); -+ string_or_die(&to, "%s/%s/%i/Manifest-%s-delta-from-%i", -+ packstage_dir, pack->module, pack->from, "MoM", pack->from); - - ret = link(from, to); - if (ret) { -@@ -439,9 +442,9 @@ static int make_final_pack(struct packdata *pack) - - /* tar the staging directory up */ - LOG(NULL, "starting tar for pack", "%s: %i to %i", pack->module, pack->from, pack->to); -- string_or_die(&tar, "tar " TAR_PERM_ATTR_ARGS " --directory=" PACKSTAGE_DIR "/%s/%i/ " -- "--numeric-owner -Jcf " STAGING_DIR "/%i/pack-%s-from-%i.tar delta staged", -- pack->module, pack->from, pack->to, pack->module, pack->from); -+ string_or_die(&tar, "tar " TAR_PERM_ATTR_ARGS " --directory=%s/%s/%i/ " -+ "--numeric-owner -Jcf %s/%i/pack-%s-from-%i.tar delta staged", -+ packstage_dir, pack->module, pack->from, staging_dir, pack->to, pack->module, pack->from); - ret = system(tar); - free(tar); - LOG(NULL, "finished tar for pack", "%s: %i to %i", pack->module, pack->from, pack->to); -diff --git a/src/rename.c b/src/rename.c -index 70f9006..5ea979c 100644 ---- a/src/rename.c -+++ b/src/rename.c -@@ -153,7 +153,7 @@ static void precompute_file_data(struct manifest *manifest, struct file *file, i - } - - if (manifest) { -- string_or_die(&filename, "%s/%i/%s/%s", IMAGE_DIR, manifest->version, manifest->component, file->filename); -+ string_or_die(&filename, "%s/%i/%s/%s", image_dir, manifest->version, manifest->component, file->filename); - } else if (old_rename) { - item = g_list_first(last_versions_list); - while (item) { -@@ -161,13 +161,13 @@ static void precompute_file_data(struct manifest *manifest, struct file *file, i - item = g_list_next(item); - - free(filename); -- string_or_die(&filename, "%s/%i/full/%s", IMAGE_DIR, last_change, file->filename); -+ string_or_die(&filename, "%s/%i/full/%s", image_dir, last_change, file->filename); - if (!lstat(filename, &buf)) { - break; - } - } - } else { -- string_or_die(&filename, "%s/%i/full/%s", IMAGE_DIR, file->last_change, file->filename); -+ string_or_die(&filename, "%s/%i/full/%s", image_dir, file->last_change, file->filename); - } - - /* make sure file->stat.st_size is valid */ -diff --git a/src/versions.c b/src/versions.c -index eb38acc..3dd1e63 100644 ---- a/src/versions.c -+++ b/src/versions.c -@@ -213,10 +213,10 @@ GList *get_last_versions_list(int next_version, int max_versions) - int idx, build_num, build_type, jump_point; - int jump_point_found; - -- dir = opendir(STAGING_DIR); -+ dir = opendir(staging_dir); - if (dir == NULL) { - LOG(NULL, "Cannot open directory", "dir_path= %s, strerror= %s", -- STAGING_DIR, strerror(errno)); -+ staging_dir, strerror(errno)); - return NULL; - } - -@@ -226,7 +226,7 @@ GList *get_last_versions_list(int next_version, int max_versions) - } - - free(filename); -- string_or_die(&filename, STAGING_DIR "/%s", entry.d_name); -+ string_or_die(&filename, "%s/%s", staging_dir, entry.d_name); - - if (lstat(filename, &stat)) { - LOG(NULL, "lstat failed", "path= %s, strerror= %s", --- -2.5.0 diff --git a/recipes-core/swupd-server/swupd-server-2.53/0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch b/recipes-core/swupd-server/swupd-server-2.53/0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch deleted file mode 100644 index f0a645a..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch +++ /dev/null @@ -1,131 +0,0 @@ -From a32179878e8e439948a4a6385515a0aea7a61592 Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@intel.com> -Date: Fri, 29 Jan 2016 17:48:46 +0200 -Subject: [PATCH] Add system_argv() helper for safer calls to system utilities - -Often file names contain special characters like hashes or -whitespaces and that makes escaping a difficult task when using -system(). Thus add a new helper system_argv() that is based -on execvp() syscall and doesn't require escaping. - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@intel.com> - -Upstream-Status: Backport [v2.54+] - ---- - include/swupd.h | 1 + - src/fullfiles.c | 6 ++---- - src/helpers.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 66 insertions(+), 4 deletions(-) - -diff --git a/include/swupd.h b/include/swupd.h -index 522ac2e..ad4b967 100644 ---- a/include/swupd.h -+++ b/include/swupd.h -@@ -228,6 +228,7 @@ extern FILE * fopen_exclusive(const char *filename); /* no mode, opens for write - extern void dump_file_info(struct file *file); - extern void string_or_die(char **strp, const char *fmt, ...); - extern void print_elapsed_time(struct timeval *previous_time, struct timeval *current_time); -+extern int system_argv(char *const argv[]); - - extern bool signature_initialize(void); - extern void signature_terminate(void); -diff --git a/src/fullfiles.c b/src/fullfiles.c -index 1bb581e..fa78293 100644 ---- a/src/fullfiles.c -+++ b/src/fullfiles.c -@@ -138,12 +138,10 @@ static void create_fullfile(struct file *file) - string_or_die(&tempfile, "%s/%s", empty, file->hash); - if (link(origin, tempfile) < 0) { - LOG(NULL, "hardlink failed", "%s due to %s (%s -> %s)", file->filename, strerror(errno), origin, tempfile); -- string_or_die(&tarcommand, "cp -a %s %s", origin, tempfile); -- if (system(tarcommand) != 0) { -- LOG(NULL, "Failed to run command:", "%s", tarcommand); -+ char *const argv[] = {"cp", "-a", origin, tempfile, NULL}; -+ if (system_argv(argv) != 0) { - assert(0); - } -- free(tarcommand); - } - - /* step 2a: tar it with each compression type */ -diff --git a/src/helpers.c b/src/helpers.c -index 65acffd..5884b51 100644 ---- a/src/helpers.c -+++ b/src/helpers.c -@@ -29,6 +29,7 @@ - #include <sys/types.h> - #include <sys/stat.h> - #include <sys/time.h> -+#include <sys/wait.h> - #include <fcntl.h> - #include <errno.h> - -@@ -124,3 +125,65 @@ void print_elapsed_time(struct timeval *previous_time, struct timeval *current_t - - free(elapsed); - } -+ -+void concat_str_array(char **output, char *const argv[]) -+{ -+ int size = 0; -+ -+ for (int i = 0; argv[i]; i++) { -+ size += strlen(argv[i]) + 1; -+ } -+ -+ *output = malloc(size + 1); -+ if (!*output) { -+ LOG(NULL, "Failed to allocate", "%i bytes", size); -+ assert(0); -+ } -+ strcpy(*output, ""); -+ for (int i = 0; argv[i]; i++) { -+ strcat(*output, argv[i]); -+ strcat(*output, " "); -+ } -+} -+ -+int system_argv(char *const argv[]) -+{ -+ int child_exit_status; -+ pid_t pid; -+ int status; -+ -+ pid = fork(); -+ -+ if (pid == 0) { /* child */ -+ execvp(*argv, argv); -+ LOG(NULL, "This line must not be reached", ""); -+ assert(0); -+ } else if (pid < 0) { -+ LOG(NULL, "Failed to fork a child process", ""); -+ assert(0); -+ } else { -+ pid_t ws = waitpid(pid, &child_exit_status, 0); -+ -+ if (ws == -1) { -+ LOG(NULL, "Failed to wait for child process", ""); -+ assert(0); -+ } -+ -+ if (WIFEXITED(child_exit_status)) { -+ status = WEXITSTATUS(child_exit_status); -+ } else { -+ LOG(NULL, "Child process didn't exit", ""); -+ assert(0); -+ } -+ -+ if (status != 0) { -+ char* cmdline = NULL; -+ -+ concat_str_array(&cmdline, argv); -+ LOG(NULL, "Failed to run command:", "%s", cmdline); -+ free(cmdline); -+ } -+ -+ return status; -+ } -+} --- -2.5.0 diff --git a/recipes-core/swupd-server/swupd-server-2.53/0003-Add-configure-option-to-re-enable-config-files-in-ma.patch b/recipes-core/swupd-server/swupd-server-2.53/0003-Add-configure-option-to-re-enable-config-files-in-ma.patch deleted file mode 100644 index ce94375..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0003-Add-configure-option-to-re-enable-config-files-in-ma.patch +++ /dev/null @@ -1,64 +0,0 @@ -From f35e84199529c0dc320d8d4280a79b8060dbaf21 Mon Sep 17 00:00:00 2001 -From: Joshua Lock <joshua.g.lock@intel.com> -Date: Fri, 12 Feb 2016 16:02:58 +0000 -Subject: [PATCH] Add configure option to re-enable config files in manifests - -Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> - -Upstream-Status: Backport [v3.0+] - ---- - configure.ac | 6 ++++++ - include/swupd.h | 6 ++++++ - src/manifest.c | 2 +- - 3 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 0cb074f..47256b6 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -28,6 +28,12 @@ AC_ARG_ENABLE( - AC_DEFINE(SWUPD_WITH_LZMA,1,[Use lzma compression]) - [enable_lzma=check] - ) -+AC_ARG_ENABLE( -+ [stateless], -+ AS_HELP_STRING([--disable-stateless],[OS is not stateless, do not ignore configuration files (stateless by default)]), -+ AC_DEFINE(SWUPD_WITH_STATELESS,0,[OS is not stateless]), -+ AC_DEFINE(SWUPD_WITH_STATELESS,1,[OS is stateless]) -+) - - AS_IF([test "$enable_lzma" = "check"], - [PKG_CHECK_MODULES([lzma], -diff --git a/include/swupd.h b/include/swupd.h -index ad4b967..d45ca9c 100644 ---- a/include/swupd.h -+++ b/include/swupd.h -@@ -23,6 +23,12 @@ - #define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs --xattrs-include='*'" - #endif - -+#if SWUPD_WITH_STATELESS -+#define OS_IS_STATELESS 1 -+#else -+#define OS_IS_STATELESS 0 -+#endif -+ - /* Build types */ - #define REGULAR_BUILD 0 - #define FIX_BUILD 1 -diff --git a/src/manifest.c b/src/manifest.c -index 251c884..24403e3 100644 ---- a/src/manifest.c -+++ b/src/manifest.c -@@ -825,7 +825,7 @@ int prune_manifest(struct manifest *manifest) - next = g_list_next(list); - file = list->data; - -- if ((!file->is_deleted) && (file->is_config)) { -+ if (OS_IS_STATELESS && (!file->is_deleted) && (file->is_config)) { - // toward being a stateless OS - LOG(file, "Skipping config file in manifest write", "component %s", manifest->component); - manifest->files = g_list_delete_link(manifest->files, list); --- -2.5.0 diff --git a/recipes-core/swupd-server/swupd-server-2.53/0004-Fix-regression-that-introduced-a-directory-named.patch b/recipes-core/swupd-server/swupd-server-2.53/0004-Fix-regression-that-introduced-a-directory-named.patch deleted file mode 100644 index 5fc432f..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0004-Fix-regression-that-introduced-a-directory-named.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 841418e5e3f40ee5ae492d606d403feef82cdc1c Mon Sep 17 00:00:00 2001 -From: Patrick McCarty <patrick.mccarty@intel.com> -Date: Mon, 22 Feb 2016 22:07:08 -0800 -Subject: [PATCH] Fix regression that introduced a directory named '/ ' - -Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com> - -Upstream-Status: Backport [v3.0+] - ---- - src/chroot.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/chroot.c b/src/chroot.c -index cb6a04a..58e1f1a 100644 ---- a/src/chroot.c -+++ b/src/chroot.c -@@ -41,7 +41,7 @@ void chroot_create_full(int newversion) - struct stat buf; - char *full_dir; - -- string_or_die(&full_dir, "%s/%i/full/ ", image_dir, newversion); -+ string_or_die(&full_dir, "%s/%i/full/", image_dir, newversion); - - g_mkdir_with_parents(full_dir, S_IRWXU); - --- -2.5.0 diff --git a/recipes-core/swupd-server/swupd-server-2.53/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch b/recipes-core/swupd-server/swupd-server-2.53/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch deleted file mode 100644 index 0706862..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 5a061a5d332e11fa55ea2ecd68554e77c2bbc36e Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Mon, 14 Mar 2016 16:44:00 +0200 -Subject: [PATCH] xattrs.c: Avoid freeing dangling pointers - -It may happen that in a new version of a file xattrs -get added or removed. In this case one of the xattr -strings points to the bogus 0xdeadcafe address. -In order to avoid freeing the dangling pointer check -the length of the xattr string. - -Upstream-Status: Backport [v2.54+] - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - src/xattrs.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/src/xattrs.c b/src/xattrs.c -index bf7256c..16905bd 100644 ---- a/src/xattrs.c -+++ b/src/xattrs.c -@@ -242,8 +242,8 @@ int xattrs_compare(const char *filename1, const char *filename2) - { - char *new_xattrs; - char *old_xattrs; -- size_t new_xattrs_len; -- size_t old_xattrs_len; -+ size_t new_xattrs_len = 0; -+ size_t old_xattrs_len = 0; - int ret = 0; - - xattrs_get_blob(filename1, &old_xattrs, &old_xattrs_len); -@@ -258,8 +258,10 @@ int xattrs_compare(const char *filename1, const char *filename2) - ret = -1; - } - -- free(old_xattrs); -- free(new_xattrs); -+ if (old_xattrs_len) -+ free(old_xattrs); -+ if (new_xattrs_len) -+ free(new_xattrs); - - return ret; - } --- -2.5.0 - diff --git a/recipes-core/swupd-server/swupd-server-2.53/0006-Always-use-xattrs-when.patch b/recipes-core/swupd-server/swupd-server-2.53/0006-Always-use-xattrs-when.patch deleted file mode 100644 index e8e0efb..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0006-Always-use-xattrs-when.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 71e2abe1af2a8760701923071413da1314e44f4c Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Fri, 19 Feb 2016 18:52:45 +0200 -Subject: [PATCH] Always use xattrs when calculating file hashes - -Currently swupd-client includes xattrs to hash sums of all files. -Therefore in order to avoid relaxing security and to prevent -`swupd verify` from reporting hash mismatches for updated files -it's better to include xattrs to hashes for all files. - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> - -Upstream-Status: Backport [v3.1.0+] - ---- - src/manifest.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/manifest.c b/src/manifest.c -index 38d386b..dcda18d 100644 ---- a/src/manifest.c -+++ b/src/manifest.c -@@ -788,7 +788,8 @@ bool compute_hash_with_xattrs(const char *filename) - return true; - } - -- return false; -+ /* Currently swupd-client includes xattrs to hash sums of all files */ -+ return true; - } - - /* Returns 0 == success, -1 == failure */ diff --git a/recipes-core/swupd-server/swupd-server-2.53/0007-Clean-up-tar-options-drop-a-for-the-extract-mode.patch b/recipes-core/swupd-server/swupd-server-2.53/0007-Clean-up-tar-options-drop-a-for-the-extract-mode.patch deleted file mode 100644 index 2f933d0..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0007-Clean-up-tar-options-drop-a-for-the-extract-mode.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4431ad34734632c439881a30ca90617a1fd1dde4 Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Tue, 23 Feb 2016 14:50:37 +0200 -Subject: [PATCH] Clean up tar options: drop -a for the extract mode. - -The -a option is not needed for the extract mode since tar -auto-detects compression type from file format. - -Upstream-Status: Accepted - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - src/pack.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/pack.c b/src/pack.c -index 5bb99b8..e5203d0 100644 ---- a/src/pack.c -+++ b/src/pack.c -@@ -114,7 +114,7 @@ static void explode_pack_stage(int version, char *module) - * time on the client... - */ - string_or_die(&tar, "tar --directory=%s/%s/%i/staged --warning=no-timestamp " -- TAR_PERM_ATTR_ARGS " -axf %s", packstage_dir, module, version, path); -+ TAR_PERM_ATTR_ARGS " -xf %s", packstage_dir, module, version, path); - ret = system(tar); - if (!ret) { - unlink(path); --- -2.5.0 - diff --git a/recipes-core/swupd-server/swupd-server-2.53/0008-Clean-up-tar-commands-always-put-files-after-options.patch b/recipes-core/swupd-server/swupd-server-2.53/0008-Clean-up-tar-commands-always-put-files-after-options.patch deleted file mode 100644 index 3dabcc8..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0008-Clean-up-tar-commands-always-put-files-after-options.patch +++ /dev/null @@ -1,44 +0,0 @@ -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 - diff --git a/recipes-core/swupd-server/swupd-server-2.53/0009-Add-compatibility-with-libarchive-s-bsdtar-command.patch b/recipes-core/swupd-server/swupd-server-2.53/0009-Add-compatibility-with-libarchive-s-bsdtar-command.patch deleted file mode 100644 index 7821938..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/0009-Add-compatibility-with-libarchive-s-bsdtar-command.patch +++ /dev/null @@ -1,168 +0,0 @@ -From e72a040628d7b8b5fd193653c13304f47cba611b Mon Sep 17 00:00:00 2001 -From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> -Date: Tue, 23 Feb 2016 15:11:58 +0200 -Subject: [PATCH] Add compatibility with libarchive's bsdtar command - -Since GNU tar fails to extract files with xattrs preserved when -Integrity Measurement Architecture (IMA) is enabled some vendors -may choose to install libarchive-based tar (bsdtar) on their embedded -devices, so the swupd server needs to be able to create archives -in its format. - -This patch adds one compile-time options --enable-bsdtar that is used -to enable/disable GNU tar specific options. Also it harmonizes -the command strings to be compatible with both GNU tar and bsdtar. -Particularly it -- changes --exclude pattern from '%s'/* to more explicit '%s/?*' because - bsdtar's pattern matching is greedier than in tar: it uses tcsh's - globbing where '*' can be anything including the null string and the - original pattern would include the directory itself; -- OS file names are escaped with leading ./ to avoid collisions with - file names starting with @ which has special meaning in bsdtar. - -Upstream-Status: Accepted - -Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> ---- - configure.ac | 8 ++++++++ - include/swupd.h | 14 ++++++++++++-- - src/fullfiles.c | 12 ++++++------ - src/manifest.c | 2 +- - src/pack.c | 4 ++-- - 5 files changed, 29 insertions(+), 11 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 47256b6..32d1412 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -15,6 +15,14 @@ PKG_CHECK_MODULES([openssl], [libcrypto >= 0.9.8]) - AC_CHECK_LIB([magic], [magic_open], [], [AC_MSG_ERROR([the magic library is missing])]) - AC_CHECK_PROGS(TAR, tar) - AC_ARG_ENABLE( -+ bsdtar, -+ AS_HELP_STRING([--enable-bsdtar],[Use alternative bsdtar command (uses tar by default)]), -+ AS_IF([test "x$enable_bsdtar" = "xyes"], -+ AC_DEFINE([SWUPD_WITH_BSDTAR], 1, [Use alternative bsdtar]), -+ AC_DEFINE([SWUPD_WITH_BSDTAR], 0, [Use default tar command])), -+ AC_DEFINE([SWUPD_WITH_BSDTAR], 0, [Use default tar command]) -+) -+AC_ARG_ENABLE( - bzip2, - AS_HELP_STRING([--disable-bzip2],[Do not use bzip2 compression (uses bzip2 by default)]), - AC_DEFINE(SWUPD_WITHOUT_BZIP2,1,[Do not use bzip2 compression]) , -diff --git a/include/swupd.h b/include/swupd.h -index d45ca9c..b049135 100644 ---- a/include/swupd.h -+++ b/include/swupd.h -@@ -17,10 +17,20 @@ - - #define SWUPD_SERVER_STATE_DIR "/var/lib/update" - -+#if SWUPD_WITH_BSDTAR -+#define TAR_COMMAND "bsdtar" -+#define TAR_XATTR_ARGS "" -+#define TAR_WARN_ARGS "" -+#else -+#define TAR_COMMAND "tar" -+#define TAR_XATTR_ARGS "--xattrs --xattrs-include='*'" -+#define TAR_WARN_ARGS "--warning=no-timestamp" -+#endif -+ - #if SWUPD_WITH_SELINUX --#define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs --xattrs-include='*' --selinux" -+#define TAR_PERM_ATTR_ARGS "--preserve-permissions --selinux " TAR_XATTR_ARGS - #else --#define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs --xattrs-include='*'" -+#define TAR_PERM_ATTR_ARGS "--preserve-permissions " TAR_XATTR_ARGS - #endif - - #if SWUPD_WITH_STATELESS -diff --git a/src/fullfiles.c b/src/fullfiles.c -index 23e95db..cf77e74 100644 ---- a/src/fullfiles.c -+++ b/src/fullfiles.c -@@ -93,8 +93,8 @@ static void create_fullfile(struct file *file) - assert(0); - } - -- 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", -+ string_or_die(&tarcommand, TAR_COMMAND " -C %s " TAR_PERM_ATTR_ARGS " -cf - --exclude='%s/?*' './%s' 2> /dev/null | " -+ TAR_COMMAND " -C %s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", - dir, base, base, rename_tmpdir); - if (system(tarcommand) != 0) { - LOG(NULL, "Failed to run command:", "%s", tarcommand); -@@ -111,7 +111,7 @@ 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 " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar %s", -+ string_or_die(&tarcommand, TAR_COMMAND " -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); -@@ -146,7 +146,7 @@ static void create_fullfile(struct file *file) - - /* step 2a: tar it with each compression type */ - // lzma -- string_or_die(&tarcommand, "tar --directory=%s " TAR_PERM_ATTR_ARGS " -Jcf %s/%i/files/%s.tar.xz %s", -+ string_or_die(&tarcommand, TAR_COMMAND " --directory=%s " TAR_PERM_ATTR_ARGS " -Jcf %s/%i/files/%s.tar.xz %s", - empty, outdir, file->last_change, file->hash, file->hash); - if (system(tarcommand) != 0) { - LOG(NULL, "Failed to run command:", "%s", tarcommand); -@@ -154,7 +154,7 @@ static void create_fullfile(struct file *file) - } - free(tarcommand); - // gzip -- string_or_die(&tarcommand, "tar --directory=%s " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar.gz %s", -+ string_or_die(&tarcommand, TAR_COMMAND " --directory=%s " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar.gz %s", - empty, outdir, file->last_change, file->hash, file->hash); - if (system(tarcommand) != 0) { - LOG(NULL, "Failed to run command:", "%s", tarcommand); -@@ -162,7 +162,7 @@ static void create_fullfile(struct file *file) - } - free(tarcommand); - #ifdef SWUPD_WITH_BZIP2 -- string_or_die(&tarcommand, "tar --directory=%s " TAR_PERM_ATTR_ARGS " -jcf %s/%i/files/%s.tar.bz2 %s", -+ string_or_die(&tarcommand, TAR_COMMAND " --directory=%s " TAR_PERM_ATTR_ARGS " -jcf %s/%i/files/%s.tar.bz2 %s", - empty, outdir, file->last_change, file->hash, file->hash); - if (system(tarcommand) != 0) { - LOG(NULL, "Failed to run command:", "%s", tarcommand); -diff --git a/src/manifest.c b/src/manifest.c -index e878288..cf0cabf 100644 ---- a/src/manifest.c -+++ b/src/manifest.c -@@ -750,7 +750,7 @@ static int write_manifest_tar(struct manifest *manifest) - - /* now, tar the thing up for efficient full file download */ - /* and put the signature of the plain manifest into the archive, too */ -- string_or_die(&tarcmd, "tar --directory=%s/%i " TAR_PERM_ATTR_ARGS " -Jcf " -+ string_or_die(&tarcmd, TAR_COMMAND " --directory=%s/%i " TAR_PERM_ATTR_ARGS " -Jcf " - "%s/%i/Manifest.%s.tar Manifest.%s Manifest.%s.signed", - conf, manifest->version, conf, manifest->version, manifest->component, - manifest->component, manifest->component); -diff --git a/src/pack.c b/src/pack.c -index e5203d0..1a11a03 100644 ---- a/src/pack.c -+++ b/src/pack.c -@@ -113,7 +113,7 @@ static void explode_pack_stage(int version, char *module) - * the resulting pack is slightly smaller, and in addition, we're saving CPU - * time on the client... - */ -- string_or_die(&tar, "tar --directory=%s/%s/%i/staged --warning=no-timestamp " -+ string_or_die(&tar, TAR_COMMAND " --directory=%s/%s/%i/staged " TAR_WARN_ARGS " " - TAR_PERM_ATTR_ARGS " -xf %s", packstage_dir, module, version, path); - ret = system(tar); - if (!ret) { -@@ -442,7 +442,7 @@ static int make_final_pack(struct packdata *pack) - - /* tar the staging directory up */ - LOG(NULL, "starting tar for pack", "%s: %i to %i", pack->module, pack->from, pack->to); -- string_or_die(&tar, "tar " TAR_PERM_ATTR_ARGS " --directory=%s/%s/%i/ " -+ string_or_die(&tar, TAR_COMMAND " " TAR_PERM_ATTR_ARGS " --directory=%s/%s/%i/ " - "--numeric-owner -Jcf %s/%i/pack-%s-from-%i.tar delta staged", - packstage_dir, pack->module, pack->from, staging_dir, pack->to, pack->module, pack->from); - ret = system(tar); --- -2.5.0 - diff --git a/recipes-core/swupd-server/swupd-server-2.53/fullfiles.c-work-around-pseudo-bug.patch b/recipes-core/swupd-server/swupd-server-2.53/fullfiles.c-work-around-pseudo-bug.patch deleted file mode 100644 index aa03054..0000000 --- a/recipes-core/swupd-server/swupd-server-2.53/fullfiles.c-work-around-pseudo-bug.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 939a50bf2fec9463fb721fa9188f98e991dfddc9 Mon Sep 17 00:00:00 2001 -From: Patrick Ohly <patrick.ohly@intel.com> -Date: Wed, 30 Mar 2016 13:14:42 +0200 -Subject: [PATCH] fullfiles.c: work around pseudo bug - -Hard-linking the actual file looses the xattrs due to a pseudo bug. -We work around that here by explicitly copying the xattrs. - -Upstream-Status: Inappropriate [workaround] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> ---- - src/fullfiles.c | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - -diff --git a/src/fullfiles.c b/src/fullfiles.c -index fa78293..949d8f0 100644 ---- a/src/fullfiles.c -+++ b/src/fullfiles.c -@@ -29,6 +29,7 @@ - #include <assert.h> - #include <sys/types.h> - #include <sys/stat.h> -+#include <sys/xattr.h> - #include <stdint.h> - #include <errno.h> - #include <libgen.h> -@@ -144,6 +145,35 @@ static void create_fullfile(struct file *file) - } - } - -+ /* step 1a: work around pseudo bug https://bugzilla.yoctoproject.org/show_bug.cgi?id=9317: -+ pseudo fails to share xattrs between files sharing the same inode. We have to copy -+ all xattrs explicitly. */ -+ { -+ /* Intentionally simplistic code with static buffer sizes. -+ Pseudo bug fix is scheduled for the near future. */ -+ char list[1024]; -+ char *name; -+ ssize_t listsize; -+ listsize = llistxattr(origin, list, sizeof(list)); -+ if (listsize < 0) { -+ fprintf(stderr, "Copying xattrs: llistxattr(%s): %s\n", origin, strerror(errno)); -+ assert(0); -+ } -+ for (name = list; name < list + listsize; name += strlen(name) + 1) { -+ char value[2048]; -+ ssize_t valuesize; -+ valuesize = lgetxattr(origin, name, value, sizeof(value)); -+ if (valuesize < 0) { -+ fprintf(stderr, "Copying xattrs: lgetxattr(%s): %s\n", origin, strerror(errno)); -+ assert(0); -+ } -+ if (lsetxattr(tempfile, name, value, valuesize, 0)) { -+ fprintf(stderr, "Copying xattrs: lsetxattr(%s, %s): %s\n", tempfile, name, strerror(errno)); -+ assert(0); -+ } -+ } -+ } -+ - /* step 2a: tar it with each compression type */ - // lzma - string_or_die(&tarcommand, "tar --directory=%s " TAR_PERM_ATTR_ARGS " -Jcf %s/%i/files/%s.tar.xz %s", --- -2.1.4 - diff --git a/recipes-core/swupd-server/swupd-server_2.53.bb b/recipes-core/swupd-server/swupd-server_2.53.bb deleted file mode 100644 index edb4407..0000000 --- a/recipes-core/swupd-server/swupd-server_2.53.bb +++ /dev/null @@ -1,41 +0,0 @@ -SUMMARY = "swupd sofware update from Clear Linux - server component" -LICENSE = "GPL-2.0" -LIC_FILES_CHKSUM = "file://COPYING;md5=04d0b48662817042d80393e7511fa41b \ - file://bsdiff/LICENSE;md5=0dbe7a50f028269750631fcbded3846a" - -DEPENDS = "file glib-2.0 rsync openssl libarchive" - -SRC_URI = "\ - https://download.clearlinux.org/releases/5940/clear/source/SRPMS/${BPN}-${PV}-4.src.rpm;extract=${BP}.tar.gz \ - file://0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch \ - file://0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch \ - file://0003-Add-configure-option-to-re-enable-config-files-in-ma.patch \ - file://0004-Fix-regression-that-introduced-a-directory-named.patch \ - file://0005-xattrs.c-Avoid-freeing-dangling-pointers.patch \ - file://0006-Always-use-xattrs-when.patch \ - file://0007-Clean-up-tar-options-drop-a-for-the-extract-mode.patch \ - file://0008-Clean-up-tar-commands-always-put-files-after-options.patch \ - file://0009-Add-compatibility-with-libarchive-s-bsdtar-command.patch \ - file://fullfiles.c-work-around-pseudo-bug.patch \ -" - -SRC_URI[md5sum] = "14f25677b5a4f0b33785910b03860939" -SRC_URI[sha256sum] = "c2d0e595444fe198c4092dd83d20a929fd1402a13b66b410b76677ed3a993d99" - -inherit pkgconfig autotools - -EXTRA_OECONF = "--enable-bzip2 --enable-lzma --disable-stateless --enable-bsdtar" - -# safer-calls-to-system-utilities.patch uses for loop initial declaration -CFLAGS_append = " -std=c99" - -do_install_append () { - mkdir -p ${D}${sysconfdir}/swupd-certs - install -m 0755 ${S}/test/signature/* ${D}${sysconfdir}/swupd-certs/ -} - -# Work around lack of "RPROVIDES = bsdtar-native" in libarchive-native. -RDEPENDS_${PN}_class-target = "bsdtar rsync" -RDEPENDS_${PN}_class-native = "libarchive rsync" - -BBCLASSEXTEND = "native" |