summaryrefslogtreecommitdiffstats
path: root/lib/metadata.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/metadata.sh')
-rw-r--r--lib/metadata.sh26
1 files changed, 26 insertions, 0 deletions
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
+}