Skip to content

Cleanup makefile and add docs - #39

Merged
samdoran merged 1 commit into
mainfrom
cleanup-makefile
May 21, 2026
Merged

Cleanup makefile and add docs#39
samdoran merged 1 commit into
mainfrom
cleanup-makefile

Conversation

@r0x0d

@r0x0d r0x0d commented May 21, 2026

Copy link
Copy Markdown
Member

Cleanup the Makefile with unused targets and added a new doc.

Summary by CodeRabbit

  • Documentation

    • Updated build instructions in project README
    • Added comprehensive Makefile documentation covering build prerequisites, targets, and workflow
  • Chores

    • Streamlined build system configuration and automation
    • Updated COPR repository references

Review Change Stack

Cleanup the Makefile with unused targets and added a new doc.
@r0x0d
r0x0d requested a review from a team as a code owner May 21, 2026 15:16
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Makefile build system refactored to use COPR group identity instead of user-specific hardcoding, with chroot scope limited to rawhide. Dynamic FAS_USERNAME resolution and new clean target replace obsolete targets. Documentation updated across README and new makefile.md to reflect streamlined build flow.

Changes

COPR group migration and build system refactoring

Layer / File(s) Summary
Makefile targets refactored for rawhide-focused COPR group workflow
Makefile
FAS_USERNAME now resolves dynamically from copr whoami, TOOL2RPM variable added, create-copr-repo and build targets scoped to fedora-rawhide-x86_64 chroot only, srpm target uses fedpkg --release rawhide, logs target updated to use dynamic username, new clean target removes build artifacts, and obsolete targets create-gh-repo, spec, sync removed.
README and comprehensive Makefile documentation updated
README.md, docs/makefile.md
README updates COPR badge and build instructions to reference rhel-lightspeed group and rawhide packaging flow; new docs/makefile.md provides complete target reference, prerequisites, workflow examples, and links to related documentation.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Cleanup makefile and add docs' accurately summarizes the main changes: simplifying the Makefile and adding new documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup-makefile

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

23-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove stale reference to deleted make spec target.

The setup instructions reference make spec (lines 29-31), but this target was removed from the Makefile in this PR. Users following these instructions will encounter a "No rule to make target 'spec'" error.

📝 Proposed fix
 ## Setup
 
 Before executing a new build, run the initial setup first:
 
 ```bash
 # Create a new copr repository
 make create-copr-repo
-
-# Will create a specfile based on project settings.
-# This is only needed in case the goose.spec is missing.
-make spec

Alternatively, if a spec file generation workflow still exists outside the Makefile, update the comment to reflect the new process.
</details>

As per coding guidelines, documentation must not contain stale references to old file names or structures.

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @README.md around lines 23 - 32, Remove the stale reference to the deleted
make target by deleting the lines that mention and call "make spec" and the
accompanying comment; keep the "make create-copr-repo" instruction intact
(referencing the existing target create-copr-repo) or replace the removed "make
spec" text with an updated note describing the new specfile generation workflow
if one exists outside the Makefile so README.md no longer references the
non-existent "make spec" target.


</details>

</blockquote></details>

</blockquote></details>
🧹 Nitpick comments (2)
Makefile (2)

3-3: ⚡ Quick win

Remove unused TOOL2RPM variable.

The TOOL2RPM variable is defined but never referenced in any target. This appears to be leftover from the removed spec target.

🧹 Proposed fix
 NAME := goose
 PKG_NAME := $(NAME)
-TOOL2RPM := rust2rpm
 FAS_USERNAME := $(shell copr whoami)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` at line 3, Remove the unused TOOL2RPM variable definition from the
Makefile: delete the line that defines TOOL2RPM := rust2rpm (ensure no other
targets or variables reference TOOL2RPM first), leaving the Makefile without
this dead variable.

6-38: 💤 Low value

Consider adding inline comments for target documentation.

While the targets follow conventions, adding brief inline comments (especially for less obvious targets like freeze) would improve maintainability. The coding guidelines emphasize that targets should be well-documented.

Example:

# Freeze Python dependency versions for goose extensions
.PHONY: freeze
freeze:
	./scripts/freeze.py --python-versions 3.14

