Commit Graph
235 Commits
Author SHA1 Message Date
Otavio Pontes b068fb845e docs: Explicitly adding a list of files in the doc check exclude list
We have a list of header files that weren't documented yet. Add them explicitly
to the check to prevent us to lower the quality of the documentation of headers
that are well documented.

Also fixing some documentation that weren't included because of incorrect style.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-01-28 09:21:40 -08:00
Castulo Martinez 86786b94ca Organizing compare like functions
We used compare-like functions as arguments to other functions that
filter, sort, compare data. These functions are scattered accros the
code and they are sometimes difficult to identify so there is a lot of
code duplication.

This commit organizes all the compare like functions throughout the code
in the same place and with standard naming so it is easier to find them
and reuse them.

Closes #1167

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-22 13:08:17 -08:00
Castulo Martinez ca98b3a7db Adding "3rd-party clean" command
This commit implements the swupd clean command for the 3rd-party bundles
so users are able to clean the cache on their state directories.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 16:38:41 -08:00
Castulo Martinez cb67bf7b67 Implementing the "3rd-party check-update" command
This commit adds the ability to check for updates on 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 11:50:33 -08:00
Castulo Martinez 11ddfefc88 Implementing the "3rd-party repair" command
This commit adds the ability to repair bundles from 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 11:23:37 -08:00
Castulo Martinez d96b6f6d92 Implementing the "3rd-party diagnose" command
This commit adds the ability to diagnose bundles from 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 10:57:37 -08:00
Castulo Martinez f48c58e737 Implementing 3rd-party update command
This commit adds the ability to update the system based on the 3rd-party
repositories the user have.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-12 08:41:45 -08:00
Castulo Martinez 33b4e9ea52 Implementation of 3rd-party bundle-info command
This commit adds a new "3rd-party bundle-info" command which can be used
to show information about a bundle from a 3rd-party repository. If no
3rd-party repository is specified, the bundle is searched for in all
available repositories.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-12 08:17:55 -08:00
Castulo Martinez 9d59dc068e Implementing the 3rd-party bundle-remove command
This commit adds the ability to remove 3rd-party bundles. If a repo is
not specified the bundle will be searched for in all repositories. All
options from the normal bundle-remove command are supported with
3rd-party bundles.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-11 16:11:35 -08:00
Castulo Martinez be1573f064 Implementing 3rd-party bundle-list command
This commit introduces a new command to list bundles from all 3rd-party
repositories. At this point users cannot choose a specific repo to show
its bundles but rather all repos are shown.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 15:44:51 -08:00
Castulo Martinez 1d53b9bdd4 Adding dummy "3rd-party bundle-add" command
This commit adds the 3rd-party bundle-add command to swupd. It does not
implement the functionality yet.
The actual functionality will be implemented in a different commit.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Otavio Pontes 9821902174 3rd_party: Make repo.ini functions part of a module to handle repositories
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-21 13:16:33 -08:00
Otavio Pontes 709d5a9831 config: Consolidate parser and writer in same file
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-21 13:16:33 -08:00
Otavio Pontes 2131d96825 config: Reorganize includes to make sure everyone is including config.h
3rd_party_internal that isn't used for anyone.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-21 13:16:33 -08:00
Karthik Prabhu Vinod fe0cd44e5e Concrete implementation for third-party repo add
sudo swupd 3rd-party add <repo_name> <upstream_url>

With some clean up from Otavio

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-11-21 13:16:33 -08:00
Otavio Pontes 50327fc9d3 Makefile: Change behavior of make check
Now make check is only running unit tests and a new target,
functional-check is used for bat tests. The major win on that
was that now we can use find to look for all bat tests in the
functional library and we don't need to keep the BATS list
updated.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-18 15:48:10 -08:00
Karthik Prabhu Vinod 8069064c43 Add third-party skeletal features
This PR starts the third-party repo-add, delete, list skeletal features
for swupd. This PR also add support for configure flag
to build third-party optionally for swupd, off by default.

Repo Add:
 sudo swupd 3rd-party add <repo_name> <URL>
Repo Remove:
 sudo swupd 3rd-party remove <repo_name>
Repos List:
 sudo swupd 3rd-party list

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-10-31 10:23:00 -07:00
John Akre bf4cdc03a0 os_install: Skip optional bundles when flag set
When the --skip-optional flag is set, optional (also-add) bundles will
be skipped.

Fixes: #1182

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-10-31 09:12:21 -07:00
Castulo Martinez 744bd4774a Adding tests for bundle-remove --recursive
Functional tests for the new "--recursive" flag in bundle-remove that
will be used to remove a bundle and its dependencies.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-10-30 13:38:41 -06:00
Otavio Pontes ac54931e84 Makefile: Add missing file bundle.h
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-21 16:22:50 -07:00
Karthik Prabhu Vinod c207c9240c Add --path to swupd autoupdate mechanism
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>

Fixes #527
2019-10-21 12:26:48 -07:00
Otavio Pontes 95271fc410 progress: Always print a progress bar or a spinner on json output
Changing the progress report lib to always print 0 or -1 when a step is
started and a 100 when a step finishes.

