From ef9da61736858fc1ffb3b6deab8b6057daefc6d8 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 25 Sep 2023 09:59:14 -0400 Subject: metadata, package: Encode binary package names Remove restriction on duplicate "clean" names. --- (limited to 'lib/metadata.sh') 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 -- cgit v0.9.1