mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-04 15:58:22 +00:00
Block on manifest collisions but allow override
When content mismatches in the user manifest and the upstream content, that is - the filenames are equal but the hashes are not, this signifies that something is being introduced that already exists and is not the same. Currently, only additive functionality is fully guaranteed to work, so existing packages can be added as long as they are the same as the ones provided by upstream. If non-unique content is added, all conflicts will be printed out to the user so it can be fixed, and swupd will exit unless it is given the allow-mix-collisions override flag. Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
This commit is contained in:
committed by
Matthew Johnson
parent
71a58815bd
commit
be4c7bdba1
+2
-1
@@ -7,8 +7,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/queue.h>
|
||||
#include <string.h>
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include "list.h"
|
||||
#include "swupd-error.h"
|
||||
@@ -80,6 +80,7 @@ struct version_container {
|
||||
|
||||
struct header;
|
||||
|
||||
extern bool allow_mix_collisions;
|
||||
extern bool verbose_time;
|
||||
extern bool force;
|
||||
extern bool migrate;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "swupd.h"
|
||||
|
||||
bool allow_mix_collisions = false;
|
||||
bool force = false;
|
||||
bool migrate = false;
|
||||
bool sigcheck = true;
|
||||
|
||||
+5
-1
@@ -54,6 +54,7 @@ static const struct option prog_opts[] = {
|
||||
{ "no-scripts", no_argument, 0, 'N' },
|
||||
{ "no-boot-update", no_argument, 0, 'b' },
|
||||
{ "migrate", no_argument, 0, 'b' },
|
||||
{ "allow-mix-collisions", no_argument, 0, 'a' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -91,12 +92,15 @@ static bool parse_options(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "hxnIdtNbmu:P:c:v:sF:p:S:C:", prog_opts, NULL)) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "hxnIdtNbmau:P:c:v:sF:p:S:C:", prog_opts, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case '?':
|
||||
case 'h':
|
||||
print_help(argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'a':
|
||||
allow_mix_collisions = true;
|
||||
break;
|
||||
case 'd':
|
||||
download_only = true;
|
||||
break;
|
||||
|
||||
+1
-1
@@ -1546,5 +1546,5 @@ int enforce_compliant_manifest(struct file **a, struct file **b, int searchsize,
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
return ret; // No collisions were found, so manifest is purely additive
|
||||
return ret; // If collisions were found, so manifest is purely additive
|
||||
}
|
||||
|
||||
@@ -368,6 +368,10 @@ version_check:
|
||||
ret = check_manifests_uniqueness(server_version, mix_server_version);
|
||||
if (ret) {
|
||||
printf("\n\t!! %i collisions were found between mix and upstream, please re-create mix !!\n", ret);
|
||||
if (!allow_mix_collisions) {
|
||||
ret = EXIT_FAILURE;
|
||||
goto clean_curl;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the clearversion that will be used to generate the new mix content */
|
||||
|
||||
Reference in New Issue
Block a user