Local testing with some small bundles shows that bumping the fullfile
download minimum to 10 still yields much faster results than downloading
the zero pack. 10 is a more realistic heuristic.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
for error recovery, bundle-add needs to read all currently installed manifests
and consolidate them into the normal tree.
currently, bundle-add does this always, even for the common case of no errors.
this patch turns this around and does this work lazily once the first
error is encountered.
There are some cases where do_staging() is ok to be called without
having a full MoM for performance reasons (e.g. in bundle_add
where alternative recovery is in place)
With overlapping bundle-content, it's not entirely uncommon for files
that are in a newly added bundle to already exist on the system.
This patch optimizes this case by removing these from the files that need
to be installed.
In addition, if after this filter step, there's less than 5
(number to be tuned) files to install left, skip downloading the pack
for the bundle and just grab the full files directly.
Mixin re-creates the os-core bundle when creating a local mix. This
causes the corresponding os-core-update-index bundle-info file to have
changes to the metadata listed inside. Treate this as mixin state and do
not check hashes for this file.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
In order to avoid the need to dereference *bundles all the time
another variable was added.
The check about making sure the bundle to be removed is not os-core
was moved before the message "Removing bundle: <bundle>" to avoid
confusions.
When 1 or more bundles fail to be removed from the system a message
was being displayed, a message that looked like this:
"1 bundle(s) of 2 failed to remove"
This commit changes that message so it uses pasive voice, like this:
"1 bundle(s) of 2 failed to be removed"
The current remove_bundle() function was designed to only be called
once, but for multiple bundle removals, it is currently called
multiple times.
This commit refactors this function so the bundle removal code can
handle multiple bundles at once.
Fixes#449
Use fullfile_download to download full files from server if a pack
download has failed or if the file is missing/corrupted in a pack.
Verify --install wasn't checking if the content of the downloaded
files match the hash in the manifest. As the fullfile download
function check that, the hashes in some tests needed to be fixed.
Use download_fullfiles() instead of reimplementing it on
full_download_loop().
Tests:
- Test skip-verified-fullfiles was alterered because in the current
implementation start_full_download() won't be called when there's no
extra file to download.
Moving the fullfile fallback to a single file and exporting it in
swupd.h in order to be reused on update and bundle add.
Tests:
- Changing verify tests becase download function won't be called when
there's no file to be downloaded
Checking for hashes inside the download function was out of scope
and made the function harder to be reused. Instead, check if hashes
matches the files in the system before calling the download function,
so only necessary files will be downloaded.
In most cases the parameters in_memory_file, bool resume_ok are ignored
in swupd_curl_get_file. So creating a swupd_curl_get_file_full with all
parameters and leaving the swupd_curl_get_file clearer.
Curl module doesn't need to have any information on what is the content of
the file it's going to download. And there's no reason to force users to
use memory to store a file only for version numbers. If there's another
small file needed in the future, we can use the memory to hold it.
Also fixes:
- Memory allocated for version string was too big. Using maximum number of
chars to store an integer for it.
- As the size to store a version string is small, uses the stack instead of
the heap for it.
- On swupd_curl_test_resume, don't alocate memory and copy data to it
to be discarded later.
All #warnings messages on swupd code were related to tasks to be performed
in the future and not real code warnings. Using the TODO comment, that is
already used for other tasks.
It's too annoying to see warning messages on compile time and having them
makes a bit harder to noticed when we are introducing real compiler warnings.
Message informing that the system was successfully updated should be
the last message. Having a message that looks like an error as the
last message in an update can be confusing for users.
Fixes#454
Added the -n/--nosigcheck paramater to search, based on the other subcommands that
already have nosigcheck.
I tested this by invalidating Swupd_Root.pem and testing the failing
and passing cases - without nosigcheck and with nosigcheck
respectively.
Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com>
We use a full feature version control system (git) for a reason.
'non-production' code can be kept on each one favorite personal branch
and debug code, if key for development, should be implemented as
working/tested part of the project (via a well designed logging system)
and not as commented code.
Not to mention that this is be a best pratice which we should all watch
over.
Signed-off-by: Murilo Belluzzo <murilo.belluzzo@intel.com>
Fixes#446
When a new upstream version is detected the new local mixer build must
be done before manifest uniqueness is checked. This is due to the fact
that os-core can change in the upstream version, so it has to be
re-built locally against the upstream content in order to avoid false
positives for file colisions.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
These additional files are files that change on the system due to the
local mix. Add these to the ignore list for file colision checks.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Fixes#448
Make a number of functions static, and bodge around the extra symbol
that gcc adds (__gnu_lto_v1) when compiling with -flto=4
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Update mixer integration to key off the .valid-mix flag file to check if
a mix exists. Also update the .clearversion filename to upstreamurl (it
has changed in upstream).
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
swupd-client is properly open-sourced and licensed. The copyright header
is unnecessary, confusing, and causes issues for scripts parsing output.
The copyright header is now only printed when swupd is passed the
--version flag.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Set /etc/swupd permissions to 0777 to let the default umask policy
handle stripping bits appropriately.
If we can write files to /etc/swupd, do it, making the directory first,
if necessary. If not, bail out cleanly. Only delete the
mirror_contenturl and mirror_versionurl files from the directory, not
the directory itself.
Add tests to verify normal behavior and corner cases.
The user does not need to know that swupd is trying to determine the
server version. This is printed twice when doing mirror checks.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Handle updates against configured mirrors by warning or unsetting
out-of-date mirrors. If a mirror is only slightly out of date warn the
user that the mirror is stale but continue normal operations. If a
mirror is out of date by a large range (arbitrary difference of 500, or
about a month and a half) simply unset the mirror and continue using the
upstream url.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
The mirror subcommand provides users with an interface to use to set or
unset their configured mirror URL.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
To allow swupd users located in geos far from the default Clear Linux
CDN to get efficient download speeds, allow them to set a mirror content
and version url under
/etc/swupd/mirror_contenturl
/etc/swupd/mirror_versionurl
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Add a specific printf and separate failure code to indicate SSL cert
failures. This return code (24) will be returned to telemetry as well to
indicate this specific failure.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>