47 Commits
Author SHA1 Message Date
Patrick McCarty e4b2a32448 Release v3.3.0
This release adds support for bundle includes in preparation for
deployment of this feature in swupd-server. It also adds some functional
tests for the 'search' subcommand and includes a couple of bug fixes:

- Removes a bashism in running 'mkdir -p' for multiple directories.
- Supports 'bsdtar' as a compile-time alternative to 'tar'.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v3.3.0
2016-03-22 11:14:39 -07:00
William Douglas 7544162243 Add include support for update
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.
2016-03-22 10:38:57 -07:00
William Douglas 4c7f900a79 Fix bundle manifest
Test bundle was for version 100 but used version 10 content, update
contents for version 100.
2016-03-22 10:38:57 -07:00
William Douglas dc00af2ddf 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).
2016-03-22 10:38:57 -07:00
William Douglas beb675de5e Don't set error for subscriptions not in MoM
Because the subs list may contain bundles that are new in the version
being updated to, don't set an error in the subs item for things not in
a particular manifest version.
2016-03-22 10:38:57 -07:00
William Douglas 7fa16a7e25 Update test for missing os-core bundle on update
os-core should always be in the list of subscribed bundles so fix test
to check if it exists in the subscribed list or not.
2016-03-22 10:38:57 -07:00
William Douglas 317b57d773 Skip excess checks for retry resetting in update
Avoid a branch when resetting retry and timeout variables during
main_update.
2016-03-22 10:38:57 -07:00
William Douglas 53bfe188b0 Remove legacy version identifier from btrfs era
The latest_version in check_versions and read_versions was a legacy
variable used for btrfs support that no longer exists and was a
duplicate of current_version in all use cases. This patch removes the
variable completely from the above functions.
2016-03-22 10:38:57 -07:00
Patrick McCarty 7a1f9adf2e Restore single quotes in do_staging() tar commands
Because we currently need to protect file->filename in tar commands if
the filename contains spaces or other special shell characters, restore
the single quotes. Using the single quotes prohibits filenames
themselves containing single quote characters, so a more robust solution
would be preferred.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-17 11:34:40 -07:00
Dmitry Rozhkov c5a58efebb Add compatibility with libarchive's bsdtar command
Since GNU tar fails to extract files with xattrs preserved when
Integrity Measurement Architecture (IMA) is enabled some vendors
may choose to install libarchive-based tar (bsdtar) on their embedded
devices, so the swupd server needs to be able to create archives
in its format.

This patch adds one compile-time options --enable-bsdtar that is used
to enable/disable GNU tar specific options.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
2016-03-17 11:31:10 -07:00
Brad T. Peters be35968781 swupd-client: Functional test for the Search
This patch adds a host of new functional tests, ensuring the search
feature works as expected.

Signed-off-by: Brad T. Peters <brad.t.peters@intel.com>
2016-03-17 11:04:35 -07:00
Brad T. Peters 337986b357 Add a Port option to Search command
Signed-off-by: Brad T. Peters <brad.t.peters@intel.com>
2016-03-15 14:28:24 -07:00
William Douglas 92211a6c7d Fix functional test manifest
The manifest references a file but was using the directory flag
incorrectly, fix.
2016-03-14 19:45:30 +00:00
William Douglas 7143aec578 Add bundle-add include support
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.
2016-03-11 23:36:13 +00:00
William Douglas deba09525a Allow manifests to contain includes
Start handling the case where a manifest has an includes line. This line
will be used to specify other manifests that are to be installed with
the containing manifest.
2016-03-11 23:36:13 +00:00
William Douglas d4dea3f0a8 Pass install_bundles a list of bundles
Intead of passing install_bundles a char **, pass it a list of char * as
this will be easier to use with the include feature coming due to not
needing to make a new character array.
2016-03-11 23:36:13 +00:00
William Douglas 25127cebe8 Refacter bundle installation
Pull out code that only can be run once into a bundle installer frontend
function and move code that could be run recursively into an another
function. This is done in preparation for manifest includes.
2016-03-11 23:36:13 +00:00
William Douglas c3b357d5ab Use bool to track new bundle request
Instead of having counter for new bundles requests, just set a bool when
a new bundle request is detected.
2016-03-11 23:36:13 +00:00
Patrick McCarty 18a16b6e16 Remove duplicate sys/stat.h include
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-11 15:34:34 -08:00
Patrick McCarty 50d19b6aa9 Remove extraneous bsdiff.h include
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-11 15:32:45 -08:00
William Douglas 1eb40ab8e6 Update source file formats with clang v3.8 2016-03-11 15:30:43 -08:00
Archana Shinde fce36edb2a Get rid of bash-specific syntax while creating state dir
The system call invokes /bin/sh. So, getting rid of brace expansion
syntax while creating the state dir as it may not be supported by /bin/sh
2016-03-11 10:33:47 -08:00
Patrick McCarty a709e4101b Release v3.2.0
This release includes a couple of new features, a couple of bug fixes
for boot file handling, build fixes, and adds some new functional tests.

