Instead of just checking if the versions have changed for a file to be
updated, compare the current file's hash to updated file's expected hash
and only queue files for update that are changed.
The recent GNU tar release (1.29) is more strict with option parsing in
that positional options must come before the file list to add to the
archive.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Instead of requiring a pack is used for bundle-add, allow the use of
verify_fix_path when staging fails to: download, verify and stage the
item using the full file.
Correct output of tests where the 'required' wording was removed.
Check file hashes after successful tar extraction and fail if there is a
hash mismatch during udpate. As part of this change failure handling for
errors in the tar extraction path with a check space warning as a best
guess of error cause.
This change also fixes tests where the hashes were not correct and adds
a test to verify hash matching is verified.
Add new function consolidate_files that replaces
consolidate_submanifests in order to remove the requirement of modifying
manifest components in place. This change enables creating seperate
consolidated file lists for bundle-add, one for new files to be
installed on the system and one for the currently installed bundles
files. Once these have been seperated out, only files requiring
installation can be processed by do_staging and the list of files
installed on the system can be used to run verify_fix_path.
This also modifies bundle-add to stop trying to create tracking
files which was impacting testing.
Update verify to correctly check the return value of get_latest_version
for errors. Since get_latest_version could return a variety of negative
error codes to signify errors compare against that range instead of -1
to determine success of the operation.
Instead of only checking if bundle-remove has at least one bundle
argument and ignoring additional ones, check that there is exactly one
argument passed to bundle-remove instead.
In the case where the swupd_download_version_to_memory callback was run
multiple times, it would overwrite previous data instead of appending.
Correct this behavior by keeping track of data written so far in the
struct passed to the callback.
Instead of specifying a version number argument to -m allow passing the
latest string which will query for the latest version and use that as
the install target version.
Stop printing a message when bundles are included and going to be
installed or if bundles are already included and going to be skipped
when doing the add_subscriptions call.
Instead update the install_bundles call to notify users when an
installed bundle was attempted to be be installed again.
In a previous commit, the init_globals() call was removed from the
hashdump code, which resulted in path_prefix not being set in case the
--basepath option was not specified, and led to a NULL pointer
dereference.
Fix the issue by calling the new set_path_prefix() function. The NULL
value will honor the --basepath option if specified, or set the default
path_prefix.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
The Manifest.os-core was present, but the compressed version was not.
Fix the issue by providing the compressed version.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Fullfile deltas were only being applied to the root filesystem, since
the prefix was a compile-time constant string (STAGING_SUBVOL) set to
"/" by default.
Instead, use path_prefix for the prefix so that the deltas can be
applied when specifying --path on the command line. This also enables
writing a functional test for the delta application, added in this
commit.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Previously include manifests that were not newer than the current
version would be silently ignored even if they had not been previously
installed causing bundles to miss included dependencies.
Fix this by adding a is_tracked field to struct file that is nonzero
when the bundle the file is contained in is marked as tracked via having
a /usr/share/clear/bundles/$name file.
The is_tracked == 0 version of the file will be dropped in the
consolidate_manifest phase if that filename from another bundle has
is_tracked != 0 to avoid downloading and installing an already existing
file.
The is_tracked == 0 version of the file will then be added to the update
list from the consolidated manifest if that file was not previously
installed on the system (in addition to the other cases it would already
have been added to the list for).
Since a numeric format now requires a config file, and aligning the
client format with the test format is a maintenance problem, use the
"staging" format for all tests.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Add support in update to properly support bundles that include other
bundles inside them. This feature is intended to work with bundle
additions by adding included bundles (from bundles already subscribed)
to the subscription list prior to downloading packs and full files.
As part of this change the add_subscriptions function from bundle.c was
modified to handle retrying manifest downloads.
Eventually manifests will be able to include other manifests and this
patchset adds support for adding those included manifests when running
bundle-add on the including manifest.
The following tests are added here:
- Add a boot file via 'bundle-add' (failed before the previous commit).
- Remove a boot file via 'bundle-remove'.
- Add a boot file via 'update'.
- Detect a boot file hash mismatch via 'verify' (failed before the
previous commit).
- Fix a boot file with incorrect hash via 'verify --fix' (failed before
the previous commit).
- Ignore a boot file during 'verify --fix' if marked deleted (failed
before the previous commit).
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>