diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-applypatches.sh | 20 | ||||
-rw-r--r-- | src/ob-buildenv.sh | 28 | ||||
-rw-r--r-- | src/ob-buildopk.sh | 30 | ||||
-rw-r--r-- | src/ob-checkbuilddeps.sh | 60 | ||||
-rw-r--r-- | src/ob-genchanges.sh | 52 | ||||
-rw-r--r-- | src/ob-gencontrol.sh | 58 | ||||
-rw-r--r-- | src/ob-installdocs.sh | 50 | ||||
-rw-r--r-- | src/ob-installplatconf.sh | 48 | ||||
-rw-r--r-- | src/ob-unpacksource.sh | 50 |
9 files changed, 198 insertions, 198 deletions
diff --git a/src/ob-applypatches.sh b/src/ob-applypatches.sh index daf3d82..6451de2 100644 --- a/src/ob-applypatches.sh +++ b/src/ob-applypatches.sh @@ -19,16 +19,6 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -main() -{ - ob_set_text_domain 'opkbuild' - - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - - apply_patches -} - apply_patches() { applied='false' @@ -57,4 +47,14 @@ apply_patches() ${applied} || ob_info "$(ob_get_msg 'no_patches')" } +main() +{ + ob_set_text_domain 'opkbuild' + + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + + apply_patches +} + main "${@}" diff --git a/src/ob-buildenv.sh b/src/ob-buildenv.sh index 3421a46..182a050 100644 --- a/src/ob-buildenv.sh +++ b/src/ob-buildenv.sh @@ -19,20 +19,6 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -main() -{ - ob_set_text_domain 'opkbuild' - - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - - ob_info "$(ob_get_msg 'setup_build_env')" - - setup_build_helper - setup_toolchain - setup_build_flags -} - setup_build_helper() { IFS=', ' @@ -89,4 +75,18 @@ setup_build_flags() fi } +main() +{ + ob_set_text_domain 'opkbuild' + + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + + ob_info "$(ob_get_msg 'setup_build_env')" + + setup_build_helper + setup_toolchain + setup_build_flags +} + main "${@}" diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh index ab016ff..8ac3ba4 100644 --- a/src/ob-buildopk.sh +++ b/src/ob-buildopk.sh @@ -19,6 +19,21 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" +build_opk() +{ + binary="${1}" + version="${2}" + arch="${3}" + plat="${4}" + + (cd "${binary}.data" && tar -czf '../data.tar.gz' '.') + (cd "${binary}.control" && tar -czf '../control.tar.gz' '.') + + tar -czf "../../${binary}_${version}_${arch}_${plat}.opk" \ + 'debian-binary' 'data.tar.gz' 'control.tar.gz' + rm -Rf 'data.tar.gz' 'control.tar.gz' +} + main() { ob_set_text_domain 'opkbuild' @@ -41,19 +56,4 @@ main() rm 'debian-binary' } -build_opk() -{ - binary="${1}" - version="${2}" - arch="${3}" - plat="${4}" - - (cd "${binary}.data" && tar -czf '../data.tar.gz' '.') - (cd "${binary}.control" && tar -czf '../control.tar.gz' '.') - - tar -czf "../../${binary}_${version}_${arch}_${plat}.opk" \ - 'debian-binary' 'data.tar.gz' 'control.tar.gz' - rm -Rf 'data.tar.gz' 'control.tar.gz' -} - main "${@}" diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh index 51264fe..fd1f10b 100644 --- a/src/ob-checkbuilddeps.sh +++ b/src/ob-checkbuilddeps.sh @@ -19,16 +19,32 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -main() +check_dep() { - ob_set_text_domain 'opkbuild' + local dep="${1}" + local dep_pkg= + local dep_rel= + local dep_ver= + local status= + local pkg_ver= - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - ob_set_package_substvars '' + ob_parse_dep -p dep_pkg -r dep_rel -v dep_ver "${dep}" + status="$("${OPKG}" status "${dep_pkg}")" - check_build_deps - return ${?} + if ! printf '%s\n' "${status}" | grep '^Status: .* .* installed$' \ + >/dev/null 2>&1; then + return 1 + fi + if [ "x${dep_rel}" != 'x' ]; then + pkg_ver="$(printf '%s\n' "${status}" | \ + sed -n 's/^Version: //p')" + if "${OPKG}" compare-versions \ + "${pkg_ver}" "${dep_rel}" "${dep_ver}"; then + return 1 + fi + fi + + return 0 } check_build_deps() @@ -62,32 +78,16 @@ check_build_deps() return 0 } -check_dep() +main() { - local dep="${1}" - local dep_pkg= - local dep_rel= - local dep_ver= - local status= - local pkg_ver= - - ob_parse_dep -p dep_pkg -r dep_rel -v dep_ver "${dep}" - status="$("${OPKG}" status "${dep_pkg}")" + ob_set_text_domain 'opkbuild' - if ! printf '%s\n' "${status}" | grep '^Status: .* .* installed$' \ - >/dev/null 2>&1; then - return 1 - fi - if [ "x${dep_rel}" != 'x' ]; then - pkg_ver="$(printf '%s\n' "${status}" | \ - sed -n 's/^Version: //p')" - if "${OPKG}" compare-versions \ - "${pkg_ver}" "${dep_rel}" "${dep_ver}"; then - return 1 - fi - fi + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + ob_set_package_substvars '' - return 0 + check_build_deps + return ${?} } main "${@}" diff --git a/src/ob-genchanges.sh b/src/ob-genchanges.sh index 91d0229..9522204 100644 --- a/src/ob-genchanges.sh +++ b/src/ob-genchanges.sh @@ -19,32 +19,6 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -main() -{ - ob_set_text_domain 'opkbuild' - - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - - if [ -n "${OB_DO_SOURCE}" ]; then - changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}_src_all.changes" - ob_info "$(ob_get_msg 'gen_changes')" "${changes}" - exec 3>"../../${changes}" - write_changes "${OPK_SOURCE_VERSION}" 'src' 'all' - write_files_src - exec 3>&- - else - changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}" - changes="${changes}_${OPK_HOST_ARCH}_${OPK_HOST_PLAT}.changes" - ob_info "$(ob_get_msg 'gen_changes')" "${changes}" - exec 3>"../../${changes}" - write_changes "${OPK_BINARY_VERSION}" \ - "${OPK_HOST_ARCH}" "${OPK_HOST_PLAT}" - write_files_bin - exec 3>&- - fi -} - write_changes() { version="${1}" @@ -103,4 +77,30 @@ write_files_bin() done } +main() +{ + ob_set_text_domain 'opkbuild' + + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + + if [ -n "${OB_DO_SOURCE}" ]; then + changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}_src_all.changes" + ob_info "$(ob_get_msg 'gen_changes')" "${changes}" + exec 3>"../../${changes}" + write_changes "${OPK_SOURCE_VERSION}" 'src' 'all' + write_files_src + exec 3>&- + else + changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}" + changes="${changes}_${OPK_HOST_ARCH}_${OPK_HOST_PLAT}.changes" + ob_info "$(ob_get_msg 'gen_changes')" "${changes}" + exec 3>"../../${changes}" + write_changes "${OPK_BINARY_VERSION}" \ + "${OPK_HOST_ARCH}" "${OPK_HOST_PLAT}" + write_files_bin + exec 3>&- + fi +} + main "${@}" diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index 0a3817c..9b0a241 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -19,35 +19,6 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -main() -{ - ob_set_text_domain 'opkbuild' - - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - - if [ -n "${OB_DO_SOURCE}" ]; then - gen_control "src-${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" 'src' 'all' \ - "${OPK_SOURCE} source package" 'false' - gen_md5sums "src-${OPK_SOURCE}" - else - for pkg in ${OPK_PACKAGES_REDUCED}; do - ob_set_package_substvars "${pkg}" - arch="$(ob_get_binary_parameter "${pkg}" 'Architecture')" - [ "${arch}" != 'all' ] && arch="${OPK_HOST_ARCH}" - plat="$(ob_get_binary_parameter "${pkg}" 'Platform')" - [ "${plat}" != 'all' ] && plat="${OPK_HOST_PLAT}" - desc="$(ob_get_binary_parameter "${pkg}" 'Description')" - desc="$(ob_substvars "${desc}")" - gen_control "${pkg}" "${OPK_BINARY_VERSION}" "${arch}" "${plat}" \ - "${desc}" 'true' - install_maintainer_scripts "${pkg}" - gen_conffiles "${pkg}" - gen_md5sums "${pkg}" - done - fi -} - gen_control() { binary="${1}" @@ -180,4 +151,33 @@ gen_md5sums() fi } +main() +{ + ob_set_text_domain 'opkbuild' + + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + + if [ -n "${OB_DO_SOURCE}" ]; then + gen_control "src-${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" 'src' 'all' \ + "${OPK_SOURCE} source package" 'false' + gen_md5sums "src-${OPK_SOURCE}" + else + for pkg in ${OPK_PACKAGES_REDUCED}; do + ob_set_package_substvars "${pkg}" + arch="$(ob_get_binary_parameter "${pkg}" 'Architecture')" + [ "${arch}" != 'all' ] && arch="${OPK_HOST_ARCH}" + plat="$(ob_get_binary_parameter "${pkg}" 'Platform')" + [ "${plat}" != 'all' ] && plat="${OPK_HOST_PLAT}" + desc="$(ob_get_binary_parameter "${pkg}" 'Description')" + desc="$(ob_substvars "${desc}")" + gen_control "${pkg}" "${OPK_BINARY_VERSION}" "${arch}" "${plat}" \ + "${desc}" 'true' + install_maintainer_scripts "${pkg}" + gen_conffiles "${pkg}" + gen_md5sums "${pkg}" + done + fi +} + main "${@}" diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh index e151fd2..f48f97d 100644 --- a/src/ob-installdocs.sh +++ b/src/ob-installdocs.sh @@ -19,6 +19,31 @@ . "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" +install_docs() +{ + srcs="${1}" + dest="${2}" + data_doc_dir="${3}" + + for src in ${srcs}; do + if [ -f "${src}" ]; then + if [ "${dest%/*}" != "${dest}" ]; then + mkdir -p "${data_doc_dir}/${dest%/*}" || \ + ob_error "$(ob_get_msg 'cant_make_doc_dir')" + fi + cp -R "${src}" "${data_doc_dir}/${dest}" || \ + ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}" + elif [ -d "${src}" ]; then + if [ "${dest%/*}" != "${dest}" ]; then + mkdir -p "${data_doc_dir}/${dest%/*}" || \ + ob_error "$(ob_get_msg 'cant_make_doc_dir')" + fi + cp -R "${src}/." "${data_doc_dir}/${dest}" || \ + ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}" + fi + done +} + main() { ob_set_text_domain 'opkbuild' @@ -66,29 +91,4 @@ main() done } -install_docs() -{ - srcs="${1}" - dest="${2}" - data_doc_dir="${3}" - - for src in ${srcs}; do - if [ -f "${src}" ]; then - if [ "${dest%/*}" != "${dest}" ]; then - mkdir -p "${data_doc_dir}/${dest%/*}" || \ - ob_error "$(ob_get_msg 'cant_make_doc_dir')" - fi - cp -R "${src}" "${data_doc_dir}/${dest}" || \ - ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}" - elif [ -d "${src}" ]; then - if [ "${dest%/*}" != "${dest}" ]; then - mkdir -p "${data_doc_dir}/${dest%/*}" || \ - ob_error "$(ob_get_msg 'cant_make_doc_dir')" - fi - cp -R "${src}/." "${data_doc_dir}/${dest}" || \ - ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}" - fi - done -} - main "${@}" diff --git a/src/ob-installplatconf.sh b/src/ob-installplatconf.sh index b8d9c7f..eb05372 100644 --- a/src/ob-installplatconf.sh +++ b/src/ob-installplatconf.sh @@ -22,30 +22,6 @@ system_paths_ifs=' ' -main() -{ - ob_set_text_domain 'opkbuild' - - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - - copied='false' - - if [ -r '../platconf' ]; then - copy_config 'platconf' '.' - copied='true' - fi - - for pkg in ${OPK_PACKAGES}; do - if [ -r "../${pkg}.pkg/platconf" ]; then - copy_config "${pkg}.pkg/platconf" "${pkg}.data" - copied='true' - fi - done - - "${copied}" || ob_info "$(ob_get_msg 'no_plat_config')" -} - copy_config() { list="${1}" @@ -87,4 +63,28 @@ copy_config() done <"../${list}" } +main() +{ + ob_set_text_domain 'opkbuild' + + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + + copied='false' + + if [ -r '../platconf' ]; then + copy_config 'platconf' '.' + copied='true' + fi + + for pkg in ${OPK_PACKAGES}; do + if [ -r "../${pkg}.pkg/platconf" ]; then + copy_config "${pkg}.pkg/platconf" "${pkg}.data" + copied='true' + fi + done + + "${copied}" || ob_info "$(ob_get_msg 'no_plat_config')" +} + main "${@}" diff --git a/src/ob-unpacksource.sh b/src/ob-unpacksource.sh index 478fa17..26bb537 100644 --- a/src/ob-unpacksource.sh +++ b/src/ob-unpacksource.sh @@ -24,37 +24,12 @@ upstream_ar= upstream_ar_z= upstream_ar_dir= -main() -{ - ob_set_text_domain 'opkbuild' - - ob_init_package '..' || exit 1 - ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 - - if [ -d 'src' ]; then - ob_info "$(ob_get_msg 'already_unpacked')" - else - if [ -d '../src' ]; then - unpack_native - elif get_upstream_archive; then - unpack_upstream - fi - fi -} - unpack_native() { ob_info "$(ob_get_msg 'unpacking_native')" cp -Rp '../src' 'src' || ob_error "$(ob_get_msg 'cant_unpack_native')" } -unpack_upstream() -{ - get_upstream_compression - get_upstream_dir - extract_upstream -} - get_upstream_archive() { upstream_ar_base="${OPK_SOURCE}-${OPK_SOURCE_VERSION_UPSTREAM}.orig.tar" @@ -123,4 +98,29 @@ extract_upstream() ob_error "$(ob_get_msg 'cant_move_native')" } +unpack_upstream() +{ + get_upstream_compression + get_upstream_dir + extract_upstream +} + +main() +{ + ob_set_text_domain 'opkbuild' + + ob_init_package '..' || exit 1 + ob_parse_package_metadata -c '.opkbuild.cache' || exit 1 + + if [ -d 'src' ]; then + ob_info "$(ob_get_msg 'already_unpacked')" + else + if [ -d '../src' ]; then + unpack_native + elif get_upstream_archive; then + unpack_upstream + fi + fi +} + main "${@}" |