From 146b35f63aafd180c88ea975e2d7100c4a0ebb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoran=20Peri=C4=8Di=C4=87?= Date: Wed, 8 Apr 2026 13:38:35 +0200 Subject: [PATCH] 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 --- fetch-sources.sh | 42 ------------------------------------- turborepo-remote-cache.spec | 40 ++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 50 deletions(-) delete mode 100755 fetch-sources.sh diff --git a/fetch-sources.sh b/fetch-sources.sh deleted file mode 100755 index 9479519..0000000 --- a/fetch-sources.sh +++ /dev/null @@ -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-.tar.gz (upstream src) -# turborepo-remote-cache--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}" diff --git a/turborepo-remote-cache.spec b/turborepo-remote-cache.spec index 3b4a0ef..28eb548 100644 --- a/turborepo-remote-cache.spec +++ b/turborepo-remote-cache.spec @@ -1,6 +1,13 @@ %global npm_name turborepo-remote-cache %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 Version: 2.8.2 Release: 1%{?dist} @@ -9,9 +16,7 @@ License: MIT Group: Development/Tools URL: https://github.com/ducktors/turborepo-remote-cache -# Fetch both with ./fetch-sources.sh before rpmbuild -Source0: %{name}-%{version}.tar.gz -Source1: %{name}-%{version}-node_modules_prod.tar.gz +Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source10: %{name}.sysusers Source11: %{name}.service @@ -21,9 +26,11 @@ Source13: config.env BuildArch: noarch BuildRequires: systemd-rpm-macros +%if %{with service} BuildRequires: nodejs-devel BuildRequires: nodejs-npm BuildRequires: pnpm +%endif %description 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 the server. +%if %{with service} %package service Summary: Turborepo Remote Cache as a native Node.js systemd service Requires: %{name} = %{version}-%{release} @@ -46,15 +54,18 @@ Conflicts: %{name}-container %description service 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. +%endif %package container Summary: Turborepo Remote Cache as a Podman quadlet Requires: %{name} = %{version}-%{release} Requires: podman Requires: containers-common +%if %{with service} Conflicts: %{name}-service +%endif %description container Runs turborepo-remote-cache as a Podman container via quadlet, @@ -64,12 +75,17 @@ from /var/cache/turborepo-remote-cache on the host. %prep %setup -q -n %{name}-%{version} -# Drop the vendored node_modules from Source1 into the source tree -tar -xzf %{SOURCE1} %build -# Compile TypeScript → dist/. node_modules is already vendored. -pnpm build +%if %{with service} +# 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 %{__rm} -rf %{buildroot} @@ -82,6 +98,7 @@ install -m 640 %{SOURCE13} %{buildroot}%{_sysconfdir}/%{name}/config.env install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{name} +%if %{with service} # -service: install app tree to %{nodejs_sitelib}/turborepo-remote-cache install -d -m 755 %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pr dist node_modules package.json \ @@ -97,6 +114,7 @@ chmod 755 %{buildroot}%{nodejs_sitelib}/%{npm_name}/dist/cli.js # -service: systemd unit install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service +%endif # -container: quadlet install -p -D -m 644 %{SOURCE12} \ @@ -105,6 +123,7 @@ install -p -D -m 644 %{SOURCE12} \ %pre %sysusers_create_package %{name} %{SOURCE10} +%if %{with service} %post service %systemd_post %{name}.service @@ -113,6 +132,7 @@ install -p -D -m 644 %{SOURCE12} \ %postun service %systemd_postun_with_restart %{name}.service +%endif %files %defattr(-,root,root,-) @@ -121,6 +141,7 @@ install -p -D -m 644 %{SOURCE12} \ %config(noreplace) %attr(0640,root,turbo-cache) %{_sysconfdir}/%{name}/config.env %dir %attr(0750,turbo-cache,turbo-cache) %{_localstatedir}/cache/%{name} +%if %{with service} %files service %defattr(-,root,root,-) %{_unitdir}/%{name}.service @@ -129,6 +150,7 @@ install -p -D -m 644 %{SOURCE12} \ %{nodejs_sitelib}/%{npm_name}/node_modules %{nodejs_sitelib}/%{npm_name}/package.json %{_bindir}/%{name} +%endif %files container %defattr(-,root,root,-) @@ -138,5 +160,7 @@ install -p -D -m 644 %{SOURCE12} \ * Wed Apr 08 2026 Zoran Pericic - 2.8.2-1 - Initial package for ducktors/turborepo-remote-cache 2.8.2 - 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 - Listens on 127.0.0.1:3128; storage at /var/cache/turborepo-remote-cache