From ff17ee18055957d1b08b2a59a436497043e51db1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 02 2022 18:04:04 +0000 Subject: import ansible-collection-microsoft-sql-1.2.4-1.el7_9 --- diff --git a/.ansible-collection-microsoft-sql.metadata b/.ansible-collection-microsoft-sql.metadata index 86b0247..494ee3b 100644 --- a/.ansible-collection-microsoft-sql.metadata +++ b/.ansible-collection-microsoft-sql.metadata @@ -1,2 +1,2 @@ 99df2e20aff7ec8c244218a45bbcd3d68b791311 SOURCES/auto-maintenance-cdc706f14614ef5e80bbce8db10beb369e889df9.tar.gz -b4828ecf3eeaaf10e84998f35a63b29e66611a08 SOURCES/mssql-02d2edb8ac7815cc5789a56414c09bfd0700cbb1.tar.gz +7a6dfa4cb1a14deacfff752bc7cd452b500771d7 SOURCES/mssql-1.2.4.tar.gz diff --git a/.gitignore b/.gitignore index 6841366..5fc4dfb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/auto-maintenance-cdc706f14614ef5e80bbce8db10beb369e889df9.tar.gz -SOURCES/mssql-02d2edb8ac7815cc5789a56414c09bfd0700cbb1.tar.gz +SOURCES/mssql-1.2.4.tar.gz diff --git a/SPECS/ansible-collection-microsoft-sql.spec b/SPECS/ansible-collection-microsoft-sql.spec index 3b1d1c7..9f79f69 100644 --- a/SPECS/ansible-collection-microsoft-sql.spec +++ b/SPECS/ansible-collection-microsoft-sql.spec @@ -1,7 +1,7 @@ # 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 +%if 0%{?rhel} >= 9 %bcond_without ansible %global ansible_build_dep ansible-core >= 2.11.0 %else @@ -16,7 +16,7 @@ %bcond_with collection_artifact # Do not convert .md to .html on RHEL 7 because tools the conversion are not available -%if 0%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?rhel} >= 8 %bcond_without html %else %bcond_with html @@ -25,26 +25,26 @@ Name: ansible-collection-microsoft-sql Url: https://github.com/linux-system-roles/mssql Summary: The Ansible collection for Microsoft SQL Server management -Version: 1.1.1 -Release: 3%{?dist} +Version: 1.2.4 +Release: 1%{?dist} -#Group: Development/Libraries License: MIT -%global installbase %{_datadir}/microsoft -%global _pkglicensedir %{_licensedir}/%{name} +%global rolename mssql %global collection_namespace microsoft %global collection_name sql +%global collection_rolename server +%global legacy_rolename %{collection_namespace}.sql-server -%global collection_version %{version} +%global installbase %{_datadir}/ansible/roles +%global _pkglicensedir %{_licensedir}/%{name} # Helper macros originally from macros.ansible by Igor Raits # Not available on RHEL, so we must define those macros locally here without using ansible-galaxy # 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%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?rhel} >= 8 %{!?ansible_collection_files:%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/} %else # Define undefined macro using "!?ansible_collection_files:..." does not work for rhel-7 @@ -56,13 +56,14 @@ License: MIT # ansible-core is in rhel 8.6 and later - default to ansible-core, but allow # the use of ansible if present - we may revisit this if the automatic dependency # generator is added to ansible-core in RHEL -# Fedora - the automatic generator will add this - no need to explicit declare -# it in the spec file # EL7 - no dependency on ansible because there is no ansible in el7 - user is # responsible for knowing they have to install ansible %if 0%{?rhel} >= 8 Requires: (ansible-core >= 2.11.0 or ansible >= 2.9.0) %endif + +Requires: rhel-system-roles + %if %{with ansible} BuildRequires: %{ansible_build_dep} %endif @@ -72,51 +73,19 @@ BuildRequires: %{ansible_build_dep} # Simply copy everything instead of galaxy-installing the built artifact. %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) %else -%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 +%define ansible_collection_build_install() ansible-galaxy collection build -v; ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz %endif -# For each role, call defcommit() and the point to it with SourceN: %{archiveurlN}. -%global archiveext tar.gz -# list of source role names -%global rolenames %nil -# list of assignments that can be used to populate a bash associative array variable -%global rolestodir %nil -# list of target rolenames to copy the roles to -%global target_rolenames %nil -# list of collection rolenames to convert the roles to -%global collection_rolenames %nil - -%define getarchivedir() %(p=%{basename:%{S:%{1}}}; echo ${p%%.%{archiveext}}) - -%global parenturl https://github.com/linux-system-roles - -%define defcommit() %{expand:%%global ref%{1} %{2} -%%global shortcommit%{1} %%(c=%%{ref%{1}}; echo ${c:0:7}) -%%global extractdir%{1} %%{expand:%%getarchivedir %{1}} -%%global archiveurl%{1} %%{parenturl}/%%{rolename%{1}}/archive/%%{ref%{1}}/%%{rolename%{1}}-%%{ref%{1}}.tar.gz -%%global rolenames %%{?rolenames} %%{rolename%{1}} -%%global roletodir%{1} [%{rolename%{1}}]="%{extractdir%{1}}" -%%global rolestodir %%{?rolestodir} %{roletodir%{1}} -%%{!?target_rolename%{1}:%%global target_rolename%{1} %%{rolename%{1}}} -%%global target_rolenames %%{?target_rolenames} [%{rolename%{1}}]="%{target_rolename%{1}}" -%%{!?collection_rolename%{1}:%%global collection_rolename%{1} %%{rolename%{1}}} -%%global collection_rolenames %%{?collection_rolenames} [%{rolename%{1}}]="%{collection_rolename%{1}}" -} - -%defcommit 1 02d2edb8ac7815cc5789a56414c09bfd0700cbb1 -%global rolename1 mssql -%global target_rolename1 sql-server -%global collection_rolename1 server - %global mainid cdc706f14614ef5e80bbce8db10beb369e889df9 +%global parenturl https://github.com/linux-system-roles Source: %{parenturl}/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz -Source1: %{archiveurl1} +Source1: %{parenturl}/%{rolename}/archive/%{version}/%{rolename}-%{version}.tar.gz BuildArch: noarch %if %{with html} # Requirements for md2html.sh to build the documentation -%if 0%{?fedora} || 0%{?rhel} >= 9 +%if 0%{?rhel} >= 9 BuildRequires: rubygem-kramdown-parser-gfm %else BuildRequires: pandoc @@ -127,22 +96,23 @@ BuildRequires: highlight # Requirements for galaxy_transform.py BuildRequires: python3 -%if 0%{?fedora} || 0%{?rhel} >= 8 +%if 0%{?rhel} >= 8 BuildRequires: %{py3_dist ruamel.yaml} %else BuildRequires: python3-ruamel-yaml %endif %if %{undefined __ansible_provides} -Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{collection_version} +Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{version} %endif # be compatible with the usual Fedora Provides: Provides: ansible-collection-%{collection_namespace}-%{collection_name} = %{version}-%{release} %description -This RPM installs the Ansible collection for Microsoft SQL Server management -microsoft.sql. This RPM also installs the roles provided by the collection in -the legacy roles format for users of Ansible < 2.9. +This RPM installs the %{collection_namespace}.%{collection_name} Ansible +collection that provides the %{collection_rolename} role for Microsoft SQL +Server management. This RPM also installs the %{legacy_rolename} role +in the legacy roles format for users of Ansible < 2.9. %if %{with collection_artifact} %package collection-artifact @@ -153,142 +123,124 @@ Collection artifact for %{name}. This package contains %{collection_namespace}-% %endif %prep -%setup -q -a1 -n %{getarchivedir 0} - -# Declare the array containing names of directories to copy roles to for prep -declare -A ROLESTODIR=(%{rolestodir}) -for rolename in %{rolenames}; do - mv "${ROLESTODIR[${rolename}]}" ${rolename} -done - -# Removing symlinks in tests/roles -for rolename in %{rolenames}; do - 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 -done +%setup -q -a1 -n auto-maintenance-%{mainid} -# 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@' '{}' + +mv %{rolename}-%{version} %{rolename} + +# Remove 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 %build %if %{with html} # Convert README.md to README.html in the source roles -readmes="" -for rolename in %{rolenames}; do - readmes="${readmes} $rolename/README.md" -done -sh md2html.sh $readmes +sh md2html.sh %{rolename}/README.md %endif mkdir .collections # Copy README.md for the collection build -cp %{rolename1}/.collection/README.md lsr_role2collection/collection_readme.md +cp %{rolename}/.collection/README.md lsr_role2collection/collection_readme.md # Copy galaxy.yml for the collection build -cp %{rolename1}/.collection/galaxy.yml ./ +cp %{rolename}/.collection/galaxy.yml ./ + # Ensure the correct entries in galaxy.yml -./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{collection_version}" "Ansible collection for Microsoft SQL Server management" > galaxy.yml.tmp +./galaxy_transform.py "%{collection_namespace}" "%{collection_name}" "%{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" \ + "https://github.com/linux-system-roles/mssql/blob/master/README.md" \ + "https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%208&component=ansible-collection-microsoft-sql" \ + > galaxy.yml.tmp mv galaxy.yml.tmp galaxy.yml -# Declare the array containing collection rolenames to convert roles to -declare -A COLLECTION_ROLENAMES=(%{collection_rolenames}) - -# Convert roles to the collection format -for rolename in %{rolenames}; do - 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_ROLENAMES[${rolename}]}" \ - --meta-runtime lsr_role2collection/runtime.yml -done +# Replace fedora.linux_system_roles with redhat.rhel_system_roles +sed -i 's/fedora\.linux_system_roles/redhat.rhel_system_roles/g' \ + %{rolename}/CHANGELOG.md \ + %{rolename}/README.md \ + %{rolename}/tasks/*.yml \ + %{rolename}/tests/*.yml \ + %{rolename}/meta/*.yml + +# Convert 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]* +rm -r .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/%{collection_rolename}/.[A-Za-z]* # Copy galaxy.yml to the collection directory cp -p galaxy.yml .collections/ansible_collections/%{collection_namespace}/%{collection_name} -%install -mkdir -p $RPM_BUILD_ROOT%{installbase} -mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles +# Copy CHANGELOG.md from mssql to collection dir +mv .collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{collection_rolename}/CHANGELOG.md \ + .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ -# Declare the array containing target rolenames to copy roles to -declare -A TARGET_ROLENAMES=(%{target_rolenames}) - -# Copy roles to the target directory within the microsoft directory and rename -for rolename in %{rolenames}; do - cp -pR "$rolename" "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}" - sed -i "s/linux-system-roles\.$rolename/microsoft\.${TARGET_ROLENAMES[${rolename}]}/g" \ - $RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/tests/*.yml -done +%install +mkdir -p %{buildroot}%{installbase} -# Generate symlinks for roles in /usr/share/ansible/roles -for rolename in %{rolenames}; do - ln -s "%{installbase}/${TARGET_ROLENAMES[${rolename}]}" "$RPM_BUILD_ROOT%{_datadir}/ansible/roles/microsoft.${TARGET_ROLENAMES[${rolename}]}" -done +# Copy role in legacy format and rename rolename in tests +cp -pR "%{rolename}" "%{buildroot}%{installbase}/%{legacy_rolename}" +sed -i "s/linux-system-roles\.%{rolename}/microsoft\.%{legacy_rolename}/g" \ + %{buildroot}%{installbase}/%{legacy_rolename}/tests/*.yml # Copy README, COPYING, and LICENSE files to the corresponding directories -mkdir -p $RPM_BUILD_ROOT%{_pkglicensedir} -for rolename in %{rolenames}; do - mkdir -p "$RPM_BUILD_ROOT%{_pkgdocdir}/${TARGET_ROLENAMES[${rolename}]}" - cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/README.md" \ - "$RPM_BUILD_ROOT%{_pkgdocdir}/${TARGET_ROLENAMES[${rolename}]}" +mkdir -p %{buildroot}%{_pkglicensedir} +mkdir -p "%{buildroot}%{_pkgdocdir}/%{legacy_rolename}" +cp -p "%{buildroot}%{installbase}/%{legacy_rolename}/README.md" \ + "%{buildroot}%{_pkgdocdir}/%{legacy_rolename}" %if %{with html} - cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/README.html" \ - "$RPM_BUILD_ROOT%{_pkgdocdir}/${TARGET_ROLENAMES[${rolename}]}" +cp -p "%{buildroot}%{installbase}/%{legacy_rolename}/README.html" \ + "%{buildroot}%{_pkgdocdir}/%{legacy_rolename}" %endif - if [ -f "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/COPYING" ]; then - cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/COPYING" \ - "$RPM_BUILD_ROOT%{_pkglicensedir}/${TARGET_ROLENAMES[${rolename}]}.COPYING" - fi - if [ -f "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/LICENSE" ]; then - cp -p "$RPM_BUILD_ROOT%{installbase}/${TARGET_ROLENAMES[${rolename}]}/LICENSE" \ - "$RPM_BUILD_ROOT%{_pkglicensedir}/${TARGET_ROLENAMES[${rolename}]}.LICENSE" - fi -done +if [ -f "%{buildroot}%{installbase}/%{legacy_rolename}/COPYING" ]; then + cp -p "%{buildroot}%{installbase}/%{legacy_rolename}/COPYING" \ + "%{buildroot}%{_pkglicensedir}/%{legacy_rolename}.COPYING" +fi +if [ -f "%{buildroot}%{installbase}/%{legacy_rolename}/LICENSE" ]; then + cp -p "%{buildroot}%{installbase}/%{legacy_rolename}/LICENSE" \ + "%{buildroot}%{_pkglicensedir}/%{legacy_rolename}.LICENSE" +fi # Remove dot files -rm -r $RPM_BUILD_ROOT%{installbase}/*/.[A-Za-z]* +rm -r %{buildroot}%{installbase}/*/.[A-Za-z]* +rm -r %{buildroot}%{installbase}/%{legacy_rolename}/tests/.[A-Za-z]* + # Remove the molecule directory -rm -r $RPM_BUILD_ROOT%{installbase}/*/molecule +rm -r %{buildroot}%{installbase}/*/molecule pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ %ansible_collection_build_install popd -mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection -mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles +mkdir -p %{buildroot}%{_pkgdocdir}/collection +mkdir -p %{buildroot}%{_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 + %{buildroot}%{_pkgdocdir}/collection -# Declare the array containing collection rolenames to convert roles to -declare -A COLLECTION_ROLENAMES=(%{collection_rolenames}) - -for rolename in %{rolenames}; do - if [ -f "%{buildroot}%{ansible_collection_files}%{collection_name}/roles/${COLLECTION_ROLENAMES[${rolename}]}/README.md" ]; then - mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${COLLECTION_ROLENAMES[${rolename}]} - cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${COLLECTION_ROLENAMES[${rolename}]}/README.md \ - $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${COLLECTION_ROLENAMES[${rolename}]} - fi -done +if [ -f "%{buildroot}%{ansible_collection_files}%{collection_name}/roles/%{collection_rolename}/README.md" ]; then + mkdir -p %{buildroot}%{_pkgdocdir}/collection/roles/%{collection_rolename} + cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/roles/%{collection_rolename}/README.md \ + %{buildroot}%{_pkgdocdir}/collection/roles/%{collection_rolename} +fi %if %{with html} -# converting README.md to README.html for collection in $RPM_BUILD_ROOT%{_pkgdocdir}/collection -readmes="$RPM_BUILD_ROOT%{_pkgdocdir}/collection/README.md" -for rolename in %{rolenames}; do - readmes="${readmes} $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${COLLECTION_ROLENAMES[${rolename}]}/README.md" -done -sh md2html.sh $readmes +# Convert README.md to README.html for collection in %%{buildroot}%%{_pkgdocdir}/collection +sh md2html.sh %{buildroot}%{_pkgdocdir}/collection/roles/%{collection_rolename}/README.md %endif %if %{with collection_artifact} @@ -296,7 +248,7 @@ sh md2html.sh $readmes 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/ + %{buildroot}%{_datadir}/ansible/collections/ fi popd %endif @@ -340,9 +292,6 @@ touch $files_section echo '%dir %{_datadir}/ansible' >> $files_section echo '%dir %{_datadir}/ansible/roles' >> $files_section %endif -%if "%{installbase}" != "%{_datadir}/ansible/roles" -echo '%dir %{installbase}' >> $files_section -%endif echo '%dir %{ansible_collection_files}' >> $files_section echo '%dir %{ansible_collection_files}%{collection_name}' >> $files_section find %{buildroot}%{ansible_collection_files}%{collection_name} -mindepth 1 -maxdepth 1 | \ @@ -388,13 +337,8 @@ fi # done with files_section.txt generation %files -f files_section.txt -%{_pkgdocdir}/*/README.md -%{_pkgdocdir}/collection/roles/*/README.md -%if %{with html} -%{_pkgdocdir}/*/README.html -%{_pkgdocdir}/collection/roles/*/README.html -%endif -%license %{_pkglicensedir}/* +%{_pkgdocdir} +%license %{_pkglicensedir} %license %{installbase}/*/LICENSE* %license %{ansible_collection_files}/%{collection_name}/LICENSE* @@ -404,6 +348,26 @@ fi %endif %changelog +* Fri Sep 23 2022 Sergei Petrosian - 1.2.4-1 +- Simplify spec file + - Do not install roles to /usr/share/microsoft and then create symlinks + to /usr/share/ansible/roles/, instead install directly to + /usr/share/ansible/roles/ + - Remove unused removal of ambiguous python shebangs + - Remove all loops because this RPM contains only one role + - Remove defsource - simply define the source for mssql + - 's|$RPM_BUILD_ROOT|%%{buildroot}|' for consistency + - Remove getarchivedir for simplicity + - Wrap description by 80 symbols and clarify it + - Remove tests/.fmf dir from the RPM + Resolves: rhbz#2129108 +- Input multiple sql scripts + - Allow _input_sql_file vars to accept list of files + - Flush handlers prior to inputting post sql script + Resolves: rhbz#2129333 +- Use firewall role to configure firewall for SQL Server + Resolves: rhbz#2129334 + * Mon May 23 2022 Sergei Petrosian - 1.1.1-3 - Insert the "Ansible managed" comment to /var/opt/mssql/mssql.conf Resolves: rhbz#2006233 (EL7)