Issue #1859 - Part 4: Update mar file generation scripts for use of xz.

- Update packaging scripts to support both lzma and bzip2
- Update python script to support lzma
- Update test scripts to support lzma to be thorough

This all requires xz to be available in the path on the build system.
This commit is contained in:
Moonchild 2022-01-21 22:22:07 +00:00 committed by roytam1
commit 121d56e082
9 changed files with 163 additions and 78 deletions

View file

@ -169,7 +169,11 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
if check_for_add_if_not_update "$f"; then
# The full workdir may not exist yet, so create it if necessary.
mkdir -p `dirname "$workdir/$f"`
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
if [[ -n $MAR_OLD_FORMAT ]]; then
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
else
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
fi
copy_perm "$newdir/$f" "$workdir/$f"
make_add_if_not_instruction "$f" "$updatemanifestv3"
archivefiles="$archivefiles \"$f\""
@ -179,7 +183,11 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
if check_for_forced_update "$requested_forced_updates" "$f"; then
# The full workdir may not exist yet, so create it if necessary.
mkdir -p `dirname "$workdir/$f"`
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
if [[ -n $MAR_OLD_FORMAT ]]; then
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
else
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
fi
copy_perm "$newdir/$f" "$workdir/$f"
make_add_instruction "$f" "$updatemanifestv2" "$updatemanifestv3" 1
archivefiles="$archivefiles \"$f\""
@ -207,21 +215,44 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
# if service is not enabled then default to old behavior
if [ -z "$MBSDIFF_HOOK" ]; then
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
$BZIP2 -z9 "$workdir/$f.patch"
if [[ -n $MAR_OLD_FORMAT ]]; then
$BZIP2 -z9 "$workdir/$f.patch"
else
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
fi
else
# if service enabled then check patch existence for retrieval
if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"; then
notice "file \"$f\" found in funsize, diffing skipped"
if [[ -n $MAR_OLD_FORMAT ]]; then
if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"; then
notice "file \"$f\" found in funsize, diffing skipped"
else
# if not found already - compute it and cache it for future use
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
$BZIP2 -z9 "$workdir/$f.patch"
$MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"
fi
else
# if not found already - compute it and cache it for future use
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
$BZIP2 -z9 "$workdir/$f.patch"
$MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"
if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.xz"; then
notice "file \"$f\" found in funsize, diffing skipped"
else
# if not found already - compute it and cache it for future use
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
$MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.xz"
fi
fi
fi
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
if [[ -n $MAR_OLD_FORMAT ]]; then
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
else
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
fi
copy_perm "$newdir/$f" "$workdir/$f"
patchfile="$workdir/$f.patch.bz2"
if [[ -n $MAR_OLD_FORMAT ]]; then
patchfile="$workdir/$f.patch.bz2"
else
patchfile="$workdir/$f.patch.xz"
fi
patchsize=$(get_file_size "$patchfile")
fullsize=$(get_file_size "$workdir/$f")
@ -262,7 +293,11 @@ for ((i=0; $i<$num_newfiles; i=$i+1)); do
dir=$(dirname "$workdir/$f")
mkdir -p "$dir"
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
if [[ -n $MAR_OLD_FORMAT ]]; then
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
else
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
fi
copy_perm "$newdir/$f" "$workdir/$f"
if check_for_add_if_not_update "$f"; then
@ -303,8 +338,13 @@ for ((i=0; $i<$num_olddirs; i=$i+1)); do
fi
done
$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
$BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
if [[ -n $MAR_OLD_FORMAT ]]; then
$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
$BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
else
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv2" && mv -f "$updatemanifestv2.xz" "$updatemanifestv2"
$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
fi
mar_command="$MAR"
if [[ -n $MOZ_PRODUCT_VERSION ]]