Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40968

Replace %filter_setup with native provides/requires filtering in the MariaDB spec

    XMLWordPrintable

Details

    Description

      Description

      Our spec file currently uses redhat-rpm-config's %filter_setup macro to filter auto-generated Provides/Requires. This macro forces RPM's legacy external dependency-generator path instead of the default internal one, which has performance costs, most visible on our largest-file-count subpackages (e.g. MariaDB-test, MariaDB-server).

      How %filter_setup works:

      Ref: https://gitlab.com/redhat/centos-stream/rpms/redhat-rpm-config/-/blob/c10s/macros?ref_type=heads&blame=1#L473

      %global _use_internal_dependency_generator 0
      %global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u
      %global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}"
      %global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}"
      

      Setting use_internal_dependency_generator to 0 forces rpmbuild onto the deprecated external-generator branch in rpm's own source. The __deploop line above then forks a brand-new rpmdeps process once per packaged file, thus absorbing its bootstrap performance penalty on every invocation.

      Proposed changed:
      Migrate our spec's filtering to rpm's native, in-process filtering macros, which don't touch use_internal_dependency_generator at all.

      Ref: https://docs.fedoraproject.org/en-US/packaging-guidelines/AutoProvidesAndRequiresFiltering/

      With the diff from below, on top of 11.8, I obtained the following
      times on .spec files processing during cpack's invocation of rpmbuild.

      I don't know why mariadb-devel took longer to process but this is a separate issue that was investigated as part of: https://mariadb.slack.com/archives/C012UURLW9W/p1787747064513859

      diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
      index e27c06534c6..d2dc1409569 100644
      --- a/cmake/cpack_rpm.cmake
      +++ b/cmake/cpack_rpm.cmake
      @@ -125,13 +125,10 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "
       
       %define pretrans %{nil}
       
      -%{?filter_setup:
      -%filter_provides_in \\\\.\\\\(test\\\\|result\\\\|h\\\\|cc\\\\|c\\\\|inc\\\\|opt\\\\|ic\\\\|cnf\\\\|rdiff\\\\|cpp\\\\)$
      -%filter_requires_in \\\\.\\\\(test\\\\|result\\\\|h\\\\|cc\\\\|c\\\\|inc\\\\|opt\\\\|ic\\\\|cnf\\\\|rdiff\\\\|cpp\\\\)$
      -%filter_from_provides /perl(\\\\(mtr\\\\|My::\\\\)/d
      -%filter_from_requires /\\\\(perl(\\\\(.*mtr\\\\|My::\\\\|.*HandlerSocket\\\\|Mysql\\\\)\\\\)/d
      -%filter_setup
      -}
      +%global __provides_exclude_from ^.*\\\\.(test|result|h|cc|c|inc|opt|ic|cnf|rdiff|cpp)$
      +%global __requires_exclude_from ^.*\\\\.(test|result|h|cc|c|inc|opt|ic|cnf|rdiff|cpp)$
      +%global __provides_exclude ^perl\\\\((mtr|My::)
      +%global __requires_exclude ^perl\\\\((.*mtr|My::|.*HandlerSocket|Mysql)
       ")
       
       # this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
      

      The resulting packages should be checked for any side-effects, mostly the Requires/Provides headers must be identical between the two methods.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rvarzaru Varzaru Razvan-Liviu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.