Commit Graph
586 Commits
Author SHA1 Message Date
Castulo Martinez 3319a4eb4e testlib: Adding support for exported files
This commit makes possible the creation of bundles with exported files
in test environments. These bundles will have the 'x' in the appropriate
place in the manifest plus those bundles that are to be installed in the
environment will have the "exporting script" created in the 3rd-party
bin directory.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-29 15:58:02 -08:00
Castulo Martinez a562fb4fd3 Implement --file option for diagnose/repair
When diagnosing/repairing a system, sometimes is useful to only
diagnose/repair a specific file or path.

This commit implements the --file option for diagnose/repair so a file
or path can be diagnosed only instead of doing it to the whole OS or a
whole bundle.

Closes #1150

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-28 15:01:47 -08:00
Castulo Martinez 3e1167e4ec Expand bundle-info install status with explicit
bundle-info currently shows the installation status of a bundle, but
this one is restricted to "installed" or "not installed", it doesn't
show if a bundle was explicitly or implicitly installed.

This commit adds this information to the installation status during a
bundle-info.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-22 13:10:48 -08:00
Castulo Martinez 381f08dea1 Adding installation status to bundle-list
The "bundle-list" command can be used to show all installed bundles in
the system, however, currently there is no way to know which of those
installed bundles were implicitly or explicitly installed.

This commit implements the "--status" flag for bundle-list which can be
used to show which bundles were explicitly or implicitly installed.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-22 13:10:48 -08:00
Castulo Martinez 355edf2b61 Do not run scripts after updating from 3rd-party
Swupd should not run post-update scripts after updating content from a
3rd-party repo since it may threaten the security of the system.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-22 13:06:47 -08:00
Karthik Prabhu Vinod 6caae35301 autoupdate: adding auto-update test back
This PR re-enables the failing auto-update
tests while moving from travis to github actions

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2020-01-22 13:01:52 -08:00
Castulo Martinez a040496bc5 Implementing tree view for bundle-list --deps
Sometimes is useful to see the list of dependencies in a tree view form,
for example when trying to remove bundles from a system.

This commit adds the ability of listing the dependencies of a bundle in
a tree view when --verbose is used.

Closes #929

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-17 13:36:21 -08:00
Castulo Martinez e3134ad17b Moving the content from 3rd-party bundles
This commit moves the path where the content from 3rd-party bundles is
going to be installed from opt/3rd-party/<bundle_name> to
/opt/3rd-party/bundles/<bundle_name> so bundle directories are separated
from other top level directories like bin.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-16 15:43:29 -08:00
Castulo Martinez 823836550e Show what indirect dependencies are optional
When using "bundle-info BUNDLE --dependencies", information regarding
BUNDLE is presented to the user, this information includes the list of
direct and indirect dependencies BUNDLE has. All direct includes that
are optional (also-add) are marked as such, while there is no way to
distiguish what indirect dependencies are optional with the provided
information.

This commit expands the information shown by the command so indirect
dependencies that are optional are shown as such along with info about
the status of that dependency.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-16 13:40:50 -08:00
Castulo Martinez 81b4401509 Renaming the 3rd-party repository
The 3rd-party repository directory is currently 3rd_party, this name is
incorrect and needs to be changed to 3rd-party.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-10 16:14:01 -08:00
Karthik Prabhu Vinod 79c33d1957 Swupd info: Add functional tests
Closes: #1124

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2020-01-10 15:25:09 -08:00
Castulo Martinez 3f3ff08c8f Add ability to search files in specific version
The search-file command is restricted to looking for files in the
current version. This commit adds the --version option to the command
that can be used to seach for files in specific versions of Clear.

Closes #1155

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-08 11:36:48 -08:00
Castulo Martinez f90a9b3c65 Testlib option to create a replica of a test env
Sometimes when a test finds a problem in the source code it is difficult
to determine what is the problem in the code, so the code needs to be
debugged. In order to do this, the test environment of the particular
test has to be created but without running the test, so we can run the
command executed by the test with the debugger.

This commit adds a function (create_test_environment_only) to create a
specific test environment based on a bats file, but without running the
test.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-04 18:43:58 -08:00
Castulo Martinez db033b1d6b Show spinner when loading manifests in bundle-list
For some options of bundle-list, like --deps and --has-dep, we sometimes
need to download a considerable amount of manifests, if that happens
swupd just seems to hang for some time, this time could be considerably
in slow networks.

