Blame SPECS/ansible-collection-microsoft-sql.spec

a59251
# NOTE: Even though ansible-core is in 8.6, it is only available
a59251
# at *runtime*, not at *buildtime* - so we can't have
a59251
# ansible-core as a build_dep on RHEL8
a59251
%if 0%{?fedora} || 0%{?rhel} >= 9
a59251
%bcond_without ansible
a59251
%global ansible_build_dep ansible-core >= 2.11.0
a59251
%else
3b3dcc
%if 0%{?rhel} && ! 0%{?epel}
3b3dcc
%bcond_with ansible
3b3dcc
%else
3b3dcc
%bcond_without ansible
a59251
%global ansible_build_dep ansible >= 2.9.10
a59251
%endif
3b3dcc
%endif
3b3dcc
3b3dcc
%bcond_with collection_artifact
3b3dcc
3b3dcc
# Do not convert .md to .html on RHEL 7 because tools the conversion are not available
3b3dcc
%if 0%{?fedora} || 0%{?rhel} >= 8
3b3dcc
%bcond_without html
3b3dcc
%else
3b3dcc
%bcond_with html
3b3dcc
%endif
3b3dcc
3b3dcc
Name: ansible-collection-microsoft-sql
3b3dcc
Url: https://github.com/linux-system-roles/mssql
3b3dcc
Summary: The Ansible collection for Microsoft SQL Server management
92ba2a
Version: 1.2.4
7a1691
Release: 1%{?dist}
3b3dcc
3b3dcc
#Group: Development/Libraries
3b3dcc
License: MIT
3b3dcc
%global installbase %{_datadir}/microsoft
3b3dcc
%global _pkglicensedir %{_licensedir}/%{name}
3b3dcc
3b3dcc
%global collection_namespace microsoft
3b3dcc
%global collection_name sql
3b3dcc
3b3dcc
%global collection_version %{version}
3b3dcc
3b3dcc
# Helper macros originally from macros.ansible by Igor Raits <ignatenkobrain>
3b3dcc
# Not available on RHEL, so we must define those macros locally here without using ansible-galaxy
3b3dcc
3b3dcc
# Not used (yet). Could be made to point to AH in RHEL - but what about CentOS Stream?
3b3dcc
#%%{!?ansible_collection_url:%%define ansible_collection_url() https://galaxy.ansible.com/%%{collection_namespace}/%%{collection_name}}
3b3dcc
3b3dcc
%if 0%{?fedora} || 0%{?rhel} >= 8
3b3dcc
%{!?ansible_collection_files:%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/}
3b3dcc
%else
3b3dcc
# Define undefined macro using "!?ansible_collection_files:..." does not work for rhel-7
3b3dcc
%if %{?ansible_collection_files:0}%{!?ansible_collection_files:1}
3b3dcc
%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/
3b3dcc
%endif
3b3dcc
%endif
3b3dcc
a59251
# ansible-core is in rhel 8.6 and later - default to ansible-core, but allow
a59251
# the use of ansible if present - we may revisit this if the automatic dependency
a59251
# generator is added to ansible-core in RHEL
a59251
# Fedora - the automatic generator will add this - no need to explicit declare
a59251
# it in the spec file
a59251
# EL7 - no dependency on ansible because there is no ansible in el7 - user is
a59251
# responsible for knowing they have to install ansible
a59251
%if 0%{?rhel} >= 8
a59251
Requires: (ansible-core >= 2.11.0 or ansible >= 2.9.0)
a59251
%endif
45df16
45df16
%if 0%{?fedora}
45df16
Requires: linux-system-roles
45df16
%else
45df16
Requires: rhel-system-roles
45df16
%endif
45df16
3b3dcc
%if %{with ansible}
a59251
BuildRequires: %{ansible_build_dep}
3b3dcc
%endif
3b3dcc
3b3dcc
%if %{without ansible}
3b3dcc
# We don't have ansible-galaxy.
3b3dcc
# Simply copy everything instead of galaxy-installing the built artifact.
3b3dcc
%define ansible_collection_build_install() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz .; 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)
3b3dcc
%else
3b3dcc
%define ansible_collection_build_install() ansible-galaxy collection build; ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
3b3dcc
%endif
3b3dcc
7a1691
# For each role, call defsource() and the point to it with SourceN: %{archiveurlN}.
3b3dcc
%global archiveext tar.gz
3b3dcc
# list of source role names
3b3dcc
%global rolenames %nil
3b3dcc
# list of assignments that can be used to populate a bash associative array variable
3b3dcc
%global rolestodir %nil
3b3dcc
# list of target rolenames to copy the roles to
3b3dcc
%global target_rolenames %nil
3b3dcc
# list of collection rolenames to convert the roles to
3b3dcc
%global collection_rolenames %nil
3b3dcc
3b3dcc
%define getarchivedir() %(p=%{basename:%{S:%{1}}}; echo ${p%%.%{archiveext}})
3b3dcc
3b3dcc
%global parenturl https://github.com/linux-system-roles
3b3dcc
7a1691
# You can feed either tag or commit to defsource
7a1691
%define defsource() %{expand:%%global ref%{1} %{2}
3b3dcc
%%global extractdir%{1} %%{expand:%%getarchivedir %{1}}
3b3dcc
%%global archiveurl%{1} %%{parenturl}/%%{rolename%{1}}/archive/%%{ref%{1}}/%%{rolename%{1}}-%%{ref%{1}}.tar.gz
3b3dcc
%%global rolenames %%{?rolenames} %%{rolename%{1}}
3b3dcc
%%global roletodir%{1} [%{rolename%{1}}]="%{extractdir%{1}}"
3b3dcc
%%global rolestodir %%{?rolestodir} %{roletodir%{1}}
3b3dcc
%%{!?target_rolename%{1}:%%global target_rolename%{1} %%{rolename%{1}}}
3b3dcc
%%global target_rolenames %%{?target_rolenames} [%{rolename%{1}}]="%{target_rolename%{1}}"
3b3dcc
%%{!?collection_rolename%{1}:%%global collection_rolename%{1} %%{rolename%{1}}}
3b3dcc
%%global collection_rolenames %%{?collection_rolenames} [%{rolename%{1}}]="%{collection_rolename%{1}}"
3b3dcc
}
3b3dcc
92ba2a
%defsource 1 1.2.4
3b3dcc
%global rolename1 mssql
3b3dcc
%global target_rolename1 sql-server
3b3dcc
%global collection_rolename1 server
3b3dcc
7a1691
%global mainid cdc706f14614ef5e80bbce8db10beb369e889df9
3b3dcc
Source: %{parenturl}/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
3b3dcc
Source1: %{archiveurl1}
3b3dcc
3b3dcc
BuildArch: noarch
3b3dcc
3b3dcc
%if %{with html}
3b3dcc
# Requirements for md2html.sh to build the documentation
3b3dcc
%if 0%{?fedora} || 0%{?rhel} >= 9
3b3dcc
BuildRequires: rubygem-kramdown-parser-gfm
3b3dcc
%else
3b3dcc
BuildRequires: pandoc
3b3dcc
BuildRequires: asciidoc
3b3dcc
BuildRequires: highlight
3b3dcc
%endif
3b3dcc
%endif
3b3dcc
3b3dcc
# Requirements for galaxy_transform.py
3b3dcc
BuildRequires: python3
3b3dcc
%if 0%{?fedora} || 0%{?rhel} >= 8
f5af9e
BuildRequires: %{py3_dist ruamel.yaml}
3b3dcc
%else
3b3dcc
BuildRequires: python3-ruamel-yaml
3b3dcc
%endif
3b3dcc
3b3dcc
%if %{undefined __ansible_provides}
3b3dcc
Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{collection_version}
3b3dcc
%endif
3b3dcc
# be compatible with the usual Fedora Provides:
3b3dcc
Provides: ansible-collection-%{collection_namespace}-%{collection_name} = %{version}-%{release}
3b3dcc
3b3dcc
%description
3b3dcc
This RPM installs the Ansible collection for Microsoft SQL Server management
3b3dcc
microsoft.sql. This RPM also installs the roles provided by the collection in
3b3dcc
the legacy roles format for users of Ansible < 2.9.
3b3dcc
3b3dcc
%if %{with collection_artifact}
3b3dcc
%package collection-artifact
3b3dcc
Summary: Collection artifact to import to Automation Hub / Ansible Galaxy
3b3dcc
3b3dcc
%description collection-artifact
3b3dcc
Collection artifact for %{name}. This package contains %{collection_namespace}-%{collection_name}-%{version}.tar.gz
3b3dcc
%endif
3b3dcc
3b3dcc
%prep
3b3dcc
%setup -q -a1 -n %{getarchivedir 0}
3b3dcc
3b3dcc
# Declare the array containing names of directories to copy roles to for prep
3b3dcc
declare -A ROLESTODIR=(%{rolestodir})
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    mv "${ROLESTODIR[${rolename}]}" ${rolename}
3b3dcc
done
3b3dcc
3b3dcc
# Removing symlinks in tests/roles
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    if [ -d ${rolename}/tests/roles ]; then
3b3dcc
        find ${rolename}/tests/roles -type l -exec rm {} \;
