summaryrefslogtreecommitdiffstats
path: root/lib/metadata.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-09-25 09:59:14 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-09-25 11:37:56 (EDT)
commitef9da61736858fc1ffb3b6deab8b6057daefc6d8 (patch)
treec5fb739e632533f33b4f1aa0804d9ec5e987dd17 /lib/metadata.sh
parentdfc2e98ae678073977cd66a41592aee25454d757 (diff)
metadata, package: Encode binary package names
Remove restriction on duplicate "clean" names.
Diffstat (limited to 'lib/metadata.sh')
-rw-r--r--lib/metadata.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/metadata.sh b/lib/metadata.sh
index da0c893..bc7e717 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -61,6 +61,25 @@ ob_validate_binary_name()
return 0
}
+## @brief Convert a source or binary package name to a "clean" identifier name
+## @details \fBob_clean_name\fP() encodes characters in a source or binary
+## package name that would be invalid in a shell variable or function
+## name. This conversion is performed by the metadata plugin selected
+## at libopkbuild's build time.
+## @operand name req The source or binary package name to convert.
+## @return Returns 0 on success.
+## @stdout Prints the converted name.
+## @pure yes This function has no side effects.
+ob_clean_name()
+{
+ local name="${1}"
+ shift 1 || _ob_abort
+
+ _ob_metadata_do 'clean_name' "${name}" || return ${?}
+
+ return 0
+}
+
## @brief Parse a source package version
## @details \fBob_parse_version\fP() validates and parses a source package
## version identifier using the metadata plugin selected at