Also reorganizing all commands to have less steps (when possible) and that
are more meaningful to progress report. Hide some internal steps that doesn't
provide useful information to end users.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-18 09:27:25 -07:00
Otavio Pontes 78ae0d3ff5 Makefile: Reorder file
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:29:07 -07:00
Otavio Pontes 3b5644a4e3 compliant: Merge check-ids, check-flags in make compliant
Adding more tests to make compliant instead of creating new ones.
Shellcheck and docs-coverage weren't added because they have extra
dependencies

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes 2827914675 compliant: enforce sorted list of files in Makefile.am
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes 18978eed70 Makefile: Move code style check to a bats script
Just moving code from Makefile to a bats script to be easier to extend the
code style check

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes 9f2c1e578f code: Rename command source files to the name of the command
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 17:43:18 -05:00
Castulo Martinez f7aeea5cef Implement bundle-info command
The bundle-info command shows detailed data related to a specified
bundle. Among the data currently displayed it includes:
- If the bundle is installed or not
- If the bundle is experimental or not
- If the bundle is installed, it shows if there is an existing update
for the bundle
- The latest available version of the bundle
- The size of the bundle and all its dependencies
- The max size needed in disk to install a bundle if not installed

This commit also adds the following command flags:
--version: so a user can display information for a bundle in a
specific version, not only the current version.
--dependencies: this flag can be used to show all optional and required
bundles that are directly and indirectly included by the specified
bundle.
--files: this flag can be used to show all files that are part of a
given bundle.

All flags can be combined to show specific data.

This is the first of a series of PRs to implement the bundle-info
features referred to at #461.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-10-04 08:42:55 -07:00
Otavio Pontes 8288a4f657 timelist: Move timelist to lib
Timelist is a generic tool to measure time and it can be moved to lib/

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-03 15:14:11 -07:00
Otavio Pontes eb316d0a0e list: Adding unit test for list_deduplicate
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-09-25 09:09:25 -07:00
Castulo Martinez a16914f90b Adding tests for diagnose/repair --bundles
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-20 15:26:51 -07:00
Otavio Pontes 69cd7d9395 test: Support running tests in a different directory
All files that are written by tests should be written in the directory
where the tests were executed and not the directory where code is.

Make distcheck now works fine

Fixes #343

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-09-13 15:35:03 -07:00
Karthik Prabhu Vinod 9679835c40 Update: Perform sig check on latest file
Fixes #1051

Signed-off-by: Karthik Prabhu <karthik.prabhu.vinod@intel.com>
2019-09-11 15:25:32 -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
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
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 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
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
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
Castulo Martinez 2e3a584558 Removing --bundle flag from repair
The -B/--bundle option is confusing and causing users to wipe out their
systems. This option was really just meant for os-install, so this
commit removes it from "swupd repair".

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-29 15:20:56 -07:00
Otavio Pontes 302d0e784a Makefile: Clean manpages only on distclean
Manpages are created in make dist so we should clean them only on distclean.
For example if you run:

$ make dist
$ tar xf swupd-client-version.tar.gz && cd swupd-client
$ make clean

All manpages are going to be deleted and the source files aren't available on
the tarball. So you are going to be blocked in a build.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-29 15:04:51 -07:00
Otavio Pontes 2cab05ea21 globals: Group globals functions and variables in a header file
To make it easier to document and to read, group global related functions
and variables in an exclusive header file

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-25 10:45:05 -07:00
Castulo Martinez 6a0849646d Adding --extra-files-only flag to diagnose/repair
Since --picky was made a superset of diagnose/repair, there is the need
of a new flag that only finds/repairs the extra files that are not in
any manifest.

Many things were included in this commit:
- This commit adds the new flag --extra-files-only for this purpose.
- The commit also refactors the verify function to simplify its workflow
and remove code duplication
- It also adds some validations for flags that are mutually exclusive in
verify/diagnose/repair
- Updates the documentation

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-19 10:46:20 -07:00
Otavio Pontes 0f88a05b43 Makefile.am: Sort files in filelist
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-17 14:29:05 -07:00
Otavio Pontes e148456c8a test: Shellcheck tests should return an error on fails
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-12 16:32:18 -07:00
Otavio Pontes 382c1d782f also-add: Update, diagnose and repair shoudn't consider the also-add bundles
In the case that we have a bundle installed as also-add and removed later,
repair shouldn't reinstall that bundle. The same is valid for diagnose and update.
Os-install is the only exception. We should always install all bundles that are
listed as also-add in os-install.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-12 15:44:25 -07:00
Castulo Martinez e63dc805cf Adding flag validation to the swupd build process
swupd supports global flags and supports local flags that are specific
to subcommands. Flags that are specific to subcommands can be reused in
a different subcommand. Global flags should be unique and should not be
reused as local flags to avoid conflicts.

This commit adds a bash script that checks that the flags currently used
in swupd are valid (have no conflicts with other flags from the same
command or with the global flags). This script will be run as part of
the build process so in case an invalid flag is found the build will be
stopped. Alternatively, the script can be used by developers to validate
a new flag during the implementation time.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-12 14:28:05 -07:00
Otavio Pontes f337da5b9c bundleadd: Rename flag from optional to also-add
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-08 13:58:24 -07:00
Castulo Martinez c5ba016331 bundle-add skips optional bundles if specified
Swupd will install optional bundles on bundle-add by default,
but will skip them if specified by the user by using the
--skip-optional / -o flag..

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-03 14:59:47 -07:00
Castulo Martinez 9924bf7ee2 bundle-add installs optional bundles by default
An optional bundle is not required to be installed in the system while
included bundles are. Swupd will install optional bundles on bundle-add
by default.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-03 14:59:47 -07:00