Switch to online pnpm build, add --without service bcond
- Source0 now points at the GitHub tag tarball so spectool -g can fetch it; drops fetch-sources.sh - %build runs pnpm install --frozen-lockfile --ignore-scripts, then pnpm exec tsc (bypasses upstream lint), then pnpm prune --prod - Guard all -service bits behind %bcond_without service so offline builds can produce base + -container with --without service - Base and -container subpackages never need network
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Fetch upstream source tarball and vendor production node_modules.
|
|
||||||
#
|
|
||||||
# Produces two files next to the spec:
|
|
||||||
# turborepo-remote-cache-<VERSION>.tar.gz (upstream src)
|
|
||||||
# turborepo-remote-cache-<VERSION>-node_modules_prod.tar.gz
|
|
||||||
#
|
|
||||||
# Requires: curl, tar, pnpm, node
|
|
||||||
#
|
|
||||||
# Run this before `rpmbuild` whenever VERSION changes.
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
VERSION="${1:-2.8.2}"
|
|
||||||
PKG="turborepo-remote-cache"
|
|
||||||
UPSTREAM="https://github.com/ducktors/${PKG}"
|
|
||||||
|
|
||||||
SPEC_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
WORK="$(mktemp -d)"
|
|
||||||
trap 'rm -rf "$WORK"' EXIT
|
|
||||||
|
|
||||||
SRC_TARBALL="${PKG}-${VERSION}.tar.gz"
|
|
||||||
DEPS_TARBALL="${PKG}-${VERSION}-node_modules_prod.tar.gz"
|
|
||||||
|
|
||||||
echo ">>> Fetching ${UPSTREAM}/archive/refs/tags/v${VERSION}.tar.gz"
|
|
||||||
curl -fsSL -o "${SPEC_DIR}/${SRC_TARBALL}" \
|
|
||||||
"${UPSTREAM}/archive/refs/tags/v${VERSION}.tar.gz"
|
|
||||||
|
|
||||||
echo ">>> Extracting source to ${WORK}"
|
|
||||||
tar -C "${WORK}" -xzf "${SPEC_DIR}/${SRC_TARBALL}"
|
|
||||||
cd "${WORK}/${PKG}-${VERSION}"
|
|
||||||
|
|
||||||
echo ">>> Installing production dependencies with pnpm"
|
|
||||||
pnpm install --prod --frozen-lockfile --ignore-scripts
|
|
||||||
|
|
||||||
echo ">>> Packing node_modules into ${DEPS_TARBALL}"
|
|
||||||
tar -czf "${SPEC_DIR}/${DEPS_TARBALL}" node_modules
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Done:"
|
|
||||||
echo " ${SPEC_DIR}/${SRC_TARBALL}"
|
|
||||||
echo " ${SPEC_DIR}/${DEPS_TARBALL}"
|
|
||||||
@@ -1,6 +1,13 @@
|
|||||||
%global npm_name turborepo-remote-cache
|
%global npm_name turborepo-remote-cache
|
||||||
%global __brp_mangle_shebangs_exclude_from ^%{nodejs_sitelib}/%{npm_name}/.*$
|
%global __brp_mangle_shebangs_exclude_from ^%{nodejs_sitelib}/%{npm_name}/.*$
|
||||||
|
|
||||||
|
# Build the native Node.js -service subpackage by default.
|
||||||
|
# Disable when building in a network-less environment (e.g. stock mock):
|
||||||
|
# rpmbuild -bb --without service turborepo-remote-cache.spec
|
||||||
|
# mock --without=service ...
|
||||||
|
# The base and -container subpackages never need network.
|
||||||
|
%bcond_without service
|
||||||
|
|
||||||
Name: turborepo-remote-cache
|
Name: turborepo-remote-cache
|
||||||
Version: 2.8.2
|
Version: 2.8.2
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
@@ -9,9 +16,7 @@ License: MIT
|
|||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
URL: https://github.com/ducktors/turborepo-remote-cache
|
URL: https://github.com/ducktors/turborepo-remote-cache
|
||||||
|
|
||||||
# Fetch both with ./fetch-sources.sh <version> before rpmbuild
|
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
Source0: %{name}-%{version}.tar.gz
|
|
||||||
Source1: %{name}-%{version}-node_modules_prod.tar.gz
|
|
||||||
|
|
||||||
Source10: %{name}.sysusers
|
Source10: %{name}.sysusers
|
||||||
Source11: %{name}.service
|
Source11: %{name}.service
|
||||||
@@ -21,9 +26,11 @@ Source13: config.env
|
|||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: systemd-rpm-macros
|
BuildRequires: systemd-rpm-macros
|
||||||
|
%if %{with service}
|
||||||
BuildRequires: nodejs-devel
|
BuildRequires: nodejs-devel
|
||||||
BuildRequires: nodejs-npm
|
BuildRequires: nodejs-npm
|
||||||
BuildRequires: pnpm
|
BuildRequires: pnpm
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Turborepo Remote Cache is a self-hosted implementation of the Vercel
|
Turborepo Remote Cache is a self-hosted implementation of the Vercel
|
||||||
@@ -37,6 +44,7 @@ Install either turborepo-remote-cache-service (native Node.js) or
|
|||||||
turborepo-remote-cache-container (Podman quadlet) to actually run
|
turborepo-remote-cache-container (Podman quadlet) to actually run
|
||||||
the server.
|
the server.
|
||||||
|
|
||||||
|
%if %{with service}
|
||||||
%package service
|
%package service
|
||||||
Summary: Turborepo Remote Cache as a native Node.js systemd service
|
Summary: Turborepo Remote Cache as a native Node.js systemd service
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
@@ -46,15 +54,18 @@ Conflicts: %{name}-container
|
|||||||
|
|
||||||
%description service
|
%description service
|
||||||
Runs turborepo-remote-cache as a native Node.js process under systemd,
|
Runs turborepo-remote-cache as a native Node.js process under systemd,
|
||||||
using the pnpm-vendored production dependencies shipped with this
|
using the pnpm-vendored production dependencies built into this
|
||||||
package. Listens on 127.0.0.1:3128 by default.
|
package. Listens on 127.0.0.1:3128 by default.
|
||||||
|
%endif
|
||||||
|
|
||||||
%package container
|
%package container
|
||||||
Summary: Turborepo Remote Cache as a Podman quadlet
|
Summary: Turborepo Remote Cache as a Podman quadlet
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
Requires: podman
|
Requires: podman
|
||||||
Requires: containers-common
|
Requires: containers-common
|
||||||
|
%if %{with service}
|
||||||
Conflicts: %{name}-service
|
Conflicts: %{name}-service
|
||||||
|
%endif
|
||||||
|
|
||||||
%description container
|
%description container
|
||||||
Runs turborepo-remote-cache as a Podman container via quadlet,
|
Runs turborepo-remote-cache as a Podman container via quadlet,
|
||||||
@@ -64,12 +75,17 @@ from /var/cache/turborepo-remote-cache on the host.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{version}
|
%setup -q -n %{name}-%{version}
|
||||||
# Drop the vendored node_modules from Source1 into the source tree
|
|
||||||
tar -xzf %{SOURCE1}
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Compile TypeScript → dist/. node_modules is already vendored.
|
%if %{with service}
|
||||||
pnpm build
|
# Pull all deps (dev + prod) so tsc is available. Network required.
|
||||||
|
pnpm install --frozen-lockfile --ignore-scripts
|
||||||
|
# Compile TypeScript directly (bypass upstream `pnpm build` which also
|
||||||
|
# runs lint — lint is a dev-time check we don't care about at package build).
|
||||||
|
pnpm exec tsc -p ./tsconfig.json
|
||||||
|
# Drop dev dependencies before shipping.
|
||||||
|
pnpm prune --prod --ignore-scripts
|
||||||
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%{__rm} -rf %{buildroot}
|
%{__rm} -rf %{buildroot}
|
||||||
@@ -82,6 +98,7 @@ install -m 640 %{SOURCE13} %{buildroot}%{_sysconfdir}/%{name}/config.env
|
|||||||
|
|
||||||
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{name}
|
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{name}
|
||||||
|
|
||||||
|
%if %{with service}
|
||||||
# -service: install app tree to %{nodejs_sitelib}/turborepo-remote-cache
|
# -service: install app tree to %{nodejs_sitelib}/turborepo-remote-cache
|
||||||
install -d -m 755 %{buildroot}%{nodejs_sitelib}/%{npm_name}
|
install -d -m 755 %{buildroot}%{nodejs_sitelib}/%{npm_name}
|
||||||
cp -pr dist node_modules package.json \
|
cp -pr dist node_modules package.json \
|
||||||
@@ -97,6 +114,7 @@ chmod 755 %{buildroot}%{nodejs_sitelib}/%{npm_name}/dist/cli.js
|
|||||||
|
|
||||||
# -service: systemd unit
|
# -service: systemd unit
|
||||||
install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service
|
install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service
|
||||||
|
%endif
|
||||||
|
|
||||||
# -container: quadlet
|
# -container: quadlet
|
||||||
install -p -D -m 644 %{SOURCE12} \
|
install -p -D -m 644 %{SOURCE12} \
|
||||||
@@ -105,6 +123,7 @@ install -p -D -m 644 %{SOURCE12} \
|
|||||||
%pre
|
%pre
|
||||||
%sysusers_create_package %{name} %{SOURCE10}
|
%sysusers_create_package %{name} %{SOURCE10}
|
||||||
|
|
||||||
|
%if %{with service}
|
||||||
%post service
|
%post service
|
||||||
%systemd_post %{name}.service
|
%systemd_post %{name}.service
|
||||||
|
|
||||||
@@ -113,6 +132,7 @@ install -p -D -m 644 %{SOURCE12} \
|
|||||||
|
|
||||||
%postun service
|
%postun service
|
||||||
%systemd_postun_with_restart %{name}.service
|
%systemd_postun_with_restart %{name}.service
|
||||||
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
@@ -121,6 +141,7 @@ install -p -D -m 644 %{SOURCE12} \
|
|||||||
%config(noreplace) %attr(0640,root,turbo-cache) %{_sysconfdir}/%{name}/config.env
|
%config(noreplace) %attr(0640,root,turbo-cache) %{_sysconfdir}/%{name}/config.env
|
||||||
%dir %attr(0750,turbo-cache,turbo-cache) %{_localstatedir}/cache/%{name}
|
%dir %attr(0750,turbo-cache,turbo-cache) %{_localstatedir}/cache/%{name}
|
||||||
|
|
||||||
|
%if %{with service}
|
||||||
%files service
|
%files service
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
@@ -129,6 +150,7 @@ install -p -D -m 644 %{SOURCE12} \
|
|||||||
%{nodejs_sitelib}/%{npm_name}/node_modules
|
%{nodejs_sitelib}/%{npm_name}/node_modules
|
||||||
%{nodejs_sitelib}/%{npm_name}/package.json
|
%{nodejs_sitelib}/%{npm_name}/package.json
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
|
%endif
|
||||||
|
|
||||||
%files container
|
%files container
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
@@ -138,5 +160,7 @@ install -p -D -m 644 %{SOURCE12} \
|
|||||||
* Wed Apr 08 2026 Zoran Pericic <zpericic@netst.org> - 2.8.2-1
|
* Wed Apr 08 2026 Zoran Pericic <zpericic@netst.org> - 2.8.2-1
|
||||||
- Initial package for ducktors/turborepo-remote-cache 2.8.2
|
- Initial package for ducktors/turborepo-remote-cache 2.8.2
|
||||||
- Split into -service (native Node.js) and -container (Podman quadlet)
|
- Split into -service (native Node.js) and -container (Podman quadlet)
|
||||||
|
- -service build pulls deps online with pnpm; disable with
|
||||||
|
--without service when network is unavailable
|
||||||
- Dynamic sysusers turbo-cache user
|
- Dynamic sysusers turbo-cache user
|
||||||
- Listens on 127.0.0.1:3128; storage at /var/cache/turborepo-remote-cache
|
- Listens on 127.0.0.1:3128; storage at /var/cache/turborepo-remote-cache
|
||||||
|
|||||||
Reference in New Issue
Block a user