Skip to content

Commit d24bb0b

Browse files
committed
dbuild 1.8.2: lint compose.yaml whitespace, fix init template, local README.j2 override
1 parent 43050dc commit d24bb0b

5 files changed

Lines changed: 31 additions & 8 deletions

File tree

dbuild/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""dbuild: FreeBSD OCI container image build tool.
22
"""
33

4-
VERSION = "1.8.1"
4+
VERSION = "1.8.2"

dbuild/docs.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,16 @@ def generate_manpage(parser: argparse.ArgumentParser) -> str:
201201

202202

203203
def _get_jinja_env(base: Path) -> jinja2.Environment | None:
204-
"""Create Jinja2 environment looking first in .daemonless/templates, then bundled."""
204+
"""Create Jinja2 environment with override priority:
205+
1. repo root (README.j2 alongside Containerfile.j2)
206+
2. .daemonless/templates/
207+
3. bundled dbuild templates
208+
"""
205209
if jinja2 is None:
206210
return None
207211

208212
search_paths = [
213+
base,
209214
base / ".daemonless" / "templates",
210215
Path(__file__).parent / "templates",
211216
]
@@ -447,13 +452,16 @@ def run(cfg: Config, args: argparse.Namespace) -> int:
447452
log.error("Could not find dbuild templates.")
448453
return 1
449454

450-
# 1. Generate README.md (if docs: manual isn't set)
455+
# 1. Generate README.md (if docs: manual isn't set, or if a local README.j2 exists)
451456
is_manual = (cfg.metadata.docs == "manual" or
452457
(isinstance(cfg.metadata.docs, dict) and cfg.metadata.docs.get("manual", False)))
458+
has_local_readme_j2 = (base / "README.j2").exists()
453459

454-
if is_manual:
460+
if is_manual and not has_local_readme_j2:
455461
log.info("Skipping README.md generation (docs: manual)")
456462
else:
463+
if is_manual and has_local_readme_j2:
464+
log.info("docs: manual — using local README.j2 override")
457465
try:
458466
template = env.get_template("README.j2")
459467
content = template.render(context, render_mode="github")

dbuild/lint.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@ def lint_repo(repo_path: Path, verbose: bool = False) -> tuple[list[str], list[s
159159
" — run dbuild generate on a host with a git remote set"
160160
)
161161

162+
if compose_path.exists():
163+
lines = compose_path.read_text().splitlines()
164+
for i, line in enumerate(lines, 1):
165+
if line != line.rstrip():
166+
warnings.append(f"compose.yaml:{i}: trailing whitespace")
167+
blank_runs = 0
168+
for i, line in enumerate(lines, 1):
169+
if line.strip() == "":
170+
blank_runs += 1
171+
if blank_runs > 1:
172+
warnings.append(f"compose.yaml:{i}: consecutive blank lines")
173+
blank_runs = 0 # report once per run
174+
else:
175+
blank_runs = 0
176+
162177
readme_path = repo_path / "README.md"
163178
if readme_path.exists():
164179
readme_text = readme_path.read_text()

dbuild/templates/compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ services:
2828
image: ghcr.io/daemonless/{{ name }}:latest
2929
container_name: {{ name }}
3030
restart: unless-stopped
31-
32-
{%- if mlock %}
31+
{%- if mlock %}
32+
3333
annotations:
3434
org.freebsd.jail.allow.mlock: "true"
35-
{%- endif %}
35+
{%- endif %}
3636

3737
environment:
3838
- PUID=1000

docs/dbuild.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH DBUILD 1 "2026-04-02" "dbuild 1.8.1" "User Commands"
1+
.TH DBUILD 1 "2026-04-05" "dbuild 1.8.2" "User Commands"
22
.SH NAME
33
dbuild \- FreeBSD OCI container image build tool
44
.SH SYNOPSIS

0 commit comments

Comments
 (0)