Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 6 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,63 +1,36 @@
NAME := goose
PKG_NAME := $(NAME)
TOOL2RPM := rust2rpm
FAS_USERNAME := r0x0d
FILES_TO_SYNC := $(wildcard *.src.rpm) $(wildcard *.spec) generate-vendor-tarball.sh

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.


.PHONY: create-copr-repo
create-copr-repo:
copr create \
--chroot fedora-43-x86_64 \
--chroot fedora-44-x86_64 \
--chroot fedora-rawhide-x86_64 \
$(NAME)

.PHONY: create-gh-repo
create-gh-repo:
git init
git add . && git commit -m "Initial commit for $(NAME)"
gh repo create $(NAME) \
--public \
--disable-wiki \
--remote origin \
--source . \
--push \
--description "Upstream rpm repository for https://github.com/block/goose"

.PHONY: spec
spec:
@echo "Goose is not packaged in crates.io. Skipping."

.PHONY: sources
sources:
spectool -g $(NAME).spec

.PHONY: srpm
srpm:
fedpkg srpm
fedpkg --release rawhide srpm

.PHONY: build
build: srpm
build: srpm
copr build $(NAME) $(NAME)*.src.rpm \
--chroot fedora-43-x86_64 \
--chroot fedora-44-x86_64 \
--chroot fedora-rawhide-x86_64 \
--chroot epel-9-x86_64 \
--chroot epel-10-x86_64 \
--timeout 36000

.PHONY: logs
logs:
@command -v fuzzytail > /dev/null || { echo >&2 "fuzzytail is not installed. Install with pip install fuzzytail"; }
fuzzytail watch $(FAS_USERNAME)/$(NAME)

.PHONY: sync
sync:
scp $(FILES_TO_SYNC) $(FAS_USERNAME)@fedorapeople.org:/home/fedora/$(FAS_USERNAME)/public_html/$(NAME)
.PHONY: clean
clean:
rm -rf *.src.rpm *.tar.gz *.tar.xz *.crate vendor

.PHONY: freeze
freeze:
Expand Down
48 changes: 18 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
[![Copr build status](https://copr.fedorainfracloud.org/coprs/r0x0d/goose/package/goose/status_image/last_build.png)](https://copr.fedorainfracloud.org/coprs/r0x0d/goose/package/goose/)
[![Copr build status](https://copr.fedorainfracloud.org/coprs/g/rhel-lightspeed/goose/package/goose/status_image/last_build.png)](https://copr.fedorainfracloud.org/coprs/g/rhel-lightspeed/goose/package/goose/)

# goose

* [COPR repo](https://copr.fedorainfracloud.org/coprs/r0x0d/goose)
* [Upstream repo](https://github.com/block/goose)
* [Upstream license](https://github.com/block/goose/blob/main/LICENSE)
* [Fedora Package Review Bugzilla](TODO)
This is the development repository for the Fedora/RHEL RPM packaging of
[goose](https://github.com/block/goose). It is the upstream source for the
dist-git version of the package. Changes are developed and tested here before
being submitted to dist-git.

* [COPR repo](https://copr.fedorainfracloud.org/coprs/g/rhel-lightspeed/goose)
* [Upstream repo](https://github.com/aaif-goose/goose)
* [Upstream license](https://github.com/aaif-goose/goose/blob/main/LICENSE)
* [Fedora Package Review Bugzilla](https://bugzilla.redhat.com/show_bug.cgi?id=2428704)

## Documentation

- [Makefile Reference](docs/makefile.md) -- build targets and typical workflow
- [Version Update Process](docs/update-process.md) -- how to update to a new
upstream version

## Setup

Expand All @@ -29,30 +40,7 @@ To build this RPM via copr, the following commands are required:
make sources

# Will perform two operations:
# * Generate a new srpm with `fedpkg srpm`
# * Generate a new srpm with `fedpkg --release rawhide srpm`
# * Request a new build on copr
make build
```

## Push to Github (optional)

This step is optional, but it will secure that the specfile and other settings
are persisted somewhere.

```bash
# Create a new repository in your account using `gh` and some pre-defined
# settings.
make create-gh-repo
```

## Generate patches for downstream

```bash
git clone git@github.com:block/goose goose-source
cd goose-source
git checkout $TAG
# ... modify the source ...
git add -u && git commit
# ... write your commit message ...
git format-patch -<number of commits to generate patch>
```
```
116 changes: 116 additions & 0 deletions docs/makefile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Makefile Reference

This document describes the Makefile targets available for building and
managing the goose RPM package.

## Prerequisites

The following tools must be available in your environment, either installed
locally or inside a development container:

- `fedpkg`
- `spectool`
- `copr-cli`
- `fuzzytail` (optional, for `make logs`)

## Targets

### `create-copr-repo`

Creates a new [COPR](https://copr.fedorainfracloud.org) repository for
building goose. This is a one-time setup step and only needs to be run when
bootstrapping the project from scratch.

The repository is created with the following chroots enabled:

- `fedora-rawhide-x86_64`

```bash
make create-copr-repo
```

### `sources`

Downloads the source tarballs defined in `goose.spec` using `spectool`. The
files are placed in the repository root directory.

```bash
make sources
```

### `srpm`

Generates a source RPM (`.src.rpm`) using `fedpkg` targeting the Rawhide
release. This is automatically called by the `build` target, but can be run
independently to verify that the spec file produces a valid SRPM.

```bash
make srpm
```

### `build`

Builds the package in COPR. This target first generates an SRPM (via the
`srpm` dependency), then submits it to the COPR build system targeting
`fedora-rawhide-x86_64` with a 10-hour timeout.

```bash
make build
```

### `logs`

Watches COPR build logs in real time using
[fuzzytail](https://pypi.org/project/fuzzytail/). Requires `fuzzytail` to be
installed (`pip install fuzzytail`). The command will display an error message
if the tool is not found.

```bash
make logs
```

### `clean`

Removes generated build artifacts from the repository root:

- `*.src.rpm` -- source RPMs
- `*.tar.gz`, `*.tar.xz` -- source tarballs
- `*.crate` -- Rust crate archives
- `vendor/` -- vendored dependencies directory

```bash
make clean
```

### `freeze`

Freezes Python dependency versions for the goose Python extensions. Runs
`scripts/freeze.py` targeting Python 3.14 to produce pinned requirement files
under `requirements/`.

```bash
make freeze
```

## Typical Workflow

A standard build cycle looks like this:

```bash
# 1. Download the sources defined in the spec file
make sources

# 2. Build the SRPM and submit to COPR
make build

# 3. (Optional) Watch the build logs
make logs

# 4. Clean up artifacts when done
make clean
```

## Related Documentation

- [Version Update Process](update-process.md) -- how to update goose to a new
upstream version using the Claude Code automation