mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-03 15:29:29 +00:00
Allow bundle-add to fallback to full files
Instead of requiring a pack is used for bundle-add, allow the use of verify_fix_path when staging fails to: download, verify and stage the item using the full file. Correct output of tests where the 'required' wording was removed.
This commit is contained in:
committed by
Patrick McCarty
parent
bc45fa6ca9
commit
080d805727
@@ -146,6 +146,7 @@ dist_check_SCRIPTS = \
|
||||
test/functional/bundleadd/add-multiple/test.bats \
|
||||
test/functional/bundleadd/boot-file/test.bats \
|
||||
test/functional/bundleadd/include/test.bats \
|
||||
test/functional/bundleadd/fix-missing-file/test.bats \
|
||||
test/functional/bundleadd/list/test.bats \
|
||||
test/functional/bundleadd/verify-fix-path/test.bats \
|
||||
test/functional/bundleremove/boot-file/test.bats \
|
||||
|
||||
+24
-11
@@ -433,12 +433,8 @@ int install_bundles(struct list *bundles, int current_version, struct manifest *
|
||||
|
||||
(void)rm_staging_dir_contents("download");
|
||||
|
||||
printf("Downloading required packs...\n");
|
||||
ret = download_subscribed_packs(true);
|
||||
if (ret != 0) {
|
||||
printf("pack downloads failed, cannot proceed with the installation, exiting.\n");
|
||||
goto out;
|
||||
}
|
||||
printf("Downloading packs...\n");
|
||||
(void)download_subscribed_packs(true);
|
||||
|
||||
/* step 3: Add tracked bundles */
|
||||
read_subscriptions_alt();
|
||||
@@ -466,15 +462,32 @@ int install_bundles(struct list *bundles, int current_version, struct manifest *
|
||||
}
|
||||
|
||||
ret = do_staging(file, mom);
|
||||
if (ret == 0) {
|
||||
rename_staged_file_to_final(file);
|
||||
} else {
|
||||
printf("Failed to stage file: %s (ret = %d). Aborting bundle-add\n",
|
||||
file->filename, ret);
|
||||
if (ret) {
|
||||
ret = verify_fix_path(file->filename, mom);
|
||||
}
|
||||
if (ret) {
|
||||
ret = EBUNDLE_INSTALL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
iter = list_head(to_install_files);
|
||||
while (iter) {
|
||||
file = iter->data;
|
||||
iter = iter->next;
|
||||
|
||||
if (file->is_deleted || file->do_not_update || ignore(file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* This was staged by verify_fix_path */
|
||||
if (!file->staging) {
|
||||
file = search_file_in_manifest(mom, file->filename);
|
||||
}
|
||||
|
||||
rename_staged_file_to_final(file);
|
||||
}
|
||||
|
||||
sync();
|
||||
|
||||
/* step 5: Run any scripts that are needed to complete update */
|
||||
|
||||
@@ -26,7 +26,7 @@ teardown() {
|
||||
|
||||
echo "$output"
|
||||
[ "${lines[2]}" = "Attempting to download version string to memory" ]
|
||||
[ "${lines[3]}" = "Downloading required packs..." ]
|
||||
[ "${lines[3]}" = "Downloading packs..." ]
|
||||
[ "${lines[4]}" = "Downloading test-bundle pack for version 10" ]
|
||||
[ "${lines[5]}" = "Extracting pack." ]
|
||||
[ "${lines[6]}" = "Installing bundle(s) files..." ]
|
||||
|
||||
@@ -32,7 +32,7 @@ teardown() {
|
||||
|
||||
echo "$output"
|
||||
[ "${lines[2]}" = "Attempting to download version string to memory" ]
|
||||
[ "${lines[3]}" = "Downloading required packs..." ]
|
||||
[ "${lines[3]}" = "Downloading packs..." ]
|
||||
[ "${lines[4]}" = "Downloading test-bundle1 pack for version 10" ]
|
||||
[ "${lines[5]}" = "Extracting pack." ]
|
||||
[ "${lines[6]}" = "Downloading test-bundle2 pack for version 10" ]
|
||||
|
||||
@@ -26,7 +26,7 @@ teardown() {
|
||||
|
||||
echo "$output"
|
||||
[ "${lines[2]}" = "Attempting to download version string to memory" ]
|
||||
[ "${lines[3]}" = "Downloading required packs..." ]
|
||||
[ "${lines[3]}" = "Downloading packs..." ]
|
||||
[ "${lines[4]}" = "Downloading test-bundle pack for version 10" ]
|
||||
[ "${lines[5]}" = "Extracting pack." ]
|
||||
[ "${lines[6]}" = "Installing bundle(s) files..." ]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
NAME="Clear Linux Software for Intel Architecture"
|
||||
VERSION=1
|
||||
ID=clear-linux-os
|
||||
VERSION_ID=10
|
||||
PRETTY_NAME="Clear Linux Software for Intel Architecture"
|
||||
ANSI_COLOR="1;35"
|
||||
HOME_URL="https://clearlinux.org"
|
||||
SUPPORT_URL="https://clearlinux.org"
|
||||
BUG_REPORT_URL="https://bugs.clearlinux.org/jira"
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load "../../swupdlib"
|
||||
|
||||
t1_hash="e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3"
|
||||
|
||||
setup() {
|
||||
clean_test_dir
|
||||
tar -C "$DIR/web-dir/10" -cf "$DIR/web-dir/10/Manifest.MoM.tar" Manifest.MoM Manifest.MoM.signed
|
||||
tar -C "$DIR/web-dir/10" -cf "$DIR/web-dir/10/Manifest.os-core.tar" Manifest.os-core Manifest.os-core.signed
|
||||
tar -C "$DIR/web-dir/10" -cf "$DIR/web-dir/10/Manifest.test-bundle.tar" Manifest.test-bundle Manifest.test-bundle.signed
|
||||
sudo chown root:root "$DIR/web-dir/10/files/$t1_hash"
|
||||
tar -C "$DIR/web-dir/10/files" -cf "$DIR/web-dir/10/files/$t1_hash.tar" $t1_hash --exclude=$t1_hash/*
|
||||
}
|
||||
|
||||
teardown() {
|
||||
pushd "$DIR/web-dir/10"
|
||||
rm *.tar
|
||||
popd
|
||||
pushd "$DIR/web-dir/10/files"
|
||||
rm *.tar
|
||||
popd
|
||||
sudo chown $(ls -l "$DIR/test.bats" | awk '{ print $3 ":" $4 }') "$DIR/web-dir/10/files/$t1_hash"
|
||||
sudo rm "$DIR/target-dir/foo"
|
||||
}
|
||||
|
||||
@test "bundle-add verify_fix_path support" {
|
||||
run sudo sh -c "$SWUPD bundle-add $SWUPD_OPTS test-bundle"
|
||||
|
||||
echo "$output"
|
||||
[ "${lines[2]}" = "Attempting to download version string to memory" ]
|
||||
[ "${lines[3]}" = "Downloading packs..." ]
|
||||
[ "${lines[4]}" = "Downloading test-bundle pack for version 10" ]
|
||||
[ "${lines[5]}" = "Installing bundle(s) files..." ]
|
||||
[ "${lines[6]}" = "Path /foo is missing on the file system" ]
|
||||
[ "${lines[10]}" = "Bundle(s) installation done." ]
|
||||
[ -f "$DIR/target-dir/foo" ]
|
||||
}
|
||||
|
||||
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80
|
||||
@@ -0,0 +1,9 @@
|
||||
MANIFEST 3
|
||||
version: 10
|
||||
previous: 0
|
||||
filecount: 1
|
||||
timestamp: 1451940175
|
||||
contentsize: 13805671819
|
||||
|
||||
M... 6259043bcbac93ffff65097ec52ba0e8658e8b2b7cdb99bd2939d639ee23209e 10 os-core
|
||||
M... 0259043bcbac93ffff65097ec52ba0e8658e8b2b7cdb99bd2939d639ee23209e 10 test-bundle
|
||||
@@ -0,0 +1,3 @@
|
||||
-----BEGIN PKCS7-----
|
||||
Empty
|
||||
-----END PKCS7-----
|
||||
@@ -0,0 +1,8 @@
|
||||
MANIFEST 3
|
||||
version: 10
|
||||
previous: 0
|
||||
filecount: 1
|
||||
timestamp: 1451936779
|
||||
contentsize: 17929151
|
||||
|
||||
D... cde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr
|
||||
@@ -0,0 +1,3 @@
|
||||
-----BEGIN PKCS7-----
|
||||
Empty
|
||||
-----END PKCS7-----
|
||||
@@ -0,0 +1,9 @@
|
||||
MANIFEST 3
|
||||
version: 10
|
||||
previous: 0
|
||||
filecount: 1
|
||||
timestamp: 1451936779
|
||||
contentsize: 17929151
|
||||
includes: os-core
|
||||
|
||||
F... e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 10 /foo
|
||||
@@ -0,0 +1,3 @@
|
||||
-----BEGIN PKCS7-----
|
||||
Empty
|
||||
-----END PKCS7-----
|
||||
+1
@@ -0,0 +1 @@
|
||||
test boot file
|
||||
@@ -0,0 +1 @@
|
||||
10
|
||||
@@ -31,7 +31,7 @@ teardown() {
|
||||
|
||||
echo "$output"
|
||||
[ "${lines[2]}" = "Attempting to download version string to memory" ]
|
||||
[ "${lines[3]}" = "Downloading required packs..." ]
|
||||
[ "${lines[3]}" = "Downloading packs..." ]
|
||||
[ "${lines[4]}" = "Downloading test-bundle pack for version 10" ]
|
||||
[ "${lines[5]}" = "Extracting pack." ]
|
||||
[ "${lines[6]}" = "Downloading os-core pack for version 10" ]
|
||||
|
||||
@@ -37,7 +37,7 @@ teardown() {
|
||||
|
||||
echo "$output"
|
||||
[ "${lines[2]}" = "Attempting to download version string to memory" ]
|
||||
[ "${lines[3]}" = "Downloading required packs..." ]
|
||||
[ "${lines[3]}" = "Downloading packs..." ]
|
||||
[ "${lines[4]}" = "Downloading test-bundle pack for version 10" ]
|
||||
[ "${lines[5]}" = "Extracting pack." ]
|
||||
[ "${lines[6]}" = "Installing bundle(s) files..." ]
|
||||
|
||||
Reference in New Issue
Block a user