diff options
author | P. J. McDermott <pjm@nac.net> | 2012-10-03 17:04:08 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-10-03 17:04:08 (EDT) |
commit | 69caab6f35231ac709a9b259b18b1adb594c3590 (patch) | |
tree | 2820a19abf9ee0f774f54277867c4e96b419d327 /src | |
parent | d573dd21829b877d648b804a7b6970100a147e87 (diff) |
Clean up some old oh-* utilities.
Diffstat (limited to 'src')
-rw-r--r-- | src/oh-applypatches.sh | 55 | ||||
-rw-r--r-- | src/oh-checkbuilddeps.sh | 32 | ||||
-rw-r--r-- | src/oh-copyconfig.sh | 81 | ||||
-rw-r--r-- | src/oh-unpacksource.sh | 123 |
4 files changed, 0 insertions, 291 deletions
diff --git a/src/oh-applypatches.sh b/src/oh-applypatches.sh deleted file mode 100644 index 621e882..0000000 --- a/src/oh-applypatches.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!@@SH@@ -# -# opkhelper -# src/oh-applypatches -# Apply patches to source code. -# -# Copyright (C) 2012 Patrick "P. J." McDermott -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -. @@LIBDIR@@/messages -. @@LIBDIR@@/locale - -main() -{ - oh_locale_set - oh_set_source_dir .. - - if [ "${#}" -ne 0 ]; then - oh_usage - exit 1 - fi - - apply_patches -} - -apply_patches() -{ - applied=false - - if [ -d ../patches ]; then - # Iterate over patches ordered alphabetically by name. - for patch in $(ls -1 ../patches | sort); do - oh_info "${oh_str_applying_patch}" "${patch}" - patch -N -p 1 -u -d src -i "../../patches/${patch}" || \ - oh_error "${oh_str_cant_apply_patch}" "${patch}" - applied=true - done - fi - - ${applied} || oh_info "${oh_str_no_patches}" -} - -main "${@}" diff --git a/src/oh-checkbuilddeps.sh b/src/oh-checkbuilddeps.sh deleted file mode 100644 index 80ab9f4..0000000 --- a/src/oh-checkbuilddeps.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!@@SH@@ -# -# opkhelper -# src/oh-checkbuilddeps -# Make sure that package build dependencies are installed. -# -# Copyright (C) 2012 Patrick "P. J." McDermott -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -. @@LIBDIR@@/messages -. @@LIBDIR@@/locale - -main() -{ - oh_locale_set - - oh_info "${oh_str_checking_build_deps}" -} - -main "${@}" diff --git a/src/oh-copyconfig.sh b/src/oh-copyconfig.sh deleted file mode 100644 index d6621d4..0000000 --- a/src/oh-copyconfig.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!@@SH@@ -# -# opkhelper -# src/oh-copyconfig -# Copy build-time or run-time platform configuration files. -# -# Copyright (C) 2012 Patrick "P. J." McDermott -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -. @@LIBDIR@@/messages -. @@LIBDIR@@/locale - -main() -{ - oh_locale_set - oh_set_source_dir .. - - if [ "${#}" -ne 0 ]; then - oh_usage - exit 1 - fi - - copied=false - - if [ -f ../config ]; then - copy_config config '.' - copied=true - fi - - for bin_config in ../*.pkg/config; do - copy_config "${bin_config#../}" 'dest' - copied=true - done - - "${copied}" || oh_info "${oh_str_no_plat_config}" -} - -copy_config() -{ - list="${1}" - dest_base="${2}" - - while read -r src dest; do - if [ -z "${src}" -o -z "${dest}" ]; then - oh_error "${oh_str_bad_config_syntax}" "${list}" - fi - # Make sure the destination directory exists. - mkdir -p "${dest_base}/${dest%/*}" || \ - oh_error "${oh_str_cant_make_config_dest_dir}" "${dest%/*}" - # Find the config package files. - # TODO: Don't hardcode path. - config_dir_base="/usr/share/config/${OH_HOST_PLATFORM}/${OH_SOURCE}" - if [ -d "${config_dir_base}-${OH_SOURCE_VERSION_UPSTREAM}" ]; then - src_base="${config_dir_base}-${OH_SOURCE_VERSION_UPSTREAM}" - elif [ -d "${config_dir_base}" ]; then - src_base="${config_dir_base}" - else - # This shouldn't happen unless the package maintainer neglected to - # add the config package to the package's Build-Depends field. - oh_error "${oh_str_no_config_dir}" - fi - # Copy the config file(s). - oh_info "${oh_str_copying_config_file}" "${src}" "${dest}" - cp -p "${src_base}/${src}" "${dest_base}/${dest}" || \ - oh_error "${oh_str_cant_copy_config_file}" - done <"../${list}" -} - -main "${@}" diff --git a/src/oh-unpacksource.sh b/src/oh-unpacksource.sh deleted file mode 100644 index 2e5fc7a..0000000 --- a/src/oh-unpacksource.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!@@SH@@ -# -# opkhelper -# src/oh-unpacksource -# Unpack native or upstream source. -# -# Copyright (C) 2012 Patrick "P. J." McDermott -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -. @@LIBDIR@@/messages -. @@LIBDIR@@/locale - -# Global parameters: -UPSTREAM_ARCHIVE_BASE= -UPSTREAM_ARCHIVE= -UPSTREAM_ARCHIVE_Z= -UPSTREAM_ARCHIVE_DIR= - -main() -{ - oh_locale_set - oh_set_source_dir .. - - if [ "${#}" -ne 0 ]; then - oh_usage - exit 1 - fi - - if [ -d ../src ]; then - unpack_native - else - unpack_upstream - fi -} - -unpack_native() -{ - oh_info "${oh_str_unpacking_native}" - cp -Rp ../src src || oh_error "${oh_str_cant_unpack_native}" -} - -unpack_upstream() -{ - get_upstream_archive - get_upstream_compression - get_upstream_dir - extract_upstream -} - -get_upstream_archive() -{ - UPSTREAM_ARCHIVE_BASE="${OH_SOURCE}-${OH_SOURCE_VERSION_UPSTREAM}.orig.tar." - UPSTREAM_ARCHIVE=$(find .. -name "${UPSTREAM_ARCHIVE_BASE}*") - case "$(echo "${UPSTREAM_ARCHIVE}" | grep -v '^$' | wc -l)" in - 0) - oh_error "${oh_str_no_sources}" - ;; - 1) - ;; - *) - oh_error "${oh_str_multiple_upstream_sources}" - ;; - esac -} - -get_upstream_compression() -{ - z_ext="${UPSTREAM_ARCHIVE#../${UPSTREAM_ARCHIVE_BASE}}" - case "${z_ext}" in - gz) - UPSTREAM_ARCHIVE_Z=z - ;; - bz2) - UPSTREAM_ARCHIVE_Z=j - ;; - lz) - UPSTREAM_ARCHIVE_Z=a - ;; - Z) - UPSTREAM_ARCHIVE_Z=Z - ;; - *) - oh_error "${oh_str_unsupported_archive_compression}" "${z_ext}" - ;; - esac -} - -get_upstream_dir() -{ - UPSTREAM_ARCHIVE_DIR=$(tar "-t${UPSTREAM_ARCHIVE_Z}f" \ - "${UPSTREAM_ARCHIVE}" | sed -n 's@^\./\([^/]*\)$@\1@p') - case "$(echo "${UPSTREAM_ARCHIVE_DIR}" | grep -v '^$' | wc -l)" in - 0) - oh_error "${oh_str_no_upstream_dirs}" - ;; - 1) - ;; - *) - oh_error "${oh_str_multiple_top_upstream_dirs}" - esac -} - -extract_upstream() -{ - oh_info "${oh_str_unpacking_upstream}" - tar "-x${UPSTREAM_ARCHIVE_Z}f" "${UPSTREAM_ARCHIVE}" || \ - oh_error "${oh_str_cant_unpack_upstream}" - mv "${UPSTREAM_ARCHIVE_DIR}" src || oh_error "${oh_str_cant_move_native}" -} - -main "${@}" |