Update to ver 1.4.1

- Update BuiildRequires to use ansible-core on RHEL > 8.8
- Move RHEL related code into an include for spec readability
- Update role to version 1.4.1 to add customizable storage paths
  Resolves: RHEL-528
This commit is contained in:
Sergei Petrosian 2023-06-13 12:33:58 +02:00
parent 25c76d0a20
commit 7ca8b4cd90
4 changed files with 47 additions and 36 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ SOURCES/auto-maintenance-73800682a3293ef5ab5ed5880329ce792cd34bbf.tar.gz
SOURCES/mssql-1.3.0.tar.gz
/auto-maintenance-73800682a3293ef5ab5ed5880329ce792cd34bbf.tar.gz
/mssql-1.3.0.tar.gz
/mssql-1.4.1.tar.gz

View File

@ -1,15 +1,12 @@
# NOTE: Even though ansible-core is in 8.6, it is only available
# at *runtime*, not at *buildtime* - so we can't have
# ansible-core as a build_dep on RHEL8
%if 0%{?fedora} || 0%{?rhel} >= 9
%bcond_without ansible
# NOTE: ansible-core is in rhel-8.6 and newer, but not installable
# in buildroot as it depended on modular Python.
# It has been installable at buildtime in 8.8 and newer.
%if 0%{?fedora}
BuildRequires: ansible-packaging
%else
%if 0%{?rhel} >= 8
BuildRequires: ansible-core >= 2.11.0
%endif
%else
%bcond_with ansible
%endif
%bcond_with collection_artifact
@ -24,8 +21,8 @@ BuildRequires: ansible-core >= 2.11.0
Name: ansible-collection-microsoft-sql
Url: https://github.com/linux-system-roles/mssql
Summary: The Ansible collection for Microsoft SQL Server management
Version: 1.3.0
Release: 3%{?dist}
Version: 1.4.1
Release: 1%{?dist}
License: MIT
@ -37,24 +34,6 @@ License: MIT
%global legacy_rolename %{collection_namespace}.sql-server
%global _pkglicensedir %{_licensedir}/%{name}
# Helper macros originally from macros.ansible by Igor Raits <ignatenkobrain>
# On RHEL, not available, so we must define those macros locally
# On Fedora, provided by ansible-packager
# Not used (yet). Could be made to point to AH in RHEL - but what about CentOS Stream?
#%%{!?ansible_collection_url:%%define ansible_collection_url() https://galaxy.ansible.com/%%{collection_namespace}/%%{collection_name}}
%if 0%{?rhel}
Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{collection_version}
%global ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/
%define ansible_roles_dir %{_datadir}/ansible/roles
%if %{without ansible}
# Untar and copy everything instead of galaxy-installing the built artifact when ansible is not available
%define ansible_collection_build() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz .
%define ansible_collection_install() mkdir -p %{buildroot}%{ansible_collection_files}%{collection_name}; (cd %{buildroot}%{ansible_collection_files}%{collection_name}; tar -xf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz)
%else
%define ansible_collection_build() ansible-galaxy collection build
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
%endif
%endif
# be compatible with the usual Fedora Provides:
Provides: ansible-collection-%{collection_namespace}-%{collection_name} = %{collection_version}-%{release}
@ -83,6 +62,10 @@ Requires: linux-system-roles
Source: %{parenturl}/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
Source1: %{parenturl}/%{rolename}/archive/%{source1id}/%{rolename}-%{source1id}.tar.gz
# Includes with ansible_collection_build/_install that differ between RHEL versions
Source1002: ansible-packaging.inc
%include %{SOURCE1002}
BuildArch: noarch
%if %{with html}
@ -112,7 +95,7 @@ Summary: Collection artifact to import to Automation Hub / Ansible Galaxy
%description collection-artifact
Collection artifact for %{name}. This package contains
%{collection_namespace}-%{collection_name}-%{version}.tar.gz
%{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz
%endif
%pretrans -p <lua>
@ -149,7 +132,7 @@ cp %{rolename}/.collection/galaxy.yml ./
%if 0%{?rhel}
# Ensure the correct entries in galaxy.yml
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{version}" \
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" \
"Ansible collection for Microsoft SQL Server management" \
"https://github.com/linux-system-roles/mssql" \
"https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/administration_and_configuration_tasks_using_system_roles_in_rhel/assembly_configuring-microsoft-sql-server-using-microsoft-sql-server-ansible-role_assembly_updating-packages-to-enable-automation-for-the-rhel-system-roles" \
@ -157,7 +140,7 @@ cp %{rolename}/.collection/galaxy.yml ./
"https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%208&component=ansible-collection-microsoft-sql" \
> galaxy.yml.tmp
%else
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{version}" \
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" \
"Ansible collection for Microsoft SQL Server management" \
> galaxy.yml.tmp
%endif
@ -166,8 +149,8 @@ mv galaxy.yml.tmp galaxy.yml
%if 0%{?rhel}
# Replace "fedora.linux_system_roles" with "redhat.rhel_system_roles"
# This is for the "roles calling other roles" case
find %{rolename} -type f -exec \
sed -e "s/fedora[.]linux_system_roles[.]/redhat.rhel_system_roles./g" \
find . -type f -exec \
sed -e "s/fedora\.linux_system_roles/redhat.rhel_system_roles/g" \
-i {} \;
%endif
@ -263,8 +246,8 @@ sh md2html.sh -t %{buildroot}%{_pkgdocdir}/collection/roles/%{collection_rolenam
%if %{with collection_artifact}
# Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
if [ -f %{collection_namespace}-%{collection_name}-%{version}.tar.gz ]; then
mv %{collection_namespace}-%{collection_name}-%{version}.tar.gz \
if [ -f %{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz ]; then
mv %{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz \
%{buildroot}%{_datadir}/ansible/collections/
fi
popd
@ -346,10 +329,16 @@ find %{buildroot}%{ansible_roles_dir} -mindepth 1 -maxdepth 1 | \
%if %{with collection_artifact}
%files collection-artifact
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{version}.tar.gz
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz
%endif
%changelog
* Wed May 31 2023 Sergei Petrosian <spetrosi@redhat.com> - 1.4.1-1
- Update BuiildRequires to use ansible-core on RHEL > 8.8
- Move RHEL related code into an include for spec readability
- Update role to version 1.4.1 to add customizable storage paths
Resolves: RHEL-528
* Thu Feb 23 2023 Sergei Petrosian <spetrosi@redhat.com> - 1.3.0-3
- Spec: add functionality to build from a commit hash
- Use latest 1.3.0 to add flexibility to AD integration functionality

21
ansible-packaging.inc Normal file
View File

@ -0,0 +1,21 @@
# Helper macros originally from macros.ansible by Igor Raits <ignatenkobrain>
# This file is for maintaining the compatibility with macros and other
# functionality (generators) provided by ansible-packaging on Fedora.
Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{collection_version}
# ansible-galaxy is available by ansible-core on RHEL 8.6 and newer at buildtime.
%define ansible_collection_build() ansible-galaxy collection build
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
%define ansible_roles_dir %{_datadir}/ansible/roles
%define ansible_collections_dir %{_datadir}/ansible/collections/ansible_collections
# TODO: Officially deprecate this macro and add the following line to the macro
# def after the new approach has gotten more testing and adoption:
# %%{warn: %%{ansible_collection_files} is deprecated. Use %%files -f %%{ansible_collection_filelist} instead.}
%define ansible_collection_files %{shrink:
%{ansible_collections_dir}/%{collection_namespace}/
}
%define ansible_collection_filelist %{__ansible_builddir}/ansible_collection_files

View File

@ -1,2 +1,2 @@
SHA512 (auto-maintenance-73800682a3293ef5ab5ed5880329ce792cd34bbf.tar.gz) = 327a9381f7051661cd75742c3c2542d67c0220bdeb9d11bb6c982d7bf053c232d9a192511dc4a90b678bafbbd8e5b08664a8570c62ab652ddf089a98b083b99b
SHA512 (mssql-1.3.0.tar.gz) = 3e3d3de36efa88a6a536a70d599de87b377a0cd0b097d9db719d96eda9a8624497c68468bd03d929b3b3e59314fe003fd998768e3c5bbb4d29c57624b4d05625
SHA512 (mssql-1.4.1.tar.gz) = ea79e0e7fd25fbdebc547157b12e2c152dae7e876fb5289042b13c53637e92f203f0f2d2fb5750a6f16ea21deba977dde81f7bea3d01dc06b4c54930bc995e11