diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-06-17 14:15:30 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-06-17 14:38:00 (EDT) |
commit | 4351e99efdc4e66b441e001b91c5b942c706331b (patch) | |
tree | 9e7fdfdf4934c3d525f556064116566da018e8e2 /lib/metadata | |
parent | e90bfa447904d9621782213ef87bd8592ec026fa (diff) |
ob_get_system_path(): Allow overriding DATADIR
Diffstat (limited to 'lib/metadata')
-rw-r--r-- | lib/metadata/proteanos.sh | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh index f007c22..40d5d32 100644 --- a/lib/metadata/proteanos.sh +++ b/lib/metadata/proteanos.sh @@ -120,8 +120,15 @@ _ob_get_system_path() { local path_id="${1}" shift 1 || _ob_abort + local datadir= local pkgver= + if [ x"${OB_TEST_DATADIR:+set}" = x'set' ]; then + datadir="${OB_TEST_DATADIR}" + else + datadir="${DATADIR}" + fi + case "${path_id}" in 'package-source') # source version @@ -136,19 +143,19 @@ _ob_get_system_path() 'buildflags') # arch [ ${#} -eq 1 ] || _ob_abort - printf '%s/opkbuild/buildflags/%s' "${DATADIR}" "${1}" + printf '%s/opkbuild/buildflags/%s' "${datadir}" "${1}" ;; 'platconf') # [source version] plat if [ ${#} -eq 1 ]; then - printf '%s/platconf/%s\n' "${DATADIR}" "${1}" + printf '%s/platconf/%s\n' "${datadir}" "${1}" return 0 fi [ ${#} -eq 3 ] || _ob_abort # Deprecated: ob_parse_version -u 'pkgver' -- "${2}" - printf '%s/platconf/%s/%s\n' "${DATADIR}" "${3}" "${1}" - printf '%s/platconf/%s/%s_%s\n' "${DATADIR}" \ + printf '%s/platconf/%s/%s\n' "${datadir}" "${3}" "${1}" + printf '%s/platconf/%s/%s_%s\n' "${datadir}" \ "${3}" "${1}" "${pkgver}" ;; esac |