3b3dcc
        if [ -d ${rolename}/tests/roles/linux-system-roles.${rolename} ]; then
3b3dcc
            rm -r ${rolename}/tests/roles/linux-system-roles.${rolename}
3b3dcc
        fi
3b3dcc
    fi
3b3dcc
done
3b3dcc
3b3dcc
# transform ambiguous #!/usr/bin/env python shebangs to python3 to stop brp-mangle-shebangs complaining
3b3dcc
find -type f -executable -name '*.py' -exec \
3b3dcc
     sed -i -r -e '1s@^(#! */usr/bin/env python)(\s|$)@#\13\2@' '{}' +
3b3dcc
3b3dcc
%build
3b3dcc
%if %{with html}
3b3dcc
# Convert README.md to README.html in the source roles
3b3dcc
readmes=""
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    readmes="${readmes} $rolename/README.md"
3b3dcc
done
3b3dcc
sh md2html.sh $readmes
3b3dcc
%endif
3b3dcc
3b3dcc
mkdir .collections
3b3dcc
# Copy README.md for the collection build
3b3dcc
cp %{rolename1}/.collection/README.md lsr_role2collection/collection_readme.md
3b3dcc
# Copy galaxy.yml for the collection build
3b3dcc
cp %{rolename1}/.collection/galaxy.yml ./
45fd31
3b3dcc
# Ensure the correct entries in galaxy.yml
45fd31
%if 0%{?rhel}
45df16
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" \
45df16
                      "Ansible collection for Microsoft SQL Server management" \
