← 返回
开发者工具 中文

rpm-packager

Build installable RPM packages from source code on CentOS/RHEL by creating SPEC files and compiling for versions 7, 8, or 9 RPM-based systems.
在 CentOS/RHEL 系统上通过编写 SPEC 文件并编译,为版本 7、8、9 的 RPM 系统构建可安装的 RPM 包。
yukariccccccc yukariccccccc 来源
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 723
下载
💾 9
安装
1
版本
#latest

概述

RPM Packager Skill

Transform source code into installable RPM packages for CentOS/RHEL systems.

Quick Start

# Basic usage
./scripts/build-rpm.sh <source-dir> <package-name> <version> <release>

# Example
./scripts/build-rpm.sh ./myapp myapp 1.0.0 1

Workflow

1. Prepare Source Code

Ensure source code is ready:

  • Has a build system (Makefile, CMakeLists.txt, setup.py, etc.)
  • Clean directory structure
  • No build artifacts

2. Check Prerequisites

Required tools on CentOS/RHEL (requires sudo privileges):

sudo yum install rpm-build mock gcc make

> Note: Installing system packages requires sudo privileges. The build process itself runs as your user account.

3. Run Build Script

cd ~/.openclaw/workspace/skills/rpm-packager
chmod +x scripts/build-rpm.sh
./scripts/build-rpm.sh /path/to/source package-name 1.0.0 1

4. Verify Output

Build produces:

  • Binary RPM: ~/rpmbuild/RPMS/x86_64/package-name-1.0.0-1.el8.x86_64.rpm
  • Source RPM: ~/rpmbuild/SRPMS/package-name-1.0.0-1.el8.src.rpm

5. Install & Test

# Install the RPM
sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/package-name-1.0.0-1.el8.x86_64.rpm

# Or use yum/dnf for dependency resolution
sudo yum localinstall ~/rpmbuild/RPMS/x86_64/package-name-1.0.0-1.el8.x86_64.rpm

# Verify installation
rpm -q package-name

SPEC File Customization

For complex packages, customize the SPEC file:

  1. Review template: See references/spec-template.md
  2. Edit generated SPEC: Modify ~/rpmbuild/SPECS/package-name.spec
  3. Rebuild: rpmbuild -ba ~/rpmbuild/SPECS/package-name.spec

Common Customizations

Add dependencies:

BuildRequires: python3-devel openssl-devel
Requires: python3 openssl-libs

Custom install paths:

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}/package-name
install -m 755 myapp %{buildroot}%{_bindir}/
install -m 644 config.conf %{buildroot}%{_sysconfdir}/package-name/

Include documentation:

%files
%doc README.md LICENSE CHANGELOG.md
%{_bindir}/myapp

Build for Different CentOS Versions

Use mock for clean builds targeting specific versions:

# CentOS 7
mock -r centos-7-x86_64 package-name.spec

# CentOS 8
mock -r centos-8-x86_64 package-name.spec

# CentOS 9
mock -r centos-9-x86_64 package-name.spec

Environment Variables

VariableDefaultDescription
--------------------------------
RPM_BUILDER_NAMEOpenClaw BuilderBuilder name in changelog
RPM_BUILD_DIR~/rpmbuildCustom build directory

Troubleshooting

Build fails with "No such file or directory"

  • Check BuildRequires for missing tools
  • Verify source tarball extracts correctly

RPM installs but command not found

  • Ensure %files section includes correct paths
  • Check executable permissions in %install

Dependency errors during install

  • Add missing Requires entries to SPEC file
  • Use yum localinstall instead of rpm -i for auto-dependency resolution

Output Locations

After successful build:

  • Binary RPMs: ~/rpmbuild/RPMS//
  • Source RPM: ~/rpmbuild/SRPMS/
  • Build logs: ~/rpmbuild/BUILDLOGS/
  • SPEC files: ~/rpmbuild/SPECS/

Security Notes

  • Build directory defaults to ~/rpmbuild to avoid conflicts with system-wide builds
  • Builder identity is anonymized by default (uses OpenClaw Builder)
  • No personal information is embedded in generated RPMs unless explicitly configured

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 09:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 676 📥 325,569
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 71 📥 181,360
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 41,366