Last active
December 23, 2025 19:39
-
-
Save jperkin/ce0b765a3a868389b09e235b58105a32 to your computer and use it in GitHub Desktop.
scan index skip unnecessary MULTI_VERSION
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/mk/pbulk/pbulk-index.mk b/mk/pbulk/pbulk-index.mk | |
| index 5340119107bb..4b7486fdd1b8 100644 | |
| --- a/mk/pbulk/pbulk-index.mk | |
| +++ b/mk/pbulk/pbulk-index.mk | |
| @@ -15,40 +15,49 @@ | |
| # _PBULK_MULTI_LIST.foo enumerates the supported settings | |
| # _PBULK_MULTI_VAR.foo forces a specific version | |
| # _PBULK_MULTI_DEFAULT.foo contains the default value | |
| +# _PBULK_MULTI_PREFIX.foo contains the PKGNAME prefix | |
| _PBULK_MULTI?= apache lua mysql php postgresql python rails ruby | |
| _PBULK_MULTI_LIST.apache= PKG_APACHE_ACCEPTED | |
| _PBULK_MULTI_VAR.apache= PKG_APACHE | |
| _PBULK_MULTI_DEFAULT.apache= PKG_APACHE_DEFAULT | |
| +_PBULK_MULTI_PREFIX.apache= APACHE_PKG_PREFIX | |
| _PBULK_MULTI_LIST.lua= _LUA_VERSIONS_ACCEPTED | |
| _PBULK_MULTI_VAR.lua= LUA_VERSION_REQD | |
| _PBULK_MULTI_DEFAULT.lua= LUA_VERSION_DEFAULT | |
| +_PBULK_MULTI_PREFIX.lua= LUA_PKGPREFIX | |
| _PBULK_MULTI_LIST.mysql= MYSQL_VERSIONS_ACCEPTED | |
| _PBULK_MULTI_VAR.mysql= MYSQL_VERSION_REQD | |
| _PBULK_MULTI_DEFAULT.mysql= MYSQL_VERSION_DEFAULT | |
| +#_PBULK_MULTI_PREFIX.mysql= Not yet supported | |
| _PBULK_MULTI_LIST.php= _PHP_VERSIONS_ACCEPTED | |
| _PBULK_MULTI_VAR.php= PHP_VERSION_REQD | |
| _PBULK_MULTI_DEFAULT.php= PHP_VERSION_DEFAULT | |
| +_PBULK_MULTI_PREFIX.php= PHP_PKG_PREFIX | |
| _PBULK_MULTI_LIST.postgresql= PGSQL_VERSIONS_ACCEPTED | |
| _PBULK_MULTI_VAR.postgresql= PGSQL_VERSION_REQD | |
| _PBULK_MULTI_DEFAULT.postgresql= PGSQL_VERSION_DEFAULT | |
| +#_PBULK_MULTI_PREFIX.postgresql= Not yet supported | |
| _PBULK_MULTI_LIST.python= _PYTHON_VERSIONS_ACCEPTED | |
| _PBULK_MULTI_VAR.python= PYTHON_VERSION_REQD | |
| _PBULK_MULTI_DEFAULT.python= PYTHON_VERSION_DEFAULT | |
| +_PBULK_MULTI_PREFIX.python= PYPKGPREFIX | |
| _PBULK_MULTI_LIST.rails= RUBY_RAILS_ACCEPTED | |
| _PBULK_MULTI_VAR.rails= RUBY_RAILS_REQD | |
| _PBULK_MULTI_DEFAULT.rails= RUBY_RAILS_DEFAULT | |
| +_PBULK_MULTI_PREFIX.rails= RUBY_RAILS | |
| _PBULK_MULTI_LIST.ruby= _RUBY_VERSIONS_ACCEPTED | |
| _PBULK_MULTI_VAR.ruby= RUBY_VERSION_REQD | |
| _PBULK_MULTI_DEFAULT.ruby= RUBY_VERSION_DEFAULT | |
| +_PBULK_MULTI_PREFIX.ruby= RUBY_PKGPREFIX | |
| .PHONY: pbulk-index pbulk-index-item | |
| @@ -74,6 +83,25 @@ _PBULK_SORTED_LIST.${_t}:= \ | |
| . endfor | |
| .endif | |
| +# Reduce iteration for classes that don't affect PKGNAME. If PKGNAME doesn't | |
| +# contain the class prefix, use only the first accepted version instead of | |
| +# iterating all. This can significantly improve performance. | |
| +# | |
| +# We use the first element of _PBULK_SORTED_LIST (not _PBULK_MULTI_DEFAULT) | |
| +# because the default may not be in the package's accepted versions list. | |
| + | |
| +.if defined(_PBULK_MULTI_NEEDED) | |
| +. for _t in ${_PBULK_MULTI_NEEDED} | |
| +. if defined(_PBULK_MULTI_PREFIX.${_t}) | |
| +. if empty(PKGNAME:M*${${_PBULK_MULTI_PREFIX.${_t}}}*) | |
| +_PBULK_SORTED_LIST.${_t}:= ${_PBULK_SORTED_LIST.${_t}:[1]} | |
| +. endif | |
| +. else | |
| +_PBULK_SORTED_LIST.${_t}:= ${_PBULK_SORTED_LIST.${_t}:[1]} | |
| +. endif | |
| +. endfor | |
| +.endif | |
| + | |
| .if !defined(_PBULK_MULTI_NEEDED) | |
| # No multi-package handling needed, directly print the item. | |
| pbulk-index: pbulk-index-item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment