Repository navigation
Description
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 -lThe 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
doneThat 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.
Activity
fix(cdi): pin the CDI release kubevirt-cdi is reconciled against and …