Registry / devops / rpm-builder

rpm-builder

JSON →
library1.2.1jsnpmunverified

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-builder
INSTALL
IMPORT
SIG · RPM-BUILDER
R
rpm-builder
devopsjavascriptv1.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

buildRpm
const buildRpm = require('rpm-builder');
import buildRpm from 'rpm-builder';
The package is CommonJS-only and exports a single function as its module.exports. Direct ESM import syntax will not work without a CommonJS wrapper or transpilation.
buildRpm (callback API)
require('rpm-builder')(options, callback);
The primary API surface is a function that takes options and a Node.js-style callback. It does not return a Promise.

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.

const buildRpm = require('rpm-builder'); const path = require('path'); const fs = require('fs'); // Create some dummy files for the RPM const tempDir = path.join(__dirname, 'temp_app_files'); fs.mkdirSync(tempDir, { recursive: true }); fs.writeFileSync(path.join(tempDir, 'app.js'), 'console.log("Hello RPM!");'); fs.writeFileSync(path.join(tempDir, 'config.json'), '{ "port": 3000 }'); const options = { name: 'my-node-application', version: '1.0.0', release: '1', summary: 'A simple Node.js application packaged as an RPM', description: 'This RPM contains a basic Node.js script and a configuration file.', group: 'Development/Tools', license: 'MIT', vendor: 'MyCompany', buildArch: 'noarch', files: [ { src: path.join(tempDir, 'app.js'), dest: '/usr/local/bin/my-app/app.js' }, { src: path.join(tempDir, 'config.json'), dest: '/etc/my-app/config.json' } ], // Optional: Set a temporary directory, will be cleaned up by default tempDir: path.join(__dirname, 'rpm_build_tmp'), // Optional: Keep the temporary directory for inspection after build keepTemp: false }; buildRpm(options, function(err, rpmPath) { // Clean up dummy files after attempting RPM build fs.rmSync(tempDir, { recursive: true, force: true }); if (options.tempDir && !options.keepTemp) { fs.rmSync(options.tempDir, { recursive: true, force: true }); } if (err) { console.error('Failed to build RPM:', err); return; } console.log('Successfully built RPM:', rpmPath); // Example: mv ' + rpmPath + ' /path/to/my/rpms/new-package.rpm });
Debug
Known issues
breakingThe `rpm-builder` package is effectively abandoned, with no updates in over six years. This means there will be no future security fixes, bug patches, or feature enhancements. Use in production environments without careful security review and mitigation strategies is not recommended.
fix
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.
affects: >=1.0.0
gotchaThis library critically depends on the `rpmbuild` utility being installed and available in the system's PATH. If `rpmbuild` is not found, the build process will fail with an 'ENOENT' error (No such file or directory) during the `spawn` call.
fix
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.
affects: >=1.0.0
gotchaPaths specified in `files` objects (`src`, `dest`) and `excludeFiles` are relative to the *process's current working directory* (`process.cwd()`) by default, unless a `cwd` property is explicitly set on a specific file entry. Misunderstanding this can lead to files not being included or being placed incorrectly in the RPM.
fix
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.
affects: >=1.0.0
gotchaThe `tempDir` option defaults to a dynamically generated directory and is automatically cleaned up after the RPM build completes (unless `keepTemp` is `true`). If the build fails or you need to inspect the intermediate build artifacts, the temporary directory will be gone.
fix
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.
affects: >=1.0.0
Errors
Common errors & fixes
Error: spawn rpmbuild ENOENT
The `rpmbuild` command-line utility, which `rpm-builder` shells out to, is not installed on the system or is not found in the system's PATH.
fix
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.
Files are missing in the resulting RPM package, or they appear in the wrong directory structure.
Incorrect `src`, `dest`, or `cwd` path configurations within the `files` array. Relative paths are resolved against `process.cwd()` unless `cwd` is specified per file.
fix
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*.
TypeError: buildRpm is not a function
Attempting to use `rpm-builder` with ESM `import` syntax (`import buildRpm from 'rpm-builder';`) in an environment that does not transpile CommonJS modules, or when assuming it exports a default function for ESM.
fix
Use the CommonJS `require` syntax: `const buildRpm = require('rpm-builder');` The package is not designed for native ESM environments.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
rpmbuildrequiredThis Node.js library acts as a wrapper for the system's 'rpmbuild' utility, which must be pre-installed on the host system where RPM packages are being built.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
rpm-builder — npm install rpm-builder · libregistry