Name: wsh-cockpit
Version: 5.0.150
Release: 1%{?dist}
Summary: Whitestar Shell Cockpit Module
License: GPL

Source0: https://whitestar.io/repo/wsh/5.0.014/5.0.150/wsh.tar.xz
Source1: https://whitestar.io/repo/wsh/5.0.014/5.0.150/wsh-node.tar.xz
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
%if 0%{?fedora}
BuildRequires: nodejs-devel
%endif
BuildRequires: nodejs
BuildRequires: make
BuildRequires: libappstream-glib
BuildRequires: gettext
%if 0%{?rhel} && 0%{?rhel} <= 8
BuildRequires: libappstream-glib-devel
%endif

# require wsh service to run
Requires: wsh >= 5.0.150, cockpit-bridge

%description
Whitestar Shell Cockpit Module

%prep
%autosetup -n wsh -a 1

%build
ESLINT=0 NODE_ENV=production PACKAGE_NAME=wsh make

%install
make install-cockpit DESTDIR=%{buildroot} PREFIX=/usr PACKAGE_NAME=wsh

# drop source maps, they are large and just for debugging
find %{buildroot}%{_datadir}/cockpit/ -name '*.map' | xargs --no-run-if-empty rm --verbose

%check
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*

# this can't be meaningfully tested during package build; tests happen through
# FMF (see plans/all.fmf) during package gating

%files
%doc README.md
%{_datadir}/cockpit/*
%{_datadir}/metainfo/*

%changelog