mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-03 15:29:29 +00:00
Testlib: Dirs added in updates should be in packs
When creating an update that adds a directory, the dir is added to the delta pack to update from the previous version, but the new dir should be in fact in all the delta packs previous to that one as well so a user could use a delta pack to update from any previous version to the latest one. Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit is contained in:
committed by
Otavio Pontes
parent
35aca608ce
commit
167b25442b
@@ -322,7 +322,6 @@ copy_manifest() {
|
||||
local bundle_file
|
||||
local file_tar
|
||||
local format
|
||||
local prev_ver
|
||||
|
||||
from_path="$env_name"/web-dir/"$from_version"
|
||||
to_path="$env_name"/web-dir/"$to_version"
|
||||
@@ -1364,12 +1363,18 @@ create_version() { # swupd_function
|
||||
# if the previous version is 0 then create a new MoM, otherwise copy the MoM
|
||||
# from the previous version
|
||||
if [ "$from_version" = 0 ]; then
|
||||
|
||||
mom=$(create_manifest "$env_name"/web-dir/"$version" MoM)
|
||||
if [ "$partial" = false ]; then
|
||||
create_tar "$mom"
|
||||
sign_manifest "$mom"
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# copy the packs from the previous version
|
||||
sudo cp "$env_name"/web-dir/"$from_version"/pack-*.tar "$env_name"/web-dir/"$version"
|
||||
|
||||
sudo cp "$env_name"/web-dir/"$from_version"/Manifest.MoM "$env_name"/web-dir/"$version"
|
||||
mom="$env_name"/web-dir/"$version"/Manifest.MoM
|
||||
# update MoM info and create the tars
|
||||
@@ -1403,8 +1408,6 @@ create_version() { # swupd_function
|
||||
fi
|
||||
fi
|
||||
|
||||
# copy the packs from the previous version
|
||||
sudo cp "$env_name"/web-dir/"$from_version"/pack-*.tar "$env_name"/web-dir/"$version"
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -2547,9 +2550,28 @@ update_bundle() { # swupd_function
|
||||
add_to_manifest -p "$bundle_manifest" "$new_dir" "$fdir"
|
||||
fi
|
||||
done
|
||||
# Add the dir to the delta-pack
|
||||
add_to_pack "$bundle" "$new_dir"
|
||||
add_to_pack "$bundle" "$new_dir" "$oldversion"
|
||||
|
||||
# since directories usually have the same hash, add it to
|
||||
# the zero pack only if it doesn't already have one
|
||||
if ! tar -tf "$version_path"/pack-"$bundle"-from-0.tar | grep -q "${new_dir##*/}"; then
|
||||
add_to_pack "$bundle" "$new_dir"
|
||||
fi
|
||||
|
||||
# Add the dir to all previous delta-packs if not already there
|
||||
pre_ver="$version"
|
||||
while [ "$pre_ver" -ge 0 ]; do
|
||||
pre_ver=$(get_manifest_previous_version "$env_name" MoM "$pre_ver")
|
||||
if [ "$pre_ver" -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
if [ -e "$version_path"/pack-"$bundle"-from-"$pre_ver".tar ]; then
|
||||
if tar -tf "$version_path"/pack-"$bundle"-from-"$pre_ver".tar | grep -q "${new_dir##*/}"; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
add_to_pack "$bundle" "$new_dir" "$pre_ver"
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
contentsize=$(awk '/^contentsize/ { print $2 }' "$bundle_manifest")
|
||||
|
||||
Reference in New Issue
Block a user