From 888356f8a16d95cd98e99094a3dbf9d442b3ee03 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 21 Jun 2020 22:04:37 -0400 Subject: ob_qualify_package_name(): New function --- (limited to 'lib') diff --git a/lib/metadata.sh b/lib/metadata.sh index da3ff60..44fc427 100644 --- a/lib/metadata.sh +++ b/lib/metadata.sh @@ -334,3 +334,29 @@ ob_get_system_path() return 0 } + +## @brief Get a possibly architecture-qualified package name +## @details \fBob_qualify_package_name\fP() qualifies the name of a binary +## package with the host architecture if the package is in a section +## whose packages are coinstallable. +## @operand name req The name of the binary package. +## @operand host_arch req The host architecture. +## @return Returns 0. +## @stdout Prints \fIname\fP, possibly followed by a colon and \fIhost_arch\fP. +## @pure yes This function has no side effects. +ob_qualify_package_name() +{ + local name="${1}" + local host_arch="${2}" + shift 2 || _ob_abort + local sect= + + sect="$(ob_get_binary_parameter "${name}" 'Section')" + if _ob_metadata_do 'section_is_coinstallable' "${sect}"; then + printf '%s:%s' "${name}" "${host_arch}" + else + printf '%s' "${name}" + fi + + return 0 +} diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh index 2713423..66f2ea8 100644 --- a/lib/metadata/proteanos.sh +++ b/lib/metadata/proteanos.sh @@ -164,3 +164,18 @@ _ob_get_system_path() return 0 } + +_ob_section_is_coinstallable() +{ + local sect="${1}" + shift 1 || _ob_abort + + case "${sect}" in + 'lib') + return 0 + ;; + *) + return 1 + ;; + esac +} -- cgit v0.9.1