Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
769c465c78 | ||
|
|
d5492bc305 |
||
|
|
8c93ed1606 | ||
|
|
b786cecdf9 | ||
|
|
0a0c95bab7 | ||
|
|
fdd68fbe2d | ||
|
|
aac86e3646 | ||
|
|
4e33741bc9 | ||
|
|
cd097f083d | ||
|
|
36224631ac | ||
|
|
64a93f15aa |
||
|
|
bbd74d8e40 |
10 changed files with 17 additions and 36 deletions
|
|
@ -1,12 +1,8 @@
|
||||||
# nodejs binary
|
# nodejs binary
|
||||||
%__nodejs %{_bindir}/node
|
%__nodejs %{_bindir}/node
|
||||||
|
|
||||||
# currently installed nodejs version
|
|
||||||
%nodejs_version %(%{__nodejs} -v | sed s/v//)
|
|
||||||
%_nodejs_major_version %(echo %{nodejs_version} | sed 's#^\\([0-9]\\+\\).*#\\1#')
|
|
||||||
|
|
||||||
# nodejs library directory
|
# nodejs library directory
|
||||||
%nodejs_sitelib %{_prefix}/lib/node_modules_%{_nodejs_major_version}
|
%nodejs_sitelib %{_prefix}/lib/node_modules
|
||||||
|
|
||||||
#arch specific library directory
|
#arch specific library directory
|
||||||
#for future-proofing only; we don't do multilib
|
#for future-proofing only; we don't do multilib
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ if [ -f "$TARBALL" ]; then
|
||||||
mv ${TARBALL_DIR}/*.tgz .
|
mv ${TARBALL_DIR}/*.tgz .
|
||||||
rm -rf ${TARBALL_DIR}
|
rm -rf ${TARBALL_DIR}
|
||||||
else
|
else
|
||||||
npm pack ${PACKAGE}
|
npm pack ${PACKAGE}@${VERSION}
|
||||||
fi
|
fi
|
||||||
tar xfz *.tgz
|
tar xfz *.tgz
|
||||||
cd package
|
cd package
|
||||||
|
|
@ -70,10 +70,10 @@ for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name
|
||||||
npm install --omit=dev --omit=optional
|
npm install --omit=dev --omit=optional
|
||||||
if [ $? -ge 1 ] ; then
|
if [ $? -ge 1 ] ; then
|
||||||
echo " ERROR WILL ROBINSON"
|
echo " ERROR WILL ROBINSON"
|
||||||
rm -rf node_modules
|
rm -rf node_modules
|
||||||
else
|
else
|
||||||
echo " Successful prod dependencies download"
|
echo " Successful prod dependencies download"
|
||||||
mv node_modules/ node_modules_prod
|
mv node_modules/ node_modules_prod
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
@ -102,15 +102,15 @@ for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name
|
||||||
echo " ERROR WILL ROBINSON"
|
echo " ERROR WILL ROBINSON"
|
||||||
else
|
else
|
||||||
echo " Successful dev dependencies download"
|
echo " Successful dev dependencies download"
|
||||||
mv node_modules/ node_modules_dev
|
mv node_modules/ node_modules_dev
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
if [ -d node_modules_prod ] ; then
|
if [ -d node_modules_prod ] ; then
|
||||||
tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz $(find . -type d -name node_modules_prod)
|
tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz --sort=name $(find . -type d -name node_modules_prod)
|
||||||
fi
|
fi
|
||||||
if [ -d node_modules_dev ] ; then
|
if [ -d node_modules_dev ] ; then
|
||||||
tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz $(find . -type d -name node_modules_dev)
|
tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz --sort=name $(find . -type d -name node_modules_dev)
|
||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
cp -v ${PACKAGE_SAFE}-${VERSION}* "${OUTPUT_DIR}"
|
cp -v ${PACKAGE_SAFE}-${VERSION}* "${OUTPUT_DIR}"
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ Source0007: nodejs-symlink-deps
|
||||||
Source0008: nodejs.attr
|
Source0008: nodejs.attr
|
||||||
Source0009: nodejs.prov
|
Source0009: nodejs.prov
|
||||||
Source0010: nodejs.req
|
Source0010: nodejs.req
|
||||||
Source0011: nodejs_abi.attr
|
|
||||||
Source0012: nodejs_abi.req
|
|
||||||
|
|
||||||
Source0111: nodejs-packaging-bundler
|
Source0111: nodejs-packaging-bundler
|
||||||
|
|
||||||
|
|
@ -29,9 +27,6 @@ Source0101: test.tar.gz
|
||||||
|
|
||||||
BuildRequires: python3
|
BuildRequires: python3
|
||||||
|
|
||||||
# Several of the macros require the /usr/bin/node command, so we need to
|
|
||||||
# ensure that it is present when packaging.
|
|
||||||
Requires: /usr/bin/node
|
|
||||||
Requires: redhat-rpm-config
|
Requires: redhat-rpm-config
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
|
@ -63,10 +58,8 @@ tar xvf test.tar.gz
|
||||||
%install
|
%install
|
||||||
install -Dpm0644 macros.nodejs %{buildroot}%{macrosdir}/macros.nodejs
|
install -Dpm0644 macros.nodejs %{buildroot}%{macrosdir}/macros.nodejs
|
||||||
install -Dpm0644 nodejs.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs.attr
|
install -Dpm0644 nodejs.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs.attr
|
||||||
install -Dpm0644 nodejs_abi.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_abi.attr
|
|
||||||
install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov
|
install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov
|
||||||
install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.req
|
install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.req
|
||||||
install -pm0755 nodejs_abi.req %{buildroot}%{_rpmconfigdir}/nodejs_abi.req
|
|
||||||
install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps
|
install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps
|
||||||
install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep
|
install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep
|
||||||
install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion
|
install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def symlink(source, dest):
|
def symlink(source, dest):
|
||||||
|
if os.path.sep in dest:
|
||||||
|
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||||
try:
|
try:
|
||||||
os.symlink(source, dest)
|
os.symlink(source, dest)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
|
||||||
10
nodejs.req
10
nodejs.req
|
|
@ -633,9 +633,9 @@ def has_only_bundled_dependencies(module_dir_path):
|
||||||
for basename in os.listdir(dependency_root_path)
|
for basename in os.listdir(dependency_root_path)
|
||||||
)
|
)
|
||||||
bundled_dependency_iter = (
|
bundled_dependency_iter = (
|
||||||
os.path.realpath(path)
|
path
|
||||||
for path in dependency_path_iter
|
for path in dependency_path_iter
|
||||||
if not os.path.islink(path) or path.startswith(module_root_path)
|
if not os.path.islink(path) or os.path.realpath(path).startswith(module_root_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
return any(bundled_dependency_iter)
|
return any(bundled_dependency_iter)
|
||||||
|
|
@ -659,9 +659,6 @@ def extract_dependencies(metadata_path, optional=False):
|
||||||
TypeError: Invalid dependency data type.
|
TypeError: Invalid dependency data type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if has_only_bundled_dependencies(os.path.dirname(metadata_path)):
|
|
||||||
return # skip
|
|
||||||
|
|
||||||
# Read metadata
|
# Read metadata
|
||||||
try:
|
try:
|
||||||
with open(metadata_path, mode="r") as metadata_file:
|
with open(metadata_path, mode="r") as metadata_file:
|
||||||
|
|
@ -676,6 +673,9 @@ def extract_dependencies(metadata_path, optional=False):
|
||||||
except KeyError: # NodeJS engine version unspecified
|
except KeyError: # NodeJS engine version unspecified
|
||||||
yield rpm_format("nodejs(engine)")
|
yield rpm_format("nodejs(engine)")
|
||||||
|
|
||||||
|
if has_only_bundled_dependencies(os.path.dirname(metadata_path)):
|
||||||
|
return # skip
|
||||||
|
|
||||||
# Report listed dependencies
|
# Report listed dependencies
|
||||||
kind = "optionalDependencies" if optional else "dependencies"
|
kind = "optionalDependencies" if optional else "dependencies"
|
||||||
container = metadata.get(kind, {})
|
container = metadata.get(kind, {})
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
%__nodejs_native_requires %{_rpmconfigdir}/nodejs_abi.req
|
|
||||||
%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Get the ABI version
|
|
||||||
abi_version=$(/usr/bin/node -p process.versions.modules)
|
|
||||||
|
|
||||||
# Write out the Virtual Requires
|
|
||||||
echo "nodejs(abi) = ${abi_version}"
|
|
||||||
|
|
||||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
||||||
SHA512 (test.tar.gz) = dfbda67b8741f1ca36bf63b2e842f81ba07381b3d92e75fa7e29f8e456543b4cae55e95785902f31a14ae4d0b7e89161ba04c0c10c2fff617b4ae9607c91e599
|
SHA512 (test.tar.gz) = 04c1e741caa124c12b1070b6411d1a9fef9b328e15ec274170b7dcd9d26d9a6f9db21d6722ce0b39d0b693f237398065dd127b95a9a6e4947e182db2e3fad6f2
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
|
(nodejs(engine) >= 6 with nodejs(engine) < 10)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
|
(nodejs(engine) >= 6 with nodejs(engine) < 10)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue