305 lines
12 KiB
RPMSpec
305 lines
12 KiB
RPMSpec
%bcond_with collection_artifact
|
|
|
|
Name: ansible-collection-microsoft-sql
|
|
Url: https://github.com/linux-system-roles/mssql
|
|
Summary: The Ansible collection for Microsoft SQL Server management
|
|
Version: 1.2.4
|
|
Release: 2%{?dist}
|
|
|
|
License: MIT
|
|
|
|
%global rolename mssql
|
|
%global legacy_rolename sql-server
|
|
%global collection_namespace microsoft
|
|
%global collection_name sql
|
|
%global collection_rolename server
|
|
|
|
%global installbase %{_datadir}/%{collection_namespace}
|
|
%global _pkglicensedir %{_licensedir}/%{name}
|
|
|
|
Requires: linux-system-roles
|
|
|
|
# For each role, call defsource() and the point to it with SourceN: %%{archiveurlN}.
|
|
%global archiveext tar.gz
|
|
|
|
%define getarchivedir() %(p=%{basename:%{S:%{1}}}; echo ${p%%.%{archiveext}})
|
|
|
|
%global mainid cdc706f14614ef5e80bbce8db10beb369e889df9
|
|
%global parenturl https://github.com/linux-system-roles
|
|
Source: %{parenturl}/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
|
|
Source1: %{parenturl}/%{rolename}/archive/%{version}/%{rolename}-%{version}.tar.gz
|
|
|
|
BuildArch: noarch
|
|
|
|
# Requirement for %%ansible_collection_build, %%ansible_collection_install, %%ansible_collection_files
|
|
BuildRequires: ansible-packaging
|
|
|
|
# Requirements for md2html.sh to build the documentation
|
|
BuildRequires: rubygem-kramdown-parser-gfm
|
|
|
|
# Requirements for galaxy_transform.py
|
|
BuildRequires: python3
|
|
BuildRequires: %{py3_dist ruamel.yaml}
|
|
|
|
%description
|
|
This RPM installs the Ansible collection for Microsoft SQL Server management
|
|
%{collection_namespace}.%{collection_name}. This RPM also installs the roles
|
|
provided by the collection in the legacy roles format for users of Ansible < 2.9.
|
|
|
|
%if %{with collection_artifact}
|
|
%package collection-artifact
|
|
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
|
|
%endif
|
|
|
|
%prep
|
|
%setup -q -a1 -n %{getarchivedir 0}
|
|
|
|
mv %{rolename}-%{version} %{rolename}
|
|
|
|
# Removing symlinks in tests/roles
|
|
if [ -d %{rolename}/tests/roles ]; then
|
|
find %{rolename}/tests/roles -type l -exec rm {} \;
|
|
if [ -d %{rolename}/tests/roles/linux-system-roles.%{rolename} ]; then
|
|
rm -r %{rolename}/tests/roles/linux-system-roles.%{rolename}
|
|
fi
|
|
fi
|
|
|
|
# transform ambiguous #!/usr/bin/env python shebangs to python3 to stop brp-mangle-shebangs complaining
|
|
find -type f -executable -name '*.py' -exec \
|
|
sed -i -r -e '1s@^(#! */usr/bin/env python)(\s|$)@#\13\2@' '{}' +
|
|
|
|
%build
|
|
# Convert README.md to README.html in the source roles
|
|
sh md2html.sh %{rolename}/README.md
|
|
|
|
mkdir .collections
|
|
# Copy README.md for the collection build
|
|
cp %{rolename}/.collection/README.md lsr_role2collection/collection_readme.md
|
|
# Copy galaxy.yml for the collection build
|
|
cp %{rolename}/.collection/galaxy.yml ./
|
|
|
|
# Ensure the correct entries in galaxy.yml
|
|
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{version}" \
|
|
"Ansible collection for Microsoft SQL Server management" \
|
|
> galaxy.yml.tmp
|
|
mv galaxy.yml.tmp galaxy.yml
|
|
|
|
# Convert roles to the collection format
|
|
python3 lsr_role2collection.py --role "%{rolename}" \
|
|
--src-path "%{rolename}" \
|
|
--src-owner linux-system-roles \
|
|
--dest-path .collections \
|
|
--readme lsr_role2collection/collection_readme.md \
|
|
--namespace %{collection_namespace} \
|
|
--collection %{collection_name} \
|
|
--new-role "%{collection_rolename}" \
|
|
--meta-runtime lsr_role2collection/runtime.yml
|
|
|
|
# removing dot files/dirs
|
|
rm -r .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.[A-Za-z]*
|
|
|
|
# Copy galaxy.yml to the collection directory
|
|
cp -p galaxy.yml .collections/ansible_collections/%{collection_namespace}/%{collection_name}
|
|
|
|
# Copy CHANGELOG.md from %%{rolename} to collection dir
|
|
mv .collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{collection_rolename}/CHANGELOG.md \
|
|
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
|
|
|
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
|
%ansible_collection_build
|
|
popd
|
|
|
|
%install
|
|
mkdir -p $RPM_BUILD_ROOT%{installbase}
|
|
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles
|
|
|
|
# Copy roles to the legacy_rolename directory within the microsoft directory and rename
|
|
cp -pR %{rolename} "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}"
|
|
sed -i "s/linux-system-roles\.%{rolename}/%{collection_namespace}\.%{legacy_rolename}/g" \
|
|
$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/tests/*.yml
|
|
|
|
# Generate symlinks for roles in /usr/share/ansible/roles
|
|
ln -s "%{installbase}/%{legacy_rolename}" "$RPM_BUILD_ROOT%{_datadir}/ansible/roles/%{collection_namespace}.%{legacy_rolename}"
|
|
|
|
# Copy README, COPYING, and LICENSE files to the corresponding directories
|
|
mkdir -p $RPM_BUILD_ROOT%{_pkglicensedir}
|
|
mkdir -p "$RPM_BUILD_ROOT%{_pkgdocdir}/%{legacy_rolename}"
|
|
cp -p "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/README.md" \
|
|
"$RPM_BUILD_ROOT%{_pkgdocdir}/%{legacy_rolename}"
|
|
cp -p "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/README.html" \
|
|
"$RPM_BUILD_ROOT%{_pkgdocdir}/%{legacy_rolename}"
|
|
if [ -f "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/COPYING" ]; then
|
|
cp -p "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/COPYING" \
|
|
"$RPM_BUILD_ROOT%{_pkglicensedir}/%{legacy_rolename}.COPYING"
|
|
fi
|
|
if [ -f "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/LICENSE" ]; then
|
|
cp -p "$RPM_BUILD_ROOT%{installbase}/%{legacy_rolename}/LICENSE" \
|
|
"$RPM_BUILD_ROOT%{_pkglicensedir}/%{legacy_rolename}.LICENSE"
|
|
fi
|
|
|
|
# Remove dot files
|
|
rm -r $RPM_BUILD_ROOT%{installbase}/*/.[A-Za-z]*
|
|
|
|
# Remove the molecule directory
|
|
rm -r $RPM_BUILD_ROOT%{installbase}/*/molecule
|
|
|
|
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
|
%ansible_collection_install
|
|
popd
|
|
|
|
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
|
|
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles
|
|
|
|
# Copy the collection README files to the collection
|
|
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/README.md \
|
|
$RPM_BUILD_ROOT%{_pkgdocdir}/collection
|
|
|
|
if [ -f "%{buildroot}%{ansible_collection_files}%{collection_name}/roles/%{collection_rolename}/README.md" ]; then
|
|
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/%{collection_rolename}
|
|
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/roles/%{collection_rolename}/README.md \
|
|
$RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/%{collection_rolename}
|
|
fi
|
|
|
|
# Convert README.md to README.html for collection in $RPM_BUILD_ROOT%%{_pkgdocdir}/collection
|
|
sh md2html.sh $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/%{collection_rolename}/README.md
|
|
|
|
%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 \
|
|
$RPM_BUILD_ROOT%{_datadir}/ansible/collections/
|
|
fi
|
|
popd
|
|
%endif
|
|
|
|
%files
|
|
%{_pkgdocdir}
|
|
%license %{_pkglicensedir}
|
|
%{ansible_collection_files}
|
|
%{installbase}/%{legacy_rolename}
|
|
%{_datadir}/ansible/roles/%{collection_namespace}.%{legacy_rolename}
|
|
|
|
%if %{with collection_artifact}
|
|
%files collection-artifact
|
|
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{version}.tar.gz
|
|
%endif
|
|
|
|
%changelog
|
|
* Tue Sep 20 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.4-2
|
|
- Remove all code unrelated to Fedora to siplify the file
|
|
- Remove bcond_with ansible because Fedora always have ansible
|
|
- Replace the ansible_build_dep macro with simple ansible-packaging
|
|
- Remove %bcond_with html because Fedora always can convert md to html
|
|
- Remove conditions related to RHEL
|
|
- Replace ansible_collection_build_install with biult-in build & install
|
|
- Remove unrelated to Fedora Provides
|
|
- Remove all loops because this RPM contains only one role
|
|
- Remove definition of ansible_collection_files as its part of ansible-packaging
|
|
- Use ansible_collection_files in %files section
|
|
- Remove defsource - simply define the source for mssql
|
|
Resolves: rhbz#2126901
|
|
|
|
* Thu Sep 1 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.4-1
|
|
- Replicate all provided databases
|
|
- This change fixes the bug where only the first database provided with
|
|
mssql_ha_db_names got replicated
|
|
- Clarify that the role does not remove not listed databases
|
|
Resolves: rhbz#2066337
|
|
- Input multiple sql scripts
|
|
- Allow _input_sql_file vars to accept list of files
|
|
- Flush handlers prior to inputting post sql script
|
|
Resolves: rhbz#2120712
|
|
- Note that ha_cluster is not idempotent
|
|
- SPEC: Do not update dates in CHANGELOG.md
|
|
|
|
* Thu Aug 25 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.3-1
|
|
- Use firewall role to configure firewall for SQL Server
|
|
Resolves: rhbz#2120709
|
|
- Add mssql_ha_virtual_ip
|
|
Replace mssql_ha_db_name with mssql_ha_db_names to let users replicate multiple DBs
|
|
Resolves: rhbz#2066337
|
|
|
|
- Replace simple `mssql_input_sql_file` with `pre` and `post` variables
|
|
Resolves: rhbz#2120712
|
|
- Add Requires: linux-system-roles or rhel-system-roles
|
|
- Replace fedora.linux_system_roles:redhat.rhel_system_roles on RHEL
|
|
- Add downstream values to galaxy.yml
|
|
- Change defcommit to defsource that takes both tags and commits
|
|
- Update CHANGELOG.md with the current date and copy it to collection dir
|
|
|
|
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-4
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
|
|
|
* Mon Mar 21 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.1.1-3
|
|
- Fix inserting ansible_managed
|
|
Resolves: rhbz#2057651 (EL8)
|
|
Resolves: rhbz#2064690 (EL9)
|
|
- Users now can provide a custom URLs to pull packages and RPM key from
|
|
Resolves: rhbz#2038256 (EL8)
|
|
Resolves: rhbz#2064648 (EL9)
|
|
|
|
* Fri Mar 18 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.1.1-2
|
|
- RHEL8.6, 9 - add "Requires: ansible-core or ansible"
|
|
Resolves: rhbz#2065664 (EL8)
|
|
Resolves: rhbz#2065669 (EL8)
|
|
|
|
* Thu Mar 17 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.1.1-1
|
|
- Insert the "Ansible managed" comment to the /var/opt/mssql/mssql.conf file
|
|
Resolves rhbz#2057651 (EL8)
|
|
Resolves rhbz#2064690 (EL9)
|
|
|
|
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-3
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
|
|
|
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-2
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
|
|
|
* Wed Jul 21 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.1.0-1
|
|
- Add support for Microsoft SQL Server 2017
|
|
|
|
* Mon Jul 19 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.12-2
|
|
- Copy fix for RHEL 7 builds from rhel-system-roles
|
|
Link to the original fix:
|
|
https://src.fedoraproject.org/rpms/linux-system-roles/c/093981119f99ac51a6e06a2714b587e4e2fe287c
|
|
|
|
* Tue Jul 13 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.12-1
|
|
- Add the meta-runtime option from the latest auto-maintenance
|
|
- Use the latest mssql that ships fixes for issues #24,#25,#26,#27,#28,35
|
|
|
|
* Tue Jun 29 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.11-3
|
|
- Add a missing slash at the {ansible_collection_files} definition for rhel 7
|
|
|
|
* Thu Jun 17 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.11-2
|
|
- Make the ansible_collection_files macro defined in Fedora automatically and
|
|
in RHEL manually consistent - having slash at the end to clean double-slashes
|
|
|
|
* Thu Jun 17 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.11-1
|
|
- Update the version to be consistent with the Galaxy collection at
|
|
https://galaxy.ansible.com/microsoft/sql
|
|
|
|
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-5
|
|
- Update commit hash for mssql
|
|
|
|
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-4
|
|
- Generate symlinks for roles in /usr/share/ansible/roles
|
|
|
|
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-3
|
|
- Copy changes made to linux-system-roles in this PR:
|
|
https://src.fedoraproject.org/rpms/linux-system-roles/pull-request/13#
|
|
- Make spec file available for older versions of OSes.
|
|
- Drop python3-six dependency which was used by lsr_role2collection.py.
|
|
- Drop html files from rpm if the version has no markdown parser.
|
|
- Drop unnecessary python scripts which include python3 only code, e.g.,
|
|
f-strings.
|
|
Resolves rhbz#1970165
|
|
|
|
* Mon Jun 14 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-2
|
|
- Fix long description lines
|
|
- Fix incorrect role includes in microsoft/sql-server/tests/
|
|
|
|
* Thu Jun 3 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-1
|
|
- Initial release
|