#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2023 Marcel Telka
#

%file% salt.xml

%patch% 01-optional-deps.patch
%patch% 02-test-docker.patch

%include-2%
COMPONENT_FMRI =		system/management/salt
COMPONENT_CLASSIFICATION =	System/Administration and Configuration

# This is a standalone application.  Since no other Python project depends on
# it we just provide single unversioned package.
SINGLE_PYTHON_VERSION = yes

# The installer is unable to install salt wheel due to some bug (see
# https://github.com/saltstack/salt/issues/65083) so we need to switch to
# pyproject_installer.  The pyproject_installer is used during bootstrap so we
# just pretend we are bootstapping and we will get the pyproject_installer
# based build and install.
PYTHON_BOOTSTRAP = yes
%include-3%
# Install salt.xml
COMPONENT_POST_INSTALL_ACTION += \
	$(MKDIR) $(PROTO_DIR)/lib/svc/manifest/application ; \
	$(CP) $(COMPONENT_DIR)/files/salt.xml $(PROTO_DIR)/lib/svc/manifest/application ; \

# This project does not support tox so we need to provide test requirements
# manually.
TEST_REQUIREMENTS += requirements/pytest.txt
%hook-manifest%
# All licenses apply (see the LICENSE file), but license-detector is unable to
# detect that
sed -i -e '/^COMPONENT_LICENSE/s/ OR / AND /g' Makefile
git add Makefile