mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-03 23:38:25 +00:00
Update pack download version handling
Instead of taking in versions as arguments to download_subscribed_packs, just use the version information in the subs list items (set by calling subscription_versions_from_MoM function).
This commit is contained in:
committed by
Patrick McCarty
parent
beb675de5e
commit
dc00af2ddf
+1
-1
@@ -165,7 +165,7 @@ extern void account_delta_hit(void);
|
||||
extern void account_delta_miss(void);
|
||||
extern void print_statistics(int version1, int version2);
|
||||
|
||||
extern int download_subscribed_packs(int oldversion, int newversion, bool required);
|
||||
extern int download_subscribed_packs(bool required);
|
||||
|
||||
extern void try_delta(struct file *file);
|
||||
extern void full_download(struct file *file);
|
||||
|
||||
+1
-1
@@ -406,7 +406,7 @@ int install_bundles(struct list *bundles, int current_version, struct manifest *
|
||||
(void)rm_staging_dir_contents("download");
|
||||
|
||||
printf("Downloading required packs...\n");
|
||||
ret = download_subscribed_packs(0, current_version, true);
|
||||
ret = download_subscribed_packs(true);
|
||||
if (ret != 0) {
|
||||
printf("pack downloads failed, cannot proceed with the installation, exiting.\n");
|
||||
goto out;
|
||||
|
||||
+2
-6
@@ -96,7 +96,7 @@ static int download_pack(int oldversion, int newversion, char *module)
|
||||
}
|
||||
|
||||
/* pull in packs for base and any subscription */
|
||||
int download_subscribed_packs(int oldversion, int UNUSED_PARAM newversion, bool required)
|
||||
int download_subscribed_packs(bool required)
|
||||
{
|
||||
struct list *iter;
|
||||
struct sub *sub = NULL;
|
||||
@@ -115,11 +115,7 @@ int download_subscribed_packs(int oldversion, int UNUSED_PARAM newversion, bool
|
||||
continue;
|
||||
}
|
||||
|
||||
if (oldversion != 0) {
|
||||
oldversion = sub->oldversion;
|
||||
}
|
||||
|
||||
err = download_pack(oldversion, sub->version, sub->component);
|
||||
err = download_pack(sub->oldversion, sub->version, sub->component);
|
||||
if (err < 0) {
|
||||
if (required) {
|
||||
return err;
|
||||
|
||||
+1
-1
@@ -332,7 +332,7 @@ load_server_manifests:
|
||||
|
||||
download_packs:
|
||||
/* Step 5: get the packs and untar */
|
||||
ret = download_subscribed_packs(current_version, server_version, false);
|
||||
ret = download_subscribed_packs(false);
|
||||
if (ret == -ENONET) {
|
||||
// packs don't always exist, tolerate that but not ENONET
|
||||
if (retries < MAX_TRIES) {
|
||||
|
||||
+5
-5
@@ -228,13 +228,13 @@ static bool hash_needs_work(struct file *file, char *hash)
|
||||
}
|
||||
}
|
||||
|
||||
static int get_all_files(int version, struct manifest *official_manifest)
|
||||
static int get_all_files(struct manifest *official_manifest)
|
||||
{
|
||||
int ret;
|
||||
struct list *iter;
|
||||
|
||||
/* for install we need everything so synchronously download zero packs */
|
||||
ret = download_subscribed_packs(0, version, true);
|
||||
ret = download_subscribed_packs(true);
|
||||
if (ret < 0) { // require zero pack
|
||||
/* If we hit this point, we know we have a network connection, therefore
|
||||
* the error is server-side. This is also a critical error, so detailed
|
||||
@@ -356,10 +356,10 @@ RETRY_DOWNLOADS:
|
||||
}
|
||||
|
||||
/* allow optimization of install case */
|
||||
static int get_required_files(int version, struct manifest *official_manifest)
|
||||
static int get_required_files(struct manifest *official_manifest)
|
||||
{
|
||||
if (cmdline_option_install) {
|
||||
return get_all_files(version, official_manifest);
|
||||
return get_all_files(official_manifest);
|
||||
}
|
||||
|
||||
if (cmdline_option_fix) {
|
||||
@@ -671,7 +671,7 @@ int verify_main(int argc, char **argv)
|
||||
|
||||
if (cmdline_option_fix || cmdline_option_install) {
|
||||
/* when fixing or installing we need input files. */
|
||||
ret = get_required_files(version, official_manifest);
|
||||
ret = get_required_files(official_manifest);
|
||||
if (ret != 0) {
|
||||
goto brick_the_system_and_clean_curl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user