From cf854359717dc6b1e90b1b559901f158e39eaf7a Mon Sep 17 00:00:00 2001 From: LucĂ­a Andrea Illanes Albornoz Date: Apr 24 2024 18:07:09 +0000 Subject: subr.ex/ex_pkg.subr:ex_pkg_register_group(): separate {owner,copy} from {auto,noauto} groups. groups.d/dev_packages.group: updated. etc/README.md: updated. --- diff --git a/etc/README.md b/etc/README.md index 001a583..98f1d35 100644 --- a/etc/README.md +++ b/etc/README.md @@ -328,28 +328,31 @@ contain package variable defaults, optionally the alphabetically sorted list of packages, if any, in ``_PACKAGES``, and their package variables sorted alphabetically with the exception of ``${PKG_DEPENDS}`` (if present,) ``${PKG_SHA256SUM}``, ``${PKG_URL}``, and ``${PKG_VERSION}``, and/or ``${PKG_URLS_GIT}``, -which are specified in this order. - -Additionally, single package files may be added beneath ``groups.d/[0-9][0-9][0-9]..d/``, -named ``.package`` containing the package's variables, with one of the two following -epilogues: +which are specified in this order. Build group files require the following epilogue, the +parameters enclosed in square brackets being optional: ```shell - -ex_pkg_register "" "${RTL_FILEOP_SOURCE_FNAME}"; +ex_pkg_register_group "" "${RTL_FILEOP_SOURCE_FNAME}" [["owner|copy"] ["auto|noauto"]]; # vim:filetype=sh textwidth=0 ``` -or, if the group name should not be inferred automatically and explicitly set: +If ``copy`` is specified, the build group will copy all of its packages from their respective +build groups without taking ownership thereof, if ``owner`` is specified, the default, the build +group owns all of its packages. If ``noauto`` is specified, the build group will not be added to +the list of build groups to build by default, if ``auto`` is specified, the build group will be +added to the list of build groups to build by default. + +Additionally, single package files may be added beneath ``groups.d/[0-9][0-9][0-9]..d/``, +named ``.package`` containing the package's variables, with the following epilogue, +the parameters enclosed in square brackets being optional: ```shell - -ex_pkg_register "" "${RTL_FILEOP_SOURCE_FNAME}" ""; +ex_pkg_register "" "${RTL_FILEOP_SOURCE_FNAME}" [""]; # vim:filetype=sh textwidth=0 ``` - + 1. Pick a build group according to the criteria mentioned and specifiy the set of package variables required (see above and section [4.4](#44-package-variables)) in either the corresponding group file or a single package file; in the former case, do also add the diff --git a/groups.d/dev_packages.group b/groups.d/dev_packages.group index 1370740..c596224 100644 --- a/groups.d/dev_packages.group +++ b/groups.d/dev_packages.group @@ -15,6 +15,6 @@ DEV_PACKAGES_PKG_CONFIG_LIBDIR="${PREFIX_NATIVE}/lib/pkgconfig"; DEV_PACKAGES_PREFIX="${PREFIX_NATIVE}"; DEV_PACKAGES_PYTHON="${PREFIX}/bin/python2"; -ex_pkg_register_group "dev_packages" "${RTL_FILEOP_SOURCE_FNAME}" "noauto"; +ex_pkg_register_group "dev_packages" "${RTL_FILEOP_SOURCE_FNAME}" "copy" "noauto"; # vim:filetype=sh textwidth=0 diff --git a/subr.ex/ex_pkg.subr b/subr.ex/ex_pkg.subr index 75f1aae..c90515f 100644 --- a/subr.ex/ex_pkg.subr +++ b/subr.ex/ex_pkg.subr @@ -299,6 +299,7 @@ ex_pkg_register() { # ex_pkg_register_group() - register single group # @_group_name: single group name # @_fname: pathname to file group is defined in, relative to midipix_build root +# @[_ownerfl]: "owner" for groups that own their packages, "copy" for shorthand groups referring to packages from other groups # @[_autofl]: "auto" for groups to build by default, "noauto" for optional groups only built when requested # ${EXP_PKG_REGISTER_GROUP_RGROUPS}: inout reference to variable of build groups # ${EXP_PKG_REGISTER_GROUP_RGROUPS_NOAUTO}: inout reference to variable of build groups only built when requested @@ -306,7 +307,8 @@ ex_pkg_register() { # Returns: zero (0) on success, non-zero (>0) on failure. # ex_pkg_register_group() { - local _eprg_group_name="${1}" _eprg_fname="${2}" _eprg_autofl="${3:-auto}" \ + local _eprg_group_name="${1}" _eprg_fname="${2}" \ + _eprg_ownerfl="${3:-owner}" _eprg_autofl="${4:-auto}" \ _eprg_pkg_name="" _eprg_pkg_names="" _eprg_rgroups=""; case "${_eprg_autofl}" in @@ -318,17 +320,19 @@ ex_pkg_register_group() { rtl_lconcat "${_eprg_rgroups}" "${_eprg_group_name}"; fi; - if rtl_get_var_unsafe \$_eprg_pkg_names -u "${_eprg_group_name}_PACKAGES"\ - && [ "${_eprg_pkg_names:+1}" = 1 ]; then - case "${_eprg_autofl}" in - auto) + case "${_eprg_ownerfl}" in + owner) + if rtl_get_var_unsafe \$_eprg_pkg_names -u "${_eprg_group_name}_PACKAGES"\ + && [ "${_eprg_pkg_names:+1}" = 1 ]; then for _eprg_pkg_name in ${_eprg_pkg_names}; do rtl_set_var_unsafe -u "PKG_${_eprg_pkg_name}_GROUP" "${_eprg_group_name}"; rtl_set_var_unsafe -u "PKG_${_eprg_pkg_name}_GROUP_FNAME" "${_eprg_fname}"; done; - ;; - esac; - fi; + fi; + ;; + copy) ;; + *) ;; + esac; return 0; };