45df16
                      "https://github.com/linux-system-roles/mssql" \
45df16
                      "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" \
45df16
                      "https://github.com/linux-system-roles/mssql/blob/master/README.md" \
45df16
                      "https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%208&component=ansible-collection-microsoft-sql" \
45df16
                      > galaxy.yml.tmp
45fd31
%else
45fd31
./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" \
45fd31
                      "Ansible collection for Microsoft SQL Server management" \
45fd31
                      > galaxy.yml.tmp
45fd31
%endif
3b3dcc
mv galaxy.yml.tmp galaxy.yml
3b3dcc
3b3dcc
# Declare the array containing collection rolenames to convert roles to
3b3dcc
declare -A COLLECTION_ROLENAMES=(%{collection_rolenames})
3b3dcc
45fd31
# Replace fedora.linux_system_roles with redhat.rhel_system_roles
45fd31
%if 0%{?rhel}
45fd31
for rolename in %{rolenames}; do
45fd31
    sed -i 's/fedora\.linux_system_roles/redhat.rhel_system_roles/g' \
7a1691
    $rolename/CHANGELOG.md \
7a1691
    $rolename/README.md \
7a1691
    $rolename/tasks/*.yml \
7a1691
    $rolename/tests/*.yml \
7a1691
    $rolename/meta/*.yml
45fd31
done
45fd31
%endif
45fd31
3b3dcc
# Convert roles to the collection format
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    python3 lsr_role2collection.py --role "$rolename" \
3b3dcc
        --src-path "$rolename" \
3b3dcc
        --src-owner linux-system-roles \
3b3dcc
        --dest-path .collections \
3b3dcc
        --readme lsr_role2collection/collection_readme.md \
3b3dcc
        --namespace %{collection_namespace} --collection %{collection_name} \
3b3dcc
        --new-role "${COLLECTION_ROLENAMES[${rolename}]}" \
45fd31
        --meta-runtime lsr_role2collection/runtime.yml
3b3dcc
done
3b3dcc
3b3dcc
# removing dot files/dirs
3b3dcc
rm -r .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.[A-Za-z]*
3b3dcc
3b3dcc
# Copy galaxy.yml to the collection directory
3b3dcc
cp -p galaxy.yml .collections/ansible_collections/%{collection_namespace}/%{collection_name}
3b3dcc
92ba2a
# Copy CHANGELOG.md from mssql to collection dir
7a1691
mv .collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{collection_rolename1}/CHANGELOG.md \
7a1691
    .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
7a1691
3b3dcc
%install
3b3dcc
mkdir -p $RPM_BUILD_ROOT%{installbase}
3b3dcc
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles
3b3dcc
3b3dcc
# Declare the array containing target rolenames to copy roles to
3b3dcc
declare -A TARGET_ROLENAMES=(%{target_rolenames})
3b3dcc
3b3dcc
# Copy roles to the target directory within the microsoft directory and rename
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    cp -pR "$rolename" "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}"
3b3dcc
    sed -i "s/linux-system-roles\.$rolename/microsoft\.${TARGET_ROLENAMES[${rolename}]}/g" \
3b3dcc
      $RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/tests/*.yml
3b3dcc
done
3b3dcc
3b3dcc
# Generate symlinks for roles in /usr/share/ansible/roles
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    ln -s "%{installbase}/${TARGET_ROLENAMES[${rolename}]}" "$RPM_BUILD_ROOT%{_datadir}/ansible/roles/microsoft.${TARGET_ROLENAMES[${rolename}]}"
3b3dcc
done
3b3dcc
3b3dcc
# Copy README, COPYING, and LICENSE files to the corresponding directories
3b3dcc
mkdir -p $RPM_BUILD_ROOT%{_pkglicensedir}
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    mkdir -p "$RPM_BUILD_ROOT%{_pkgdocdir}/${TARGET_ROLENAMES[${rolename}]}"
3b3dcc
    cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/README.md" \
3b3dcc
       "$RPM_BUILD_ROOT%{_pkgdocdir}/${TARGET_ROLENAMES[${rolename}]}"
3b3dcc
%if %{with html}
3b3dcc
    cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/README.html" \
3b3dcc
       "$RPM_BUILD_ROOT%{_pkgdocdir}/${TARGET_ROLENAMES[${rolename}]}"
3b3dcc
%endif
3b3dcc
    if [ -f "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/COPYING" ]; then
3b3dcc
        cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/COPYING" \
3b3dcc
           "$RPM_BUILD_ROOT%{_pkglicensedir}/${TARGET_ROLENAMES[${rolename}]}.COPYING"
3b3dcc
    fi
3b3dcc
    if [ -f "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/LICENSE" ]; then
3b3dcc
        cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/LICENSE" \
3b3dcc
           "$RPM_BUILD_ROOT%{_pkglicensedir}/${TARGET_ROLENAMES[${rolename}]}.LICENSE"
3b3dcc
    fi
3b3dcc
done
3b3dcc
3b3dcc
# Remove dot files
3b3dcc
rm -r $RPM_BUILD_ROOT%{installbase}/*/.[A-Za-z]*
3b3dcc
3b3dcc
# Remove the molecule directory
3b3dcc
rm -r $RPM_BUILD_ROOT%{installbase}/*/molecule
3b3dcc
3b3dcc
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
3b3dcc
%ansible_collection_build_install
3b3dcc
popd
3b3dcc
3b3dcc
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
3b3dcc
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles
3b3dcc
3b3dcc
# Copy the collection README files to the collection
3b3dcc
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/README.md \
3b3dcc
   $RPM_BUILD_ROOT%{_pkgdocdir}/collection
3b3dcc
3b3dcc
# Declare the array containing collection rolenames to convert roles to
3b3dcc
declare -A COLLECTION_ROLENAMES=(%{collection_rolenames})
3b3dcc
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
  if [ -f "%{buildroot}%{ansible_collection_files}%{collection_name}/roles/${COLLECTION_ROLENAMES[${rolename}]}/README.md" ]; then
3b3dcc
    mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${COLLECTION_ROLENAMES[${rolename}]}
3b3dcc
    cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${COLLECTION_ROLENAMES[${rolename}]}/README.md \
3b3dcc
        $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${COLLECTION_ROLENAMES[${rolename}]}
3b3dcc
  fi
3b3dcc
done
3b3dcc
3b3dcc
%if %{with html}
3b3dcc
# converting README.md to README.html for collection in $RPM_BUILD_ROOT%{_pkgdocdir}/collection
3b3dcc
readmes="$RPM_BUILD_ROOT%{_pkgdocdir}/collection/README.md"
3b3dcc
for rolename in %{rolenames}; do
3b3dcc
    readmes="${readmes} $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${COLLECTION_ROLENAMES[${rolename}]}/README.md"
3b3dcc
done
3b3dcc
sh md2html.sh $readmes
3b3dcc
%endif
3b3dcc
3b3dcc
%if %{with collection_artifact}
3b3dcc
# Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact
3b3dcc
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
3b3dcc
if [ -f %{collection_namespace}-%{collection_name}-%{version}.tar.gz ]; then
3b3dcc
    mv %{collection_namespace}-%{collection_name}-%{version}.tar.gz \
3b3dcc
       $RPM_BUILD_ROOT%{_datadir}/ansible/collections/
3b3dcc
fi
3b3dcc
popd
3b3dcc
%endif
3b3dcc
3b3dcc
# generate the %files section in the file files_section.txt
3b3dcc
format_item_for_files() {
3b3dcc
    # $1 is directory or file name in buildroot
3b3dcc
    # $2 - if true, and item is a directory, use %dir
3b3dcc
    local item
3b3dcc
    local files_item
3b3dcc
    item="$1"
3b3dcc
    files_item=${item##"%{buildroot}"}
3b3dcc
    if [ -L "$item" ]; then
3b3dcc
        echo "$files_item"
3b3dcc
    elif [ -d "$item" ]; then
3b3dcc
        if [[ "$item" == */doc* ]]; then
