diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-13 17:02:36 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-13 17:02:36 (EDT) |
commit | 2ddb616b87a2a4684d03c9b54e95f800e73017d9 (patch) | |
tree | 7412948f42899345c0a64d84867e1b6674bae6c7 | |
parent | eb39158e933a3f84a39b1aae4deaaae7ccde9f6b (diff) |
ob_parse_package_metadata(): Eliminate caching
Cf. commit da45b6d.
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | lib/package.sh | 55 | ||||
-rw-r--r-- | src/ob-applypatches.sh | 2 | ||||
-rw-r--r-- | src/ob-buildenv.sh | 2 | ||||
-rw-r--r-- | src/ob-buildopk.sh | 2 | ||||
-rw-r--r-- | src/ob-checkbuilddeps.sh | 2 | ||||
-rw-r--r-- | src/ob-genchanges.sh | 2 | ||||
-rw-r--r-- | src/ob-gencontrol.sh | 2 | ||||
-rw-r--r-- | src/ob-installdocs.sh | 2 | ||||
-rw-r--r-- | src/ob-installplatconf.sh | 2 | ||||
-rw-r--r-- | src/ob-unpacksource.sh | 2 | ||||
-rw-r--r-- | src/opkbuild.sh | 2 |
12 files changed, 10 insertions, 66 deletions
@@ -4,7 +4,6 @@ Tasks General Cleanup --------------- - * Eliminate metadata caching. * General code auditing and cleanup: - Protect against command operands beginning with "-", e.g.: * `[ "x${foo}" = 'xbar' ]` instead of `[ "${foo}" = 'bar' ]` diff --git a/lib/package.sh b/lib/package.sh index aa1a9a3..eab9709 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -60,63 +60,8 @@ _ob_package_do() ob_parse_package_metadata() { - local opt= - local cache_file= - local pkg= - local pkg_clean= - local param_name= - local param_value= - - OPTIND=1 - while getopts 'c:' opt; do - case "${opt}" in - c) - cache_file="${OPTARG}" - ;; - ?) - _ob_abort - ;; - esac - done - shift $(($OPTIND - 1)) - - # Load a previously saved cache file, if any. - if [ -n "${cache_file}" -a -r "${cache_file}" ]; then - if [ "${cache_file#*/}" != "${cache_file}" ]; then - . "${cache_file}" - else - . "./${cache_file}" - fi - return 0 - fi - _ob_package_do 'parse_package_metadata' - if [ -n "${cache_file}" ]; then - >"${cache_file}" - for param_name in ${_OB_SOURCE_PARAMETERS}; do - param_value="$(ob_get_source_parameter \ - "${param_name}" | sed "s/'/'\\\\''/g")" - printf "%s='%s'\n" \ - "_OB_SRCFIELD_${param_name}" "${param_value}" \ - >>"${cache_file}" - done - for pkg in $(ob_get_binary_packages); do - pkg_clean="$({ tr 'a-z' 'A-Z' | tr -dC 'A-Z0-9';} <<-EOF - "${pkg}" - EOF - )" - for param_name in ${_OB_BINARY_PARAMETERS}; do - param_value="$(ob_get_binary_parameter "${pkg}" \ - "${param_name}" | sed "s/'/'\\\\''/g")" - printf "%s='%s'\n" \ - "_OB_BINFIELD_${pkg_clean}_${param_name}" \ - "${param_value}" \ - >>"${cache_file}" - done - done - fi - return 0 } diff --git a/src/ob-applypatches.sh b/src/ob-applypatches.sh index 0ab3308..e4e8531 100644 --- a/src/ob-applypatches.sh +++ b/src/ob-applypatches.sh @@ -61,7 +61,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 apply_patches || return 1 diff --git a/src/ob-buildenv.sh b/src/ob-buildenv.sh index 685852a..e224c54 100644 --- a/src/ob-buildenv.sh +++ b/src/ob-buildenv.sh @@ -91,7 +91,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 ob_info "$(ob_get_msg 'setup_build_env')" diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh index 41db005..670740f 100644 --- a/src/ob-buildopk.sh +++ b/src/ob-buildopk.sh @@ -46,7 +46,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 printf '2.0\n' >'debian-binary' if [ -n "${OB_DO_SOURCE}" ]; then diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh index aea3d9a..05826ad 100644 --- a/src/ob-checkbuilddeps.sh +++ b/src/ob-checkbuilddeps.sh @@ -89,7 +89,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 ob_set_package_substvars '' check_build_deps || return ${?} diff --git a/src/ob-genchanges.sh b/src/ob-genchanges.sh index 42e2633..37f96a9 100644 --- a/src/ob-genchanges.sh +++ b/src/ob-genchanges.sh @@ -93,7 +93,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 if [ -n "${OB_DO_SOURCE}" ]; then changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}_src_all.changes" diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index 822dda6..551e6de 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -172,7 +172,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 if [ -n "${OB_DO_SOURCE}" ]; then gen_control "src-${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" 'src' 'all' \ diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh index 06707ee..6b15e2c 100644 --- a/src/ob-installdocs.sh +++ b/src/ob-installdocs.sh @@ -64,7 +64,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 if ! doc_pkg="$(ob_get_doc_package)"; then ob_error "$(ob_get_msg 'cant_get_doc_pkg')" diff --git a/src/ob-installplatconf.sh b/src/ob-installplatconf.sh index d81628a..4eac903 100644 --- a/src/ob-installplatconf.sh +++ b/src/ob-installplatconf.sh @@ -75,7 +75,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 copied='false' diff --git a/src/ob-unpacksource.sh b/src/ob-unpacksource.sh index 4a95aec..98b2da1 100644 --- a/src/ob-unpacksource.sh +++ b/src/ob-unpacksource.sh @@ -138,7 +138,7 @@ main() fi ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 if [ -d 'src' ]; then ob_info "$(ob_get_msg 'already_unpacked')" diff --git a/src/opkbuild.sh b/src/opkbuild.sh index b7bc160..6f3246b 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -226,7 +226,7 @@ setup_package() ob_info "$(ob_get_msg 'parse_package_metadata')" ob_init_package '..' || return 1 - ob_parse_package_metadata -c '.opkbuild.cache' || return 1 + ob_parse_package_metadata || return 1 OPK_SOURCE="$(ob_get_source_parameter 'Source')" OPK_SOURCE_VERSION="$(ob_get_source_parameter 'Version')" |