688 Commits
Author SHA1 Message Date
Matthew Johnson 3fbd376579 Release v3.17.4
This release make several bug fixes and implementation improvements as
listed below:

* Fix memory leak on subscription list
* Add missing --nosigcheck option to search subcommand
* Better memory management in some codepaths
* Report missing packs to telemetry (when user is opted-in)
* Unused/commented-out code removed from codebase
* Improve the internal swupd_curl API, including making it more usable
  and performing better memory management.
* Remove content when running swupd clean and only keep manifests around
* Add fullfile fallback to bundle-add code.
* Refactor bundle-remove to properly remove multiple bundles.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
v3.17.4
2018-06-08 10:51:22 -07:00
Castulo Martinez e388674a94 Renaming variable for consistency
Renaming a variable from camel case to snake case to keep
consistency with the project.
2018-06-08 10:49:21 -07:00
Castulo Martinez 1dc830fa57 Store the bundle to be removed in a variable
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.
2018-06-08 10:49:21 -07:00
Castulo Martinez 006e29b565 Removing unnecessary curopts struct
The curopts struct is no longer being used to save parsed options
when using the bundle-remove command so it can be removed from the
code.
2018-06-08 10:49:21 -07:00
Castulo Martinez f49fb714fe Fixing typo in remove bundle message
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"
2018-06-08 10:49:21 -07:00
Castulo Martinez 71a2a4cb0e Refactor bundle-remove to handle multiple bundles
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
2018-06-08 10:49:21 -07:00
Otavio Pontes b0911b3f0a Verify --install: Download full files if pack download fails
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.
2018-06-08 10:43:09 -07:00
Otavio Pontes c7c224de47 Bundle-add: Download full files if pack download fails or has problems
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.
2018-06-08 10:43:09 -07:00
Otavio Pontes 9648035803 Update: Use consolidated version of fullfiles download
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.
2018-06-08 10:43:09 -07:00
Otavio Pontes 660537d36f Verify: Consolidate download fullfile fallback to be reused
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
2018-06-08 10:43:09 -07:00
Otavio Pontes 6a51b2e451 Verify: Remove file hash comparison from download function
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.
2018-06-08 10:43:09 -07:00
Caio Marcelo de Oliveira Filho c773afc6e6 clean: do not keep content around
Instead of keeping recent content around, just delete all the files,
with exception of the latest relevant Manifests.
2018-06-08 10:37:15 -07:00
Otavio Pontes 2284ebb6f4 Fix missing brackets on single line ifs 2018-06-08 10:21:52 -07:00
Otavio Pontes b13e4ae189 compliant: Enforce braces on single line ifs
There's no way to inforce braces on single line ifs using clang-format.
Adding a grep to look for ifs without a bracket so we can at least
warn users about that.
2018-06-08 10:21:52 -07:00
Otavio Pontes 4096b123d8 curl: Make the swupd_curl_get_file easier to use
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.
2018-06-06 11:47:01 -07:00
Otavio Pontes 2f0a9810e0 curl: Don't use the heap for a local struct 2018-06-06 11:47:01 -07:00
Otavio Pontes c491c6d058 curl: Removing unused parameter 2018-06-06 11:47:01 -07:00
Otavio Pontes 887716ad56 curl: Reduce coupling of curl module by removing information about version
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.
2018-06-06 11:47:01 -07:00
Otavio Pontes 5d30df9daf curl: Remove unused code
req_version and curr_version in curl.c weren't used anywhere. Probably
this is a left over. Removing them.
2018-06-06 11:47:01 -07:00
Otavio Pontes 372fc39781 curl: Rename function to match the same pattern as swupd_deinit 2018-06-06 11:47:01 -07:00
Otavio Pontes dada319498 Remove #warnings from code. Use TODO instead
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.
2018-06-05 16:38:37 -07:00
Otavio Pontes 10064b823f Update: Change log order to have a clearer output
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.
2018-06-05 11:29:45 -07:00
Caio Marcelo de Oliveira Filho 07c9eb7c74 Report when a pack is missing using telemetry
Fixes #450.
2018-06-05 11:23:09 -07:00
Matthew Johnson 83208d4906 Code style fix
Result of 'make complaint'

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-05 09:42:52 -07:00
Otavio Pontes 3001e66d49 Downloads: Fixing typo 2018-06-05 09:37:46 -07:00
Otavio Pontes bd24a844c1 Hash: Don't use the heap for a local struct 2018-06-05 09:37:46 -07:00
root 8984007cc4 search: Add --nosigcheck
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>
2018-06-05 09:36:15 -07:00
Murilo Belluzzo 4e6e76f791 Remove template for c files
It is outdated, incomplete and silly

Signed-off-by: Murilo Belluzzo <murilo.belluzzo@intel.com>
2018-06-01 12:17:45 -07:00
Murilo Belluzzo 1448ca456c Remove all commented code from the code base
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>
2018-06-01 12:17:45 -07:00
Otavio Pontes 74756a13c1 Update: Fix memory leak on subscription list
If current_subs was cloned free the list structure. Free the list
and subscription data otherwise.

Fixes issue #363
2018-05-31 11:40:40 -07:00
Matthew Johnson 8dcbadbc75 Release v3.17.3
This release cleans up some code to declare functions as static when
appropriate and fixes a few mixer integration bugs.

* Write the valid-mix flag file in swupd-add-pkg
* Add some more state files to the ignore list for file collision
  checking.
* Check for file collisions *after* a new local build so updates to
  os-core are detected.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
v3.17.3
2018-05-23 14:49:25 -07:00
Matthew Johnson 5b06fac117 mixer integration: check for file collisions after new build
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>
2018-05-23 14:35:50 -07:00
Matthew Johnson 28224c2103 mixer integration: add more state files to ingore list
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>
2018-05-23 14:35:50 -07:00
Matthew Johnson 3dca951de5 swupd-add-pkg: write valid-mix flag file
swupd-client expects a .valid-mix file to exist in MIX_DIR when a valid
mix exists. Create this file after creating the mix.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-05-23 09:30:15 -07:00
Icarus Sparry cc3ec99bab Add make install to travis
Reformat the .travis.yml file to have shorter lines, and add 'make
install' as a step to get the scripts/fixstatic.pl program to run.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2018-05-22 15:08:38 -07:00
Icarus Sparry 6d452a824d Fix findstatic warnings
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>
2018-05-22 15:08:38 -07:00
Matthew Johnson 014de3a7a5 Release v3.17.2
This release updates mixer integration capabilities to use the latest
mixer/mixin features and configuration files and removes copyright
header prints from standard commands.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
v3.17.2
2018-05-15 11:36:12 -07:00
Matthew Johnson 85fee9aa51 Update mixer integration to use latest features
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>
2018-05-15 11:35:18 -07:00
Matthew Johnson 7b2e76239e Move copyright_header to main.c
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-05-14 12:52:34 -07:00
Matthew Johnson 5a8420b06a Remove copyright header checks from tests
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-05-14 11:05:33 -07:00
Matthew Johnson 01f771d362 Remove copyright header messages
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>
2018-05-14 11:05:33 -07:00
Matthew Johnson cff53614ca Release v3.17.1
This release removes sudo invocations in the swupd-add-pkg program and
rely on the user to run under sudo themselves. The /etc/swupd
configuration directory is now created with more open permissions to
allow users to view the configuration on their system.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
v3.17.1
2018-05-10 16:24:26 -07:00
Matthew Johnson 356ce157c1 swupd-add-pkg: remove sudo invocations
Instead of doing this behind the user's back expect them to do it
themselves. This also removes the inconsistencies of running some
commands with sudo -E and others without -E. If users want to provide -E
let them do it themselves.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-05-10 14:52:09 -07:00
Brett T. Warden ebe8a8118a Check status of swupd command in mirror tests 2018-05-09 16:51:23 -07:00
Brett T. Warden 541acddecd Tidy up /etc/swupd creation
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.
2018-05-09 16:51:23 -07:00
Brett T. Warden c264c23f61 Set mirror override path perm to 0755
When /etc/swupd is created to hold mirror URL override files, set the
permissions to 0755.
2018-05-08 16:45:14 -07:00
Matthew Johnson 75ef478119 Remove bsdifftests from swupd-client
These tests are not run and do not belong in the swupd-client
repository.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-05-08 16:03:18 -07:00
Matthew Johnson 8b0b6813eb Release v3.17.0
This release adds configurable mirror support to swupd via the 'mirror'
subcommand. Users can 'set' or 'unset' a mirror and the relevant
configuration files will be placed in /etc/swupd/. If the set mirror is
detected to be a small amount behind the upstream CDN a warning will be
issued to the user. If the mirror is significantly out-of-date the
mirror will be automatically unset to supply the user the most recent
security updates.

SSL certificate failures are now handled specially to provide meaningful
telemetry and error reporting to the user.

Retries are avoided when the contenturl is a file:// url to a local
update directory.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
v3.17.0
2018-05-04 12:53:32 -07:00
Matthew Johnson b513c07c20 Move path_prefix NULL check to mk_full_filename
Deduplicate all the path_prefix == NULL checks into the mk_full_filename
function.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-04-30 14:54:23 -07:00
Matthew Johnson e68a8a6db6 Update tests to remove version download string
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-04-30 14:54:23 -07:00