Cross-browser file naming consistency, in spite of version numbering incompatibilities.

This commit is contained in:
hackademix 2021-07-21 23:49:48 +02:00
parent 2c08b0acbe
commit 5ba7f783f4
1 changed files with 11 additions and 7 deletions

View File

@ -15,7 +15,7 @@ strip_rc_ver() {
if [[ "$2" == "rel" ]]; then if [[ "$2" == "rel" ]]; then
replace='s/("version":.*)rc\d+/$1/' replace='s/("version":.*)rc\d+/$1/'
else else
replace='s/("version":.*)(\d+)rc(\d+)/{$1 . ($2 == "0" ? "0" : ($2-1) . ".9" . sprintf("%03d", $3))}/e' replace='s/("version":.*?)(\d+)rc(\d+)/{$1 . ($2 == "0" ? "0" : ($2-1) . ".9" . sprintf("%03d", $3))}/e'
fi fi
perl -pi.bak -e "$replace" "$MANIFEST" && rm -f "$MANIFEST".bak perl -pi.bak -e "$replace" "$MANIFEST" && rm -f "$MANIFEST".bak
} }
@ -110,11 +110,14 @@ if ! grep '"id":' "$MANIFEST_OUT" >/dev/null; then
fi fi
if [ "$1" != "debug" ]; then if [ "$1" != "debug" ]; then
DBG=""
for file in "$SRC"/content/*.js; do for file in "$SRC"/content/*.js; do
if grep -P '\/\/\s(REL|DEV)_ONLY' "$file" >/dev/null; then if grep -P '\/\/\s(REL|DEV)_ONLY' "$file" >/dev/null; then
sed -re 's/\s*\/\/\s*(\S.*)\s*\/\/\s*REL_ONLY.*/\1/' -e 's/.*\/\/\s*DEV_ONLY.*//' "$file" > "$BUILD/content/$(basename "$file")" sed -re 's/\s*\/\/\s*(\S.*)\s*\/\/\s*REL_ONLY.*/\1/' -e 's/.*\/\/\s*DEV_ONLY.*//' "$file" > "$BUILD/content/$(basename "$file")"
fi fi
done done
else
DBG="-dbg"
fi fi
echo "Creating $XPI.xpi..." echo "Creating $XPI.xpi..."
@ -145,11 +148,11 @@ elif [ -f "$XPI.zip" ]; then
echo "A signed $XPI.xpi already exists, not overwriting." echo "A signed $XPI.xpi already exists, not overwriting."
else else
[[ "$VER" == *rc* ]] && xpicmd="mv" || xpicmd="cp" [[ "$VER" == *rc* ]] && xpicmd="mv" || xpicmd="cp"
$xpicmd "$XPI.zip" "$XPI.xpi" $xpicmd "$XPI.zip" "$XPI$DBG.xpi"
echo "Created $XPI.xpi" echo "Created $XPI$DBG.xpi"
fi fi
else else
echo >&2 "ERROR: Could not create $XPI.xpi!" echo >&2 "ERROR: Could not create $XPI$DBG.xpi!"
exit 3 exit 3
fi fi
ln -fs $XPI.xpi "$BASE/latest.xpi" ln -fs $XPI.xpi "$BASE/latest.xpi"
@ -181,14 +184,15 @@ fi
"$MANIFEST_OUT".tmp && \ "$MANIFEST_OUT".tmp && \
mv "$MANIFEST_OUT.tmp" "$MANIFEST_OUT" mv "$MANIFEST_OUT.tmp" "$MANIFEST_OUT"
build CHROME_ZIP=$(build | grep 'ready: .*\.zip' | sed -re 's/.* ready: //')
if [ -f "$XPI.zip" ]; then if [ -f "$CHROME_ZIP" ]; then
mv "$XPI.zip" "$XPI-edge.zip" mv "$CHROME_ZIP" "$XPI$DBG-edge.zip"
# remove Edge-specific manifest lines and package for generic Chromium # remove Edge-specific manifest lines and package for generic Chromium
grep -v '"update_url":' "$MANIFEST_OUT" > "$MANIFEST_OUT.tmp" && \ grep -v '"update_url":' "$MANIFEST_OUT" > "$MANIFEST_OUT.tmp" && \
mv "$MANIFEST_OUT.tmp" "$MANIFEST_OUT" && \ mv "$MANIFEST_OUT.tmp" "$MANIFEST_OUT" && \
build build
mv "$CHROME_ZIP" "$XPI$DBG-chrome.zip"
fi fi
mv "$BUILD" "$CHROMIUM_UNPACKED" mv "$BUILD" "$CHROMIUM_UNPACKED"