From 577041115a793c4846a63729da135d01f3f5963c Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 16:38:29 -0400 Subject: _ob_set_package_substvars_2(): Parse binary package substvars --- (limited to 'lib/package') diff --git a/lib/package/2.sh b/lib/package/2.sh index 00b0f25..ce96e5f 100644 --- a/lib/package/2.sh +++ b/lib/package/2.sh @@ -23,6 +23,8 @@ _OB_BINARY_FIELDS_REQUIRED_2='Architecture Platform Description' _OB_BINARY_FIELDS_OPTIONAL_2='Essential Depends Recommends Suggests '\ 'Pre-Depends Conflicts Provides Replaces' +_ob_source_substvars_set_2=false + _ob_parse_package_metadata_2() { local pkg= @@ -151,7 +153,7 @@ _ob_get_doc_files_2() return 0 } -_ob_substvar_2() +_ob_source_substvar_2() { local name="${1}" local value="${2}" @@ -163,22 +165,43 @@ _ob_substvar_2() return 0 } +_ob_binary_substvar_2() +{ + local name="${1}" + local value="${2}" + local pkg="${3}" + shift 3 || _ob_abort + + ob_set_binary_substvar "${name}" "${value}" "${pkg}" + + return 0 +} + _ob_set_package_substvars_2() { local pkg="${1}" shift 1 || _ob_abort - if [ -f "${_ob_package_dir}/substvars" ]; then - ob_parse_control "${_ob_package_dir}/substvars" \ - _ob_substvar_2 '' + if ! ${_ob_source_substvars_set_2}; then + if [ -f "${_ob_package_dir}/substvars" ]; then + ob_parse_control "${_ob_package_dir}/substvars" \ + _ob_source_substvar_2 '' + fi + + ob_set_source_substvar 'Source-Version' \ + "$(ob_get_source_parameter 'Version')" + ob_set_source_substvar 'Binary-Version' \ + "$(ob_get_source_parameter 'Version')" + ob_set_source_substvar 'Host-Arch' "${OPK_HOST_ARCH}" + ob_set_source_substvar 'Host-Plat' "${OPK_HOST_PLAT}" + + _ob_source_substvars_set_2=true fi - ob_set_source_substvar 'Source-Version' \ - "$(ob_get_source_parameter 'Version')" - ob_set_source_substvar 'Binary-Version' \ - "$(ob_get_source_parameter 'Version')" - ob_set_source_substvar 'Host-Arch' "${OPK_HOST_ARCH}" - ob_set_source_substvar 'Host-Plat' "${OPK_HOST_PLAT}" + if [ -f "${pkg}.substvars" ]; then + ob_parse_control "${pkg}.substvars" \ + _ob_binary_substvar_2 "${pkg}" + fi return 0 } -- cgit v0.9.1