summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-06-21 22:04:37 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-06-21 22:04:37 (EDT)
commit888356f8a16d95cd98e99094a3dbf9d442b3ee03 (patch)
tree5de94bb2e7b60c45724f892c5b96feeba6a8d636 /lib
parent40502c667e1207023e81de17ae378de908ac0632 (diff)
ob_qualify_package_name(): New function
Diffstat (limited to 'lib')
-rw-r--r--lib/metadata.sh26
-rw-r--r--lib/metadata/proteanos.sh15
2 files changed, 41 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
+}
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
+}