RPM Builder is a Node.js library designed to create Red Hat Package Manager (RPM) packages programmatically. It wraps the underlying `rpmbuild` system utility, abstracting away the complexities of direct command-line execution and spec file generation. The package allows developers to define package metadata, specify files, handle glob patterns, and exclude files using a simple JavaScript API. The current stable version is 1.2.1, released over six years ago, and the package is effectively abandoned, meaning no further updates, feature enhancements, or security patches are expected. Its primary differentiator is providing a native Node.js interface for RPM creation, which can be integrated into CI/CD pipelines for projects requiring RPM distribution artifacts. It simplifies the packaging process compared to manually creating `.spec` files and executing `rpmbuild` commands.
npm install rpm-builderVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `rpm-builder` to create a basic RPM package containing a Node.js application script and a configuration file, including necessary temporary file setup and cleanup.
Consider migrating to a more actively maintained RPM packaging solution or fork the repository and maintain it yourself. Be aware of potential compatibility issues with newer Node.js versions or system `rpmbuild` utilities.
Ensure `rpmbuild` is installed on your operating system. For Fedora/CentOS use `yum install rpmdevtools` or `dnf install rpmdevtools`. For Ubuntu/Debian use `apt-get install rpm`. On macOS, use Homebrew (`brew install rpm`) and configure it correctly.
Always use `path.join(__dirname, 'your/relative/path')` for `src` if files are relative to your script's location, or ensure `process.cwd()` is set correctly. For fine-grained control, utilize the `cwd` property within individual `files` array entries.
Set the `keepTemp: true` option in your `buildRpm` configuration to retain the temporary build directory after the process finishes. This is useful for debugging issues with file placement or `rpmbuild` behavior. Remember to manually clean up the temporary directory if `keepTemp` is enabled.
Install `rpmbuild` on your operating system. For Fedora/CentOS, run `sudo yum install rpmdevtools` or `sudo dnf install rpmdevtools`. For Ubuntu/Debian, run `sudo apt-get install rpm`. On macOS, install via Homebrew (`brew install rpm`) and ensure it's in your PATH.
Double-check all paths in your `files` array. Ensure `src` paths correctly point to existing files/globs relative to where your Node.js script is executed or specify a `cwd` for each file entry. Verify `dest` paths reflect the desired target location *within the RPM package*.
Use the CommonJS `require` syntax: `const buildRpm = require('rpm-builder');` The package is not designed for native ESM environments.