265 Commits
Author SHA1 Message Date
Brett T. Warden abb3f2b4f1 Check for rst2man or rst2man.py 2024-07-26 13:52:55 -07:00
William Douglas e01b473251 Switch to clang-format as a github action
Instead of having this be a local test, have a format target for the
Makefile and use a github action for clang-format to avoid differences
between developer systems clang-format and runner clang-format
versions.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-04-25 14:44:10 -07:00
Otavio Pontes 5ff46653cf actions: Create another job to check for API changes
Create another github job to check if the API has been changed in this
PR, so it will be easier to notice that a broken test is just an API
broken test

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-14 10:45:46 -07:00
Otavio Pontes a993c1a3fc Enforce warning to check for integer conversion errors
Converting from different int types are not always correct, so turning the
gcc warning that check for conversions that might change the value or sign of
the number.
2020-05-12 12:27:06 -07:00
Otavio Pontes 9fd1632ef0 int: Add functions to safely convert signed ints to unsigned
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-12 12:27:06 -07:00
Castulo Martinez 7e921eca64 Tracking dir functions in statedir.c
This commit adds the statedir.c module and moves the function to get the
tracking directory to this module. It also adds a new function to get
the path to a tracking file into the module.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-12 09:05:26 -07:00
Otavio Pontes 6613fc5ffa heuristics: Add test to validate heuristics
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-08 13:34:53 -07:00
Otavio Pontes 3bb6c8a9de heuristics: Consolidate main heuristics with the ignore heuristics
Ignore call was confusing and value was ignored for the main usages.
It should always run with the main heuristic functions.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-08 13:34:53 -07:00
Otavio Pontes 430ac8b0a7 exit_codes: Add header documentation
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-07 14:31:27 -07:00
Otavio Pontes 9f4e466ed3 swupd_cmds: Adding header documentation to file.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-07 14:31:27 -07:00
Otavio Pontes 8d7a7dad6e Organizing src/ directories in categories
src/
    src/3rd-party/ # Everything that is 3rd-party related
    src/cmds/ # All sub-commands from swupd (except 3rd-party ones)
    src/lib/ # Modules that implement functions not dependent on swupd
               behavior (i.e. system interations, logging)
    src/swupd_lib/ # Modules that implement functions dependent on swupd
                     behavior (i.e. hash calculation, signature verification,
                     manifest/bundle handlers)
2020-05-07 14:31:27 -07:00
Otavio Pontes 516e29bad8 autotools: Add src to the default include list
Adding src to default list of includes to make it easier to organize swupd header
files in directories.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-07 14:31:27 -07:00
Otavio Pontes 4e2e81fa4d Makefile: Adding -Wshadow to prevent accident shadowing
Make sure we are not accidently using the incorrect variable
by not allowing 2 variables with the same name.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-07 13:28:35 -07:00
Otavio Pontes 04eacb16be verifytime: Making verifytime completely independent again
We have added more dependencies in verifytime, but this was harder to
keep as it looks like, so making it completely independent from swupd
libs.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-05 12:14:54 -07:00
Otavio Pontes a3c1f97c57 shellcheck: Unify shellcheck script
Make sure shellcheck and shellcheck bats are using the same configuration to
run shellcheck

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 08:50:48 -07:00
Castulo Martinez b58e6c20ca Fail to be compliant if --quiet tests change
We are aiming to provide a stable --quiet output, so forcing "make
compliant" to fail if there are changes in the test/functional/api
tests, which cover these scenarios will prevent us from unadvertedly
changing those tests.

Closes #1501

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 14:19:57 -07:00
Otavio Pontes 6346f75477 sys: sys_path_join was wrong for string "//"
When sys_path_join("//") was used, the result was "" instead of "/"

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 13:59:07 -07:00
Otavio Pontes 83420c0fee autotools: Forces all files to include config.h header
Instead of explicitly adding config.h in every file, forcing it to be included
by the build system. Forgetting to include config.h could cause ifdefs to include
incorrect code.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-22 15:21:07 -07:00
Otavio Pontes b476183e2c telemetry: Create a header for telemetry module
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-20 09:33:51 -07:00
Otavio Pontes 0be755c2cf staging: Rename staging to target_root
Staging.c file was grouping functions that perform installation of files into
the target root (globals.path_prefix).
The staging is one step of this process, that is copying the file with a
different name to be renamed later, so this module needed a better name.
By calling it 'target root' we can group here all functions related to the
current root directory that is used by swupd, internally called path_prefix.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-10 09:59:22 -07:00
Otavio Pontes 3c01b38783 staging: Grouping all functions related to installation
Move to staging.c all functions related to installation or removal of files
in the system. Reorganize the staging_install_all_files() too.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-10 09:59:22 -07:00
Otavio Pontes 6def37a640 tests: Add script to validate if we are using one function we want to avoid
There are some functions we decided to avoid using, so add a test to make
sure we won't add them by accident.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes 19c4dbb6d6 verifytime: Adding more lib dependencies to verifytime
As there are more string functions that will be needed by log and
verifytime and it would be impractical to copy everything, prefering
to include more dependencies instead.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes 79d0c712aa testlib: Generate swupd certificates for each test to be execute
Instead of requiring an external script (.prereq) to generate the certificates
we can regenerate them before running each test.

Also removes completly the .prereq script

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 10:35:54 -07:00
Otavio Pontes bbd40948a3 Makefile: System tests should be run in serial
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 13:30:37 -07:00
Otavio Pontes db08520ed9 scripts: Don't use FORTIFY_SOURCE when optimizations are disabled
Both arguments were incompatible and warnings were being displayed for
this combination

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-17 13:32:14 -07:00
Otavio Pontes fa86651c9f Makefile: Be consistent in order of make check-functional
Sorting the bats test list to be consistent when running make-functional.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-10 10:17:34 -07:00
Otavio Pontes 34469dbbd5 Makefile: Propagate the --jobs flag to check-functional
Check-functional wasn't being run in parallel. Using $(MAKE) instead
of make to propagate make parameters

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-10 10:17:34 -07:00
Otavio Pontes 84e507d3f5 service: Remove check-update service
Clear Linux isn't using the check-update service anymore for a long time
and there's no other known uses for those scripts. So there's no reason to
keep them.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-09 14:10:51 -07:00
Castulo Martinez 68de707c04 Implementing the 3rd-party info command
Implementation of the 3rd-party info command to show the version of the
3rd-party repository along with the update URL.

Closes #1354

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-06 14:54:23 -08:00
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