## START: Set by rpmautospec ## (rpmautospec version 0.8.4) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %global npm_name npm2rpm Name: nodejs-npm2rpm-fedora Version: 8.0.0 Release: %autorelease Summary: Convert npm packages to rpm packages License: GPL-3.0 Group: Development/Libraries URL: https://github.com/theforeman/npm2rpm#readme Source0: https://registry.npmjs.org/npm2rpm/-/npm2rpm-%{version}.tgz Source1: https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz Source2: https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz Source3: https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz Source4: https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz Source5: https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz Source6: https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz Source7: https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz Source8: https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz Source9: https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz Source10: https://registry.npmjs.org/colors/-/colors-1.4.0.tgz Source11: https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz Source12: https://registry.npmjs.org/commander/-/commander-2.20.3.tgz Source13: https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz Source14: https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz Source15: https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz Source16: https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz Source17: https://registry.npmjs.org/extend/-/extend-3.0.2.tgz Source18: https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz Source19: https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz Source20: https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz Source21: https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz Source22: https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz Source23: https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz Source24: https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz Source25: https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz Source26: https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz Source27: https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz Source28: https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz Source29: https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz Source30: https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz Source31: https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz Source32: https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz Source33: https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz Source34: https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz Source35: https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz Source36: https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz Source37: https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz Source38: https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz Source39: https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz Source40: https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz Source41: https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz Source42: https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz Source43: https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz Source44: https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz Source45: https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz Source46: https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz Source47: https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz Source48: https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz Source49: https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz Source50: https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz Source51: https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz Source52: https://registry.npmjs.org/psl/-/psl-1.15.0.tgz Source53: https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz Source54: https://registry.npmjs.org/qs/-/qs-6.5.5.tgz Source55: https://registry.npmjs.org/request/-/request-2.88.2.tgz Source56: https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz Source57: https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz Source58: https://registry.npmjs.org/semver/-/semver-5.7.2.tgz Source59: https://registry.npmjs.org/semver/-/semver-7.8.5.tgz Source60: https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz Source61: https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz Source62: https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz Source63: https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz Source64: https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz Source65: https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz Source66: https://registry.npmjs.org/tar/-/tar-4.4.19.tgz Source67: https://registry.npmjs.org/tmp/-/tmp-0.0.28.tgz Source68: https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz Source69: https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz Source70: https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz Source71: https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz Source72: https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz Source73: https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz Source74: https://registry.npmjs.org/verror/-/verror-1.10.0.tgz Source75: https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz Source76: https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz Source77: https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz Source78: nodejs-npm2rpm-%{version}-package-lock.json Patch0: fedora-spec.patch BuildRequires: nodejs-devel BuildRequires: npm >= 7 BuildRequires: nodejs-packaging # The prep section runs node directly, so this is needed unconditionally. It # also works around https://issues.redhat.com/browse/RHEL-137712 on RHEL 10 # before 10.3, where the nodejs major version macro does not resolve without # node in the buildroot. BuildRequires: /usr/bin/node BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch Provides: npm(%{npm_name}) = %{version} Provides: bundled(npm(ajv)) = 6.15.0 Provides: bundled(npm(asn1)) = 0.2.6 Provides: bundled(npm(assert-plus)) = 1.0.0 Provides: bundled(npm(asynckit)) = 0.4.0 Provides: bundled(npm(aws-sign2)) = 0.7.0 Provides: bundled(npm(aws4)) = 1.13.2 Provides: bundled(npm(bcrypt-pbkdf)) = 1.0.2 Provides: bundled(npm(caseless)) = 0.12.0 Provides: bundled(npm(chownr)) = 1.1.4 Provides: bundled(npm(colors)) = 1.4.0 Provides: bundled(npm(combined-stream)) = 1.0.8 Provides: bundled(npm(commander)) = 2.20.3 Provides: bundled(npm(core-util-is)) = 1.0.2 Provides: bundled(npm(dashdash)) = 1.14.1 Provides: bundled(npm(delayed-stream)) = 1.0.0 Provides: bundled(npm(ecc-jsbn)) = 0.1.2 Provides: bundled(npm(extend)) = 3.0.2 Provides: bundled(npm(extsprintf)) = 1.3.0 Provides: bundled(npm(fast-deep-equal)) = 3.1.3 Provides: bundled(npm(fast-json-stable-stringify)) = 2.1.0 Provides: bundled(npm(forever-agent)) = 0.6.1 Provides: bundled(npm(form-data)) = 2.3.3 Provides: bundled(npm(fs-minipass)) = 1.2.7 Provides: bundled(npm(function-bind)) = 1.1.2 Provides: bundled(npm(getpass)) = 0.1.7 Provides: bundled(npm(handlebars)) = 4.7.9 Provides: bundled(npm(har-schema)) = 2.0.0 Provides: bundled(npm(har-validator)) = 5.1.5 Provides: bundled(npm(hasown)) = 2.0.4 Provides: bundled(npm(hosted-git-info)) = 4.1.0 Provides: bundled(npm(http-signature)) = 1.2.0 Provides: bundled(npm(is-core-module)) = 2.16.2 Provides: bundled(npm(is-typedarray)) = 1.0.0 Provides: bundled(npm(isstream)) = 0.1.2 Provides: bundled(npm(jsbn)) = 0.1.1 Provides: bundled(npm(json-schema)) = 0.4.0 Provides: bundled(npm(json-schema-traverse)) = 0.4.1 Provides: bundled(npm(json-stringify-safe)) = 5.0.1 Provides: bundled(npm(jsprim)) = 1.4.2 Provides: bundled(npm(lru-cache)) = 6.0.0 Provides: bundled(npm(mime-db)) = 1.52.0 Provides: bundled(npm(mime-types)) = 2.1.35 Provides: bundled(npm(minimist)) = 1.2.8 Provides: bundled(npm(minipass)) = 2.9.0 Provides: bundled(npm(minizlib)) = 1.3.3 Provides: bundled(npm(mkdirp)) = 0.5.6 Provides: bundled(npm(neo-async)) = 2.6.2 Provides: bundled(npm(normalize-package-data)) = 3.0.3 Provides: bundled(npm(oauth-sign)) = 0.9.0 Provides: bundled(npm(os-tmpdir)) = 1.0.2 Provides: bundled(npm(performance-now)) = 2.1.0 Provides: bundled(npm(psl)) = 1.15.0 Provides: bundled(npm(punycode)) = 2.3.1 Provides: bundled(npm(qs)) = 6.5.5 Provides: bundled(npm(request)) = 2.88.2 Provides: bundled(npm(safe-buffer)) = 5.2.1 Provides: bundled(npm(safer-buffer)) = 2.1.2 Provides: bundled(npm(semver)) = 5.7.2 Provides: bundled(npm(semver)) = 7.8.5 Provides: bundled(npm(source-map)) = 0.6.1 Provides: bundled(npm(spdx-correct)) = 3.2.0 Provides: bundled(npm(spdx-exceptions)) = 2.5.0 Provides: bundled(npm(spdx-expression-parse)) = 3.0.1 Provides: bundled(npm(spdx-license-ids)) = 3.0.23 Provides: bundled(npm(sshpk)) = 1.18.0 Provides: bundled(npm(tar)) = 4.4.19 Provides: bundled(npm(tmp)) = 0.0.28 Provides: bundled(npm(tough-cookie)) = 2.5.0 Provides: bundled(npm(tunnel-agent)) = 0.6.0 Provides: bundled(npm(tweetnacl)) = 0.14.5 Provides: bundled(npm(uri-js)) = 4.4.1 Provides: bundled(npm(uuid)) = 3.4.0 Provides: bundled(npm(validate-npm-package-license)) = 3.0.4 Provides: bundled(npm(verror)) = 1.10.0 Provides: bundled(npm(wordwrap)) = 1.0.0 Provides: bundled(npm(yallist)) = 3.1.1 Provides: bundled(npm(yallist)) = 4.0.0 Requires: nodejs AutoReq: no AutoProv: no %define npm_cache_dir npm_cache_%{name}-%{version}-%{release} %description %{summary} %prep # There is deliberately no setup section: every Source is consumed explicitly # below, so the build runs in the top-level build directory. Do not name the # setup macro here even in a comment - rpm expands macros inside comments, and # on rpm 6 that runs it, unpacking Source0 and cd-ing into a directory that # does not exist. mkdir -p %{npm_cache_dir} # npm ci installs the tree recorded in the lockfile: every entry carries a # resolved URL and an integrity hash, and npm serves the tarballs from the # cache primed here by content hash. No registry access is needed. for src in %{sources}; do case "$src" in *.tgz) npm cache add --cache %{npm_cache_dir} "$src" ;; *-package-lock.json) cp "$src" package-lock.json ;; *) echo "unexpected Source, do not know how to handle it: $src" >&2; exit 1 ;; esac done # Derive package.json from the lockfile so the two cannot disagree. node -e ' const fs = require("fs"); const lock = JSON.parse(fs.readFileSync("package-lock.json")); fs.writeFileSync("package.json", JSON.stringify({ name: lock.name, version: lock.version, dependencies: lock.packages[""].dependencies }, null, 2) + "\n"); ' # Extract Source0 to allow patching PREP_TEMP=$(mktemp -d) tar xzf %{SOURCE0} -C $PREP_TEMP pushd $PREP_TEMP # Apply patches and remove binaries here if needed %patch -p1 -P0 popd tar czf %{_builddir}/%{npm_name}-%{version}.tgz -C $PREP_TEMP package rm -rf $PREP_TEMP %build npm ci --offline --cache %{_builddir}/%{npm_cache_dir} --omit optional # Re-install the (possibly patched) main package over the lockfile version npm install --offline --cache %{_builddir}/%{npm_cache_dir} "%{_builddir}/%{npm_name}-%{version}.tgz" # Extract bundled dependency licenses find node_modules -name "package.json" -exec jq -r '.license | strings' {} \; > npm2rpm-8.0.0-bundled-licenses.txt find node_modules -name "package.json" -exec jq -r '.license | objects | .type' {} \; >> npm2rpm-8.0.0-bundled-licenses.txt 2>/dev/null find node_modules -name "package.json" -exec jq -r '.licenses[]? | .type' {} \; >> npm2rpm-8.0.0-bundled-licenses.txt 2>/dev/null sort -u -o npm2rpm-8.0.0-bundled-licenses.txt npm2rpm-8.0.0-bundled-licenses.txt %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pfr node_modules/%{npm_name}/node_modules %{buildroot}%{nodejs_sitelib}/%{npm_name} # npm creates a scope directory for every scope named in the lockfile, including # scopes whose packages were all omitted, which leaves empty dirs behind. # -delete implies -depth, so nested empties go bottom-up in a single pass. find %{buildroot}%{nodejs_sitelib}/%{npm_name} -type d -empty -delete cp -pfr node_modules/%{npm_name}/bin %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pfr node_modules/%{npm_name}/bundle.mustache %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pfr node_modules/%{npm_name}/lib %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pfr node_modules/%{npm_name}/package.json %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pfr node_modules/%{npm_name}/single.mustache %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pfr node_modules/%{npm_name}/test %{buildroot}%{nodejs_sitelib}/%{npm_name} mkdir -p %{buildroot}%{_bindir}/ chmod 0755 %{buildroot}%{nodejs_sitelib}/%{npm_name}/bin/npm2rpm.js ln -sf %{nodejs_sitelib}/%{npm_name}/bin/npm2rpm.js %{buildroot}%{_bindir}/npm2rpm chmod 0755 %{buildroot}%{nodejs_sitelib}/%{npm_name}/bin/packagejson2rpm.js ln -sf %{nodejs_sitelib}/%{npm_name}/bin/packagejson2rpm.js %{buildroot}%{_bindir}/packagejson2rpm %check npm test %clean rm -rf %{buildroot} %{npm_cache_dir} %files %{nodejs_sitelib}/%{npm_name} %{_bindir}/npm2rpm %{_bindir}/packagejson2rpm %license node_modules/%{npm_name}/LICENSE %license npm2rpm-8.0.0-bundled-licenses.txt %doc node_modules/%{npm_name}/README.md %doc node_modules/%{npm_name}/RELEASING.md %changelog ## START: Generated by rpmautospec * Fri Aug 14 2026 John Doe - 8.0.0-1 - Uncommitted changes ## END: Generated by rpmautospec