Skip to content

Commit

Permalink
Redirect URL override messages to STDERR
Browse files Browse the repository at this point in the history
Previously, these messages were printed to STDOUT:
Overriding version and content URLs with...
Overriding content URL with...
Overriding version URL with...

But especially with --quiet, the output to STDOUT should be strictly the
requested data. So print these as warnings instead.
  • Loading branch information
bwarden committed Aug 26, 2024
1 parent 6e02330 commit 8742b3a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/swupd_lib/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static bool global_parse_opt(int opt, char *optarg)
}
return true;
case 'u':
print("Overriding version and content URLs with %s\n", optarg);
warn("Overriding version and content URLs with %s\n", optarg);
set_version_url(optarg);
set_content_url(optarg);
return true;
Expand All @@ -563,11 +563,11 @@ static bool global_parse_opt(int opt, char *optarg)
}
return true;
case 'c':
print("Overriding content URL with %s\n", optarg);
warn("Overriding content URL with %s\n", optarg);
set_content_url(optarg);
return true;
case 'v':
print("Overriding version URL with %s\n", optarg);
warn("Overriding version URL with %s\n", optarg);
set_version_url(optarg);
return true;
case 'F':
Expand Down
6 changes: 3 additions & 3 deletions test/functional/mirror/mirror-set-unset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ teardown_file() {
run sudo sh -c "$SWUPD mirror --set -u https://example.com/swupd-file $SWUPD_OPTS"
assert_status_is 0
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://example.com/swupd-file
Warning: Overriding version and content URLs with https://example.com/swupd-file
Mirror url set
Distribution: Swupd Test Distro
Installed version: 10
Expand Down Expand Up @@ -108,7 +108,7 @@ teardown_file() {
run sudo sh -c "$SWUPD mirror --set -c https://example.com/swupd-file $SWUPD_OPTS"
assert_status_is 0
expected_output=$(cat <<-EOM
Overriding content URL with https://example.com/swupd-file
Warning: Overriding content URL with https://example.com/swupd-file
Mirror url set
Distribution: Swupd Test Distro
Installed version: 10
Expand Down Expand Up @@ -142,7 +142,7 @@ teardown_file() {
run sudo sh -c "$SWUPD mirror --set -v https://example.com/swupd-file $SWUPD_OPTS"
assert_status_is 0
expected_output=$(cat <<-EOM
Overriding version URL with https://example.com/swupd-file
Warning: Overriding version URL with https://example.com/swupd-file
Mirror url set
Distribution: Swupd Test Distro
Installed version: 10
Expand Down
10 changes: 5 additions & 5 deletions test/functional/os-install/install-statedir-cache-offline.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_setup() {

assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://localhost
Warning: Overriding version and content URLs with https://localhost
Installing OS version 10
Downloading missing manifests...
No packs need to be downloaded
Expand Down Expand Up @@ -63,7 +63,7 @@ test_setup() {

assert_status_is "$SWUPD_COULDNT_LOAD_MANIFEST"
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://localhost
Warning: Overriding version and content URLs with https://localhost
Installing OS version 10
Downloading missing manifests...
Error: Failed to connect to update server: https://localhost/10/Manifest.os-core.tar
Expand Down Expand Up @@ -92,7 +92,7 @@ test_setup() {

assert_status_is "$SWUPD_COULDNT_LOAD_MOM"
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://localhost
Warning: Overriding version and content URLs with https://localhost
Installing OS version 10
Error: Failed to connect to update server: https://localhost/10/Manifest.MoM.sig
Possible solutions for this problem are:
Expand Down Expand Up @@ -121,7 +121,7 @@ test_setup() {

assert_status_is "$SWUPD_COULDNT_DOWNLOAD_FILE"
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://localhost
Warning: Overriding version and content URLs with https://localhost
Installing OS version 10
Downloading missing manifests...
No packs need to be downloaded
Expand Down Expand Up @@ -153,7 +153,7 @@ test_setup() {

assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://localhost
Warning: Overriding version and content URLs with https://localhost
Installing OS version 10
Downloading missing manifests...
Error: Failed to connect to update server: https://localhost/10/pack-os-core-from-0.tar
Expand Down
4 changes: 2 additions & 2 deletions test/functional/usability/usa-config-file.bats
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ test_setup() {
run sudo sh -c "$SWUPD info $SWUPD_OPTS -v https://anotherurl.com"
assert_status_is "$SWUPD_OK"
expected_output=$(cat <<-EOM
Overriding version and content URLs with https://someurl.com
Overriding version URL with https://anotherurl.com
Warning: Overriding version and content URLs with https://someurl.com
Warning: Overriding version URL with https://anotherurl.com
Distribution: Swupd Test Distro
Installed version: 10
Version URL: https://anotherurl.com
Expand Down

0 comments on commit 8742b3a

Please sign in to comment.