File cockpit-docker.spec of Package cockpit-docker

#
# spec file for package cockpit-docker
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define src_version 16
Name:           cockpit-docker
Version:        16
Release:        0%{?dist}
Summary:        Cockpit module for docker containers
License:        LGPL-2.1-or-later
Group:          System/Management
URL:            https://github.com/chabad360/cockpit-docker
Source:         %{name}-%{src_version}.tar.gz
# Generate package-lock.json with: npm install --package-lock-only --legacy-peer-deps
Source10:       package-lock.json
Source11:       node_modules.spec.inc
%include %_sourcedir/node_modules.spec.inc
Patch1:         systemd_path.patch
BuildArch:      noarch
BuildRequires:  appstream-glib
BuildRequires:  cockpit-devel >= 293
BuildRequires:  local-npm-registry
BuildRequires:  make
BuildRequires:  nodejs-devel
BuildRequires:  npm
Requires:       cockpit-bridge
Requires:       docker >= 24.0.0

%description
This is the Cockpit user interface for docker containers.
The Cockpit team from RedHat stopped caring in version 215,
declaring they going 'in favor' of podman.

%prep
%setup -q -n %{name}-%{src_version}
%patch -P 1 -p1
rm -rf package-lock.json node_modules
local-npm-registry %{_sourcedir} install --with=dev --legacy-peer-deps

%build
mkdir -p pkg
cp -r %{_datadir}/cockpit/devel/lib pkg/lib
sed -i -e 's|import { glob } from "glob"|import glob from "glob"|g' pkg/lib/cockpit-po-plugin.js
NODE_ENV=production npm run build

%install
export PREFIX=%{_prefix}
%make_install
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*

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

%files
%doc README.md
%license LICENSE dist/index.js.LEGAL.txt dist/index.css.LEGAL.txt
%{_datadir}/cockpit
%{_datadir}/metainfo/*

%changelog
openSUSE Build Service is sponsored by