summaryrefslogtreecommitdiffstats
path: root/lib/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'lib/metadata')
-rw-r--r--lib/metadata/proteanos.sh65
1 files changed, 23 insertions, 42 deletions
diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh
index 514f8cb..4152847 100644
--- a/lib/metadata/proteanos.sh
+++ b/lib/metadata/proteanos.sh
@@ -27,9 +27,8 @@ _OB_VERSION_RE_PROTEANOS=${_OB_VERSION_RE_PROTEANOS}'$'
_ob_validate_source_name()
{
- local name=
-
- name="${1}"
+ local name="${1}"
+ shift 1 || _ob_abort
if grep -E "${_OB_NAME_RE_PROTEANOS}" >/dev/null 2>&1 <<-EOF
${name}
@@ -49,9 +48,8 @@ _ob_validate_source_name()
_ob_validate_binary_name()
{
- local name=
-
- name="${1}"
+ local name="${1}"
+ shift 1 || _ob_abort
if grep -E "${_OB_NAME_RE_PROTEANOS}" >/dev/null 2>&1 <<-EOF
${name}
@@ -71,9 +69,8 @@ _ob_validate_binary_name()
_ob_validate_version()
{
- local version=
-
- version="${1}"
+ local version="${1}"
+ shift 1 || _ob_abort
grep -E "${_OB_VERSION_RE_PROTEANOS}" >/dev/null 2>&1 <<-EOF
${version}
@@ -84,9 +81,8 @@ _ob_validate_version()
_ob_get_upstreamver()
{
- local version=
-
- version="${1}"
+ local version="${1}"
+ shift 1 || _ob_abort
printf '%s' "${version%-*}"
@@ -95,9 +91,8 @@ _ob_get_upstreamver()
_ob_get_distrev()
{
- local version=
-
- version="${1}"
+ local version="${1}"
+ shift 1 || _ob_abort
printf '%s' "${version##*-}"
@@ -120,47 +115,33 @@ _ob_get_system_plat()
_ob_get_system_path()
{
- local path_id=
+ local path_id="${1}"
+ shift 1 || _ob_abort
local pkgver=
- path_id="${1}"
- shift 1
-
case "${path_id}" in
'package-source')
# source version
- if [ ${#} -eq 2 ]; then
- printf '/usr/src/%s_%s' "${1}" "${2}"
- else
- return 125
- fi
+ [ ${#} -eq 2 ] || _ob_abort
+ printf '/usr/src/%s_%s' "${1}" "${2}"
;;
'package-docs')
# source version
- if [ ${#} -eq 2 ]; then
- printf '/usr/share/doc/%s' "${1}"
- else
- return 125
- fi
+ [ ${#} -eq 2 ] || _ob_abort
+ printf '/usr/share/doc/%s' "${1}"
;;
'buildflags')
# arch
- if [ ${#} -eq 1 ]; then
- printf "${DATADIR}/opkbuild/buildflags/%s" "${1}"
- else
- return 125
- fi
+ [ ${#} -eq 1 ] || _ob_abort
+ printf "${DATADIR}/opkbuild/buildflags/%s" "${1}"
;;
'platconf')
# source version plat
- if [ ${#} -eq 3 ]; then
- ob_parse_version -u 'pkgver' "${2}"
- printf "${DATADIR}/platconf/%s/%s\n" "${3}" "${1}"
- printf "${DATADIR}/platconf/%s/%s_%s\n" "${3}" "${1}" \
- "${pkgver}"
- else
- return 125
- fi
+ [ ${#} -eq 3 ] || _ob_abort
+ ob_parse_version -u 'pkgver' "${2}"
+ printf "${DATADIR}/platconf/%s/%s\n" "${3}" "${1}"
+ printf "${DATADIR}/platconf/%s/%s_%s\n" "${3}" "${1}" \
+ "${pkgver}"
;;
esac