From 533789470ff192e3b1a5375b25329125bccb0917 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Sat, 12 Jul 2025 12:35:59 +0900 Subject: [PATCH] Fix buildinfo.json pollution by only keeping latest versions (#579) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, update.sh would accumulate all historical versions in buildinfo.json, leading to an ever-growing file. This change modifies the script to rebuild buildinfo.json from scratch with only the current stable and experimental versions. Changes: - Replace incremental update logic with complete rebuild - Create fresh buildinfo.json containing only latest versions - Preserve all proper tags (stable, latest, version numbers, etc.) - Fix bash compatibility issue with associative arrays This ensures buildinfo.json remains clean and only contains the versions currently being built and published. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude --- buildinfo.json | 360 +------------------------------------------------ update.sh | 45 +++---- 2 files changed, 24 insertions(+), 381 deletions(-) diff --git a/buildinfo.json b/buildinfo.json index 580ca4c..8d2ee0b 100644 --- a/buildinfo.json +++ b/buildinfo.json @@ -1,368 +1,12 @@ { - "0.12.35": { - "sha256": "ab9cf01a56dde3073aaaa5152c628bbf9a5bb85638b87dc3d7fdb77fb169aedd", - "tags": [ - "0.12.35", - "0.12" - ] - }, - "0.13.20": { - "sha256": "cbf5481e4b7e0efcc07c7b6a1fc3ff1404ad5597f3c9d37914a52ffb58d7c159", - "tags": [ - "0.13.20", - "0.13" - ] - }, - "0.14.23": { - "sha256": "96c3e7acd4e0f066a499baba01823cac7c1caf0e50dbddcea5793f57bd60dc8c", - "tags": [ - "0.14.23", - "0.14" - ] - }, - "0.15.40": { - "sha256": "1041ef61ea4aecd1f425e6030a909f0c349a9c01d1b3324d84a61b1cfef5ba6c", - "tags": [ - "0.15.40", - "0.15" - ] - }, - "0.16.51": { - "sha256": "6cb09f5ac87f16f8d5b43cef26c0ae26cc46a57a0382e253dfda032dc5bb367f", - "tags": [ - "0.16.51", - "0.16" - ] - }, - "0.17.79": { - "sha256": "9ace12fa986df028dc1851bf4de2cb038044d743e98823bc1c48ba21aa4d23df", - "tags": [ - "0.17.79", - "0.17" - ] - }, - "1.0.0": { - "sha256": "81d9e1aa94435aeec4131c8869fa6e9331726bea1ea31db750b65ba42dbd1464", - "tags": [ - "1.0.0", - "1.0" - ] - }, - "1.1.110": { - "sha256": "485fe6db36e5decd7dd0d70e7c97e61f818100fa3e48d87884b287027c7a646a", - "tags": [ - "stable-1.1.110", - "1", - "1.1", - "1.1.110" - ] - }, - "2.0.13": { - "sha256": "27b36901a39e593adf28418c0286142c6c7a9f83d156963c7369bd405a25c7d1", - "tags": [ - "stable-2.0.13", - "2.0", - "2.0.13" - ] - }, - "2.0.14": { - "sha256": "5a4bc4c3b2a97ed1fc58eb796321e848dcc64435bd91013dd9c78a14a8ce8815", - "tags": [ - "stable-2.0.14", - "2.0", - "2.0.14" - ] - }, - "2.0.15": { - "sha256": "70b441cb807811a60586c01107248c1d8d7ae043bd1f23675fc924fbaaa538d8", - "tags": [ - "stable-2.0.15", - "2.0", - "2.0.15" - ] - }, - "2.0.16": { - "sha256": "f2069b4b746500d945eeb67ef7eda5e7aebe7fd0294c2af4e117af22a3bbaea3", - "tags": [ - "2.0.16" - ] - }, - "2.0.17": { - "sha256": "183407f2fb21e05152442ffb5f15ffb283994339ca6a51b3559a257c30505e5e", - "tags": [ - "2.0.17" - ] - }, - "2.0.18": { - "sha256": "f378a1dc8a545c13d8ca616cbe72d245aa3ce93e3f219d8d60d3c06c7df82dc0", - "tags": [ - "2.0.18" - ] - }, - "2.0.19": { - "sha256": "2e27aca3a7f65b50916d14a62203b6861cbe657e8d2dbd8f813e0a606efce9c7", - "tags": [ - "2.0.19" - ] - }, - "2.0.20": { - "sha256": "c4a901f2f1dbedbb41654560db4c6fab683a30c20334e805d4ef740c0416515a", - "tags": [ - "stable-2.0.20", - "2.0", - "2.0.20" - ] - }, - "2.0.21": { - "sha256": "1d6d2785006d6a8d9d5fdcdaa7097a189ec35ba95f3521025dc4e046f7a1398e", - "tags": [ - "stable-2.0.21", - "2.0", - "2.0.21" - ] - }, - "2.0.22": { - "sha256": "14c3eea7600fbe7f35bca52fe4c277e8f5e23b34c35ebebaa46c6752c750cb85", - "tags": [ - "2.0.22" - ] - }, - "2.0.23": { - "sha256": "e819fc9ad6df061bf9d4bffc91988dd18d0e3982c8b1c22c0525d78bda3ef216", - "tags": [ - "stable-2.0.23", - "2.0", - "2.0.23" - ] - }, - "2.0.24": { - "sha256": "4644acc4195391fe19a7468c546d10a494ce1a188964c79f20cb0fa050b67120", - "tags": [ - "2.0.24" - ] - }, - "2.0.25": { - "sha256": "0d1698f1f29759ff27faa6a5d9c3804377cb1767f2692003a8e9d4c294845e5a", - "tags": [ - "2.0.25" - ] - }, - "2.0.26": { - "sha256": "a401024039372a53b9a29b7deb4ac279cd9a34abe69426a109a13a9a1c599f1f", - "tags": [ - "2.0.26" - ] - }, - "2.0.27": { - "sha256": "63c75ce74cd9d1e4b65ae9f98e9865abdbe3d600fb3259dcda5ea69a512b2993", - "tags": [ - "2.0.27" - ] - }, - "2.0.28": { - "sha256": "ea9937b6adc7a18e17a4e1e64992ec389407497b36e68280bb14fcdd4c884dd3", - "tags": [ - "stable-2.0.28", - "2.0", - "2.0.28" - ] - }, - "2.0.29": { - "sha256": "54088c9cacfddbce2e7bf90604fea095ff723e70d9bb056e1fb469b900a50f09", - "tags": [ - "2.0.29" - ] - }, - "2.0.30": { - "sha256": "4137824a20e1f3298410432c85e62d0eb46b0dab1a8411c233699f890d4c1668", - "tags": [ - "stable-2.0.30", - "2.0", - "2.0.30" - ] - }, - "2.0.31": { - "sha256": "0ee39ff6181ef41b606b7ba1ab5c04d8f81579ef56ec4947e4d74ce5d192b5d5", - "tags": [ - "2.0.31" - ] - }, - "2.0.32": { - "sha256": "2a6102ae42dcc5e8fe923bd68bcd326a569e35912acde121301e5d4d2d856417", - "tags": [ - "stable-2.0.32", - "2.0", - "2.0.32" - ] - }, - "2.0.33": { - "sha256": "9365a34d1724e5c9f592cc9da511485e2fa7da1c12df08029bce478586ba4b7b", - "tags": [ - "2.0.33" - ] - }, - "2.0.34": { - "sha256": "9511462203ebb2763f9f8623bb17f3070041ae3cbd7d80284c1e9bb38c09fc40", - "tags": [ - "2.0.34" - ] - }, - "2.0.35": { - "sha256": "31cd58eaf4b06cc0dc5d82640f7adf2366aa9da64133d2c228f1308f1060a990", - "tags": [ - "2.0.35" - ] - }, - "2.0.36": { - "sha256": "e94567b986654f1f7c3ec5c8bd151e3768b4ab9ab9cc389f6b9fd8e0dab32ce2", - "tags": [ - "2.0.36" - ] - }, - "2.0.37": { - "sha256": "5f105131fe4f48d47fd813f57b6bd275840a47b21e39b30d22bf5da30075a786", - "tags": [ - "2.0.37" - ] - }, - "2.0.38": { - "sha256": "ad9650f7456aecc8adb5369eedb418507c7643bede0da60fc1a239878d4902de", - "tags": [ - "2.0.38" - ] - }, - "2.0.39": { - "sha256": "0f8a3d0e43797b5ff4d8b85d7c334b095a3f07d9aa7f80b1e87f94939a93df34", - "tags": [ - "stable-2.0.39", - "2.0", - "2.0.39" - ] - }, - "2.0.40": { - "sha256": "eac1f24afb68acbfcf1d72d2ad142e8584d77f2d100a3af743f106e50ac176d3", - "tags": [ - "2.0.40" - ] - }, - "2.0.41": { - "sha256": "77ebccae8167fc1a9fc4da8c11e8410f6017b92b1a0913eb58ac5285c9eec399", - "tags": [ - "stable-2.0.41", - "2.0", - "2.0.41" - ] - }, - "2.0.42": { - "sha256": "b5b8b8bdc915e67dbc1710cd3d6aa6802d397b7c0f47db07da8acf39d5bd6376", - "tags": [ - "stable-2.0.42", - "2.0", - "2.0.42" - ] - }, - "2.0.43": { - "sha256": "bde6e167330c4439ce7df3ac519ea445120258ef676f1f6ad31d0c2816d3aee3", - "tags": [ - "stable-2.0.43", - "2.0", - "2.0.43" - ] - }, - "2.0.44": { - "sha256": "9468c5e07080c01eb7a734036160bf806d62cafc11465a23150cfbd210e1036d", - "tags": [ - "2.0.44" - ] - }, - "2.0.45": { - "sha256": "4fd7e04bb3ea7d12da8e1c3befc6b53b3c0064775c960a5a9db6a943f2259fc2", - "tags": [ - "2.0.45" - ] - }, - "2.0.46": { - "sha256": "fc611b6d4078b5d9448284c2890f7e0b6b1f203d52f622c655d3600982489c3e", - "tags": [ - "2.0.46" - ] - }, - "2.0.47": { - "sha256": "f0f320c77616a4794227eb637a70b557108f3141a4633276593220a768f49a26", - "tags": [ - "stable-2.0.47", - "2.0", - "2.0.47" - ] - }, - "2.0.48": { - "sha256": "f0038835e96bbacc19d52d22d47469882d9ebe41a4e5213c0471020647a1ee2d", - "tags": [ - "2.0.48" - ] - }, - "2.0.49": { - "sha256": "ef0648ca1ba44c145a3a3e4c174ccd276eb4a335155a20df1ae0e47156fa34ff", - "tags": [ - "2.0.49" - ] - }, - "2.0.50": { - "sha256": "81d4aec735473c5bd2c87f09abcd793c31cb9a07d9fdf3c3d7275c78ebe4bc18", - "tags": [ - "2.0.50" - ] - }, - "2.0.51": { - "sha256": "fc940dea67d25d3fd403531520e8afda2779ff1fa8050f535ac1351b7873a070", - "tags": [ - "2.0.51" - ] - }, - "2.0.52": { - "sha256": "be8d6216890089890693d6d94f141f745d35c53e52c6b942f6c944f5c00c8c26", - "tags": [ - "2.0.52" - ] - }, - "2.0.53": { - "sha256": "40a57076f80dbee0238dab62f16585def06f7d7e5b41f6b677be41b4d2cae811", - "tags": [ - "2.0.53" - ] - }, - "2.0.54": { - "sha256": "ad47c541b70763552bcf597202ee84aaac727d0ba158873134dc163a3a0506f0", - "tags": [ - "2.0.54" - ] - }, "2.0.55": { "sha256": "ef12a54d1556ae1f84ff99edc23706d13b7ad41f1c02d74ca1dfadf9448fcbae", "tags": [ + "stable", "stable-2.0.55", "2", "2.0", - "2.0.55", - "stable" - ] - }, - "2.0.57": { - "sha256": "22b232afb77067c68a3afe087be6a0ee760479262598a12a709e1b03ea9508a6", - "tags": [ - "2.0.57" - ] - }, - "2.0.58": { - "sha256": "be82e1aeba4169420e1b00c12a3e00ec2309a41327f9d6c335feec27bbc885e6", - "tags": [ - "2.0.58" - ] - }, - "2.0.59": { - "sha256": "fdc467bf80e3611d6dd08c79492228ffec53f3fe914f24d793cac254d9353ff7", - "tags": [ - "2.0.59" + "2.0.55" ] }, "2.0.60": { diff --git a/update.sh b/update.sh index aee637d..88035ad 100755 --- a/update.sh +++ b/update.sh @@ -59,41 +59,40 @@ latestCurrentVersionShort=$latestCurrentVersionMajor.$latestCurrentVersionMinor echo "stableOnlineVersionShort=${stableOnlineVersionShort} experimentalOnlineVersionShort=${experimentalOnlineVersionShort}" echo "stableCurrentVersionShort=${stableCurrentVersionShort} latestCurrentVersionShort=${latestCurrentVersionShort}" +# Create new buildinfo.json with only current versions tmpfile=$(mktemp) -# Remove stable tag -cp buildinfo.json "$tmpfile" -jq --arg stable_current_version "$stable_current_version" 'with_entries(if .key == $stable_current_version then .value.tags |= . - ["stable"] else . end)' "$tmpfile" > buildinfo.json -rm -f -- "$tmpfile" +# Start with empty JSON object +echo '{}' > "$tmpfile" -# Remove latest tag -cp buildinfo.json "$tmpfile" -jq --arg latest_current_version "$latest_current_version" 'with_entries(if .key == $latest_current_version then .value.tags |= . - ["latest"] else . end)' "$tmpfile" > buildinfo.json -rm -f -- "$tmpfile" - -# Update tag by stable -cp buildinfo.json "$tmpfile" -if [[ "$stable_online_version" == "$stable_current_version" ]]; then - jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" 'with_entries(if .key == $stable_current_version then .key |= $stable_online_version | .value.sha256 |= $sha256 | .value.tags |= . - [$stable_current_version] + [$stable_online_version, "stable"] else . end)' "$tmpfile" > buildinfo.json +# Add stable version +if [[ "$stable_online_version" == "$experimental_online_version" ]]; then + # Stable and experimental are the same version + jq --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" --arg stableOnlineVersionShort "$stableOnlineVersionShort" --arg stableOnlineVersionMajor "$stableOnlineVersionMajor" \ + '. + {($stable_online_version): {sha256: $sha256, tags: ["latest", "stable", ("stable-" + $stable_online_version), $stableOnlineVersionMajor, $stableOnlineVersionShort, $stable_online_version]}}' "$tmpfile" > buildinfo.json else - jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" --arg stableOnlineVersionShort "$stableOnlineVersionShort" --arg stableOnlineVersionMajor "$stableOnlineVersionMajor" 'with_entries(if .key == $stable_current_version then .value.tags |= . - ["latest","stable",$stableOnlineVersionMajor] else . end) | to_entries | . + [{ key: $stable_online_version, value: { sha256: $sha256, tags: ["latest","stable",("stable-" + $stable_online_version),$stableOnlineVersionMajor,$stableOnlineVersionShort,$stable_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json -fi -rm -f -- "$tmpfile" - -# Update tag by latest -cp buildinfo.json "$tmpfile" -if [[ $experimental_online_version != "$stable_online_version" ]]; then + # Different stable and experimental versions + # First add stable + jq --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" --arg stableOnlineVersionShort "$stableOnlineVersionShort" --arg stableOnlineVersionMajor "$stableOnlineVersionMajor" \ + '. + {($stable_online_version): {sha256: $sha256, tags: ["stable", ("stable-" + $stable_online_version), $stableOnlineVersionMajor, $stableOnlineVersionShort, $stable_online_version]}}' "$tmpfile" > buildinfo.json.tmp + mv buildinfo.json.tmp "$tmpfile" + + # Then add experimental if [[ $stableOnlineVersionShort == "$experimentalOnlineVersionShort" ]]; then - jq --arg experimental_online_version "$experimental_online_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$experimental_sha256" 'with_entries(if .key == $stable_online_version then .value.tags |= . - ["latest"] else . end) | to_entries | . + [{ key: $experimental_online_version, value: { sha256: $sha256, tags: ["latest", $experimental_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json + jq --arg experimental_online_version "$experimental_online_version" --arg sha256 "$experimental_sha256" \ + '. + {($experimental_online_version): {sha256: $sha256, tags: ["latest", $experimental_online_version]}}' "$tmpfile" > buildinfo.json else - jq --arg experimental_online_version "$experimental_online_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$experimental_sha256" --arg experimentalOnlineVersionShort "$experimentalOnlineVersionShort" --arg experimentalOnlineVersionMajor "$experimentalOnlineVersionMajor" 'with_entries(if .key == $stable_online_version then .value.tags |= . - ["latest"] else . end) | to_entries | . + [{ key: $experimental_online_version, value: { sha256: $sha256, tags: ["latest",$experimentalOnlineVersionMajor,$experimentalOnlineVersionShort,$experimental_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json + jq --arg experimental_online_version "$experimental_online_version" --arg sha256 "$experimental_sha256" --arg experimentalOnlineVersionShort "$experimentalOnlineVersionShort" --arg experimentalOnlineVersionMajor "$experimentalOnlineVersionMajor" \ + '. + {($experimental_online_version): {sha256: $sha256, tags: ["latest", $experimentalOnlineVersionMajor, $experimentalOnlineVersionShort, $experimental_online_version]}}' "$tmpfile" > buildinfo.json fi fi + rm -f -- "$tmpfile" # Generate README tags with logical sorting and de-duplication # First, collect all unique tags with their versions -declare -A tag_versions +# Use regular arrays for bash compatibility +declare tag_versions while IFS= read -r version; do while IFS= read -r tag; do # If this tag is already seen, compare versions to keep the latest