diff -Nur gentoolkit-0.2.1_rc2/src/revdep-rebuild/revdep-rebuild gentoolkit-0.2.1_rc2.revdep-rebuild-quiet+nowait/src/revdep-rebuild/revdep-rebuild --- gentoolkit-0.2.1_rc2/src/revdep-rebuild/revdep-rebuild 2005-11-23 18:33:42.000000000 +0100 +++ gentoolkit-0.2.1_rc2.revdep-rebuild-quiet+nowait/src/revdep-rebuild/revdep-rebuild 2005-11-28 14:58:44.835336448 +0100 @@ -42,6 +42,7 @@ echo " --library=NAME NAME can be a full path to the library or a basic" echo " regular expression (man grep)" echo " -nc, --no-color Turn off colored output" + echo " -nw, --no-wait Turn off safety delays" echo " -i, --ignore Ignore temporary files from previous runs" echo " -q, --quiet Be less verbose (also passed to emerge command)" echo " -vv, --extra-verbose Be extra verbose" @@ -52,7 +53,88 @@ exit 0 fi -echo "Configuring search environment for revdep-rebuild" +echo_v() { + $VERBOSE && echo "$@" +} + +PACKAGE_NAMES=false +SONAME="not found" +SONAME_GREP=grep +SEARCH_BROKEN=true +VERBOSE=true +EXTRA_VERBOSE=false +KEEP_TEMP=false +WAIT=true + +EMERGE_OPTIONS="" +PRELIMINARY_CALLED_OPTIONS="" +while [ ! -z "$1" ] ; do + case "$1" in + -X | --package-names ) + PACKAGE_NAMES=true + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names" + shift + ;; + -q | --quiet ) + VERBOSE=false + EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" + shift + ;; + --library=* | --soname=* | --soname-regexp=* ) + SONAME="${1#*=}" + SEARCH_BROKEN=false + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" + shift + ;; + --library | --soname | --soname-regexp ) + SONAME="$2" + SEARCH_BROKEN=false + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" + shift 2 + ;; + -nc | --no-color ) + NOCOLOR=true + shift + ;; + -nw | --no-wait ) + WAIT=false + shift + ;; + -i | --ignore ) + rm -f ${LIST}* + shift + ;; + --keep-temp ) + KEEPTEMP=true + shift + ;; + -vv | --extra-verbose ) + EXTRA_VERBOSE=true + shift + ;; + -- ) + shift + ;; + * ) + EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" + shift + ;; + esac +done + +EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //') + +if [ -z "$PRELIMINARY_CALLED_OPTIONS" ] +then + CALLED_OPTIONS="" +else + for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort) + do + CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)" + done +fi + +echo_v "Configuring search environment for revdep-rebuild" # Obey PORTAGE_NICENESS PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) @@ -139,79 +221,6 @@ YL="\x1b[33;01m" BL="\x1b[34;01m" -alias echo_v=echo - -PACKAGE_NAMES=false -SONAME="not found" -SONAME_GREP=grep -SEARCH_BROKEN=true -EXTRA_VERBOSE=false -KEEP_TEMP=false - -EMERGE_OPTIONS="" -PRELIMINARY_CALLED_OPTIONS="" -while [ ! -z "$1" ] ; do - case "$1" in - -X | --package-names ) - PACKAGE_NAMES=true - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names" - shift - ;; - -q | --quiet ) - alias echo_v=: - EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" - shift - ;; - --library=* | --soname=* | --soname-regexp=* ) - SONAME="${1#*=}" - SEARCH_BROKEN=false - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" - shift - ;; - --library | --soname | --soname-regexp ) - SONAME="$2" - SEARCH_BROKEN=false - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" - shift 2 - ;; - -nc | --no-color ) - NOCOLOR=true - shift - ;; - -i | --ignore ) - rm -f ${LIST}* - shift - ;; - --keep-temp ) - KEEPTEMP=true - shift - ;; - -vv | --extra-verbose ) - EXTRA_VERBOSE=true - shift - ;; - -- ) - shift - ;; - * ) - EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" - shift - ;; - esac -done - -EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //') - -if [ -z "$PRELIMINARY_CALLED_OPTIONS" ] -then - CALLED_OPTIONS="" -else - for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort) - do - CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)" - done -fi - if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ] then NOCOLOR=true @@ -301,18 +310,18 @@ cat $LIST.0_env fi -echo -echo "Checking reverse dependencies..." -echo -echo "Packages containing binaries and libraries $HEAD_TEXT" -echo "will be emerged." +echo_v +echo_v "Checking reverse dependencies..." +echo_v +echo_v "Packages containing binaries and libraries $HEAD_TEXT" +echo_v "will be emerged." -echo -echo -n -e "${GR}Collecting system binaries and libraries...${NO}" +echo_v +echo_v -n -e "${GR}Collecting system binaries and libraries...${NO}" if [ -f $LIST.1_files ] then - echo " using existing $LIST.1_files." + echo_v " using existing $LIST.1_files." else # Be safe and remove any extraneous temporary files rm -f ${LIST}.[1-9]_* @@ -338,14 +347,14 @@ done mv $LIST.0_files $LIST.1_files - echo -e " done.\n ($LIST.1_files)" + echo_v -e " done.\n ($LIST.1_files)" fi if $SEARCH_BROKEN ; then - echo - echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}" + echo_v + echo_v -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}" if [ -f $LIST.2_ldpath ] ; then - echo " using existing $LIST.2_ldpath." + echo_v " using existing $LIST.2_ldpath." else set_trap "$LIST.2_ldpath" # Ensure that the "trusted" lib directories are at the start of the path @@ -354,15 +363,15 @@ sed '/^#/d;s/#.*$//' $LIST.2_ldpath - echo -e " done.\n ($LIST.2_ldpath)" + echo_v -e " done.\n ($LIST.2_ldpath)" fi export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)" fi -echo -echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}" +echo_v +echo_v -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}" if [ -f $LLIST.3_rebuild ] ; then - echo " using existing $LLIST.3_rebuild." + echo_v " using existing $LLIST.3_rebuild." else echo_v set_trap "$LLIST.3_rebuild" @@ -413,16 +422,16 @@ fi fi done - echo -e " done.\n ($LLIST.3_rebuild)" + echo_v -e " done.\n ($LLIST.3_rebuild)" fi if $PACKAGE_NAMES ; then EXACT_EBUILDS=false - echo - echo -n -e "${GR}Assigning files to packages...${NO}" + echo_v + echo_v -n -e "${GR}Assigning files to packages...${NO}" if [ -f $LLIST.4_packages_raw ] ; then - echo " using existing $LLIST.4_packages_raw." + echo_v " using existing $LLIST.4_packages_raw." else set_trap "$LLIST.4_packages*" echo -n >$LLIST.4_packages_raw @@ -442,22 +451,22 @@ fi done echo_v - echo -e " done.\n ($LLIST.4_packages_raw, $LLIST.4_package_owners)" + echo_v -e " done.\n ($LLIST.4_packages_raw, $LLIST.4_package_owners)" fi - echo - echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}" + echo_v + echo_v -n -e "${GR}Cleaning list of packages to rebuild...${NO}" if [ -f $LLIST.4_packages ] ; then - echo " using existing $LLIST.4_packages." + echo_v " using existing $LLIST.4_packages." else sort -u $LLIST.4_packages_raw >$LLIST.4_packages - echo -e " done.\n ($LLIST.4_packages)" + echo_v -e " done.\n ($LLIST.4_packages)" fi - echo - echo -n -e "${GR}Assigning packages to ebuilds...${NO}" + echo_v + echo_v -n -e "${GR}Assigning packages to ebuilds...${NO}" if [ -f $LLIST.4_ebuilds ] ; then - echo " using existing $LLIST.4_ebuilds." + echo_v " using existing $LLIST.4_ebuilds." else if [ -s "$LLIST.4_packages" ] then @@ -495,19 +504,19 @@ rm -f /etc/portage/package.mask fi done > $LLIST.4_ebuilds - echo -e " done.\n ($LLIST.4_ebuilds)" + echo_v -e " done.\n ($LLIST.4_ebuilds)" else - echo " Nothing to rebuild" + echo_v " Nothing to rebuild" echo -n > $LLIST.4_ebuilds fi fi else EXACT_EBUILDS=true - echo - echo -n -e "${GR}Assigning files to ebuilds...${NO}" + echo_v + echo_v -n -e "${GR}Assigning files to ebuilds...${NO}" if [ -f $LLIST.4_ebuilds ] ; then - echo " using existing $LLIST.4_ebuilds." + echo_v " using existing $LLIST.4_ebuilds." else if [ -s "$LLIST.3_rebuild" ] ; then set_trap "$LLIST.4_ebuilds" @@ -516,19 +525,19 @@ cd /var/db/pkg fgrep -l -f - */*/CONTENTS ) | sed s:/CONTENTS:: > $LLIST.4_ebuilds - echo -e " done.\n ($LLIST.4_ebuilds)" + echo_v -e " done.\n ($LLIST.4_ebuilds)" else - echo " Nothing to rebuild" + echo_v " Nothing to rebuild" echo -n > $LLIST.4_ebuilds fi fi fi -echo -echo -n -e "${GR}Evaluating package order...${NO}" +echo_v +echo_v -n -e "${GR}Evaluating package order...${NO}" if [ -f $LLIST.5_order ] ; then - echo " using existing $LLIST.5_order." + echo_v " using existing $LLIST.5_order." else RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')" if [ ! -z "$RAW_REBUILD_LIST" ] ; then @@ -541,10 +550,12 @@ echo "- An ebuild is no longer in the portage tree." echo "- An ebuild is masked, use /etc/portage/packages.keyword" echo " and/or /etc/portage/package.unmask to unmask it" - for i in . . . . . ; do - echo -n -e '\a.' - sleep 1 - done + if $WAIT ; then + for i in . . . . . ; do + echo -n -e '\a.' + sleep 1 + done + fi ln -f $LLIST.4_ebuilds $LLIST.5_order else emerge --nospinner --pretend --oneshot --emptytree $RAW_REBUILD_LIST | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order @@ -552,7 +563,7 @@ else echo -n "" >$LLIST.5_order fi - echo -e " done.\n ($LLIST.5_order)" + echo_v -e " done.\n ($LLIST.5_order)" fi REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')" @@ -560,7 +571,7 @@ trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM if [ -z "$REBUILD_LIST" ] ; then - echo -e "\n${GR}$OK_TEXT... All done.${NO} " + echo_v -e "\n${GR}$OK_TEXT... All done.${NO} " if [ ! $KEEPTEMP ] then rm $LIST.[0-2]_* @@ -572,12 +583,12 @@ IS_REAL_MERGE=true echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false -echo -echo -e "${GR}All prepared. Starting rebuild...${NO}" +echo_v +echo_v -e "${GR}All prepared. Starting rebuild...${NO}" echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST" -if $IS_REAL_MERGE ; then +if $IS_REAL_MERGE && $WAIT ; then for i in . . . . . . . . . . ; do echo -n -e '\a.' sleep 1 @@ -631,15 +642,15 @@ if $IS_REAL_MERGE ; then trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \ SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} " - echo + echo_v -n -e "${GR}Build finished correctly. Removing temporary files...${NO} " + echo_v rm $LIST.[0-2]_* rm $LLIST.[3-9]_* - echo "You can re-run revdep-rebuild to verify that all libraries and binaries" - echo "are fixed. If some inconsistency remains, it can be orphaned file, deep" - echo "dependency, binary package or specially evaluated library." + echo_v "You can re-run revdep-rebuild to verify that all libraries and binaries" + echo_v "are fixed. If some inconsistency remains, it can be orphaned file, deep" + echo_v "dependency, binary package or specially evaluated library." else - echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}" + echo_v -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}" fi fi exit 0