3b3dcc
            echo "%doc $files_item"
3b3dcc
        elif [ "${2:-false}" = true ]; then
3b3dcc
            echo "%dir $files_item"
3b3dcc
        else
3b3dcc
            echo "$files_item"
3b3dcc
        fi
3b3dcc
    elif [[ "$item" == */README.md ]] || [[ "$item" == */README.html ]]; then
3b3dcc
        if [[ "$item" == */private_* ]]; then
3b3dcc
            # mark as regular file, not %doc
3b3dcc
            echo "$files_item"
3b3dcc
        else
3b3dcc
            echo "%doc $files_item"
3b3dcc
        fi
a1bb9e
    elif [[ "$item" != */COPYING* ]] && [[ "$item" != */LICENSE* ]]; then
a1bb9e
        # Avoid dynamically using the license macro since the license macro
a1bb9e
        # is replaced with the value of License directive in the older rpmbuild.
3b3dcc
        echo "$files_item"
3b3dcc
    fi
3b3dcc
}
3b3dcc
3b3dcc
files_section=files_section.txt
3b3dcc
rm -f $files_section
3b3dcc
touch $files_section
3b3dcc
%if %{without ansible}
3b3dcc
echo '%dir %{_datadir}/ansible' >> $files_section
3b3dcc
echo '%dir %{_datadir}/ansible/roles' >> $files_section
3b3dcc
%endif
3b3dcc
%if "%{installbase}" != "%{_datadir}/ansible/roles"
3b3dcc
echo '%dir %{installbase}' >> $files_section
3b3dcc
%endif
3b3dcc
echo '%dir %{ansible_collection_files}' >> $files_section
3b3dcc
echo '%dir %{ansible_collection_files}%{collection_name}' >> $files_section
3b3dcc
find %{buildroot}%{ansible_collection_files}%{collection_name} -mindepth 1 -maxdepth 1 | \
3b3dcc
    while read item; do
