Name
odh-ai-helpers:rpm-examine
Synopsis
/rpm:examine <copr-chroot-url>
/rpm:examine <build-log-url> <srpm-url>
/rpm:examine <build.log> <specfile|dist-git> [sources]
Description
Analyze RPM build.log failures. Provide a comprehensive analysis with error summary, root cause, and actionable fixes.
Mode 1: Copr Results URL or Direct URLs to build.log and SRPM
Provide a single Copr build results URL to automatically fetch all build artifacts or provide two URLs - one for build.log and one for SRPM.
What gets downloaded:
build-live.log.gz or build.log - Main build log
*.src.rpm - Source RPM containing spec file, sources, and patches
root.log.gz, state.log - Additional context logs (optional)
Mode 2: Local Files
Provide paths to local build artifacts.
Arguments:
<build.log> - Path to build log file (required)
<specfile|dist-git> - Path to spec file or dist-git repo clone (required)
[sources] - Path to source tarball or unpacked sources (optional)
Context gathering:
If sources not provided, search in:
- build.log parent directory
- specfile parent directory
- dist-git clone directory
Implementation
1. Input Detection
- If single URL: Copr results directory → continue to step 2a
- If two URLs: Direct URLs to build.log and SRPM (Koji/Brew) → download both directly, then follow 2a steps 3-5
- If local path(s): Local workflow → continue to step 2b
2. Artifact Collection
2a. URL Workflow
- Create temporary working directory
- Download files from Copr URL:
curl -LO <copr-url>/builder-live.log.gz
curl -LO <copr-url>/*.src.rpm
curl -LO <copr-url>/root.log.gz # optional
curl -LO <copr-url>/state.log # optional
- Decompress logs:
gunzip *.log.gz (if needed)
- Extract SRPM:
rpm2cpio *.src.rpm | cpio -idmv
- Locate extracted spec file
2b. Local Workflow
- Verify build.log exists and is readable
- Verify specfile/dist-git path exists
- Search for sources if not provided:
- Check build.log parent directory for
*.tar.* or *.src.rpm
- Check specfile parent directory
- If dist-git repo, check for sources in repo
3. Context Gathering
Collect all relevant information before analysis:
Spec file analysis:
- BuildRequires dependencies
- Patches and their application order
- Macros and their expansions
- Build steps (%prep, %build, %install, %check, %files)
Additional context:
- For dist-git repos: Run
git diff to check uncommitted changes
- Examine patch files for conflicts or application failures
- Look for auxiliary files:
%{name}.conf, %{name}.desktop, systemd units
- Check for additional logs:
root.log, state.log, mock.log
Source code (if needed):
- For compiler errors: Unpack sources to examine code
- For test failures: Locate test files and configurations
- For build system issues: Check
CMakeLists.txt, Makefile.am, setup.py, etc.
4. Analysis
Scan Strategy
- Start at the end: Scan build.log from bottom up to find failure point
- Identify the phase: Determine which RPM build phase failed:
%prep - Source unpacking and patch application
%build - Compilation and building
%install - Installation to buildroot
%check - Test suite execution
- Binary RPM creation - File packaging
- Find the trigger: Locate exact command or operation that failed
- Trace backwards: Follow the chain of events leading to failure
- Cross-reference: Compare findings with specfile configuration
Error Keywords to Search
"Error:", "FAILED", "fatal error:"
"configure: error:", "No such file"
"undefined reference", "make: ***"
"CMake Error", "ninja: build stopped"
"ModuleNotFoundError", "ImportError"
"Ignoring extra path from command line" - May indicate broken line continuation in spec file
"add_subdirectory given source" + "not an existing directory" - May indicate missing options due to spec formatting
Hard To Find Error Patterns
Spec file whitespace issues:
- Trailing space after backslash (
\ instead of \) - Breaks line continuation, causing subsequent lines to be completely ignored by the shell
- Missing backslash in multi-line constructs (especially in
%if blocks)
- Detection: Use
cat -A specfile.spec to reveal trailing spaces (shows as \ $ at end of line) or grep '\\ $' specfile.spec
- Symptoms: CMake/configure options appear ignored, features default to wrong values, mysterious "directory not found" errors
5. Cleanup
- If URL workflow was used, clean up temporary directory after analysis
- Ask user before cleanup if they might need files for further investigation
Output Format
Provide a clear, structured analysis:
1. Error Summary
Brief description of what failed (1-2 sentences)
2. Root Cause
Technical explanation of why it failed:
- Which phase encountered the error
- What operation or command triggered it
- Underlying technical reason
3. Suggested Fixes
Specific, actionable steps to resolve:
- Exact changes needed (with code/spec snippets if applicable)
- Commands to run
- Dependencies to add/modify
- Patches to apply/modify
4. Additional Recommendations
Optional section for:
- Related improvements
- Potential future issues
- Best practices
- Warnings about side effects
1---2name: output-format3description: Analyze RPM build.log failures. Provide a comprehensive analysis with error summary, root cause, and actionable fixes.4---56## Name7odh-ai-helpers:rpm-examine89## Synopsis10```11/rpm:examine <copr-chroot-url>12/rpm:examine <build-log-url> <srpm-url>13/rpm:examine <build.log> <specfile|dist-git> [sources]14```1516## Description17Analyze RPM build.log failures. Provide a comprehensive analysis with error summary, root cause, and actionable fixes.1819### Mode 1: Copr Results URL or Direct URLs to build.log and SRPM20Provide a single Copr build results URL to automatically fetch all build artifacts or provide two URLs - one for build.log and one for SRPM.2122**What gets downloaded:**23- `build-live.log.gz` or `build.log` - Main build log24- `*.src.rpm` - Source RPM containing spec file, sources, and patches25- `root.log.gz`, `state.log` - Additional context logs (optional)2627### Mode 2: Local Files28Provide paths to local build artifacts.2930**Arguments:**311. `<build.log>` - Path to build log file (required)322. `<specfile|dist-git>` - Path to spec file or dist-git repo clone (required)333. `[sources]` - Path to source tarball or unpacked sources (optional)3435**Context gathering:**36If sources not provided, search in:37- build.log parent directory38- specfile parent directory39- dist-git clone directory4041## Implementation4243### 1. Input Detection44- **If single URL**: Copr results directory → continue to step 2a45- **If two URLs**: Direct URLs to build.log and SRPM (Koji/Brew) → download both directly, then follow 2a steps 3-546- **If local path(s)**: Local workflow → continue to step 2b4748### 2. Artifact Collection4950#### 2a. URL Workflow511. Create temporary working directory522. Download files from Copr URL:53 ```bash54 curl -LO <copr-url>/builder-live.log.gz55 curl -LO <copr-url>/*.src.rpm56 curl -LO <copr-url>/root.log.gz # optional57 curl -LO <copr-url>/state.log # optional58 ```593. Decompress logs: `gunzip *.log.gz` (if needed)604. Extract SRPM: `rpm2cpio *.src.rpm | cpio -idmv`615. Locate extracted spec file6263#### 2b. Local Workflow641. Verify build.log exists and is readable652. Verify specfile/dist-git path exists663. Search for sources if not provided:67 - Check build.log parent directory for `*.tar.*` or `*.src.rpm`68 - Check specfile parent directory69 - If dist-git repo, check for sources in repo7071### 3. Context Gathering72Collect all relevant information before analysis:7374**Spec file analysis:**75- BuildRequires dependencies76- Patches and their application order77- Macros and their expansions78- Build steps (%prep, %build, %install, %check, %files)7980**Additional context:**81- For dist-git repos: Run `git diff` to check uncommitted changes82- Examine patch files for conflicts or application failures83- Look for auxiliary files: `%{name}.conf`, `%{name}.desktop`, systemd units84- Check for additional logs: `root.log`, `state.log`, `mock.log`8586**Source code (if needed):**87- For compiler errors: Unpack sources to examine code88- For test failures: Locate test files and configurations89- For build system issues: Check `CMakeLists.txt`, `Makefile.am`, `setup.py`, etc.9091### 4. Analysis9293#### Scan Strategy941. **Start at the end**: Scan build.log from bottom up to find failure point952. **Identify the phase**: Determine which RPM build phase failed:96 - `%prep` - Source unpacking and patch application97 - `%build` - Compilation and building98 - `%install` - Installation to buildroot99 - `%check` - Test suite execution100 - Binary RPM creation - File packaging1013. **Find the trigger**: Locate exact command or operation that failed1024. **Trace backwards**: Follow the chain of events leading to failure1035. **Cross-reference**: Compare findings with specfile configuration104105#### Error Keywords to Search106- `"Error:"`, `"FAILED"`, `"fatal error:"`107- `"configure: error:"`, `"No such file"`108- `"undefined reference"`, `"make: ***"`109- `"CMake Error"`, `"ninja: build stopped"`110- `"ModuleNotFoundError"`, `"ImportError"`111- `"Ignoring extra path from command line"` - May indicate broken line continuation in spec file112- `"add_subdirectory given source"` + `"not an existing directory"` - May indicate missing options due to spec formatting113114#### Hard To Find Error Patterns115116**Spec file whitespace issues:**117- Trailing space after backslash (`\ ` instead of `\`) - Breaks line continuation, causing subsequent lines to be completely ignored by the shell118- Missing backslash in multi-line constructs (especially in `%if` blocks)119- **Detection**: Use `cat -A specfile.spec` to reveal trailing spaces (shows as `\ $` at end of line) or `grep '\\ $' specfile.spec`120- **Symptoms**: CMake/configure options appear ignored, features default to wrong values, mysterious "directory not found" errors121122### 5. Cleanup123- If URL workflow was used, clean up temporary directory after analysis124- Ask user before cleanup if they might need files for further investigation125126## Output Format127128Provide a clear, structured analysis:129130### 1. Error Summary131Brief description of what failed (1-2 sentences)132133### 2. Root Cause134Technical explanation of why it failed:135- Which phase encountered the error136- What operation or command triggered it137- Underlying technical reason138139### 3. Suggested Fixes140Specific, actionable steps to resolve:141- Exact changes needed (with code/spec snippets if applicable)142- Commands to run143- Dependencies to add/modify144- Patches to apply/modify145146### 4. Additional Recommendations147Optional section for:148- Related improvements149- Potential future issues150- Best practices151- Warnings about side effects