This commit enables the spinner while the manifests are baing downloaded
during a bundle-list operation so users know swupd is not hung and it is
doing some downloading.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-03 14:29:11 -08:00
Castulo Martinez b5bd920611 Fix the number of steps in swupd functions
In order to report progress accuratelly, currently swupd requires a
hardcoded number of steps per operation so we can report how far in the
operation we are. Most of these step totals are wrong.

This commit fixes the number of steps in many swupd functions.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-27 17:28:53 -08:00
Castulo Martinez fa749bc354 Cleaning the spinner once download completes
A spinner was added to swupd to show some kind of progress while
downloading content which its amount is unknown. Once the content is
downloaded the stopped spinner should be removed from the screen. This
commit does that.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-26 14:10:16 -08:00
Castulo Martinez 3856976b49 Formating 3rd-party add,list,remove command output
This commit makes a few small changes to the output of the commands to
make it look cleaner and to be consistent with the output of other swupd
commands.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-24 09:57:09 -08:00
Castulo Martinez 91d56b9cc4 Remove the state dir when removing 3rd-party repo
When we remove a 3rd-party repo from the system, we remove the directory
where all its contents got installed, but we don't remove its state
directory.

This commit removes it since we no longer need that state directory.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-23 10:52:13 -08:00
Castulo Martinez 5efb9077ec Filter messages from signature failures
When performing signature verification to the MoM or to the version
file, if there is any error during the process, a series of errors are
printed to stderr. Many of these error messages are duplicated and most
of them are too detailed.

This commit filters those detailed messages so they are only seen if the
user is using the --debug flag, showing only a few more general
error messages about the signature failure.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-23 09:43:09 -08:00
Castulo Martinez 140dba9a98 Consistency with signature verification messages
This commit enhance the consistency and readability, of the messages
shown when the signature verification is skipped or fails.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-23 09:43:09 -08:00
Castulo Martinez 53f502e141 Check 3rd-party repo certificate with operations
When running an operation, swupd uses a certificate to validate things
ilke the MoM and the version file. The certificate that needs to be used
for 3rd-party repos is different than the one that has to be used for
upstream.

This commit enables the use of the 3rd-party repo certificate that will
be installed in the repo's directory with all swupd operations, except
when adding the repository, in those cases, since the os-core bundle
hasn't been installed yet, we need to provide the cert path through
other means, like using the -C flag..

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 16:08:04 -08:00
Castulo Martinez 806ca3ee94 Verifying the URL of a repo doesn't exist already
When adding a 3rd-party repository we need to make sure that the URL
provided by the user is not already assigned to another 3rd-arty
repository, otherwise we can end up having the same repository multiple
times, just with different names.

This commit checks the URL doesn't already exists.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 14:52:34 -08:00
Castulo Martinez 946a22a777 Ignoring invalid bundle error if exist in one repo
When listing bundles using the --deps or --has-dep flags which
take a BUNDLE as argument, one or more repositories may not have
the specified BUNDLE, but we should not return a
SWUPD_INVALID_BUNDLE error unless the bundle is not found in any
repository.

This commit enforces that behavior and also modify the output of the
different list options to make them more consistent with one another.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 14:05:12 -08:00
Castulo Martinez 24de99dfcc Housekeeping on 3rd-party commands
This commit does some housekeeping in the 3rd-party commands:
 - Initialize the function "progress" only after swupd has initialized
   successfully.
 - Make functions that are not used outside of a file static.
 - Avoid using regex or partial verifications on tests when possible.
 - Add 3rd-party command flags to the default config file.
 - Don't use "repo" in help menus, use the whole "repository" word.
 - Add 3rd-party sub-commands to the flag_validator script.
 - Add missing values from the autocompletion scripts.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 12:14:08 -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 9cc3bc105d Function to run operations in all 3rd-party repos
This commit adds a function that can run an operation in one or all
3rd-party repositories. If a repository is specified then the operation
is run in only that 3rd-party repo, otherwise it is run in all 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 d0c2f881cf Update testlib to support 3rd-party bundle updates
This commit modifies some of the functions of the test library so it is
possible to update bundles that belong to 3rd-party repositories.

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 92de0ef63a Don't mix rc types in third_party_add_main
Variables defined with "enum swupd_code" should only receive values that
are consistent with swupd_code.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 16:26:31 -08:00
Castulo Martinez e1e34e4000 Reorganize where we read the system verion
This commit reorganizes the location where we read the system version
for some operations like bundle-add and bundle-list to make the code
more reusable.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 16:26:31 -08:00
Castulo Martinez 868505b5b9 Install os-core when adding a 3rd-party repo
The os-core file includes the os-release file, which has the
version of a content server. When adding a new 3rd-party repository we
need to install the os-core bundle from that repo so we can track the
current version of the repo.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 16:26:31 -08:00
Castulo Martinez 6823dc30bb Removing version from 3rd-party repo.ini file
The version of a repository won't be read from the repo.ini file anymore
but from the os-release file at the repo's path_prefix, so this commit
removes all the code related to handling the version key/value in the
repo.ini file.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 16:26:31 -08:00
Castulo Martinez e5ec67edf1 Get version from os-release on repos bundle-list
Instead of getting the current version of a 3rd-party repo during a
bundle-list from the repo.ini file, this commit changes the code so it
is gotten from the os-release file in the appropriate path_prefix for
the repo.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 16:26:31 -08:00
Castulo Martinez b91ecbbc6d Implement --repo flag for 3rd-party bundle-list
This commit adds the --repo flag for the 3rd-party bundle-list command
which can be used to specify the repository from which the bundles are
going to be listed.
2019-12-05 16:05:51 -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 068f52aa6d Making bundle-list output consistent
This commit does two things:
 - makes the output of all options of bundle-list consistent with each
other.
 - makes the ouptut of all bundle-list work properly with the --quiet
flag so it prints the output in a format that is friendly for piping the
output.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 15:44:51 -08:00
Castulo Martinez 1216f89d79 Allow users to specify the 3rd-party bundle to use
When a user is adding bundles from a 3rd-party repository, if the user
doesn't specify the repository, swupd will search for the bundle in all
3rd-party repositories. If the bundle is in more than one 3rd-party
repository, he/she needs to specify the repo to use.

This commit adds the means to specify this repo by providing the
--repo/-R flag for 3rd-party bundle-add.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Castulo Martinez 8079503cee Adding 3rd-party bundle-add section to config file
This commit adds the section that handles the "3rd-party bundle-add"
options into the default config file. It also enables the use of
the 3rd-party command and its subcommands in the config file.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Castulo Martinez c8ecede8ae Avoid running heuristics/scripts with 3rd-party
Heuristics and post-update scripts that apply to upstream bundles don't
apply to bundles installed from 3rd-party repositories. This commit
enables/disables these actions on demand so 3rd-party bundles are
installed correctly.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Castulo Martinez 184f0b9c22 Store version as int in the repo struct
The version is usually expected to be a integer throughout the swupd
code, so storing the value as an integer instead of as a string reduces
the number of times we have to convert this value.

Also this commit initializes the version to 10 instead of 0 when first
adding a repo, this is the initial value for any mix, so it makes more
sense.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Castulo Martinez 64377b6ce2 Basic tests for adding bundles from 3rd-party repo
This commit adds a few basic tests for adding a bundle from a third
party repo.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Castulo Martinez 8bb471ae40 Enabling the use of 3rd-party repos in the testlib
This commit enables the use of 3rd-party repos in some of the testlib
functions.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-26 08:23:47 -08:00
Castulo Martinez 24f60f2673 Rebalancing functional tests
This commit separates the 3rd-party tests in their own job since we will
be adding several tests related to 3rd-party in the upcoming days.

This commit also rebalances the tests in the update groups so they are
better balanced.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-25 15:13:17 -08:00
Otavio Pontes 7614400670 3d_party: Adapt 3rd party remove repo functions
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-25 13:41:52 -08:00
Karthik Prabhu Vinod 7f1e73a3d3 Concrete implementation for third-party repo remove
sudo swupd 3rd-party remove <repo_name>

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-11-25 13:41:52 -08:00
Otavio Pontes 42eb855b60 3rd_party: Parse all fields supported from repo.ini config file
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-21 16:34:46 -08:00