3b3dcc
        if [[ "$item" == */roles ]]; then
3b3dcc
            format_item_for_files "$item" true >> $files_section
3b3dcc
            find "$item" -mindepth 1 -maxdepth 1 | while read roles_dir; do
3b3dcc
                format_item_for_files "$roles_dir" true >> $files_section
3b3dcc
                find "$roles_dir" -mindepth 1 -maxdepth 1 | while read roles_item; do
3b3dcc
                    format_item_for_files "$roles_item" >> $files_section
3b3dcc
                done
3b3dcc
            done
3b3dcc
        else
3b3dcc
            format_item_for_files "$item" >> $files_section
3b3dcc
        fi
3b3dcc
    done
3b3dcc
3b3dcc
find %{buildroot}%{installbase} -mindepth 1 -maxdepth 1 | \
3b3dcc
    while read item; do
3b3dcc
        if [ -d "$item" ]; then
3b3dcc
            format_item_for_files "$item" true >> $files_section
3b3dcc
            find "$item" -mindepth 1 -maxdepth 1 | while read roles_item; do
3b3dcc
                format_item_for_files "$roles_item" >> $files_section
3b3dcc
            done
3b3dcc
        else
3b3dcc
            format_item_for_files "$item" >> $files_section
3b3dcc
        fi
