{"id":15483,"library":"rpm-builder","title":"RPM Builder","description":"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.","status":"abandoned","version":"1.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/rictorres/node-rpm-builder","tags":["javascript","rpm","package","packager","build","builder"],"install":[{"cmd":"npm install rpm-builder","lang":"bash","label":"npm"},{"cmd":"yarn add rpm-builder","lang":"bash","label":"yarn"},{"cmd":"pnpm add rpm-builder","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This 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.","package":"rpmbuild","optional":false}],"imports":[{"note":"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.","wrong":"import buildRpm from 'rpm-builder';","symbol":"buildRpm","correct":"const buildRpm = require('rpm-builder');"},{"note":"The primary API surface is a function that takes options and a Node.js-style callback. It does not return a Promise.","symbol":"buildRpm (callback API)","correct":"require('rpm-builder')(options, callback);"}],"quickstart":{"code":"const buildRpm = require('rpm-builder');\nconst path = require('path');\nconst fs = require('fs');\n\n// Create some dummy files for the RPM\nconst tempDir = path.join(__dirname, 'temp_app_files');\nfs.mkdirSync(tempDir, { recursive: true });\nfs.writeFileSync(path.join(tempDir, 'app.js'), 'console.log(\"Hello RPM!\");');\nfs.writeFileSync(path.join(tempDir, 'config.json'), '{ \"port\": 3000 }');\n\nconst options = {\n  name: 'my-node-application',\n  version: '1.0.0',\n  release: '1',\n  summary: 'A simple Node.js application packaged as an RPM',\n  description: 'This RPM contains a basic Node.js script and a configuration file.',\n  group: 'Development/Tools',\n  license: 'MIT',\n  vendor: 'MyCompany',\n  buildArch: 'noarch',\n  files: [\n    { src: path.join(tempDir, 'app.js'), dest: '/usr/local/bin/my-app/app.js' },\n    { src: path.join(tempDir, 'config.json'), dest: '/etc/my-app/config.json' }\n  ],\n  // Optional: Set a temporary directory, will be cleaned up by default\n  tempDir: path.join(__dirname, 'rpm_build_tmp'),\n  // Optional: Keep the temporary directory for inspection after build\n  keepTemp: false\n};\n\nbuildRpm(options, function(err, rpmPath) {\n  // Clean up dummy files after attempting RPM build\n  fs.rmSync(tempDir, { recursive: true, force: true });\n  if (options.tempDir && !options.keepTemp) {\n    fs.rmSync(options.tempDir, { recursive: true, force: true });\n  }\n\n  if (err) {\n    console.error('Failed to build RPM:', err);\n    return;\n  }\n  console.log('Successfully built RPM:', rpmPath);\n  // Example: mv ' + rpmPath + ' /path/to/my/rpms/new-package.rpm\n});\n","lang":"javascript","description":"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."},"warnings":[{"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.","message":"The `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.","severity":"breaking","affected_versions":">=1.0.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Paths 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"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.","cause":"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.","error":"Error: spawn rpmbuild ENOENT"},{"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*.","cause":"Incorrect `src`, `dest`, or `cwd` path configurations within the `files` array. Relative paths are resolved against `process.cwd()` unless `cwd` is specified per file.","error":"Files are missing in the resulting RPM package, or they appear in the wrong directory structure."},{"fix":"Use the CommonJS `require` syntax: `const buildRpm = require('rpm-builder');` The package is not designed for native ESM environments.","cause":"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.","error":"TypeError: buildRpm is not a function"}],"ecosystem":"npm"}