refactor(rpm): simplify to single /usr/bin/mistralrs-server binary
All checks were successful
poll-upstream / check (push) Successful in 1s
All checks were successful
poll-upstream / check (push) Successful in 1s
Drop the flavour-suffixed binary name, flavour-specific systemd unit names, and update-alternatives machinery. Install a plain mistralrs-server binary, a single mistralrs@.service template, and a default.conf.example. Flavour coexistence was over-engineered for the target audience. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,12 +36,7 @@ mistral.rs is a blazingly fast LLM inference engine written in Rust.
|
||||
This package provides the %{mistralrs_flavour} flavour, built with features:
|
||||
cuda, cudnn, and optionally flash-attn and nccl depending on flavour name.
|
||||
|
||||
The binary installs to %{_bindir}/mistralrs-server-%{mistralrs_flavour}.
|
||||
Use `update-alternatives --config mistralrs-server` to select the default
|
||||
/usr/bin/mistralrs-server symlink target.
|
||||
|
||||
%prep
|
||||
# Nothing to unpack; Source0 is the binary itself
|
||||
cp %{SOURCE0} .
|
||||
cp %{SOURCE1} .
|
||||
cp %{SOURCE2} .
|
||||
@@ -51,46 +46,30 @@ cp %{SOURCE2} .
|
||||
|
||||
%install
|
||||
install -D -m 0755 mistralrs-server-%{mistralrs_flavour} \
|
||||
%{buildroot}%{_bindir}/mistralrs-server-%{mistralrs_flavour}
|
||||
%{buildroot}%{_bindir}/mistralrs-server
|
||||
install -D -m 0644 mistralrs@.service \
|
||||
%{buildroot}%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
|
||||
%{buildroot}%{_unitdir}/mistralrs@.service
|
||||
install -D -m 0644 mistralrs@.conf.example \
|
||||
%{buildroot}%{_sysconfdir}/mistralrs/%{mistralrs_flavour}.conf.example
|
||||
%{buildroot}%{_sysconfdir}/mistralrs/default.conf.example
|
||||
|
||||
# Patch the unit to point at this flavour's binary
|
||||
sed -i "s|@BINARY@|%{_bindir}/mistralrs-server-%{mistralrs_flavour}|g" \
|
||||
%{buildroot}%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
|
||||
# Patch the unit to point at the binary
|
||||
sed -i "s|@BINARY@|%{_bindir}/mistralrs-server|g" \
|
||||
%{buildroot}%{_unitdir}/mistralrs@.service
|
||||
sed -i "s|@FLAVOUR@|%{mistralrs_flavour}|g" \
|
||||
%{buildroot}%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
|
||||
%{buildroot}%{_unitdir}/mistralrs@.service
|
||||
|
||||
%post
|
||||
# Register this flavour as an alternative for /usr/bin/mistralrs-server.
|
||||
# Priority = 10 for cuda13, 20 for cuda13-fa, 30 for cuda13-fa-nccl so that
|
||||
# "more featureful" wins by default. Consumers can override with
|
||||
# `update-alternatives --config mistralrs-server`.
|
||||
priority=10
|
||||
case "%{mistralrs_flavour}" in
|
||||
*nccl*) priority=30 ;;
|
||||
*fa*) priority=20 ;;
|
||||
esac
|
||||
update-alternatives --install /usr/bin/mistralrs-server mistralrs-server \
|
||||
%{_bindir}/mistralrs-server-%{mistralrs_flavour} "${priority}"
|
||||
|
||||
%systemd_post mistralrs-%{mistralrs_flavour}@.service
|
||||
%systemd_post mistralrs@.service
|
||||
|
||||
%preun
|
||||
%systemd_preun mistralrs-%{mistralrs_flavour}@.service
|
||||
%systemd_preun mistralrs@.service
|
||||
|
||||
%postun
|
||||
if [ $1 -eq 0 ]; then
|
||||
update-alternatives --remove mistralrs-server \
|
||||
%{_bindir}/mistralrs-server-%{mistralrs_flavour}
|
||||
fi
|
||||
%systemd_postun_with_restart mistralrs-%{mistralrs_flavour}@.service
|
||||
%systemd_postun_with_restart mistralrs@.service
|
||||
|
||||
%files
|
||||
%{_bindir}/mistralrs-server-%{mistralrs_flavour}
|
||||
%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
|
||||
%{_sysconfdir}/mistralrs/%{mistralrs_flavour}.conf.example
|
||||
%{_bindir}/mistralrs-server
|
||||
%{_unitdir}/mistralrs@.service
|
||||
%{_sysconfdir}/mistralrs/default.conf.example
|
||||
|
||||
%changelog
|
||||
|
||||
Reference in New Issue
Block a user