As per coding guidelines, Makefile targets should be well-documented and follow conventions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 6 - 38, Add short inline comments above each Makefile
target to document purpose and any non-obvious flags: e.g. annotate
create-copr-repo, sources, srpm, build (note chroot and timeout), logs (mention
fuzzytail prerequisite and usage of $(FAS_USERNAME)/$(NAME)), clean, and
especially freeze (explain it runs ./scripts/freeze.py to lock Python dependency
versions for goose extensions with --python-versions 3.14). Keep comments brief,
use the target names create-copr-repo, sources, srpm, build, logs, clean, and
freeze to locate where to insert the comments, and ensure .PHONY targets remain
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Makefile`:
- Line 4: The Makefile currently sets FAS_USERNAME at parse time with
FAS_USERNAME := $(shell copr whoami) which can error and lead to confusing
failures when running the logs target; update the assignment to silence copr
stderr (redirect copr whoami stderr to /dev/null) so it doesn't print noise
during parsing, then add a new phony target check-copr-auth that fails fast if
FAS_USERNAME is empty (print a clear error and exit non-zero), and make the logs
target depend on check-copr-auth so logs will abort immediately with a readable
message instead of invoking fuzzytail with an empty username; reference the
FAS_USERNAME variable, the logs target, and the new check-copr-auth target when
making these changes.

---

Outside diff comments:
In `@README.md`:
- Around line 23-32: Remove the stale reference to the deleted make target by
deleting the lines that mention and call "make spec" and the accompanying
comment; keep the "make create-copr-repo" instruction intact (referencing the
existing target create-copr-repo) or replace the removed "make spec" text with
an updated note describing the new specfile generation workflow if one exists
outside the Makefile so README.md no longer references the non-existent "make
spec" target.

---

Nitpick comments:
In `@Makefile`:
- Line 3: Remove the unused TOOL2RPM variable definition from the Makefile:
delete the line that defines TOOL2RPM := rust2rpm (ensure no other targets or
variables reference TOOL2RPM first), leaving the Makefile without this dead
variable.
- Around line 6-38: Add short inline comments above each Makefile target to
document purpose and any non-obvious flags: e.g. annotate create-copr-repo,
sources, srpm, build (note chroot and timeout), logs (mention fuzzytail
prerequisite and usage of $(FAS_USERNAME)/$(NAME)), clean, and especially freeze
(explain it runs ./scripts/freeze.py to lock Python dependency versions for
goose extensions with --python-versions 3.14). Keep comments brief, use the
target names create-copr-repo, sources, srpm, build, logs, clean, and freeze to
locate where to insert the comments, and ensure .PHONY targets remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c3d3153b-c77d-47cd-b1b1-beab772791dd

📥 Commits

Reviewing files that changed from the base of the PR and between 082baca and feaef13.

📒 Files selected for processing (3)
  • Makefile
  • README.md
  • docs/makefile.md

Comment thread Makefile
ifneq ("$(wildcard rust2rpm.toml)","")
FILES_TO_SYNC += rust2rpm.toml
endif
FAS_USERNAME := $(shell copr whoami)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if the Makefile gracefully handles copr whoami failures

# Test what happens if copr whoami fails
(unset COPR_CONFIG_DIR; copr whoami 2>&1) || echo "copr whoami can fail"

# Check if FAS_USERNAME is used in targets that would fail silently
rg -n 'FAS_USERNAME' Makefile

Repository: rhel-lightspeed/goose

Length of output: 212


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the Makefile with line numbers around the referenced lines
nl -ba Makefile | sed -n '1,80p'

Repository: rhel-lightspeed/goose

Length of output: 108


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect Makefile with line numbers (using cat -n since nl isn't available)
cat -n Makefile | sed -n '1,120p'

# Also show the specific region around the earlier hit lines (4 and 29)
echo "---- around line 1-40 ----"
cat -n Makefile | sed -n '1,50p'

echo "---- around line 20-40 ----"
cat -n Makefile | sed -n '20,45p'

Repository: rhel-lightspeed/goose

Length of output: 2678


Add validation/fail-fast for FAS_USERNAME before running logs.

FAS_USERNAME := $(shell copr whoami) is evaluated at Makefile load time; if copr whoami errors or returns empty, logs will run fuzzytail watch $(FAS_USERNAME)/$(NAME) and produce unclear failures. Add stderr-silencing plus an explicit guard that fails fast when logs is invoked.

FAS_USERNAME := $(shell copr whoami)
🛡️ Proposed defensive implementation
-FAS_USERNAME := $(shell copr whoami)
+FAS_USERNAME := $(shell copr whoami 2>/dev/null || echo "")
+
+.PHONY: check-copr-auth
+check-copr-auth:
+	`@test` -n "$(FAS_USERNAME)" || { echo >&2 "Error: copr whoami failed. Please authenticate with 'copr whoami'"; exit 1; }

Then make logs depend on check-copr-auth:

 .PHONY: logs
-logs:
+logs: check-copr-auth
 	`@command` -v fuzzytail > /dev/null || { echo >&2 "fuzzytail is not installed. Install with pip install fuzzytail"; }
 	fuzzytail watch $(FAS_USERNAME)/$(NAME)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` at line 4, The Makefile currently sets FAS_USERNAME at parse time
with FAS_USERNAME := $(shell copr whoami) which can error and lead to confusing
failures when running the logs target; update the assignment to silence copr
stderr (redirect copr whoami stderr to /dev/null) so it doesn't print noise
during parsing, then add a new phony target check-copr-auth that fails fast if
FAS_USERNAME is empty (print a clear error and exit non-zero), and make the logs
target depend on check-copr-auth so logs will abort immediately with a readable
message instead of invoking fuzzytail with an empty username; reference the
FAS_USERNAME variable, the logs target, and the new check-copr-auth target when
making these changes.

@samdoran
samdoran merged commit 34d2667 into main May 21, 2026
7 of 15 checks passed
@samdoran
samdoran deleted the cleanup-makefile branch May 21, 2026 16:49
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.

2 participants