Commit 933a013d authored by nanahira's avatar nanahira

add code conflict check

parent f8b69380
Pipeline #33699 failed with stages
in 51 seconds
......@@ -12,6 +12,8 @@ echo '# Auto generated by ygopro-custom-free' > dist/strings.conf
CURRENT_TIME=$(date +%s)
declare -A used_codes
something_changed=0
process_repo() {
repo_url="$1"
......@@ -66,13 +68,16 @@ process_repo() {
echo "No changes detected in $repo_identifer: $last_commit_hash"
fi
echo "Searching codes in $repo_identifer"
ls -1 workspace/$repo_identifer/*.cdb | xargs -I '{}' sqlite3 '{}' 'select id from datas where type != 0x11 and (type & 0x4000) = 0;' > "workspace/$repo_identifer-codes.txt"
echo "Checking for redtexts in $repo_identifer"
cd "$YGOPRO_SERVER_PATH"
rm expansions || rmdir expansions || true
ln -sf "$current_path/workspace/$repo_identifer" expansions
ls -1 $current_path/workspace/$repo_identifer/*.cdb | xargs -I '{}' sqlite3 '{}' 'select id from datas where type != 0x11 and (type & 0x4000) = 0;' | xargs -I '{}' ./ygopro '{}' 2>&1 | tee "$current_path/dist/redtexts/$repo_identifer.txt"
cat "$current_path/workspace/$repo_identifer-codes.txt" | xargs -I '{}' ./ygopro '{}' 2>&1 | tee "$current_path/dist/redtexts/$repo_identifer.txt"
cd "$current_path"
redtext_line_count=$(wc -l dist/redtexts/$repo_identifer.txt | cut -d' ' -f1)
......@@ -85,6 +90,21 @@ process_repo() {
fi
rm dist/redtexts/$repo_identifer.txt
echo "Checking for used codes in $repo_identifer"
# add the codes to the used_codes array
while read -r code; do
if [ -z "$code" ]; then
continue
fi
if [ -n "${used_codes[$code]}" ]; then
echo "Code $code in $repo_url is already used in ${used_codes[$code]}"
echo "CODE CONFLICT: [$code] in ${used_codes[$code]} vs $repo_url" >> dist/warnings.txt
else
used_codes[$code]="$repo_url"
fi
done < "workspace/$repo_identifer-codes.txt"
echo "Copying $repo_identifer to dist/$repo_identifer"
ls -1 workspace/$repo_identifer/*.cdb | xargs -I '{}' sqlite3 '{}' .dump | sqlite3 dist/custom-free.cdb || true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment