diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-06-16 14:09:55 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-06-21 09:34:51 +0200 |
commit | 396852e8d5aed76a88e99f1dc8af279fcf9f0eb3 (patch) | |
tree | 5e1faaf3c787c8c6dbf9ffbe4c812064ccd5564e /scripts | |
parent | ef43789b9828386a670b853ecc5cfd5471c5ecc4 (diff) | |
download | ptxdist-396852e8d5aed76a88e99f1dc8af279fcf9f0eb3.tar.gz ptxdist-396852e8d5aed76a88e99f1dc8af279fcf9f0eb3.tar.xz |
ptxd_make_xpkg: create debug ipkg packages
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/ptxd_make_world_clean.sh | 4 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_common.sh | 3 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_finish.sh | 12 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_fixup.sh | 1 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_pkg.sh | 43 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_prepare.sh | 11 |
6 files changed, 50 insertions, 24 deletions
diff --git a/scripts/lib/ptxd_make_world_clean.sh b/scripts/lib/ptxd_make_world_clean.sh index 858decaea..80bc43402 100644 --- a/scripts/lib/ptxd_make_world_clean.sh +++ b/scripts/lib/ptxd_make_world_clean.sh @@ -16,8 +16,8 @@ ptxd_make_world_clean() { if [ -f "${pkg_xpkg_map}" ]; then echo "Deleting ipks:" for name in $(< "${pkg_xpkg_map}"); do - ls "${ptx_pkg_dir}/${name}"_*.ipk - rm -f "${ptx_pkg_dir}/${name}"_*.ipk + ls "${ptx_pkg_dir}/${name}"{,-dbgsym}_*.ipk + rm -f "${ptx_pkg_dir}/${name}"{,-dbgsym}_*.ipk done echo fi diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh index 6b1c77f1b..c35b4f4e4 100644 --- a/scripts/lib/ptxd_make_xpkg_common.sh +++ b/scripts/lib/ptxd_make_xpkg_common.sh @@ -113,5 +113,8 @@ ptxd_make_xpkg_init() { pkg_xpkg_control_dir="${pkg_xpkg_tmp}/CONTROL" pkg_xpkg_control="${pkg_xpkg_control_dir}/control" pkg_xpkg_conffiles="${pkg_xpkg_control_dir}/conffiles" + pkg_xpkg_dbg_tmp="${ptx_pkg_dir}/${pkg_xpkg}-dbgsym.tmp" + pkg_xpkg_dbg_control_dir="${pkg_xpkg_dbg_tmp}/CONTROL" + pkg_xpkg_dbg_control="${pkg_xpkg_dbg_control_dir}/control" } export -f ptxd_make_xpkg_init diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh b/scripts/lib/ptxd_make_xpkg_finish.sh index 18c7ff745..3b1bd61d5 100644 --- a/scripts/lib/ptxd_make_xpkg_finish.sh +++ b/scripts/lib/ptxd_make_xpkg_finish.sh @@ -13,9 +13,13 @@ # the actual opkg package creation, will run in fakeroot # ptxd_make_xpkg_finish_impl() { - chown -R 0:0 "${pkg_xpkg_tmp}" && - ptxd_make_xpkg_pkg "${pkg_xpkg_tmp}" "${pkg_xpkg_cmds}" "${pkg_xpkg_perms}" && + chown -R 0:0 "${pkg_xpkg_tmp}" "${pkg_xpkg_dbg_tmp}" && + ptxd_make_xpkg_pkg "${pkg_xpkg_tmp}" "${pkg_xpkg_dbg_tmp}" "${pkg_xpkg_cmds}" "${pkg_xpkg_perms}" && opkg-build ${ptx_xpkg_extra_args} "${pkg_xpkg_tmp}" "${ptx_pkg_dir}" + if [ "$(find "${pkg_xpkg_dbg_tmp}" -type f | wc -l)" -gt 1 ]; then + # more than just the control file + opkg-build ${ptx_xpkg_extra_args} "${pkg_xpkg_dbg_tmp}" "${ptx_pkg_dir}" + fi } export -f ptxd_make_xpkg_finish_impl @@ -44,7 +48,7 @@ ptxd_make_xpkg_finish() { # no command file -> no files to package -> exit # if [ \! -s "${pkg_xpkg_cmds}" ]; then - rm -rf -- "${pkg_xpkg_tmp}" && + rm -rf -- "${pkg_xpkg_tmp}" "${pkg_xpkg_dbg_tmp}" && ptxd_pedantic "Packet '${pkg_xpkg}' is empty. not generating" return fi && @@ -98,7 +102,7 @@ EOF # echo -e "xpkg_finish: creating opkg package ...\n" && ptxd_make_xpkg_finish_run && - rm -rf "${pkg_xpkg_tmp}" || { + rm -rf -- "${pkg_xpkg_tmp}" "${pkg_xpkg_dbg_tmp}" || { local ret=$? echo -e "\nxpkg_finish: failed.\n" return ${ret} diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index 54f2e2bf3..cf8ddcbb6 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -28,6 +28,7 @@ ptxd_make_xpkg_fixup() { if [ -n "${pkg_xpkg_fixup_to}" ]; then echo -n "install_fixup: @${pkg_xpkg_fixup_from}@ -> ${pkg_xpkg_fixup_to} ... " sed -i -e "s,@$pkg_xpkg_fixup_from@,$pkg_xpkg_fixup_to,g" "${pkg_xpkg_control}" || return + sed -i -e "s,@$pkg_xpkg_fixup_from@,$pkg_xpkg_fixup_to,g" "${pkg_xpkg_dbg_control}" || return else echo -n "install_fixup: append '${pkg_xpkg_fixup_from}' ... " echo "${pkg_xpkg_fixup_from}" >> "${pkg_xpkg_control}" || return diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh index 3b1a21918..0ac6731d5 100644 --- a/scripts/lib/ptxd_make_xpkg_pkg.sh +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh @@ -120,6 +120,10 @@ ptxd_install_setup() { # dirs with separate debug files ddirs=("${nfsroot_dirs[@]}") + if [ "$(ptxd_get_ptxconf PTXCONF_DEBUG_PACKAGES)" = "y" -a \ + "$(ptxd_get_ptxconf PTXCONF_TARGET_DEBUG_OFF)" != "y" ]; then + ddirs[${#ddirs[@]}]="${pkg_xpkg_dbg_tmp}" + fi mod_nfs="$(printf "0%o" $(( 0${mod} & ~06000 )))" && mod_rw="$(printf "0%o" $(( 0${mod} | 0200 )))" && @@ -252,38 +256,42 @@ export -f ptxd_extract_build_id export ptxd_install_file_objcopy_args="--only-keep-debug --compress-debug-sections" ptxd_install_file_extract_debug() { - local dir="${1}" - local dst="${2}" - local dbg + local dst="${1}" + local tmp="$(mktemp -u "${PTXDIST_TEMPDIR}/debug.XXXXX")" + local dbg dir local bid=$(ptxd_extract_build_id) if [ -z "${bid}" ]; then - dbg="$(dirname "${dir}${dst}")/.debug/.$(basename "${dst}").dbg" + dbg="$(dirname "${dst}")/.debug/.$(basename "${dst}").dbg" else local path_component=${bid::-38} local name_component=${bid:2:38} - dbg="${dir}/usr/lib/debug/.build-id/${path_component}/${name_component}.debug" + dbg="/usr/lib/debug/.build-id/${path_component}/${name_component}.debug" fi - install -d "$(dirname "${dbg}")" || return # this can fail if objcopy does not support compressing debug sections or # is compiled without zlib support - "${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${dbg}" |& + "${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${tmp}" |& grep -q "\(unrecognized option\|unable to initialize com*press status\)" local -a status=( "${PIPESTATUS[@]}" ) if [ ${status[0]} -ne 0 ]; then if [ ${status[1]} -eq 0 ]; then ptxd_install_file_objcopy_args="--only-keep-debug" - "${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${dbg}" + "${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${tmp}" else # do it again to see the error message - "${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${dbg}" + "${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${tmp}" fi fi && - chmod -x "${dbg}" && - if [ -z "${bid}" ]; then - "${CROSS_OBJCOPY}" --add-gnu-debuglink "${dbg}" "${dir}${dst}" - fi + for dir in "${ddirs[@]}"; do + if [ -n "${bid}" -o -e "${dir}${dst}" ]; then + install -D -m 644 "${tmp}" "${dir}/${dbg}" + fi && + if [ -z "${bid}" -a -e "${dir}${dst}" ]; then + "${CROSS_OBJCOPY}" --add-gnu-debuglink "${dir}/${dbg}" "${dir}${dst}" + fi + done && + rm "${tmp}" } export -f ptxd_install_file_extract_debug @@ -319,9 +327,7 @@ ptxd_install_file_strip() { done && if [ "${strip}" != "k" ]; then - for dir in "${ddirs[@]}"; do - ptxd_install_file_extract_debug "${dir}" "${dst}" || return - done + ptxd_install_file_extract_debug "${dir}" "${dst}" || return fi } export -f ptxd_install_file_strip @@ -905,8 +911,9 @@ export -f ptxd_install_fixup_timestamps ptxd_make_xpkg_pkg() { local pkg_xpkg_tmp="$1" - local pkg_xpkg_cmds="$2" - local pkg_xpkg_perms="$3" + local pkg_xpkg_dbg_tmp="$2" + local pkg_xpkg_cmds="$3" + local pkg_xpkg_perms="$4" . "${pkg_xpkg_cmds}" && diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh index f473375e7..38d053d0e 100644 --- a/scripts/lib/ptxd_make_xpkg_prepare.sh +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -55,10 +55,12 @@ ptxd_make_xpkg_prepare() { rm -fr -- \ "${pkg_xpkg_tmp}" \ + "${pkg_xpkg_dbg_tmp}" \ "${pkg_xpkg_cmds}" \ "${pkg_xpkg_perms}" \ "${pkg_xpkg_install_deps}" && install -m 755 -d -- "${pkg_xpkg_control_dir}" && + install -m 755 -d -- "${pkg_xpkg_dbg_control_dir}" && touch "${pkg_xpkg_perms}" && touch "${pkg_xpkg_cmds}" || return @@ -85,6 +87,15 @@ install_init: @DEPENDS@ -> ${dep}" "${pkg_xpkg_control}" && chmod 644 "${pkg_xpkg_control}" || return + ARCH="${PTXDIST_IPKG_ARCH_STRING}" \ + PACKAGE="${pkg_xpkg}-dbgsym" \ + VERSION="${pkg_xpkg_version}" \ + DEPENDS="${pkg_xpkg}" \ + DESCRIPTION="Debug files for ${pkg_xpkg}" \ + ptxd_replace_magic "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \ + "${pkg_xpkg_dbg_control}" && + chmod 644 "${pkg_xpkg_dbg_control}" || return + local script for script in preinst postinst prerm postrm; do echo -n "install_init: ${script} " |