1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
|
#!/bin/bash
#
# release-checks.sh - sanity checking for release readiness
#
# ScummVM is the legal property of its developers, whose names
# are too numerous to list here. Please refer to the COPYRIGHT
# file distributed with this source distribution.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
TMP=release-check.tmp
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m'
echo_n() {
printf "$@"
}
echoOk() {
echo -e "${GREEN}ok${NC}"
totalChecks=$((totalChecks+1))
}
failPlus() {
failedChecks=$((failedChecks+1))
totalChecks=$((totalChecks+1))
}
if [ ! -d ../scummvm-icons ]; then
echo scummvm-icons repo is missing
echo -e "${RED}Run cd ..; git clone https://github.com/scummvm/scummvm-icons.git${NC}"
exit 1
fi
if [ ! -d ../scummvm-shaders ]; then
echo scummvm-shaders repo is missing
echo -e "${RED}Run cd ..; git clone https://github.com/scummvm/scummvm-shaders.git${NC}"
exit 1
fi
oldpwd=`pwd`
failedChecks=0
totalChecks=0
echo_n "Updating scummvm-icons..."
cd ../scummvm-icons
git pull --rebase >/dev/null
echoOk
echo_n "Updating scummvm-shaders..."
cd ../scummvm-shaders
git pull --rebase >/dev/null
echoOk
cd "$oldpwd"
###########
# Icons
###########
echo_n "Checking default icons pack..."
fileDate=`git log -1 gui/themes/gui-icons.dat | grep Date | sed 's/Date: //'`
cd ../scummvm-icons
num_lines=`git -P log --oneline "--since=$fileDate" default/ | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Repack gui/themes/gui-icons.dat${NC}"
failPlus
else
echoOk
fi
echo_n "Checking icon packs..."
cd ../scummvm-icons
last_md5=`tail -1 LIST|awk -F, '{ print $3 }'`
num_lines=`git log --oneline ${last_md5}.. | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'gen-set.py' in ../scummvm-icons${NC}"
failPlus
else
echoOk
fi
cd "$oldpwd"
###########
# Shaders
###########
echo_n "Checking default shaders pack..."
fileDate=`git log -1 gui/themes/shaders.dat | grep Date | sed 's/Date: //'`
cd ../scummvm-shaders
num_lines=`git -P log --oneline "--since=$fileDate" base/ | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Repack gui/themes/shaders.dat${NC}"
failPlus
else
echoOk
fi
echo_n "Checking shader packs..."
cd ../scummvm-shaders
last_md5=`tail -1 LIST-SHADERS|awk -F, '{ print $3 }'`
num_lines=`git log --oneline ${last_md5}.. | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'gen-shaders.py' in ../scummvm-shaders${NC}"
failPlus
else
echoOk
fi
cd "$oldpwd"
###########
# Sanity
###########
echo_n "Checking ADGF_TESTING..."
# Filter out known valid declarations
#
# as of 2022.03 they are:
# engines/advancedDetector.cpp: else if (desc->flags & ADGF_TESTING)
# engines/advancedDetector.h: ADGF_TESTING = (1u << 19), ///< Flag to designate not yet officially supported games that are fit for public testing.
# engines/ags/detection_tables.h: DETECTION_ENTRY(ID, FILENAME, MD5, SIZE, LANG, PLATFORM, nullptr, ADGF_TESTING)
git -P grep ADGF_TESTING | grep -v engines/advancedDetector. | grep -v "engines/ags/detection_tables.h:.DETECTION_ENTRY.ID," | grep -v devtools/release-checks.sh >$TMP
num_lines=`cat $TMP | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines entries. ${RED}They must be removed:${NC}"
cat $TMP
echo
failPlus
else
echoOk
fi
rm -f $TMP
echo_n "Checking ideprojects..."
if [ -f dists/codeblocks/scummvm.cbp ]; then
echoOk
else
echo -e "missing. ${RED}Run 'make ideprojects'${NC}"
failPlus
fi
###########
# Translations
###########
echo_n "Checking translations..."
fileDate=`git log -1 gui/themes/translations.dat | grep Date | sed 's/Date: //'`
num_lines=`git -P log --oneline "--since=$fileDate" po/ | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'make translations-dat'${NC}"
failPlus
else
echoOk
fi
###########
# Release Notes
###########
echo_n "Checking Release Notes..."
VERSION=`grep SCUMMVM_VERSION base/internal_version.h | awk -F\" '{ print $2 }'`
if curl -s -I https://downloads.scummvm.org/frs/scummvm/${VERSION}/ReleaseNotes | head -n 1 | grep 404 >/dev/null; then
echo -e "missing. ${RED}Upload to https://downloads.scummvm.org/frs/scummvm/${VERSION}/ReleaseNotes${NC}"
failPlus
else
echoOk
fi
echo_n "Checking Release Notes HTML..."
if curl -s -I https://downloads.scummvm.org/frs/scummvm/${VERSION}/ReleaseNotes.html | head -n 1 | grep 404 >/dev/null; then
echo -e "missing. ${RED}Upload to https://downloads.scummvm.org/frs/scummvm/${VERSION}/ReleaseNotes.html${NC}"
failPlus
else
echoOk
fi
##########
# POTFILES
##########
echo_n "Checking POTFILES duplicates..."
OLDIFS="$IFS"
IFS=$'\n' # allow arguments with tabs and spaces
# First, assemble all the files
list=`cat po/POTFILES engines/*/POTFILES | sed '/^$/d' | sort`
dupes=`uniq -c <<<"$list" | grep -v "1 "`
if [ ! -z "$dupes" ]; then
num_lines=`wc -l <<< "$dupes"`
echo -e "$num_lines dupes detected"
echo $dupes
failPlus
else
echoOk
fi
echo_n "Checking POTFILES header includes..."
headerlist=`grep \.h$ <<< "$list" | grep -v detection_ | grep -v keymapper_ | grep -v engines/gob/detection/tables`
if [ ! -z "$headerlist" ]; then
num_lines=`wc -l <<< "$headerlist"`
echo -e "$num_lines headers detected"
echo -e "${YELLOW}It is not advised to include common/translation.h in header files."
echo -e "The exception is detection_*.h and keymapper_*.h files."
echo -e "Putting this include in header could easily lead to missing POTFILES addition.${NC}"
echo "$headerlist"
failPlus
else
echoOk
fi
echo_n "Checking missing/extra POTFILES..."
# Now get list of includes
git grep -l "common/translation\.h" | grep -v devtools/create_engine | grep -v devtools/release-checks.sh | grep -v devtools/generate-android-i18n-strings.py | grep -v engines/gob/detection/tables.h | sort > $TMP
res=`diff - $TMP <<< "$list"`
if [ ! -z "$res" ]; then
echo -e "${RED}Failed.${NC}"
echo -e "${YELLOW}The diff is below. < marks extra files in POTFILES, > marks missing file in POTFILES${NC}"
echo "$res"
failPlus
else
echoOk
fi
rm -f $TMP
IFS="$OLDIFS"
##########
# Dat files
##########
echo_n "Checking engine-data files..."
cat dists/engine-data/engine_data.mk dists/engine-data/engine_data_big.mk dists/engine-data/engine_data_core.mk >dists/engine-data/engine_data_combined.mk
# Use # as delimiter, %FILE% for the filename
declare -a distfiles=(
"dists/engine-data/README#%FILE%:"
"dists/engine-data/engine_data_combined.mk#DIST_FILES_LIST \+= dists/engine-data/%FILE%"
"dists/irix/scummvm.idb#f 0644 root sys usr/ScummVM/share/scummvm/%FILE% %FILE% scummvm.sw.eoe"
)
OLDIFS="$IFS"
IFS=$'\n' # allow arguments with tabs and spaces
absentFiles=0
for f in dists/engine-data/*
do
# Skip directories
if [ -d $f ]; then
continue
fi
file=`basename $f`
# Skip README file
if [ $file == "README" -o $file == "create-playground3d-data.sh" -o $file == "create-testbed-data.sh" \
-o $file == "engine_data.mk" -o $file == "engine_data_big.mk" -o $file == "engine_data_core.mk" \
-o $file == "engine_data_combined.mk" ]; then
continue
fi
for d in "${distfiles[@]}"
do
target=`cut -d '#' -f 1 <<< "$d"`
pattern=`cut -d '#' -f 2 <<< "$d"`
res=`sed "s|%FILE%|$file|g" <<< "$pattern"`
if [ -z $(grep -E "$res" "$target" | head -1) ]; then
echo "$file is absent in $target"
absentFiles=$((absentFiles+1))
fi
done
done
rm dists/engine-data/engine_data_combined.mk
if [ "$absentFiles" -ne "0" ]; then
echo -e "$absentFiles missing files ${RED}Fix them${NC}"
failPlus
else
echoOk
fi
##########
# GUI theme files
##########
echo_n "Checking GUI theme files..."
absentFiles=0
declare -a themefiles=(
"Makefile.common#DIST_FILES_THEMES.*%FILE%"
"devtools/create_project/xcode.cpp#[ ]+files.push_back\(\"gui/themes/%FILE%\"\);"
"dists/irix/scummvm.idb#f 0644 root sys usr/ScummVM/share/scummvm/%FILE% %FILE% scummvm.sw.eoe"
"dists/scummvm.rc#%FILE%[ ]+FILE[ ]+\"gui/themes/%FILE%\""
)
for f in gui/themes/*
do
# Skip directories
if [ -d $f ]; then
continue
fi
file=`basename $f`
# Skip README file
if [ $file == "scummtheme.py" -o $file == "default.inc" ]; then
continue
fi
for d in "${themefiles[@]}"
do
target=`cut -d '#' -f 1 <<< "$d"`
pattern=`cut -d '#' -f 2 <<< "$d"`
res=`sed "s|%FILE%|$file|g" <<< "$pattern"`
if [ -z $(grep -E "$res" "$target" | head -1) ]; then
echo "$file is absent in $target"
absentFiles=$((absentFiles+1))
fi
done
done
if [ "$absentFiles" -ne "0" ]; then
echo -e "$absentFiles missing files ${RED}Fix them${NC}"
failPlus
else
echoOk
fi
##########
# LICENSE files
##########
OLDIFS="$IFS"
IFS=$'\n' # allow arguments with tabs and spaces
echo_n "Checking LICENSE files..."
absentFiles=0
declare -a licensefiles=(
"Makefile.common#DIST_FILES_DOCS.*%FILE%"
"backends/platform/maemo/debian/rules#install -m0644.*%FILE%.*debian/scummvm/usr/share/doc/scummvm"
"backends/platform/sdl/macosx/appmenu_osx.mm#openFromBundle\(@\"%FILEUNDOTTED%\"\);"
"backends/platform/sdl/win32/win32.mk#cp \\$\(srcdir\)/%FILE% \\$\(WIN32PATH\)/%FILEBASE%\.txt"
"devtools/create_project/create_project.cpp#in\.push_back\(setup.srcDir \+ \"/%FILE%\"\)"
"devtools/create_project/xcode.cpp#[ ]+files.push_back\(\"%FILE%\"\);"
"dists/irix/scummvm.idb#f 0644 root sys usr/ScummVM/%FILEBASE% %FILE% scummvm.man.readme"
"dists/redhat/scummvm.spec#%doc AUTHORS README.md.*%FILE%"
"dists/redhat/scummvm.spec.in#%doc AUTHORS README.md.*%FILE%"
"ports.mk#cp \\$\(bundle_name\)/Contents/Resources/%FILEBASE% \\$\(bundle_name\)/Contents/Resources/%FILEUNDOTTED%"
"ports.mk#mv \./ScummVM-snapshot/%FILEBASE% \./ScummVM-snapshot"
)
for f in LICENSES/*
do
file=$f
filebase=`basename $f`
fileundotted=`sed "s|\.|-|g" <<< "$filebase"`
for d in "${licensefiles[@]}"
do
if [ $filebase == "CatharonLicense.txt" -o $d == "backends/platform/sdl/win32/win32.mk" ]; then
# the file is not renamed to .txt.txt
continue
fi
target=`cut -d '#' -f 1 <<< "$d"`
pattern=`cut -d '#' -f 2 <<< "$d"`
res=`sed "s|%FILE%|$file|g;s|%FILEBASE%|$filebase|g;s|%FILEUNDOTTED%|$fileundotted|g" <<< "$pattern"`
if [ -z $(grep -E "$res" "$target" | head -1) ]; then
echo "$file is absent in $target"
absentFiles=$((absentFiles+1))
fi
done
done
if [ "$absentFiles" -ne "0" ]; then
echo -e "$absentFiles missing files ${RED}Fix them${NC}"
failPlus
else
echoOk
fi
echo_n "Checking LICENSE files contents..."
checkFailed=0
for f in LICENSES/*
do
if [ -z $(head -2 $f | grep NOTE: ) ]; then
echo "$f is missing NOTE"
checkFailed=$((checkFailed+1))
fi
done
if [ "$checkFailed" -ne "0" ]; then
echo -e "$checkFailed files malformed ${RED}Fix them${NC}"
failPlus
else
echoOk
fi
IFS="$OLDIFS"
#############################################################################
#
# Engines go here
#
#############################################################################
###########
# Bagel engine
###########
echo_n "Checking bagel.dat..."
fileDate=`git log -1 dists/engine-data/bagel.dat | grep Date | sed 's/Date: //'`
num_lines=`git -P log --oneline "--since=$fileDate" devtools/create_bagel/files | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'cd devtools/create_bagel/files; zip -r9 ../../../dists/engine-data/bagel.dat .'${NC}"
failPlus
else
echoOk
fi
###########
# MM engine
###########
echo_n "Checking mm.dat..."
fileDate=`git log -1 dists/engine-data/mm.dat | grep Date | sed 's/Date: //'`
num_lines=`git -P log --oneline "--since=$fileDate" devtools/create_mm/files | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'cd devtools/create_mm/files; zip -r9 ../../../dists/engine-data/mm.dat .'${NC}"
failPlus
else
echoOk
fi
###########
# Nancy engine
###########
echo_n "Checking nancy.dat..."
fileDate=`git log -1 dists/engine-data/nancy.dat | grep Date | sed 's/Date: //'`
num_lines=`git -P log --oneline "--since=$fileDate" devtools/create_nancy/files | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'make devtools/create_nancy;cd devtools/create_nancy;./create_nancy;cp nancy.dat ../../dists/engine-data'${NC}"
failPlus
else
echoOk
fi
###########
# Ultima engine
###########
echo_n "Checking ultima.dat..."
fileDate=`git log -1 dists/engine-data/ultima.dat | grep Date | sed 's/Date: //'`
num_lines=`git -P log --oneline "--since=$fileDate" devtools/create_ultima/files | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'cd devtools/create_ultima/files; zip -r9 ../../../dists/engine-data/ultima.dat .'${NC}"
failPlus
else
echoOk
fi
###########
# Ultima 8 engine
###########
echo_n "Checking ultima8.dat..."
fileDate=`git log -1 dists/engine-data/ultima8.dat | grep Date | sed 's/Date: //'`
num_lines=`git -P log --oneline "--since=$fileDate" devtools/create_ultima8 | wc -l`
if [ "$num_lines" -ne "0" ]; then
echo -e "$num_lines unprocessed commits. ${RED}Run 'cd devtools/create_ultima8; zip -r9 ../../dists/engine-data/ultima8.dat .'${NC}"
failPlus
else
echoOk
fi
###########
# Totals
###########
if [ "$failedChecks" -eq "0" ]; then
echo -e "${GREEN}All ok${NC}"
else
echo -e "${RED}Failed $failedChecks checks of $totalChecks"${NC}
fi
exit 0
|