diff options
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/go-mod-vcs.bbclass | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/classes/go-mod-vcs.bbclass b/classes/go-mod-vcs.bbclass index 549fa9f5..c08894d5 100644 --- a/classes/go-mod-vcs.bbclass +++ b/classes/go-mod-vcs.bbclass | |||
| @@ -1140,29 +1140,21 @@ python do_sync_go_files() { | |||
| 1140 | addtask sync_go_files after do_create_module_cache before do_compile | 1140 | addtask sync_go_files after do_create_module_cache before do_compile |
| 1141 | 1141 | ||
| 1142 | 1142 | ||
| 1143 | do_fix_go_mod_permissions() { | 1143 | go_mod_fix_module_cache_permissions() { |
| 1144 | # Go module cache is intentionally read-only for integrity, but this breaks | 1144 | # Go creates read-only files in the module cache by design. |
| 1145 | # BitBake's rm -rf cleanup (sstate_eventhandler_reachablestamps). | 1145 | # Fix permissions after do_compile so do_rm_work can clean up. |
| 1146 | # Make all files writable so workdir can be cleaned properly. | ||
| 1147 | # | ||
| 1148 | # Check multiple possible locations where Go module cache might exist | ||
| 1149 | for modpath in "${S}/pkg/mod" "${S}/src/import/pkg/mod"; do | 1146 | for modpath in "${S}/pkg/mod" "${S}/src/import/pkg/mod"; do |
| 1150 | if [ -d "$modpath" ]; then | 1147 | if [ -d "$modpath" ]; then |
| 1151 | chmod -R u+w "$modpath" 2>/dev/null || true | 1148 | chmod -R u+w "$modpath" 2>/dev/null || true |
| 1152 | bbnote "Fixed permissions on Go module cache: $modpath" | ||
| 1153 | fi | 1149 | fi |
| 1154 | done | 1150 | done |
| 1155 | # Also check sources subdirectory (for recipes with WORKDIR/sources layout) | ||
| 1156 | if [ -d "${WORKDIR}/sources" ]; then | 1151 | if [ -d "${WORKDIR}/sources" ]; then |
| 1157 | find "${WORKDIR}/sources" -type d -name "mod" -path "*/pkg/mod" 2>/dev/null | while read modpath; do | 1152 | find "${WORKDIR}/sources" -type d -name "mod" -path "*/pkg/mod" 2>/dev/null | while read modpath; do |
| 1158 | chmod -R u+w "$modpath" 2>/dev/null || true | 1153 | chmod -R u+w "$modpath" 2>/dev/null || true |
| 1159 | bbnote "Fixed permissions on Go module cache: $modpath" | ||
| 1160 | done | 1154 | done |
| 1161 | fi | 1155 | fi |
| 1162 | } | 1156 | } |
| 1163 | 1157 | do_compile[postfuncs] += "go_mod_fix_module_cache_permissions" | |
| 1164 | # Run after sync_go_files (which is the last Go module setup task) and before compile | ||
| 1165 | addtask fix_go_mod_permissions after do_sync_go_files before do_compile | ||
| 1166 | 1158 | ||
| 1167 | 1159 | ||
| 1168 | python do_go_mod_recommend() { | 1160 | python do_go_mod_recommend() { |
