644 Commits
Author SHA1 Message Date
Otavio Pontes 5bb4ef2337 swupd.bash: Make swupd.bash POSIX compliant
Bash autocomplete scripts should be POSIX compliant, so fixing that and
adding a test to validate this.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-19 13:47:49 -07:00
Castulo Martinez 8e4c017365 Moving downloaded manifests to their own directory
When swupd downloads manifests to the statedir they are downloaded in
directories that represent the version of clear that the manifests
belong to. However those version directories are stored in the statedir,
root directory. This commit moves them into their own "manifest"
directory so there is more consistency with the downloaded files.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-15 11:47:33 -07:00
Otavio Pontes d5d3c599d2 Revert "Moving downloaded manifests to their own directory"
This reverts commit 336fee7a9d.
2020-05-15 08:18:37 -07:00
Otavio Pontes 24ecf6c913 delta: Improve message on delta errors
Print a more useful error when we fail to locate a file to apply a
delta. Add a suggestion for the user to run `swupd repair` and make
it clear that the problem is in their system and not in the update
content.

Fixes #1425

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-14 13:41:59 -07:00
Castulo Martinez 336fee7a9d Moving downloaded manifests to their own directory
When swupd downloads manifests to the statedir they are downloaded in
directories that represent the version of clear that the manifests
belong to. However those version directories are stored in the statedir,
root directory. This commit moves them into their own "manifest"
directory so there is more consistency with the downloaded files.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-14 11:03:51 -07:00
Otavio Pontes 7263b2d774 verify: Don't apply heuristic to os-install
Don't run heuristics for os-install or repair --quick.
On os-install we want all files to be always installed. On repair --quick
we don't process any do_not_update files

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-13 08:24:37 -07:00
Castulo Martinez bca38243d8 3rd-party: add bundle-remove --orphans flag
Implementing the --orphans option to remove bundles no longer required
by tracked bundles from 3rd-party repositories.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-08 09:30:50 -07:00
Castulo Martinez 4d0a6d29a1 Implement bundle-remove --orphans flag
This commit implements the --orphan flag for bundle-remove which can be
used to remove bundles that are no longer required by tracked bundles.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-08 09:30:50 -07:00
Castulo Martinez 0b47050848 3rd-party: add --orphans flag for bundle-list
Implementing the --orphans flag for 3rd-party bundle-list.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-05 10:37:44 -07:00
Castulo Martinez 4cd51ca5d8 Add --orphans flag to bundle-list
Adding the --orphans flag to bundle-list which shows those bundles that
are installed ut no longer required by any tracked bundle.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-05 10:37:44 -07:00
Otavio Pontes d29865f8a9 swupd.bash: Fixing tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-05 09:09:53 -07:00
Castulo Martinez 86ef6bfde5 Testlib: Fixing functions that use a test ID
Instead of relying on all tests of the same group to exist in the same
directory, testlib should assume those tests could be scattered across
multiple directories.

Closes #1485

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-05-01 13:02:21 -07:00
Castulo Martinez 67dd98a5f1 Test: Use global_setup for bundle-list tests
Use global_setup in all bundle-list tests so we can only generate the
test environment once and use it for multiple tests. The one exception
is if we need to modify the env for a specific test.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-30 14:01:16 -07:00
Otavio Pontes d2c053cdb3 test: Create test to validate if we can repair files that have type change
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 12:26:29 -07:00
Otavio Pontes 4436d33e43 target_root: Handle invalid directory or missing directory the same way
We don't need to handle directory missing or invalid differently, because
the staging function removes it if necessary, so making the if simple.

Fix #1509

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 12:26:29 -07:00
Otavio Pontes ce0943982a shellcheck: Error SC2119 doesn't apply to our use cases
Ignoring error SC2119 because they are false positives and I don't see cases
where that would return anything useful for us.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 08:50:48 -07:00
Castulo Martinez 766be95913 Test: show_target shellcheck warning
The show_target function shows a warning that is not applicable so this
commit ignores that warning wherever show_target is used.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-29 09:04:13 -07:00
Castulo Martinez e57b9e6948 Testlib: adding help with description for all funcs
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 10:56:39 -07:00
Castulo Martinez 8a6eb85efe Testlib: function to print help menus of commands
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 10:56:39 -07:00
Castulo Martinez 201950445a Reporting if a file was fixed or not with --quiet
When using --quiet, there was no way of knowing if a file had been
successfully repaired or not. This commit fixes that.

Closes #1504

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 09:13:45 -07:00
Castulo Martinez 8b9a2e8510 API: Do not validate error messages in API tests
The tests in test/functional/api are going to validate the --quiet
output is rarely changed, therefore only expected output should be
validated and not warnings or error messages.

Closes #1502

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-27 16:04:05 -07:00
Otavio Pontes 9a8d5a09e3 target_root: Reorganize function verify_fix_path()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 14:50:22 -07:00
Castulo Martinez 8ab83f8167 3rd-party: using "repository" for headers
Headers are printed at the beginning of the output for every repository
in operations that run in multipl repos. This header was using the word
"repo" but we are trying to use the whole "repository" word every time
we printed it to the user. This commit changes that.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 17:12:17 -07:00
Castulo Martinez 6766748b42 Check extra files even if no tracked files
When running a diagnose/repair, swupd creates a list of the files to be
verified, this list contains normally all the files from the manifests
from bundles installed in the system. When the --file flag is used, this
list contains only the file specified in the flag or the directory and
files included in that directory if a directory is specified. If nothing
trakced was found using the given path, then swupd was considering
nothing else needed to be done and was exiting. This commit changes this
behavior so if there are no tracked files, we still look for extra,
untracked files before exiting.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 09:32:28 -07:00
Castulo Martinez 5e3164523d Testlib: function to add os-core-update to an env
For some tests is useful to have a minimal version of the os-core-update
bundle since some system files are tracked there.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 09:32:28 -07:00
Castulo Martinez be0fa3c69f Bug_fix: don't consider partial match with --file
When running a diagnose/repair using the --file flag, swupd was
considering partial matches, for example "--file /ba" would match
"/bar", "/baz", "/bat", etc. This commit changes it so it only matches
full matches. Foe example: "/bar" will only match "/bar",
"/bar/file", but won't match "/barbar".

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 09:32:28 -07:00
Castulo Martinez 77b499cd0b Adding a --3rd-party flag to update
This commit adds a flag that can be used to update content from
3rd-party repositories after updating the regular content if
successfull.

