summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--lib/metadata.sh5
-rw-r--r--lib/metadata/proteanos.sh15
3 files changed, 17 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 15f910c..6d52363 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,8 @@ libopkbuild:
ob_substvars() are now covered by the test suite.
* ob_get_system_path() with the "platconf" path_id now accepts a
single "plat" argument. The three-argument form is now deprecated.
+ * ob_get_system_path() with the "buildflags" or "platconf" path_id now
+ accepts an "OB_TEST_DATADIR" to override the data directory prefix.
[1]: https://reproducible-builds.org/specs/source-date-epoch/
diff --git a/lib/metadata.sh b/lib/metadata.sh
index 0597841..da3ff60 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -315,7 +315,10 @@ ob_plat_is_concerned()
## \fIversion\fP. For \fBbuildflags\fP the argument is \fI arch\fP.
## For \fBplatconf\fP they can be either only \fIplat\fP or all of
## \fIsource\fP, \fIversion\fP, and \fIplat\fP; the latter form is
-## deprecated.
+## deprecated. For \fBbuildflags\fP and \fBplatconf\fP, the system
+## path will be under the value of the \fIOB_TEST_DATADIR\fP
+## environment variable, if set and not null; this is intended for use
+## in testing programs that call this function.
## @operand path_id req One of \fBpackage-source\fP, \fBpackage-docs\fP,
## \fBbuildflags\fP, or \fBplatconf\fP.
## @operand args req Additional arguments specific to each \fIpath_id\fP.
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