Patch-by: Peter Alfredsen General installsources improvements o Move the rsync run to the end so we only see errors about source files that have been moved once. Speeds up prepstrip as well. o Optimize regexp used by grep so it catches anything after the last slash that looks like: o Make rsync for installsources non-recursive. >=debugedit-4.4.6-r2 will now sometimes output directories. Earlier versions didn't, so the option wasn't used. This change requires that earlier versions of portage block >=debugedit-4.4.6-r2, otherwise when rsync is run, directories with all their contents will be installed in /usr/src/debug o Preserve empty directories referenced in debug sections w.r.t. https://bugzilla.redhat.com/show_bug.cgi?id=444310 o Make installsources a bit more verbose, piping up when rsync is run. --- portage-2.2_rc43/bin/ebuild-helpers/prepstrip.old 2009-08-21 16:52:01.000000000 +0200 +++ portage-2.2_rc43/bin/ebuild-helpers/prepstrip 2009-10-21 01:55:25.000000000 +0200 @@ -22,10 +22,11 @@ # We'll leave out -R .note for now until we can check out the relevance # 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" ewarn "be found. This feature will not work unless debugedit is installed!" fi @@ -46,21 +47,14 @@ type -P debugedit >/dev/null || return 0 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 '/$' "${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 local x=$1 local y="${D}usr/lib/debug/${x:${#D}}.debug" @@ -176,5 +170,25 @@ [[ ${x} == *.ko ]] && save_elf_debug "${x}" ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" 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