Skip to content

Conversation

@zluudg
Copy link
Contributor

@zluudg zluudg commented Nov 19, 2025

Summary by CodeRabbit

  • New Features

    • App now prints build metadata (name, version, commit) on startup.
  • Chores

    • Rebranded CLI/service names and updated docs and default config paths.
    • Centralized build output and moved packaging/versioning to build-time placeholders.
    • Removed the old version-generation helper and updated packaging templates.
    • Updated ignore rules to exclude generated build artifacts.

✏️ Tip: You can customize this high-level summary in your review settings.

@zluudg zluudg requested a review from a team as a code owner November 19, 2025 11:54
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

Refactors build and packaging to a centralized OUT output directory, embeds build metadata via ldflags, removes the make-version.sh generator, templates package control/spec files with @@Version@@, updates .gitignore to ignore out/ and deb/DEBIAN/control.in, and rebrands CLI/docs from tapir-cli to dnstapir-cli.

Changes

Cohort / File(s) Change Summary
Build system & metadata
Makefile, VERSION, make-version.sh
Makefile now provides a fixed VERSION (0.0.0 default), new OUT, GO, INSTALL, COMMIT, RPM_VERSION, DEB_VERSION; GOFLAGS embed main.version, main.commit, main.name via ldflags; routing of artifacts to OUT; removed make-version.sh; VERSION file cleared.
Runtime build info
main.go
Added package-level build variables name, version, commit (default "BAD-BUILD") and a startup printf of build metadata before cmd.Execute().
Packaging templates
deb/DEBIAN/control.in, rpm/SPECS/dnstapir-cli.spec.in
Swapped static version strings for @@VERSION@@ placeholders; RPM spec simplified source naming and switched binary install to make install with DESTDIR; removed some prior debug-package blocks.
Artifact management & ignore rules
.gitignore
Stop ignoring deb/DEBIAN/control, start ignoring deb/DEBIAN/control.in; added out/ to ignore built artifacts.
Documentation / branding
README.md
Renamed CLI and service references: tapir-clidnstapir-cli, TAPIR-POPdnstapir-pop, adjusted examples and config paths accordingly.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Developer
    participant Git
    participant Makefile
    participant GoBuild as "go build (ldflags)"
    participant OUT as out/
    participant Packaging

    Developer->>Git: commit / tag (optional)
    Developer->>Makefile: make build / package
    Makefile->>Git: resolve COMMIT (git describe fallback)
    Makefile->>GoBuild: invoke with GOFLAGS (-X main.version, -X main.commit, -X main.name)
    GoBuild->>OUT: place binary into OUT
    Note right of OUT `#DDEEEF`: OUT-centered artifacts and version files
    Makefile->>Packaging: substitute @@VERSION@@ and produce tar/rpm/deb from OUT
    Packaging->>OUT: emit final artifacts
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to:
    • Makefile ldflags/GOFLAGS wiring and COMMIT fallback logic.
    • Packaging substitutions for @@VERSION@@ and use of OUT paths.
    • Startup build-info printing in main.go.
    • Removal of make-version.sh and cleared VERSION implications.

Possibly related PRs

Suggested reviewers

  • johanix
  • berrabou

Poem

🐇 I swapped the scripts and set the flags bright,
Out/ holds the bundles tucked neat in the night,
ldflags stamp versions, commits in the song,
No more generators — the build hops along,
dnstapir leaps, edges right where it belongs.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Leon/snapshot string in packages' is vague and does not clearly convey the actual changes made in the pull request. Revise the title to be more descriptive of the actual changes, such as 'Update build system to embed version metadata in packages' or 'Refactor versioning and build artifacts to use centralized output directory'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch leon/snapshot-string-in-packages

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
rpm/SPECS/dnstapir-cli.spec.in (1)

34-34: Non-standard DESTDIR usage could cause confusion.

The current implementation sets DESTDIR=%{buildroot}%{_bindir} and relies on the Makefile's install target appending $(prefix) (which is undefined/empty). While this works, it's non-standard. The conventional pattern is:

DESTDIR=%{buildroot} make install

And the Makefile's install target should handle the full path:

install:
	$(INSTALL) $(OUT)/$(PROG) $(DESTDIR)/usr/bin/

This makes the build process more maintainable and aligns with standard practices.

Makefile (1)

7-7: Prefer $(CURDIR) over $$(pwd) for path construction.

The current OUT:=$$(pwd)/out uses double-dollar pwd, which re-evaluates the working directory for each use of $(OUT). Consider using Make's built-in $(CURDIR) variable instead:

-OUT:=$$(pwd)/out
+OUT:=$(CURDIR)/out

This is more efficient and idiomatic in Makefiles.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c5cfcc and 484f989.

📒 Files selected for processing (8)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • README.md (1 hunks)
  • VERSION (0 hunks)
  • deb/DEBIAN/control.in (1 hunks)
  • main.go (1 hunks)
  • make-version.sh (0 hunks)
  • rpm/SPECS/dnstapir-cli.spec.in (2 hunks)
💤 Files with no reviewable changes (2)
  • VERSION
  • make-version.sh
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-06-09T08:00:25.912Z
Learnt from: zluudg
Repo: dnstapir/cli PR: 33
File: rpm/SPECS/tapir-cli.spec:0-0
Timestamp: 2025-06-09T08:00:25.912Z
Learning: In the dnstapir/cli project, the RPM spec file version field should retain the 'v' prefix (e.g., "Version: v0.3") rather than following the typical RPM convention of omitting it.

Applied to files:

  • rpm/SPECS/dnstapir-cli.spec.in
  • deb/DEBIAN/control.in
📚 Learning: 2025-08-14T12:03:40.980Z
Learnt from: zluudg
Repo: dnstapir/cli PR: 41
File: rpm/SPECS/tapir-cli.spec:42-42
Timestamp: 2025-08-14T12:03:40.980Z
Learning: User zluudg prefers not to auto-start or auto-enable systemd services in the dnstapir/cli RPM package, preferring manual activation instead.

Applied to files:

  • rpm/SPECS/dnstapir-cli.spec.in
  • deb/DEBIAN/control.in
📚 Learning: 2025-08-14T11:59:39.396Z
Learnt from: zluudg
Repo: dnstapir/cli PR: 41
File: rpm/SOURCES/restart-pop.service:11-11
Timestamp: 2025-08-14T11:59:39.396Z
Learning: The restart-pop.service in dnstapir/cli is intended as an optional, manually-activated workaround for restarting tapir-pop.service after certificate renewal. The user (zluudg) prefers to keep tapir-renew.service untouched and is okay with manual activation rather than automatic triggering.

Applied to files:

  • README.md
  • deb/DEBIAN/control.in
🪛 checkmake (0.2.2)
Makefile

[warning] 4-4: Target "VERSION" should be declared PHONY.

(phonydeclared)


[warning] 6-6: Target "PROG" should be declared PHONY.

(phonydeclared)


[warning] 7-7: Target "OUT" should be declared PHONY.

(phonydeclared)


[warning] 8-8: Target "COMMIT" should be declared PHONY.

(phonydeclared)


[warning] 9-9: Target "GOFLAGS" should be declared PHONY.

(phonydeclared)


[warning] 11-11: Target "GO" should be declared PHONY.

(phonydeclared)


[warning] 12-12: Target "INSTALL" should be declared PHONY.

(phonydeclared)


[warning] 22-22: Target "all" should be declared PHONY.

(phonydeclared)


[warning] 24-24: Target "default" should be declared PHONY.

(phonydeclared)


[warning] 51-51: Target body for "srpm" exceeds allowed length of 5 (6).

(maxbodylength)


[warning] 62-62: Target body for "deb" exceeds allowed length of 5 (7).

(maxbodylength)

🪛 LanguageTool
README.md

[grammar] ~8-~8: Ensure spelling is correct
Context: ...de. One example of this is the creation anad manipulation of DAWG files containing l...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[style] ~13-~13: To reduce wordiness, try specifying a number or using “many” or “numerous” instead.
Context: ...lag --standalone. dnstapir-cli has a large number of commands and subcommands. The entire se...

(LARGE_NUMBER_OF)

🪛 markdownlint-cli2 (0.18.1)
README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


43-43: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (8)
main.go (1)

8-17: LGTM! Build metadata implementation is correct.

The build-time variable injection approach using ldflags (configured in the Makefile) is a standard Go practice. The "BAD-BUILD" defaults serve as appropriate fallback values if the binary is built without the proper ldflags.

rpm/SPECS/dnstapir-cli.spec.in (2)

1-2: LGTM! Standard debug package disabling.

The global directive to disable debug package building is a standard RPM practice for binaries that don't benefit from separate debug symbols.


5-5: Version placeholder conflicts with established convention.

According to the learning from PR #33, the RPM spec version field should retain the 'v' prefix (e.g., "Version: v0.3"). However, the Makefile substitution will produce versions like "0.0.0^20251119.abc123" without the 'v' prefix. Please verify whether the 'v' prefix convention should be maintained or if it has been intentionally changed.

Based on learnings

README.md (1)

1-69: LGTM! Rebranding is consistent and complete.

The rebranding from tapir-cli to dnstapir-cli has been applied consistently throughout the documentation, including command examples, configuration paths, and service references.

deb/DEBIAN/control.in (1)

3-3: LGTM! Version placeholder aligns with new build system.

The change from a static version to a placeholder enables build-time version substitution, consistent with the RPM spec template and the broader packaging refactor in this PR.

.gitignore (1)

44-49: LGTM! Gitignore updates align with new build system.

The changes correctly:

  1. Track the .in template file instead of the generated control file
  2. Exclude the new out/ directory used for build artifacts

These align with the template-based packaging and OUT directory changes introduced in the Makefile.

Makefile (2)

1-4: LGTM! Centralized version constant.

The VERSION constant at 0.0.0 serves as a base version, with snapshot versioning logic (lines 15-20) producing appropriate package versions for development builds. This approach centralizes version management as indicated by the header comments.


15-20: LGTM! Snapshot versioning logic is appropriate.

The conditional logic correctly generates snapshot versions for development builds (when VERSION is 0.0.0) while preserving explicit versions for releases. The format conventions (^ for RPM, +local for DEB) are appropriate for each package type.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
README.md (1)

19-19: Add language specifiers to fenced code blocks.

Lines 19 and 43 have fenced code blocks without language specifiers. Add bash or the appropriate language to improve readability and enable syntax highlighting.

-```
+```bash
 dnstapir-cli pop ping -h

and:

-```
+```bash
 dnstapir-cli -h

Also applies to: 43-43

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 484f989 and c0c5eb8.