3b3dcc
    done
3b3dcc
if [ "%{installbase}" != "%{_datadir}/ansible/roles" ]; then
3b3dcc
    find %{buildroot}%{_datadir}/ansible/roles -mindepth 1 -maxdepth 1 | \
3b3dcc
        while read item; do
3b3dcc
            if [ -d "$item" ]; then
3b3dcc
                format_item_for_files "$item" true >> $files_section
3b3dcc
                find "$item" -mindepth 1 -maxdepth 1 | while read roles_item; do
3b3dcc
                    format_item_for_files "$roles_item" >> $files_section
3b3dcc
                done
3b3dcc
            else
3b3dcc
                format_item_for_files "$item" >> $files_section
3b3dcc
            fi
3b3dcc
        done
3b3dcc
fi
3b3dcc
# cat files_section.txt
3b3dcc
# done with files_section.txt generation
3b3dcc
3b3dcc
%files -f files_section.txt
3b3dcc
%{_pkgdocdir}/*/README.md
3b3dcc
%{_pkgdocdir}/collection/roles/*/README.md
3b3dcc
%if %{with html}
3b3dcc
%{_pkgdocdir}/*/README.html
3b3dcc
%{_pkgdocdir}/collection/roles/*/README.html
3b3dcc
%endif
3b3dcc
%license %{_pkglicensedir}/*
a1bb9e
%license %{installbase}/*/LICENSE*
a1bb9e
%license %{ansible_collection_files}/%{collection_name}/LICENSE*
3b3dcc
3b3dcc
%if %{with collection_artifact}
3b3dcc
%files collection-artifact
3b3dcc
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{version}.tar.gz
3b3dcc
%endif
3b3dcc
3b3dcc
%changelog
92ba2a
* Thu Sep 1 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.4-1
92ba2a
- Replicate all provided databases
92ba2a
  - This change fixes the bug where only the first database provided with
92ba2a
mssql_ha_db_names got replicated
92ba2a
  - Clarify that the role does not remove not listed databases
92ba2a
  Resolves: rhbz#2066338
92ba2a
- Input multiple sql scripts
92ba2a
  - Allow _input_sql_file vars to accept list of files
92ba2a
  - Flush handlers prior to inputting post sql script
92ba2a
  Resolves: rhbz#2120713
92ba2a
- Note that ha_cluster is not idempotent
92ba2a
- SPEC: Do not update dates in CHANGELOG.md
92ba2a
7a1691
* Thu Aug 25 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.3-1
7a1691
- Use firewall role to configure firewall for SQL Server
7a1691
  Resolves: rhbz#2120714
7a1691
- Add mssql_ha_virtual_ip
7a1691
  Replace mssql_ha_db_name with mssql_ha_db_names to let users replicate multiple DBs
7a1691
  Resolves: rhbz#2066338
7a1691
- Replace simple `mssql_input_sql_file` with `pre` and `post` variables
7a1691
  Resolves: rhbz#2120713
7a1691
- Add Requires: linux-system-roles or rhel-system-roles
7a1691
- Replace fedora.linux_system_roles:redhat.rhel_system_roles on RHEL
7a1691
- Add downstream values to galaxy.yml
7a1691
- Change defcommit to defsource that takes both tags and commits
7a1691
- Update CHANGELOG.md with the current date and copy it to collection dir
7a1691
45fd31
* Mon Jul 4 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.0-3
45fd31
- Update mssql commit
45fd31
  Resolves: rhbz#2066338