New features:

- Adds a new mechanism for 'swupd update' to recover in the event of
  certain types of internal errors. The mechanism is currently used to
  recover in a situation where the parent directory is missing for a
  staged file.
- Adds support for libcurl's FILE protocol, allowing the user to pass
  file:// URIs to the -u option.

Bug fixes:

- Fixes handling of boot files for all subcommands. Specifically,
  'bundle-add' was not properly installing boot files, and 'verify
  --fix' was ignoring corrupt boot files.
- Fixes an issue with certificate installation on Yocto.
- Fixes an issue with passing --disable-bzip2 to configure.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v3.2.0
2016-03-10 12:24:42 -08:00
Patrick McCarty b520fc27d8 Bump libswupd major version to 2
A couple of changes break the libswupd ABI:

- removal of the "fix" symbol (global variable)
- modification of the do_staging() signature

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-10 11:56:18 -08:00
Patrick McCarty 97047688c3 Add functional tests for boot file handling fixes
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>
2016-03-10 11:43:31 -08:00
Patrick McCarty 47cc319c0f Fix handling of added, deleted, and corrupt boot files
A user was running into issues installing the kernel-container bundle on
Clear Linux. Namely, all missing files marked as boot were not
installed.

The root issue is that the bundle-add action does not set the "fix"
global variable before calling ignore(), so ignore() mistakenly returns
true when considering boot files that are missing, but not marked
deleted.

Because 'bundle-add' should be installing new boot files, and 'verify
--fix' should be repairing boot files if they have mismatching hashes,
remove the global "fix" variable entirely, since in all current call
sites, the "fix" behavior is expected.

Also, add another call to ignore() in remove_orphaned_files() to ensure
that any file that should be ignored (including deleted boot files) are
not removed during a 'verify --fix'.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-10 11:43:31 -08:00
Amarnath Valluri 0fc80fafee Right usage of AC_ARG_ENABLE on bzip2
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-03-10 09:17:25 -08:00
Patrick McCarty d1a8852f3e Add support for libcurl's FILE protocol
To support swupd-client testing without connecting to a web server, it's
convenient to use libcurl's FILE protocol, which will query files on the
local filesystem instead.

Because the libcurl-multi download path for fullfiles has treated the
"0" response code as an error, but it has the opposite meaning when
using the FILE protocol, only set the error when connecting to a web
server.

Also, the libcurl-easy code for synchronous downloads didn't treat "0"
specially, so this commit ensures the proper handling, as well as
setting a generic download error for the FILE protocol specific
CURLE_FILE_COULDNT_READ_FILE.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-08 09:00:43 -08:00
Archana Shinde 81eed9b75e Add functional tests for testing verify_fix_path functionality.
The tests check for missing directory and hash mismatch for a parent directory.
2016-03-07 14:23:51 -08:00
Archana Shinde cd26ed8f2d Add verify_fix_path to fix missing path while staging a file
The verify_fix_path function takes a path and a consolidated MOM as its arguments.
It breaks down the path into subpaths and checks if each subpath is missing.
If found missing, the path is searched for in the consolidated manifest for its hash
and downloaded synchronously. It returns success if all that subpaths are verified
and fixed.
2016-03-07 14:23:18 -08:00
Archana Shinde 9fbd3ef647 Remove symlink check for a path while staging a file.
The do_staging function checks if a path to a file is present before staging a file.
It does so by checking first if it is a symlink and following the symlink.
Remove this check as the way manifests are generated on the server side, it is not
possible to have a file path listed with symlinks in them. The server checks for file
type DT_DIR before including files in that path.
2016-03-07 14:23:18 -08:00
Amarnath Valluri 933e8da753 Fix build failure on Yocto
On install phase certificate files are being installed twice as included in
_DATA twice. We can use EXTRA_DIST than dist_.

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-03-07 14:23:18 -08:00
William Douglas 2568e6daf7 Add functional test for hashdump 2016-03-07 14:23:18 -08:00
Patrick McCarty 944a5c8eb6 Release v3.1.0
This release adds a new feature and fixes a few bugs:

