# of the section when it has the ALLOC flag set on it ...
export SAFE_STRIP_FLAGS="--strip-unneeded"
export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment}
+prepstrip_sources_dir=/usr/src/debug/${CATEGORY}/${PF}
if hasq installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then
ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
local x=$1
local inode=$(inode_var_name "$x")
[[ -n ${!inode} ]] && return 0
- local sources_dir=/usr/src/debug/${CATEGORY}/${PF}
- debugedit -b "${WORKDIR}" -d "${sources_dir}" \
+ debugedit -b "${WORKDIR}" -d "${prepstrip_sources_dir}" \
-l "${T}"/debug.sources "${x}"
- if [[ -s ${T}/debug.sources ]] ; then
- [[ -d ${D}${sources_dir} ]] || mkdir -p "${D}${sources_dir}"
- grep -zv '/<built-in>$' "${T}"/debug.sources | \
- (cd "${WORKDIR}"; LANG=C sort -z -u | \
- rsync -rtL0 --files-from=- "${WORKDIR}/" "${D}${sources_dir}/" )
- fi
}
-
+
save_elf_debug() {
hasq splitdebug ${FEATURES} || return 0
fi
fi
done
+
+if [[ -s ${T}/debug.sources ]] && \
+ hasq installsources ${FEATURES} && \
+ ! hasq installsources ${RESTRICT} && \
+ type -P debugedit >/dev/null
+then
+ vecho "installsources: rsyncing source files"
+ [[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}"
+ grep -zv '/<[^/>]*>$' "${T}"/debug.sources | \
+ (cd "${WORKDIR}"; LANG=C sort -z -u | \
+ rsync -tL0 --files-from=- "${WORKDIR}/" "${D}${prepstrip_sources_dir}/" )
+
+ # Preserve directory structure.
+ # Needed after running save_elf_sources.
+ # https://bugzilla.redhat.com/show_bug.cgi?id=444310
+ while read -r emptydir
+ do
+ touch "$emptydir"/.keepdir
+ done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty)
+fi