📒 Files selected for processing (2)
  • Makefile (1 hunks)
  • README.md (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-14T11:59:39.396Z
Learnt from: zluudg
Repo: dnstapir/cli PR: 41
File: rpm/SOURCES/restart-pop.service:11-11
Timestamp: 2025-08-14T11:59:39.396Z
Learning: The restart-pop.service in dnstapir/cli is intended as an optional, manually-activated workaround for restarting tapir-pop.service after certificate renewal. The user (zluudg) prefers to keep tapir-renew.service untouched and is okay with manual activation rather than automatic triggering.

Applied to files:

  • README.md
🪛 checkmake (0.2.2)
Makefile

[warning] 51-51: Target body for "srpm" exceeds allowed length of 5 (6).

(maxbodylength)


[warning] 62-62: Target body for "deb" exceeds allowed length of 5 (7).

(maxbodylength)


[warning] 4-4: Target "VERSION" should be declared PHONY.

(phonydeclared)


[warning] 6-6: Target "PROG" should be declared PHONY.

(phonydeclared)


[warning] 7-7: Target "OUT" should be declared PHONY.

(phonydeclared)


[warning] 8-8: Target "COMMIT" should be declared PHONY.

(phonydeclared)


[warning] 9-9: Target "GOFLAGS" should be declared PHONY.

(phonydeclared)


[warning] 11-11: Target "GO" should be declared PHONY.

(phonydeclared)


[warning] 12-12: Target "INSTALL" should be declared PHONY.

(phonydeclared)


[warning] 22-22: Target "all" should be declared PHONY.

(phonydeclared)


[warning] 24-24: Target "default" should be declared PHONY.

(phonydeclared)

🪛 LanguageTool
README.md

[style] ~13-~13: To reduce wordiness, try specifying a number or using “many” or “numerous” instead.
Context: ...lag --standalone. dnstapir-cli has a large number of commands and subcommands. The entire se...

(LARGE_NUMBER_OF)

🪛 markdownlint-cli2 (0.18.1)
README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


43-43: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (3)
Makefile (3)

57-57: Clarify the $(outdir) variable usage.

Line 57 references $(outdir), which is not defined in the Makefile. This appears to be an optional user-provided parameter (e.g., make srpm outdir=/some/path), but it's undocumented. Add a comment or documentation explaining this pattern, or verify it's the intended behavior.

-	test -z "$(outdir)" || cp $(OUT)/$(PROG)-$(RPM_VERSION)-*.src.rpm "$(outdir)"
+	# Optional: copy to user-provided outdir if specified (e.g., make srpm outdir=/path)
+	test -z "$(outdir)" || cp $(OUT)/$(PROG)-$(RPM_VERSION)-*.src.rpm "$(outdir)"

14-20: Conditional versioning for development snapshots is well-structured.

The VERSION=0.0.0 check with conditional RPM_VERSION/DEB_VERSION logic elegantly handles development builds by appending date and commit info. This allows ldflags injection via $(COMMIT) to generate version strings like 0.0.0^20251119.abc1234 (RPM) and 0.0.0+local20251119.abc1234 (DEB).


28-32: OUT-centric build flow is clean and maintainable.

The new outdir target and dependency chain (build → outdir, $(PROG) → build) centralizes artifacts into the OUT directory, replacing ad-hoc in-tree placement. This isolates build artifacts from the source tree.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Leon Fernandez <zluudg@zluudg.se>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Makefile (1)

71-71: Consider adding test target to .PHONY (or update tool config).

The static analysis tool (checkmake) flags test as a required phony target. Either add a .PHONY: test declaration if a test target will be added, or suppress this rule if testing is not part of the Makefile.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0c5eb8 and 23e65cc.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 51-51: Target body for "srpm" exceeds allowed length of 5 (6).

(maxbodylength)


[warning] 62-62: Target body for "deb" exceeds allowed length of 5 (7).

(maxbodylength)


[warning] 71-71: Missing required phony target "test"

(minphony)


[warning] 4-4: Target "VERSION" should be declared PHONY.

(phonydeclared)


[warning] 6-6: Target "PROG" should be declared PHONY.

(phonydeclared)


[warning] 7-7: Target "OUT" should be declared PHONY.

(phonydeclared)


[warning] 8-8: Target "COMMIT" should be declared PHONY.

(phonydeclared)


[warning] 9-9: Target "GOFLAGS" should be declared PHONY.

(phonydeclared)


[warning] 11-11: Target "GO" should be declared PHONY.

(phonydeclared)


[warning] 12-12: Target "INSTALL" should be declared PHONY.

(phonydeclared)

🔇 Additional comments (4)
Makefile (4)

62-69: ✅ Line 65 path bug is fixed.

The previously flagged issue of mkdir -p deb/etc/dnstapir/certs has been correctly updated to mkdir -p $(OUT)/deb/etc/dnstapir/certs, ensuring the source tree is not modified.


71-71: ✅ .PHONY declaration is now complete.

The .PHONY line now correctly includes all non-file targets, addressing the previous review concern.


1-20: Refactored version strategy with snapshot support looks sound.

The hardcoded VERSION with conditional RPM_VERSION and DEB_VERSION snapshot logic (when VERSION is 0.0.0) appropriately handles pre-release packaging. The COMMIT variable correctly implements a file-or-git fallback, enabling tarball-based builds to use an embedded commit hash.


14-20: Verify snapshot versioning logic matches packaging expectations.

Lines 18–19 embed a date stamp and commit hash into RPM and DEB version strings when VERSION is 0.0.0. Confirm that this snapshot format aligns with your package management and distribution workflows (e.g., RPM and Debian version comparison semantics).

@zluudg zluudg merged commit faf682d into main Nov 25, 2025
3 checks passed
@zluudg zluudg deleted the leon/snapshot-string-in-packages branch November 25, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants