1476 Commits
Author SHA1 Message Date
Otavio Pontes 710e1a2cf6 Release v3.22.1
This release adds a autocompletion for zsh

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
v3.22.2
2019-08-21 15:13:57 -07:00
Otavio Pontes 4952b7aaf9 Makefile: Include swupd.zsh in dist package
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-21 14:55:04 -07:00
Otavio Pontes 070b24a1c1 Release v3.22.1
This release adds a fix for invalid memory initialization.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
v3.22.1
2019-08-21 14:31:32 -07:00
root f1b42e1c08 Fix minor code issues
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-08-21 14:19:27 -07:00
Otavio Pontes 7ad90c23df Release v3.22.0
This release adds enhancements, bug fixes and test improvements    .

Bug fixes:
 - Case insensitive when checking for insecure urls
 - Better overload of multiple configuration files
 - Improvements in documentation and help messages
 - Fixing corner cases where swupd mirror was setting invalid values
 - Fixed some memory leaks and invalid memory access
 - Fix problem on restarting swupd after a format bump
 - Fix infinite loop that could be triggered by an unstable network
 - Use same retry strategy in both sync and async downloads

Feature:
 - Make it possible to run swupd post-update scripts synchronously
 - Including zsh autocomplete script
 - Print distribution variant on swupd info command
 - Make usages of diagnose and repair consistent by always checking for both files missing and files included when using --picky
 - Introduce a new flag for diagnose and repair, --extra-files-only, to checking only extra files in the system.
 - Make it possible to run swupd offline when all needed files are in the state dir
 - Create a --download flag in os-install operation, to cache files for offline operations
 - Create a flag to always download search-file indexes on update (--update-search-file-index)
 - Print the latest available version on swupd check-update in the case of a format-bump
 - Support to have an external cache to fill the statedir on installations. The external cache is needed because it may be read only or in a different partition

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
v3.22.0
2019-08-20 17:47:38 -07:00
John Akre aa544293c2 Add functional tests for statedir-cache
This change adds tests for the statedir-cache with and without a network
connection.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-20 14:45:34 -07:00
John Akre 166b85cb95 manifest.c: Clean statedir-cache when statedir is corrupt
When a statedir manifest is corrupt, the statedir-cache must also be
cleaned so that the manifest can be downloaded over the network on the
second attempt.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-20 14:45:34 -07:00
John Akre 6f9bdc362c helpers.c: Verify statedir-cache owned by root
The contents of the statedir-cache can be copied to the statedir, so it
must follow the same permission requirements.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-20 14:45:34 -07:00
John Akre eac860e338 Add statedir-cache support
The --statedir-cache flag specifies a secondary statedir that will be
checked before downloading files over the network.

The primary reason to use the statedir-cache is to enable the os-install
command to take advantage of hardlinks when installing content across
partitions. In this case, update content stored in the statedir-cache
(source partition) will be copied to the statedir (target partition) before
installing content into the target partition. Since the update content
will exist on the target partition before installation, hardlinks can be
used instead of copies.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-20 14:45:34 -07:00
Otavio Pontes e8e9c39f84 packs: Fix memory leak
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 12:43:31 -07:00
Otavio Pontes 0696de4435 curl: Initialize curl as needed
Instead of initializing curl library on start, initialize it only when needed.
The advantage of this approach is that we can run some commands offline, if
there's no file to download.

Fixes #801
Fixes #895
Fixes #277

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 914700dc0a curl: Use same curl config on function to get content size
Use same init function for the curl handle used on
swupd_curl_query_content_size()

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 6495066fd4 curl: Check for http in globals and not curl
Instead of checking if the url is valid and approved in curl we can check
that in globals. This is important because we should fail even if we aren't
going to download any file and curl may not be initialized

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 441f270e5c fullfile: Fix memory leak on errors
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 0f70f3048a curl: Don't export capath parameters in check_connection
Don't let users to set the capath to use to test the connection.
This property should be only used by curl module.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 5ae49aaad2 curl: Use same retry strategy defined on sync curl on async curl
Don't retry downloads that are set as dont_retry by sync curl even on
async curl.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 23de8a6cec curl: Stop using CURLOPT_PIPEWAIT flag temporarily
We're seeing a problem in current curl when using the flag
CURLOPT_PIPEWAIT and trying to download a file from an unexistent or
unreachable server.

Easiest way to reproduce that on swupd is to disable your while you are
in the download phase of any swupd command. Without this patch swupd will
hangs and wont timeout.

The downside of removing this flag is that curl will prefer to open more connections
instead of waiting to check if it can multiplex. So it's a good thing to have
this enabled back in the future

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes eda855d1ef update: Save swupd binary path before executing any update process
On updates swupd binary can be replaced so readlink will fail to get the
swudp binary path. In this case we should run that before running any update
process.

And besides that hardcode /usr/bin/swupd as the default swupd path in the case
there's something wrong with readlink

Fixes #1067
Fixes #1068

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-15 15:23:55 -07:00
Otavio Pontes 71518b4888 version: Change API of read_versions back to original
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-14 14:31:33 -07:00
Castulo Martinez a41bea9fd5 Show the real latest version using check-update
When running the check-update command we get the latest version for the
format we are currently in, but we really want to get the latest version
regardless of the format.

