2 # Copyright 1999-2005 Gentoo Foundation
5 # revdep-rebuild: Reverse dependency rebuilder.
6 # Original Author: Stanislav Brabec
7 # Current Maintainer: Paul Varner <fuzzyray@gentoo.org>
11 # In exact ebuild mode revdep-rebuild can fail to properly order packages,
12 # which are not up to date.
13 # http://bugs.gentoo.org/show_bug.cgi?id=23018
15 # Rebuilding using --package-names mode should be default, but emerge has no
16 # feature to update to latest version of defined SLOT.
17 # http://bugs.gentoo.org/show_bug.cgi?id=4698
19 # Customizable variables:
21 # LD_LIBRARY_MASK - Mask of specially evaluated libraries
22 # SEARCH_DIRS - List of directories to search for executables and libraries
23 # SEARCH_DIRS_MASK - List of directories to not search
25 # These variables can be prepended to either by setting the variable in
26 # your environment prior to execution, or by placing an entry in
29 # An entry of "-*" means to clear the variable from that point forward.
30 # Example: env SEARCH_DIRS="/usr/bin -*" revdep-rebuild will set SEARCH_DIRS
31 # to contain only /usr/bin
33 if [ "$1" = "-h" -o "$1" = "--help" ]
35 echo "Usage: $0 [OPTIONS] [--] [EMERGE_OPTIONS]"
37 echo "Broken reverse dependency rebuilder."
39 echo " -X, --package-names Emerge based on package names, not exact versions"
40 echo " --library NAME Emerge existing packages that use the library with NAME"
41 echo " --library=NAME NAME can be a full path to the library or a basic"
42 echo " regular expression (man grep)"
43 echo " -nc, --no-color Turn off colored output"
44 echo " -i, --ignore Ignore temporary files from previous runs"
45 echo " -q, --quiet Be less verbose (also passed to emerge command)"
46 echo " -vv, --extra-verbose Be extra verbose"
48 echo "Calls emerge, all other options are used for it (e. g. -p, --pretend)."
50 echo "Report bugs to <http://bugs.gentoo.org>"
54 echo "Configuring search environment for revdep-rebuild"
56 # Obey PORTAGE_NICENESS
57 PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
58 if [ ! -z "$PORTAGE_NICENESS" ]
60 renice $PORTAGE_NICENESS $$ > /dev/null
61 # Since we have already set our nice value for our processes,
62 # reset PORTAGE_NICENESS to zero to avoid having emerge renice again.
63 export PORTAGE_NICENESS="0"
66 PORTAGE_ROOT=$(portageq envvar ROOT)
67 [ -z "$PORTAGE_ROOT" ] && PORTAGE_ROOT="/"
69 # Update the incremental variables using /etc/profile.env, /etc/ld.so.conf,
70 # portage, and the environment
72 # Read the incremental variables from environment and portage
73 # Until such time as portage supports these variables as incrementals
74 # The value will be what is in /etc/make.conf
75 PRELIMINARY_SEARCH_DIRS="$SEARCH_DIRS $(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS)"
76 PRELIMINARY_SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK $(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK)"
77 PRELIMINARY_LD_LIBRARY_MASK="$LD_LIBRARY_MASK $(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK)"
80 if [ -d /etc/revdep-rebuild ]
82 for file in $(ls /etc/revdep-rebuild)
84 PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(. /etc/revdep-rebuild/${file}; echo $SEARCH_DIRS)"
85 PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK $(. /etc/revdep-rebuild/${file}; echo $SEARCH_DIRS_MASK)"
86 PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK $(. /etc/revdep-rebuild/${file}; echo $LD_LIBRARY_MASK)"
89 PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*"
90 PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK /opt/OpenOffice /usr/lib/openoffice"
91 PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK libodbcinst.so libodbc.so libjava.so libjvm.so"
94 # Get the ROOTPATH and PATH from /etc/profile.env
95 if [ -e "/etc/profile.env" ]
97 PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $((. /etc/profile.env; echo ${ROOTPATH}:${PATH}) | tr ':' ' ')"
100 # Get the directories from /etc/ld.so.conf
101 if [ -e /etc/ld.so.conf ]
103 PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(grep -v "^#" /etc/ld.so.conf | tr '\n' ' ')"
106 # Set the final variables
107 # Note: Using $(echo $variable) removes extraneous spaces from variable assignment
109 for i in $(echo $PRELIMINARY_SEARCH_DIRS)
111 [ "$i" = "-*" ] && break
112 # Append a / at the end so that links and directories are treated the same by find
113 # Remove any existing trailing slashes to prevent double-slashes
114 SEARCH_DIRS="$(echo $SEARCH_DIRS ${i/%\//}/)"
117 unset SEARCH_DIRS_MASK
118 for i in $(echo $PRELIMINARY_SEARCH_DIRS_MASK)
120 [ "$i" = "-*" ] && break
121 SEARCH_DIRS_MASK="$(echo $SEARCH_DIRS_MASK $i)"
124 unset LD_LIBRARY_MASK
125 for i in $(echo $PRELIMINARY_LD_LIBRARY_MASK)
127 [ "$i" = "-*" ] && break
128 LD_LIBRARY_MASK="$(echo $LD_LIBRARY_MASK $i)"
131 # Use the color preference from portage
132 NOCOLOR=$(portageq envvar NOCOLOR)
134 # Base of temporary files names.
135 LIST=~/.revdep-rebuild
138 shopt -s expand_aliases
160 PRELIMINARY_CALLED_OPTIONS=""
161 while [ ! -z "$1" ] ; do
163 -X | --package-names )
165 PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names"
170 EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
173 --library=* | --soname=* | --soname-regexp=* )
176 PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
179 --library | --soname | --soname-regexp )
182 PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
197 -vv | --extra-verbose )
205 EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
211 EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //')
213 if [ -z "$PRELIMINARY_CALLED_OPTIONS" ]
217 for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort)
219 CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)"
223 if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ]
230 # Make the NOCOLOR variable visible to emerge
244 function set_trap () {
245 trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
248 function rm_temp () {
250 echo "Removing incomplete $1."
256 if $SEARCH_BROKEN ; then
257 SONAME_SEARCH="$SONAME"
259 HEAD_TEXT="broken by a package update"
260 OK_TEXT="Dynamic linking on your system is consistent"
261 WORKING_TEXT=" consistency"
263 # first case is needed to test against /path/to/foo.so
264 if [ ${SONAME:0:1} == '/' ] ; then
265 # Set to "<space>$SONAME<space>"
266 SONAME_SEARCH=" $SONAME "
268 # Set to "<tab>$SONAME<space>"
269 SONAME_SEARCH=" $SONAME "
271 LLIST=${LIST}_$(echo "$SONAME_SEARCH$SONAME" | md5sum | head -c 8)
272 HEAD_TEXT="using $SONAME"
273 OK_TEXT="There are no dynamic links to $SONAME"
277 # If any of our temporary files are older than 1 day, remove them all
278 [ "$(find "${LIST%/*}/." ! -name . -prune -name "${LIST##*/}*" -type f -mmin +1440)" != "" ] && rm -f ${LIST}*
280 # Don't use our previous files if environment doesn't match
281 if [ -f $LIST.0_env ]
283 PREVIOUS_SEARCH_DIRS=$(. ${LIST}.0_env; echo "$SEARCH_DIRS")
284 PREVIOUS_SEARCH_DIRS_MASK=$(. ${LIST}.0_env; echo "$SEARCH_DIRS_MASK")
285 PREVIOUS_LD_LIBRARY_MASK=$(. ${LIST}.0_env; echo "$LD_LIBRARY_MASK")
286 PREVIOUS_PORTAGE_ROOT=$(. ${LIST}.0_env; echo "$PORTAGE_ROOT")
287 PREVIOUS_OPTIONS=$(. ${LIST}.0_env; echo "$CALLED_OPTIONS")
288 if [ "$PREVIOUS_SEARCH_DIRS" != "$SEARCH_DIRS" ] || \
289 [ "$PREVIOUS_SEARCH_DIRS_MASK" != "$SEARCH_DIRS_MASK" ] || \
290 [ "$PREVIOUS_LD_LIBRARY_MASK" != "$LD_LIBRARY_MASK" ] || \
291 [ "$PREVIOUS_PORTAGE_ROOT" != "$PORTAGE_ROOT" ] || \
292 [ "$PREVIOUS_OPTIONS" != "$CALLED_OPTIONS" ]
295 echo "Environment mismatch from previous run, deleting temporary files..."
300 # Log our environment
301 echo "SEARCH_DIRS=\"$SEARCH_DIRS\"" > $LIST.0_env
302 echo "SEARCH_DIRS_MASK=\"$SEARCH_DIRS_MASK\"" >> $LIST.0_env
303 echo "LD_LIBRARY_MASK=\"$LD_LIBRARY_MASK\"" >> $LIST.0_env
304 echo "PORTAGE_ROOT=\"$PORTAGE_ROOT\"" >> $LIST.0_env
305 echo "CALLED_OPTIONS=\"$CALLED_OPTIONS\"" >> $LIST.0_env
306 echo "EMERGE_OPTIONS=\"$EMERGE_OPTIONS\"" >> $LIST.0_env
311 echo "revdep-rebuild environment:"
316 echo "Checking reverse dependencies..."
318 echo "Packages containing binaries and libraries $HEAD_TEXT"
319 echo "will be emerged."
322 echo -n -e "${GR}Collecting system binaries and libraries...${NO}"
324 if [ -f $LIST.1_files ]
326 echo " using existing $LIST.1_files."
328 # Be safe and remove any extraneous temporary files
329 rm -f ${LIST}.[1-9]_*
333 # Hack for the different versions of find.
334 find_results=$(find /usr/bin/revdep-rebuild -type f -perm /u+x 2>/dev/null)
335 if [ -z $find_results ]
337 find_results=$(find /usr/bin/revdep-rebuild -type f -perm +u+x 2>/dev/null)
338 if [ -z $find_results ]
341 echo -e "${RD}Unable to determine how to use find to locate executable files${NO}"
342 echo -e "${RD}Open a bug at http://bugs.gentoo.org${NO}"
346 # using -perm +u+x for find command
347 find $SEARCH_DIRS -type f \( -perm +u+x -o -name '*.so' -o -name '*.so.*' -o -name '*.la' \) 2>/dev/null | sort | uniq >$LIST.0_files
350 # using -perm /u+x for find command
351 find $SEARCH_DIRS -type f \( -perm /u+x -o -name '*.so' -o -name '*.so.*' -o -name '*.la' \) 2>/dev/null | sort | uniq >$LIST.0_files
354 # Remove files that match SEARCH_DIR_MASK
355 for dir in $SEARCH_DIRS_MASK
357 grep -v "^$dir" $LIST.0_files > $LIST.1_files
358 mv $LIST.1_files $LIST.0_files
361 mv $LIST.0_files $LIST.1_files
362 echo -e " done.\n ($LIST.1_files)"
365 if $SEARCH_BROKEN ; then
367 echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
368 if [ -f $LIST.2_ldpath ] ; then
369 echo " using existing $LIST.2_ldpath."
371 set_trap "$LIST.2_ldpath"
372 # Ensure that the "trusted" lib directories are at the start of the path
374 echo /lib* /usr/lib* | sed 's/ /:/g'
375 sed '/^#/d;s/#.*$//' </etc/ld.so.conf
376 sed 's:/[^/]*$::' <$LIST.1_files | sort -ru
377 ) | tr '\n' : | tr -d '\r' | sed 's/:$//' >$LIST.2_ldpath
378 echo -e " done.\n ($LIST.2_ldpath)"
380 export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
384 echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
385 if [ -f $LLIST.3_rebuild ] ; then
386 echo " using existing $LLIST.3_rebuild."
389 set_trap "$LLIST.3_rebuild"
390 LD_MASK="\\( $(echo "$LD_LIBRARY_MASK" | sed 's/\./\\./g;s/ / \\| /g') \\)"
391 echo -n >$LLIST.3_rebuild
392 cat $LIST.1_files | egrep -v '*\.la$' | while read FILE ; do
393 # Note: double checking seems to be faster than single
394 # with complete path (special add ons are rare).
395 if ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then
396 if $SEARCH_BROKEN ; then
397 if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then
398 # FIX: I hate duplicating code
399 # Only build missing direct dependencies
400 ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | sed -n 's/ \(.*\) => not found/\1/p' | tr '\n' ' ' | sed 's/ $//' )
401 REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//')
403 for lib in $ALL_MISSING_LIBS
405 if echo $REQUIRED_LIBS | grep -q $lib
407 MISSING_LIBS="$MISSING_LIBS $lib"
410 if [ "$MISSING_LIBS" != "" ]
412 echo "$FILE" >>$LLIST.3_rebuild
413 echo_v " broken $FILE (requires ${MISSING_LIBS})"
417 # FIX: I hate duplicating code
418 # Only rebuild for direct dependencies
419 ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | $SONAME_GREP "$SONAME_SEARCH" | awk '{print $1}' | tr '\n' ' ' | sed 's/ $//' )
420 REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//')
422 for lib in $ALL_MISSING_LIBS
424 if echo $REQUIRED_LIBS | grep -q $lib
426 MISSING_LIBS="$MISSING_LIBS $lib"
429 if [ "$MISSING_LIBS" != "" ]
431 echo "$FILE" >>$LLIST.3_rebuild
432 echo_v " found $FILE"
437 if $SEARCH_BROKEN ; then
438 cat $LIST.1_files | egrep '*\.la$' | while read FILE ; do
439 for depend in $(grep '^dependency_libs' $FILE | awk -F'=' '{print $2}' | sed "s/'//g") ; do
440 [ ${depend:0:1} != '/' ] && continue
441 if [ ! -e $depend ] ; then
442 echo "$FILE" >>$LLIST.3_rebuild
443 echo_v " broken $FILE (requires ${depend})"
448 echo -e " done.\n ($LLIST.3_rebuild)"
451 if $PACKAGE_NAMES ; then
455 echo -n -e "${GR}Assigning files to packages...${NO}"
456 if [ -f $LLIST.4_packages_raw ] ; then
457 echo " using existing $LLIST.4_packages_raw."
459 set_trap "$LLIST.4_packages*"
460 echo -n >$LLIST.4_packages_raw
461 echo -n >$LLIST.4_package_owners
462 cat $LLIST.3_rebuild | while read FILE ; do
463 EXACT_PKG="$(echo $FILE | sed 's/^/obj /' | (cd /var/db/pkg; grep -l -f - */*/CONTENTS) | sed s:/CONTENTS:: )"
464 # Ugly sed hack to strip version information
465 PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')"
466 if [ -z "$PKG" ] ; then
467 echo -n -e "\n ${RD}*** $FILE not owned by any package is broken! ***${NO}"
468 echo "$FILE -> (none)" >> $LLIST.4_package_owners
469 echo_v -n -e "\n $FILE -> (none)"
471 echo "$EXACT_PKG" >> $LLIST.4_packages_raw
472 echo "$FILE -> $EXACT_PKG" >> $LLIST.4_package_owners
473 echo_v -n -e "\n $FILE -> $PKG"
477 echo -e " done.\n ($LLIST.4_packages_raw, $LLIST.4_package_owners)"
481 echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}"
482 if [ -f $LLIST.4_packages ] ; then
483 echo " using existing $LLIST.4_packages."
485 sort -u $LLIST.4_packages_raw >$LLIST.4_packages
486 echo -e " done.\n ($LLIST.4_packages)"
490 echo -n -e "${GR}Assigning packages to ebuilds...${NO}"
491 if [ -f $LLIST.4_ebuilds ] ; then
492 echo " using existing $LLIST.4_ebuilds."
494 if [ -s "$LLIST.4_packages" ]
496 set_trap "$LLIST.4_ebuilds"
497 cat $LLIST.4_packages | while read EXACT_PKG
500 PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')"
501 SLOT=$(cat /var/db/pkg/${EXACT_PKG}/SLOT)
502 # If SLOT is equal to 0, then just see what portage says is latest version
505 best_visible=$(portageq best_visible $PORTAGE_ROOT $PKG)
506 [ "x" != "x$best_visible" ] && echo $best_visible
509 # Otherwise mask the other SLOTTED versions and check for latest
510 OTHER_VERSIONS=$(/usr/lib/gentoolkit/bin/find_pkgs.py $PKG | grep -v "($SLOT)" | awk '{print $2}')
511 if [ -f /etc/portage/package.mask ]
513 mv -f /etc/portage/package.mask /etc/portage/package.mask.revdep-rebuild.backup
515 # Make sure that /etc/portage/package.mask exists
516 mkdir -p /etc/portage
517 touch /etc/portage/package.mask
519 for pkg_version in $(echo $OTHER_VERSIONS | tr '\n' ' ')
521 echo "=${PKG}-${pkg_version}" >> /etc/portage/package.mask
523 best_visible=$(portageq best_visible $PORTAGE_ROOT $PKG)
524 [ "x" != "x$best_visible" ] && echo $best_visible
525 if [ -f /etc/portage/package.mask.revdep-rebuild.backup ]
527 mv -f /etc/portage/package.mask.revdep-rebuild.backup /etc/portage/package.mask
529 rm -f /etc/portage/package.mask
531 done > $LLIST.4_ebuilds
532 echo -e " done.\n ($LLIST.4_ebuilds)"
534 echo " Nothing to rebuild"
535 echo -n > $LLIST.4_ebuilds
542 echo -n -e "${GR}Assigning files to ebuilds...${NO}"
543 if [ -f $LLIST.4_ebuilds ] ; then
544 echo " using existing $LLIST.4_ebuilds."
546 if [ -s "$LLIST.3_rebuild" ] ; then
547 set_trap "$LLIST.4_ebuilds"
548 cat $LLIST.3_rebuild | sed 's/^/obj /;s/$/ /' |
551 fgrep -l -f - */*/CONTENTS
552 ) | sed s:/CONTENTS:: > $LLIST.4_ebuilds
553 echo -e " done.\n ($LLIST.4_ebuilds)"
555 echo " Nothing to rebuild"
556 echo -n > $LLIST.4_ebuilds
563 echo -n -e "${GR}Evaluating package order...${NO}"
564 if [ -f $LLIST.5_order ] ; then
565 echo " using existing $LLIST.5_order."
567 RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')"
568 if [ ! -z "$RAW_REBUILD_LIST" ] ; then
569 REBUILD_GREP="^\\($( (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --nodeps --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5a_status ) | sed -n 's/\./\\&/g;s/ //g;s/$/\\/;s/\[[^]]*\]//gp' | tr '\n' '|' | sed 's/|$//'))\$"
570 if [ $(cat $LLIST.5a_status) -gt 0 ] ; then
572 echo -e "${RD}Warning: Failed to resolve package order."
573 echo -e "Will merge in \"random\" order!${NO}"
574 echo "Possible reasons:"
575 echo "- An ebuild is no longer in the portage tree."
576 echo "- An ebuild is masked, use /etc/portage/packages.keyword"
577 echo " and/or /etc/portage/package.unmask to unmask it"
578 for i in . . . . . ; do
582 ln -f $LLIST.4_ebuilds $LLIST.5_order
584 (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --emptytree --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5b_status ) | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order
585 if [ $(cat $LLIST.5b_status) -gt 0 ] ; then
587 echo -e "${RD}Warning: Failed to resolve package order."
588 echo -e "Will merge in \"random\" order!${NO}"
589 echo "Possible reasons:"
590 echo "- An ebuild is no longer in the portage tree."
591 echo "- An ebuild is masked, use /etc/portage/packages.keyword"
592 echo " and/or /etc/portage/package.unmask to unmask it"
593 for i in . . . . . ; do
598 ln -f $LLIST.4_ebuilds $LLIST.5_order
602 echo -n "" >$LLIST.5_order
604 echo -e " done.\n ($LLIST.5_order)"
607 REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')"
609 trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
611 if [ -z "$REBUILD_LIST" ] ; then
612 echo -e "\n${GR}$OK_TEXT... All done.${NO} "
622 echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false
625 echo -e "${GR}All prepared. Starting rebuild...${NO}"
627 echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST"
629 if $IS_REAL_MERGE ; then
630 for i in . . . . . . . . . . ; do
637 #if $EXACT_EBUILDS ; then
638 # Uncomment following, if you want to recompile masked ebuilds.
639 ## FIXME: Check for PORTDIR_OVERLAY
640 # echo -e "${GR}Temporarilly disabling package mask...${NO}"
641 # trap "mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask ; echo -e "\\n\\nTerminated." ; exit 1" \
642 # SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
643 # mv -i /usr/portage/profiles/package.mask /usr/portage/profiles/package.mask.hidden
646 # Run in background to correctly handle Ctrl-C
648 EMERGE_DEFAULT_OPTS="" emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST
649 echo $? >$LLIST.6_status
653 #if $EXACT_EBUILDS ; then
654 # mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask
655 # trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
658 if [ "$(cat $LLIST.6_status)" -gt 0 ] ; then
660 echo -e "${RD}revdep-rebuild failed to emerge all packages${NO}"
661 echo -e "${RD}you have the following choices:${NO}"
663 echo "- if emerge failed during the build, fix the problems and re-run revdep-rebuild"
665 echo "- use -X or --package-names as first argument (trys to rebuild package, not exact"
668 echo "- set ACCEPT_KEYWORDS=\"~<your platform>\" and/or /etc/portage/package.unmask"
669 echo " (and remove $LLIST.5_order to be evaluated again)"
671 echo "- modify the above emerge command and run it manually"
673 echo "- compile or unmerge unsatisfied packages manually, remove temporary files and"
674 echo " try again (you can edit package/ebuild list first)"
676 echo -e "${GR}To remove temporary files, please run:${NO}"
678 exit $(cat $LLIST.6_status)
680 if $IS_REAL_MERGE ; then
681 trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \
682 SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
683 echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} "
687 echo "You can re-run revdep-rebuild to verify that all libraries and binaries"
688 echo "are fixed. If some inconsistency remains, it can be orphaned file, deep"
689 echo "dependency, binary package or specially evaluated library."
691 echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}"