diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | TODO | 9 | ||||
-rw-r--r-- | src/ob-installplatconf.sh | 26 | ||||
-rwxr-xr-x | tests/exe/ob-installplatconf.sh | 4 | ||||
-rw-r--r-- | tests/local.mk | 2 |
5 files changed, 21 insertions, 22 deletions
@@ -18,6 +18,8 @@ Utilities: * ob-gencontrol now generates source package control files without redundant "Source" fields and with "Binary" and "Build-Depends" fields. + * ob-installplatconf now supports platconf directories with upstream + versions containing pattern matching notation (e.g. "foo_1.*"). * ob-installplatconf is now covered by the test suite. libopkbuild: @@ -1,12 +1,3 @@ -Near Term -========= - -Functional Changes ------------------- - - * ob-installplatconf: Match version directory as a pattern against package - version. - Future Tasks ============ diff --git a/src/ob-installplatconf.sh b/src/ob-installplatconf.sh index 190df42..26822b3 100644 --- a/src/ob-installplatconf.sh +++ b/src/ob-installplatconf.sh @@ -28,7 +28,8 @@ copy_config() local dest= local dir= local src_base= - local config_dir_base= + local platconf_dir= + local pkg_ver= while read -r src dest; do if [ -z "${src}" ] || [ -z "${dest}" ]; then @@ -46,16 +47,19 @@ copy_config() # Find the config package files. src_base='' - IFS="${OB_LF}" - for config_dir_base in $(ob_get_system_path 'platconf' \ - "${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" \ - "${OPK_HOST_PLAT}"); do - unset IFS - if [ -d "${config_dir_base}" ]; then - src_base="${config_dir_base}" - fi - done - unset IFS + platconf_dir="$(ob_get_system_path 'platconf' \ + "${OPK_HOST_PLAT}")" + if [ -d "${platconf_dir}/${OPK_SOURCE}/" ]; then + src_base="${platconf_dir}/${OPK_SOURCE}/" + else + pkg_ver="${OPK_SOURCE}_${OPK_SOURCE_VERSION_UPSTREAM}" + for dir in "${platconf_dir}/${OPK_SOURCE}_"*/; do + case "${platconf_dir}/${pkg_ver}/" in ${dir}) + src_base="${dir}" + break + esac + done + fi if [ -z "${src_base}" ]; then # This shouldn't happen unless the package maintainer # neglected to add the config package to the package's diff --git a/tests/exe/ob-installplatconf.sh b/tests/exe/ob-installplatconf.sh index f4d2c00..1279428 100755 --- a/tests/exe/ob-installplatconf.sh +++ b/tests/exe/ob-installplatconf.sh @@ -22,11 +22,11 @@ set -eu . "${TOP_SRCDIR}/tests/aux/tap-functions.sh" . "${TOP_SRCDIR}/tests/aux/common.sh" -plan_ 4 +plan_ 6 export OB_TEST_DATADIR= -for dir in 'foo' 'foo_1.0'; do +for dir in 'foo' 'foo_1.0' 'foo_1.'; do OB_TEST_DATADIR="${TOP_SRCDIR}/tests/data/platconf_${dir}" rm -f 'poem' command_ok_ 'ob-installplatconf exit status' -- \ diff --git a/tests/local.mk b/tests/local.mk index 1035057..236926f 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -51,6 +51,8 @@ EXTRA_DIST += \ tests/data/pkg/substvars \ tests/data/platconf_foo/platconf/x60/bar/poem \ tests/data/platconf_foo/platconf/x60/foo/poem \ + tests/data/platconf_foo_1./platconf/x60/foo_1.*/poem \ + tests/data/platconf_foo_1./platconf/x60/foo_1.1/poem \ tests/data/platconf_foo_1.0/platconf/x60/foo_1.0/poem \ tests/data/platconf_foo_1.0/platconf/x60/foo_2.0/poem \ tests/data/src/src/foo.sh |