This commit fixes the issue.

Closes #482

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-14 14:31:33 -07:00
Otavio Pontes f19e8dce06 search-file: Don't estimate the total download size for manifest
Estimating the total download size is almost as slow as downloading the
manifests. So just don't do it.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-14 13:04:23 -07:00
Otavio Pontes 299977fec4 update: Download search-files indexes on update
If --update-search-file-index flag is used on update, all search-file indexes, i.e.
all Manifests will be downloaded on update. This shouldn't be used if you have
disk or network restrictions, but it shouldn't be very download intensive after the
first usage because delta manifests are going to be used.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-14 13:04:23 -07:00
Otavio Pontes f30e7e7597 search-file: Rename the file to a proper name
The search command was renamed to search file, so rename the file and
main functions name

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-14 13:04:23 -07:00
Otavio Pontes 7f37684920 test: Always run real content tests with --no-progress
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-14 12:29:32 -07:00
John Akre 970f3a257a bundle.c: Return included manifest loading errors
Previously, when adding included manifests errors were thrown away which
resulted in swupd operations that could succeed, even when failing to
load an included manifest. Now when an included manifest fails to load,
swupd will return a failure.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-12 14:38:34 -07:00
Otavio Pontes 72eb7a94b3 globals: Fix unitialzed memory access
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-07 16:38:24 -07:00
Castulo Martinez 72091e0ec9 Reverse the order of default config files
More than one config file can be read, if the same option is found in
more than one config, it will be overwritten.

This commit reverse the order of the defaul paths for the config file so
they are read in the appropriate order of precedence.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-07 15:52:04 -07:00
Castulo Martinez 83ddcdb301 Enabling ability to read multiple config files
This commit enables the ability to provide many paths for the
configuration file and read configuration from all of them if more than
one config file is found. If the same option is defined in more than one
configuration file it will just be overwritten by the one last read.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-07 15:52:04 -07:00
Castulo Martinez ed0415b3b7 Adding missing option to default config file
Adding the skip_diskspace_check option to the bundle-add section of the
default config file.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-07 15:52:04 -07:00
Otavio Pontes 74dd1686ad test: Don't check the hashes twice on real tests
Diagnose picky behavior has changed so now we can use just one call
to swupd to verify if there's no extra file and no corruption.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-07 15:51:10 -07:00
Otavio Pontes 6bc965b031 globals: If path_prefix doens't exist, creates it
This is very handy for testing because we can just run:

$ swupd os-install --path testing/

And the testing/ directory will be automatically created. It's the same
behavior we have for the state dir.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-07 15:50:53 -07:00
John Akre 031c06776e os-install: Add download flag
When the --download flag is set for the os-install command, update
content will be downloaded to the statedir and no content will be
installed.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-07 14:12:34 -07:00
John Akre 30cb21260a testlib: Enable validate_item to check statedir
Sudo is needed to validate items in the statedir.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-07 14:12:34 -07:00
Castulo Martinez 6a4b15b430 Fixing message when using repair and --picky
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-07 09:43:41 -07:00
Castulo Martinez b4c346840e Removing unused assignment to variable
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-07 09:42:51 -07:00
Otavio Pontes a22f621a5e log: Print download sizes in MB and not Mb
MB stands for Megabyte and Mb stands for Megabit, so use the correct
unit.

Fixes #1044

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-05 16:10:02 -07:00
Otavio Pontes 58360629cf extra_files: Fix uninitialized variable
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes d339feb172 culr: Print debug info if unable to set user agent
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes 770bf33a29 curl: Create a local pointer before passing it to another function
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes 80f7860888 curl: CURLE_RECV_ERROR should always be considered an error
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes 2b61f8a237 hash: Force a minimum size for swupd hash
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes bd0a9d6b9e binary_loader: Check for errors on malloc()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes bb19899bff update: Fix memory leak on check_manifests_uniqueness()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes 2e6747f9f6 packs: Fix memory leak on download error
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes f63290584e globals: Invalid usage of realpath
Using correct parameter to realpath()

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes fb1cc0c978 telemetry: Report errors when telemtry fails to report problem
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Otavio Pontes f908ebccba clean: Simplify function to count occurences of a char
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 16:29:32 -07:00
Castulo Martinez 5608930be5 Fixing a bug using ignore-ilst files in tests
When using testlib to create tests, ignore lists can be used which
include lines of output that should be ignored when running tests.

The ignore lists can exist at three different levels:
- an ignore file that applies to all tests
- an ignore file that applies to all files of one theme
- an ignore file that applies to all tests within the same file

There was a bug in this last one that was causing ignore-list files to
be unrecognized unless the test number was also used as part of the
ignore-list name. This was causing issues because the test number
can change depending on how you run the test.

This commit fixes the issue.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-08-02 14:17:19 -07:00
Otavio Pontes 45762e7eab real_content: Properly remove the cache directory used by the test
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-02 12:38:52 -07:00
Otavio Pontes d97c219f69 mirror: Removing invalid ! in check connection
check_connection() returns an int. We shouldn't use ! before comparing it to zero.
If check_connection() return is zero it's a success.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-01 15:11:58 -07:00