Internal helper: find extension start in basename (returns length without ext) A container build file named for its variant ("Dockerfile.debug") keeps * the suffix (no language extension; dropping it gives the variant the QN of * the plain Dockerfile beside it). Mirrors strip_file_extension in * src/pipeline/fqn.c -- both must agree. */
| 1698 | * the plain Dockerfile beside it). Mirrors strip_file_extension in |
| 1699 | * src/pipeline/fqn.c -- both must agree. */ |
| 1700 | static bool build_file_variant(const char *s, size_t len) { |
| 1701 | size_t b = len; |
| 1702 | while (b > 0 && s[b - SKIP_ONE] != '/') { |
| 1703 | b--; |
| 1704 | } |
| 1705 | static const char *const BASES[] = {"Dockerfile.", "Containerfile."}; |
| 1706 | for (size_t i = 0; i < sizeof(BASES) / sizeof(BASES[0]); i++) { |
| 1707 | size_t bl = strlen(BASES[i]); |
| 1708 | if (len - b > bl && strncmp(s + b, BASES[i], bl) == 0) { |
| 1709 | return true; |
| 1710 | } |
| 1711 | } |
| 1712 | return false; |
| 1713 | } |
| 1714 | |
| 1715 | static size_t strip_ext_len(const char *s, size_t len) { |
| 1716 | if (build_file_variant(s, len)) { |