45fd31
- Add condition for upstream spec build for galaxy_transform
45fd31
- Replace extra-mapping with replacing in the legacy format with sed
45fd31
45df16
* Fri Jun 17 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.0-2
45df16
  Return mistakenly deleted galaxy.yml string and bump release
45df16
45df16
* Fri Jun 17 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.2.0-1
45df16
- Add MVP HA functionality to the server role
45df16
  Resolves: rhbz#2066338
45df16
- Add mssql_tls_remote_src to the server role
45df16
  Resolves: rhbz#2039990
45df16
- Add Requires: linux-system-roles or rhel-system-roles
45df16
- Add downstream values to galaxy.yml
45df16
a59251
* Mon Mar 21 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.1.1-3
a59251
- Fix inserting ansible_managed
45df16
  Resolves: rhbz#2065206
a59251
- Users now can provide a custom URLs to pull packages and RPM key from
45df16
  Resolves: rhbz#2067175
a59251
a59251
* Fri Mar 18 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.1.1-2
a59251
- RHEL8.6, 9 - add "Requires: ansible-core or ansible"
45df16
  Resolves: rhbz#2067172
a59251
f5af9e
* Thu Mar 17 2022 Sergei Petrosian <spetrosi@redhat.com> - 1.1.1-1
f5af9e
- Insert the "Ansible managed" comment to the /var/opt/mssql/mssql.conf file
45df16
  Resolves rhbz#2065206
f5af9e
f5af9e
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-3
f5af9e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
f5af9e
f5af9e
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-2
f5af9e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
f5af9e
a1bb9e
* Wed Jul 21 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.1.0-1
a1bb9e
- Add support for Microsoft SQL Server 2017
a1bb9e
a1bb9e
* Mon Jul 19 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.12-2
a1bb9e
- Copy fix for RHEL 7 builds from rhel-system-roles
a1bb9e
  Link to the original fix:
a1bb9e
  https://src.fedoraproject.org/rpms/linux-system-roles/c/093981119f99ac51a6e06a2714b587e4e2fe287c
a1bb9e
3b3dcc
* Tue Jul 13 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.12-1
3b3dcc
- Add the meta-runtime option from the latest auto-maintenance
3b3dcc
- Use the latest mssql that ships fixes for issues #24,#25,#26,#27,#28,35
3b3dcc
3b3dcc
* Tue Jun 29 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.11-3
3b3dcc
- Add a missing slash at the {ansible_collection_files} definition for rhel 7
3b3dcc
3b3dcc
* Thu Jun 17 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.11-2
3b3dcc
- Make the ansible_collection_files macro defined in Fedora automatically and
3b3dcc
  in RHEL manually consistent - having slash at the end to clean double-slashes
3b3dcc
3b3dcc
* Thu Jun 17 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.0.11-1
3b3dcc
- Update the version to be consistent with the Galaxy collection at
3b3dcc
  https://galaxy.ansible.com/microsoft/sql
3b3dcc
3b3dcc
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-5
3b3dcc
- Update commit hash for mssql
3b3dcc
3b3dcc
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-4
3b3dcc
- Generate symlinks for roles in /usr/share/ansible/roles
3b3dcc
3b3dcc
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-3
3b3dcc
- Copy changes made to linux-system-roles in this PR:
3b3dcc
  https://src.fedoraproject.org/rpms/linux-system-roles/pull-request/13#
3b3dcc
- Make spec file available for older versions of OSes.
3b3dcc
- Drop python3-six dependency which was used by lsr_role2collection.py.
3b3dcc
- Drop html files from rpm if the version has no markdown parser.
3b3dcc
- Drop unnecessary python scripts which include python3 only code, e.g.,
3b3dcc
  f-strings.
3b3dcc
  Resolves rhbz#1970165
3b3dcc
3b3dcc
* Mon Jun 14 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-2
3b3dcc
- Fix long description lines
3b3dcc
- Fix incorrect role includes in microsoft/sql-server/tests/
3b3dcc
3b3dcc
* Thu Jun 3 2021 Sergei Petrosian <spetrosi@redhat.com> - 0.0.1-1
3b3dcc
- Initial release