Commit Graph
28 Commits
Author SHA1 Message Date
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 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 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
Otavio Pontes 2bf4169a4a Don't mix tabs with spaces in the same file
And prefer tabs over spaces, because that's the project standard for
source files

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-29 11:54:25 -07:00
Otavio Pontes d2590a1b9e fullfile: Improve output of fullfile downloads
Print a "Validate downloaded files" message to separate 2 different progress bars
and improve the output when downloading extra fullfiles

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-18 09:27:25 -07:00
Otavio Pontes 66ea5fea0f progress: Make progress bar and spinner more similar in style
And protect spinner from printf's during spinner time

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-18 09:27:25 -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 3e674a66c7 json: Remove trailing spaces at the end of strings
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-03 15:26:54 -07:00
Karthik Prabhu Vinod 3e7f81d601 Fixing missing json messages while file redirect
Removing the [*] at the end of the spinner

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-09-25 13:38:22 -07:00
Karthik Prabhu Vinod 4af2023020 Fix Download to Downloading
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-09-24 14:34:13 -07:00
Otavio Pontes d895218082 verify: Remove whitespace before ...
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-09-24 10:17:54 -07:00
Karthik Prabhu Vinod 74bcdd2fe4 Progress bar for manifest download
This ensures we have a callback function
for full_file curl download. The function
implements a spinner for progress

Fixes #1060

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-09-23 10:36:50 -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
Castulo Martinez db0c44b9b0 Test: Add missing IDs in tests
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-16 15:22:08 -07:00
Castulo Martinez da8dd88837 Test: Fix call to global_setup in tests
There was a bug in the logic of the setup function in testlib which was
causing the globale_teardown to be incorrectly called when tests were
being run using "bats <directory>/". This commit fixs the issue.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-16 15:22:08 -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
Castulo Martinez b81a3edaae Improve the flag restrictions for verify/diagnose
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-29 15:20:56 -07:00
Castulo Martinez c0b340bbd2 Fixes a bug when deleting extra files
When swupd repair is run with --picky or --extra-files-only it attempts
to remove all those files that are in the picky tree and that are not
mentioned in any manifest (from installed bundles). If swupd
encounters an error removing any of these files or directories, it
prints a message showing the failure. This message was wrong since it
was not showing the whole path to the file being deleted when the path
included a prefix.

This commit fixes the issue by appending the prefix to the path so it
shows correctly.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-29 13:43:49 -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
Castulo Martinez e0256bee24 Make "diagnose --picky" a superset of "diagnose"
Running "swupd diagnose --picky" result in only identifying the extra
files in the system, but doesn't run the other standard checks that a
"swupd diagnose" do. "swupd diagnose --picky" should do everything
"swupd diagnose" does plus searching for the extra files.

This commit fixes the issue by making diagnose --picky a superset of
diagnose. The commit also makes some changes in the output of --picky so
it is consistent with the rest of the diagnose output.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-19 10:46:20 -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 c521417205 Including a few more cosmetic changes for "verify"
This commit adds a few more cosmetic changes to the commands that run
verify in the back for consistency.
- Different steps in the update process are separated by a blank line.
- Messages from swupd should not finish with a '.'

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-14 14:50:09 -07:00
Castulo Martinez 7d295f3ec5 Fix the output when diagnosing a system
Currently when running diagnose, and a problem is found (a missing
file, a corrupt file, or an extraneous file), swupd shows the output
like this:

Verifying files
	...12%
Hash mismatch for file: /usr/bin/somefile
	...100%
Inspected 632545 files

So it splits the percentage that shows the progress of the action in two
lines. This commit fixes the output so it looks like this instead:

Checking for missing files
	...100%

Checking for corrupt files
 -> Hash mismatch for file: /usr/bin/mixer
 -> Hash mismatch for file: /usr/bin/mixin
 -> Hash mismatch for file: /usr/bin/swupd-extract
 -> Hash mismatch for file: /usr/bin/swupd-inspector
 -> Hash mismatch for file: /usr/share/zsh/site-functions/_mixer
	...100%

Checking for extraneous files
	...100%

Inspected 632545 files

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-06 15:37:21 -07:00
Castulo Martinez 4434fcb54d Split verification progress
This commit shows a more detailed progress report when diagnosing a
system.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-06 15:37:21 -07:00
Castulo Martinez eb579bcdae Adding a line break when reaching 100% in progress
This commit adds a line break at the end of the progress report (when we
reach 100%) so we don't have to manually include it every time we report
progress.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-06 15:37:21 -07:00
Castulo Martinez 2276e3f42b verify command as superseded instead of deprecated
The verify command has been superseded by diagnose, the --fix option has
been superseded by the repair command, and the --install option has been
superseded by the os-install command. This commit changes the messages
displayed to the user from showing the commands as "deprecated" to the
more accurate "superseded" description. It also fixes some other
mismatches in output when using the new commands.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-30 20:58:14 +00:00
Castulo Martinez a3131db0fe Adding the -V / --version flag to swupd commands
swupd uses the -m / --manifest flag for some commands to specify what
version to use for that specfic action. For example using "swupd verify
--install --manifest=10" will attempt to install the OS with version 10.
The problem is that this flag doesn't really hint users about what the
flag is used for, specially if the user is not familiar with swupd / mixer
internals.

This commit adds a replacement flag -V / --version that will have the
exact same functionality of -m / --manifest which will be deprecated.
The deprecated flag should be removed in 6 months time.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-24 20:57:09 +00:00
Castulo Martinez 2cb0dd80b4 Renaming "swupd verify" to "swupd diagnose"
This commit renames the "verify" command to "diagnose" to make it
more straightforward for the user to understand the purpose of the
command.

Closes #918

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-14 15:51:28 -07:00