Closes #1473

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 08:14:45 -07:00
Castulo Martinez a7ed2cbce0 Bug_fix: In closing steps in multi-repo ops
Multi-repo operations can run in one or multiple repos, so that needs to
be taken in consideration when opening and closing progress steps.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-22 10:46:59 -07:00
Castulo Martinez 1a13a29e14 Updating list to run clr-boot-manager
This commit adds the following files to trigger the execution of
clr-boot-manager:
- /usr/bin/clr-boot-manager
- /usr/share/syslinux/ldlinux.c32

Closes #1415

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-22 09:37:59 -07:00
Otavio Pontes b7d9de6ae5 tests: Adding more attribute changes to test
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-21 11:33:41 -07:00
Castulo Martinez 1e3cb68979 API: output for mirror
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd mirror

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-20 10:52:14 -07:00
Castulo Martinez dbe702ca03 API: output for 3rd-party add, remove, list
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd 3rd-party add
- swupd 3rd-party remove
- swupd 3rd-party list

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-20 09:51:22 -07:00
Otavio Pontes 64d8222e4e test: Rebalance weights
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-17 18:44:18 -07:00
Otavio Pontes 4a711d2821 test: Add test to install files with unusual characters
Make sure files with unsual characters are successfully installed. Most
characters used in test are filtered by mixer, but there's no reason to
not support them in swupd

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-17 15:20:10 -07:00
Castulo Martinez 5b2773455f API: output for hashdump
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd hashdump

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-17 12:21:40 -07:00
Castulo Martinez 5b69e4585c API: output for [3rd-party] clean
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd clean
- swupd 3rd-party clean

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-17 11:43:32 -07:00
Castulo Martinez 194d54544e API: output for os-install
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd os-install

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-17 10:39:26 -07:00
Castulo Martinez 4f852953d0 API: output for [3rd-party] repair
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd repair
- swupd 3rd-party repair

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-17 10:37:26 -07:00
Otavio Pontes c5435de83f test: Add test to check if file attrs are preserved on updates
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-16 13:52:29 -07:00
Otavio Pontes 669dfe09cf test: Preserve attributes on copy
When creating the fullfile and installing the bundle in targetfs we
need to preserve the owner and mode of file

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-16 13:52:29 -07:00
Otavio Pontes 9edb70023c 3rd-party: xdg env variable has a wrong name
XDG_CONFIG_DIRS variable was added with an incorrect name. XDG_CONF_DIRS was used instead.
Fixing that.

Fix #1443

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-16 13:25:04 -07:00
Castulo Martinez 056137fd4a Fixing progress type on diagnosing extra files
When dealing with extra files during a "verify" action, we cannot really
tell how far in the process we are, so we should be defining that step
as PROGRESS_UNDEFINED. Since we are using a PROGRESS_BAR, it is causing
to show an extra "[100%]" at the end of the diagnose process.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-16 12:54:45 -07:00
Castulo Martinez 53878d8317 API: output for [3rd-party] diagnose
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd diagnose
- swupd 3rd-party diagnose

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-15 16:15:28 -07:00
Castulo Martinez bc58b8bb48 API: output for search-file
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd search-file

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-15 15:35:00 -07:00
Castulo Martinez 532d5743ca API: output for [3rd-party] bundle-info
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-info
- swupd 3rd-party bundle-info

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-15 08:47:57 -07:00
Castulo Martinez b686c07719 API: output for [3rd-party] bundle-list
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-list
- swupd 3rd-party bundle-list

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-14 08:55:59 -07:00
Castulo Martinez 7c5c6417d0 Testlib: fix bug regenerating hashes in MoM
When a MoM contains an experimental bundle and the hashes in the MoM are
regenerated, the experimental bundles are being skipped. This commit
fixes that issue.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-13 15:29:46 -07:00
Castulo Martinez e77c270ad8 Show status for all bundles with --status
When listing bundles using "swupd bundle-list --status" we were
distinguishing bundles that were explicitly installed, by marking them
as such and since bundle-list shows only bundles tha are installed, bundles
that were not marked as explicitelly installed were assumed to be
just installed.

When we use "bundle-list --all --status" (which shows installed and
uninstalled bundles), we were marking files as "installed", "explicitly
installed" and bundles without any of these distinctions were assumed to
be not installed. This could cause confusion.

This PR changes the "bundle-list --status" so we always label bundles
as either "implicitly installed" or "installed" (even though it couls
sound a little redundant) so it is consistent with the way they are
labeled during "bundle-list --all --status".

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-13 10:17:24 -07:00
Castulo Martinez 14ba906dd1 Testlib: including os-core in test bundles
When creating test bundles, we are not including os-core in them by
default. This is how it works in production so we should do it so it
resembles the real production environment more accurately.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-13 10:16:17 -07:00
Castulo Martinez faf2d994fb API: output for [3rd-party] bundle-add
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-add
- swupd 3rd-party bundle-add

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 16:44:34 -07:00