Skip to contentSkip to conversation

utils/bump-stable-kernel-versions: only move existing headers directories

PATCH In review Raphaël Mélotte via buildroot 1 participant 2 messages Oct 29 – Nov 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils/bump-stable-kernel-versions: only move existing headers directories

Since commit bd633fe5b4785435d7822251d02289082a0d1b5e ("utils/bump-stable-kernel-versions: update for split hash file"), the script unconditionally renames package/linux-headers/<old_version> to package/linux-headers/<new_version> when it bumps a kernel version.

These version-numbered directories only exist since the hash files were split in commit 0e3ddc9dc85e29cd00338cc79ea4be1d634a75ba. On branches without this split, such as 2025.02.x, the hashes are in a single linux/linux.hash file and the directory does not exist, so 'git mv' fails:

fatal: bad source, source=package/linux-headers/6.12.112, destination=package/linux-headers/6.12.114

As the script runs with 'set -e', it then stops halfway, leaving the Config.in files updated but the hash file unchanged.

Only rename the directory when it exists, as is already done for the linux/<old_version> directory.

---
 utils/bump-stable-kernel-versions | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/bump-stable-kernel-versions +3 -1
index b02b854d95..8b93ffe9ec 100755
@@ -79,7 +79,9 @@ update_linux_hash() {
                 echo ">>> Updating version from ${old_version} to ${new_version} in Config.in files"
                 sed -Ei "s/\tdefault \"${old_version}\"([\t ]+)if /\tdefault \"${new_version}\"\1if /" \
                     package/linux-headers/Config.in.host linux/Config.in
-                git mv package/linux-headers/"${old_version}" package/linux-headers/"${new_version}"
+                if [ -d package/linux-headers/"${old_version}" ]; then
+                    git mv package/linux-headers/"${old_version}" package/linux-headers/"${new_version}"
+                fi
                 if [ -d linux/"${old_version}" ]; then
                     git mv linux/"${old_version}" linux/"${new_version}"
                 fi
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author Acked-by Thomas Perale on v1 1/1
#1 lore raw

In reply of:

Quoted 13 lines

Since commit bd633fe5b4785435d7822251d02289082a0d1b5e ("utils/bump-stable-kernel-versions: update for split hash file"), the script unconditionally renames package/linux-headers/<old_version> to package/linux-headers/<new_version> when it bumps a kernel version.

These version-numbered directories only exist since the hash files were split in commit 0e3ddc9dc85e29cd00338cc79ea4be1d634a75ba. On branches without this split, such as 2025.02.x, the hashes are in a single linux/linux.hash file and the directory does not exist, so 'git mv' fails:

fatal: bad source, source=package/linux-headers/6.12.112, destination=package/linux-headers/6.12.114

Quoted 7 lines

As the script runs with 'set -e', it then stops halfway, leaving the Config.in files updated but the hash file unchanged.

Only rename the directory when it exists, as is already done for the linux/<old_version> directory.

Quoted 26 lines
---
 utils/bump-stable-kernel-versions | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/bump-stable-kernel-versions +3 -1
index b02b854d95..8b93ffe9ec 100755
@@ -79,7 +79,9 @@ update_linux_hash() {
                 echo ">>> Updating version from ${old_version} to ${new_version} in Config.in files"
                 sed -Ei "s/\tdefault \"${old_version}\"([\t ]+)if /\tdefault \"${new_version}\"\1if /" \
                     package/linux-headers/Config.in.host linux/Config.in
-                git mv package/linux-headers/"${old_version}" package/linux-headers/"${new_version}"
+                if [ -d package/linux-headers/"${old_version}" ]; then
+                    git mv package/linux-headers/"${old_version}" package/linux-headers/"${new_version}"
+                fi
                 if [ -d linux/"${old_version}" ]; then
                     git mv linux/"${old_version}" linux/"${new_version}"
                 fi
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot