hack/package.mk declares its own targets phony, and deliberately stops there. From #3353: "update and image are gone, because package.mk does not define them; the including package Makefile does." That was the right call, since naming an undefined target in .PHONY creates it as an empty target and turns No rule to make target into Nothing to be done.
So the targets a package defines for itself are left to that package, and most packages do not declare them. Measured at origin/main, f7cb9e785:
package Makefiles defining test: or update: 126
all such targets declared phony 20
at least one undeclared 106
REF=origin/main
for mk in $(git ls-tree -r --name-only "$REF" -- packages | grep -E '^packages/[^/]+/[^/]+/Makefile$'); do
body=$(git show "$REF:$mk")
printf '%s' "$body" | grep -qE '^(test|update):' || continue
ok=1
printf '%s' "$body" | grep -qE '^test:' && { printf '%s' "$body" | grep -qE '^\.PHONY:.*\btest\b' || ok=0; }
printf '%s' "$body" | grep -qE '^update:' && { printf '%s' "$body" | grep -qE '^\.PHONY:.*\bupdate\b' || ok=0; }
[ "$ok" = 1 ] || echo "$mk"
done | wc -l
The command reads from a named ref rather than the working tree on purpose: anyone counting this is mid-change by definition, so a count taken in a checkout includes the counter's own edits. Re-running it against origin/main gives the same number whatever branch you are on.
The hazard is the one #3353 already wrote down: put a file or directory named test next to such a Makefile and make test prints 'test' is up to date. and exits 0 without running anything. For test: that is worse than for most targets, because hack/helm-unit-tests.sh walks packages by probing make -n test, so a shadowed target reads as a package whose suite passed.
Nothing collides today. At the same ref, no path named test or update exists beside any package Makefile:
REF=origin/main
for mk in $(git ls-tree -r --name-only "$REF" -- packages | grep -E '^packages/[^/]+/[^/]+/Makefile$'); do
d=$(dirname "$mk")
for t in test update; do git cat-file -e "$REF:$d/$t" 2>/dev/null && echo "$d/$t"; done
done
That prints nothing, and the same probe does find packages/system/kubevirt-cdi/tests when asked for a path that exists, so the empty result is the tree and not a broken check. Preventive, then, like #3353 and #3709 before it.
Scope, so this does not overlap them. #3353 covered the targets hack/package.mk itself defines and excluded these by design. #3709 covers the four Makefiles under packages/core/, which include hack/common-envs.mk and declare nothing. This is the remaining slice: the per-package test: and update: targets across the other groups. 20 packages already declare them, so the fix is a line each in the rest rather than a new convention.
hack/package.mkdeclares its own targets phony, and deliberately stops there. From #3353: "updateandimageare gone, becausepackage.mkdoes not define them; the including package Makefile does." That was the right call, since naming an undefined target in.PHONYcreates it as an empty target and turnsNo rule to make targetintoNothing to be done.So the targets a package defines for itself are left to that package, and most packages do not declare them. Measured at
origin/main,f7cb9e785:The command reads from a named ref rather than the working tree on purpose: anyone counting this is mid-change by definition, so a count taken in a checkout includes the counter's own edits. Re-running it against
origin/maingives the same number whatever branch you are on.The hazard is the one #3353 already wrote down: put a file or directory named
testnext to such a Makefile andmake testprints'test' is up to date.and exits 0 without running anything. Fortest:that is worse than for most targets, becausehack/helm-unit-tests.shwalks packages by probingmake -n test, so a shadowed target reads as a package whose suite passed.Nothing collides today. At the same ref, no path named
testorupdateexists beside any package Makefile:That prints nothing, and the same probe does find
packages/system/kubevirt-cdi/testswhen asked for a path that exists, so the empty result is the tree and not a broken check. Preventive, then, like #3353 and #3709 before it.Scope, so this does not overlap them. #3353 covered the targets
hack/package.mkitself defines and excluded these by design. #3709 covers the four Makefiles underpackages/core/, which includehack/common-envs.mkand declare nothing. This is the remaining slice: the per-packagetest:andupdate:targets across the other groups. 20 packages already declare them, so the fix is a line each in the rest rather than a new convention.