New feature:

- Adds a new subcommand, "search", that can be used for searching for
  bundles that provide a certain binary or library; if there are any
  bundle providers, they are printed to the console.

Bug fixes:

- Fixes peer links of manifests between two Manifest.MoMs; as a result,
  changed/added/deleted manifest reporting is fixed for updates, and
  more delta manifests are likely to apply if available.

- Adds more specific reporting for Curl error messsages.

- Make 'swupd verify --install' output less verbose; files in the target
  directory are not expected to exist, so reporting missing/fixed for
  files is unnecessary unless errors are encountered.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v3.1.0
2016-03-07 14:23:18 -08:00
Patrick McCarty 885c6d4e94 Fix detection of previous version in the ABI checker script
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty 97db552019 Fix code style in some tests
clang-format does not have an option to make braces mandatory around
blocks (if/for/while/etc), but this is a style rule we are enforcing.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty b925a8481c Run clang-format on the code
The following command was run with clang 3.7.1:

$ clang-format -i -style=file include/*.h src/*.c test/*.c

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty 74973c8f1d Minor adjustments before running clang-format
clang-format is very picky about comment placement... Comments
immediately preceding labels are indented strangely, so move the
comments after labels instead. Also, adjust comment indentation level to
align with the surrounding code.

One other minor adjustment is needed for an array initialization; the
opening brace for the initialization must appear on the same line, or
else clang-format will format the entire statement differently.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty 1cc96b6e5f Add Clang format style file
To make the code style more consistent, I will be running clang-format
to enforce the style guidelines (very similar to the Linux kernel
style). Add a clang-format style file to get started.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty 814ce477d8 Pass string literals to #warning
To avoid compiler warnings about invalid characters in the argument to
 #warning, always pass a string literal.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty 840206b585 Fix two new compiler warnings
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Patrick McCarty fd2e6b7628 Enable test coverage setup
To generate test coverage reports, run:

  $ ./configure --enable-coverage
  $ make check
  $ make coverage

Results can be browsed from the coverage/index.html file.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-03-07 14:23:18 -08:00
Brad T. Peters e0be8cf0d3 swupd-client: Add Search Feature
New swupd primary command, offers the ability to
search for the provider of a specified binary or library.

A full complement of bundle manifests for the os-release version
is downloaded to the client prior to conducting any search. This
patch has been designed to enable this download, or staging, to
take place prior and separate from use of the search function.
However, with each search, the manifest complement is checked to
ensure completion.

Overhead:

A check against the Clear Linux 6300 manifest set
shows a search will entail a ONE TIME 83 MB network download
(the compressed manifest set), and a constant decompressed 400MB
usage on disk. Future searches will only require new or modified
manifests be downloaded.

Finally, download size is provided to notify user of expected delay

-----
Ex:
"Downloading manifests. Downloading 83.23 MB..."

Signed-off-by: Brad T. Peters <brad.t.peters@intel.com>
2016-03-07 14:23:01 -08:00
Brad T. Peters 79f1c7fb6a swupd-client: Add Curl bottom layer error messages
In each of these Curl error cases, we have no choice but to terminate
operation. We cannot programmatically work around these issues,
therefore this patch adds error msg details so user can pursue a
solution

Signed-off-by: Brad T. Peters <brad.t.peters@intel.com>
2016-02-25 13:54:31 -08:00
Tudor Marcu 2a23c3fbe8 Fix massive output spam
During a swupd verify --install, files are expected to be missing and must
be "fixed," so do not print out that it is missing/fixed in this case.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-02-25 11:53:31 -08:00
Archana Shinde d424cce760 Sort the manifests instead of files associated with the MOM
The function link_submanifests compares the bundle manifest names.
So sort the bundle manifests rather than the files here.
2016-02-24 12:36:55 -08:00
Patrick McCarty c42f8a3aa1 Initial commit
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v3.0.0
2016-02-24 09:34:13 -08:00