--- db.eclass.orig 2012-10-09 06:31:16.000000000 +1030 +++ db.eclass.orig 2013-06-16 10:00:49.080103866 +0930 @@ -28,8 +28,22 @@ # now rebuild all the correct ones for ext in so a; do for name in libdb libdb_{cxx,tcl,java,sql,stl}; do - target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -n |tail -n 1` - [ -n "${target}" ] && ln -sf ${target//.\//} ${name}.${ext} + target_array=( $(find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -nr) ) + # If ${target} is part of preserved_libs_registry, strip it from array # + index=1 + for target in ${target_array[@]}; do + if [ -n "`grep "${target}" "${ROOT}/var/lib/portage/preserved_libs_registry"`" ]; then + einfo "Found ${target} as part of preserve-rebuild set, ignoring..." + target_array=("${target_array[@]:$index}") + break + fi + let index++ + done + target="${target_array[0]}" + if [ -n "${target}" ]; then + einfo "Creating ${name}.${ext} symlinks to ${target}" + ln -sf ${target//.\//} ${name}.${ext} + fi done; done;