1 |
Author: fuzzyray |
2 |
Date: 2010-02-16 22:36:11 +0000 (Tue, 16 Feb 2010) |
3 |
New Revision: 743 |
4 |
|
5 |
Modified: |
6 |
branches/gentoolkit-0.2.4/ChangeLog |
7 |
branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild |
8 |
Log: |
9 |
Backport revdep-rebuild from trunk for all recent fixes. Bugs included in this are 143498, 280341, and 289599. |
10 |
|
11 |
Modified: branches/gentoolkit-0.2.4/ChangeLog |
12 |
=================================================================== |
13 |
--- branches/gentoolkit-0.2.4/ChangeLog 2010-02-15 19:26:34 UTC (rev 742) |
14 |
+++ branches/gentoolkit-0.2.4/ChangeLog 2010-02-16 22:36:11 UTC (rev 743) |
15 |
@@ -1,3 +1,7 @@ |
16 |
+2010-02-16: Paul Varner <fuzzyrau@g.o> |
17 |
+ * revdep-rebuild: Backport revdep-rebuild from trunk for all recent |
18 |
+ fixes. Bugs included in this are 143498, 280341, and 289599. |
19 |
+ |
20 |
2010-02-05: Paul Varner <fuzzyray@g.o> |
21 |
* revdep-rebuild: Update revdep-rebuild to use extended regular |
22 |
expressions instead of basic regular expressions. (Bug 143498) |
23 |
|
24 |
Modified: branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild |
25 |
=================================================================== |
26 |
--- branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild 2010-02-15 19:26:34 UTC (rev 742) |
27 |
+++ branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild 2010-02-16 22:36:11 UTC (rev 743) |
28 |
@@ -1,5 +1,5 @@ |
29 |
#!/bin/bash |
30 |
-# Copyright 1999-2008 Gentoo Foundation |
31 |
+# Copyright 1999-2010 Gentoo Foundation |
32 |
|
33 |
# revdep-rebuild: Reverse dependency rebuilder. |
34 |
# Original Author: Stanislav Brabec |
35 |
@@ -18,6 +18,7 @@ |
36 |
|
37 |
# Readonly variables: |
38 |
declare -r APP_NAME="${0##*/}" # The name of this application |
39 |
+declare -r VERSION="svn" |
40 |
declare -r OIFS="$IFS" # Save the IFS |
41 |
declare -r ENV_FILE=0_env.rr # Contains environment variables |
42 |
declare -r FILES_FILE=1_files.rr # Contains a list of files to search |
43 |
@@ -89,6 +90,7 @@ |
44 |
|
45 |
main() { |
46 |
# preliminary setup |
47 |
+ portage_settings |
48 |
get_opts "$@" |
49 |
setup_portage |
50 |
setup_search_paths_and_masks |
51 |
@@ -163,6 +165,11 @@ |
52 |
|
53 |
print_usage() { |
54 |
cat << EOF |
55 |
+${APP_NAME}: (${VERSION}) |
56 |
+ |
57 |
+Copyright (C) 2003-2010 Gentoo Foundation, Inc. |
58 |
+This is free software; see the source for copying conditions. |
59 |
+ |
60 |
Usage: $APP_NAME [OPTIONS] [--] [EMERGE_OPTIONS] |
61 |
|
62 |
Broken reverse dependency rebuilder. |
63 |
@@ -189,6 +196,7 @@ |
64 |
and passed directly to emerge. |
65 |
|
66 |
Report bugs to <http://bugs.gentoo.org> |
67 |
+ |
68 |
EOF |
69 |
} |
70 |
## |
71 |
@@ -233,7 +241,17 @@ |
72 |
die() { |
73 |
local status=$1 |
74 |
shift |
75 |
- eerror "$@" |
76 |
+ |
77 |
+ # Check if eerror has been loaded. |
78 |
+ # Its loaded _after_ opt parsing but not before due to RC_NOCOLOR. |
79 |
+ type eerror &> /dev/null |
80 |
+ |
81 |
+ if [[ $? -eq 0 ]]; |
82 |
+ then |
83 |
+ eerror "$@" |
84 |
+ else |
85 |
+ echo " * ${@}" >> /dev/stderr |
86 |
+ fi |
87 |
exit $status |
88 |
} |
89 |
## |
90 |
@@ -252,12 +270,23 @@ |
91 |
} |
92 |
## |
93 |
# Get the name of the package that owns a file or list of files given as args. |
94 |
+# NOTE: depends on app-misc/realpath! |
95 |
get_file_owner() { |
96 |
local IFS=$'\n' |
97 |
- # ${*/%/ } adds a space to the end of each object name to prevent false |
98 |
+ |
99 |
+ rpath=$(realpath "${*}" 2>/dev/null) |
100 |
+ # To ensure we always have something in rpath... |
101 |
+ [[ -z $rpath ]] && rpath=${*} |
102 |
+ |
103 |
+ # Workaround for bug 280341 |
104 |
+ mlib=$(echo ${*}|sed 's:/lib/:/lib64/:') |
105 |
+ [[ "${*}" == "${mlib}" ]] && mlib=$(echo ${*}|sed 's:/lib64/:/lib/:') |
106 |
+ |
107 |
+ # Add a space to the end of each object name to prevent false |
108 |
# matches, for example /usr/bin/dia matching /usr/bin/dialog (bug #196460). |
109 |
- find -L /var/db/pkg -name CONTENTS -print0 | |
110 |
- xargs -0 grep -Fl "${*/%/ }" | |
111 |
+ # The same for "${rpath} ". |
112 |
+ find /var/db/pkg -type f -name CONTENTS -print0 | |
113 |
+ xargs -0 grep -m 1 -Fl -e "${*} " -e "${rpath} " -e "${mlib} " | |
114 |
sed 's:/var/db/pkg/\(.*\)/CONTENTS:\1:' |
115 |
} |
116 |
## |
117 |
@@ -273,7 +302,6 @@ |
118 |
setup_color() { |
119 |
# This should still work if NOCOLOR is set by the -C flag or in the user's |
120 |
# environment. |
121 |
- export NOCOLOR=$(portageq envvar NOCOLOR) |
122 |
[[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr) |
123 |
. /etc/init.d/functions.sh |
124 |
} |
125 |
@@ -641,7 +669,7 @@ |
126 |
local include |
127 |
for path in $(sed '/^#/d;s/#.*$//' < /etc/ld.so.conf); do |
128 |
if [[ $include = true ]]; then |
129 |
- for include_path in $(sed '/^#/d;s/#.*$//' /etc/${path}); do |
130 |
+ for include_path in $(sed '/^#/d;s/#.*$//' /etc/${path} 2>/dev/null); do |
131 |
echo $include_path |
132 |
done |
133 |
include="" |
134 |
@@ -983,12 +1011,27 @@ |
135 |
done < "$OWNERS_FILE" | gawk '!s[$0]++' # (omit dupes) |
136 |
fi |
137 |
} |
138 |
+ |
139 |
+# Get multiple portage variables at once to speedup revdep-rebuild. |
140 |
+portage_settings() { |
141 |
+ local ORIG_SEARCH_DIRS="$SEARCH_DIRS" |
142 |
+ local ORIG_SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK" |
143 |
+ local ORIG_LD_LIBRARY_MASK="$LD_LIBRARY_MASK" |
144 |
+ unset SEARCH_DIRS |
145 |
+ unset SEARCH_DIRS_MASK |
146 |
+ unset LD_LIBRARY_MASK |
147 |
+ |
148 |
+ eval $(portageq envvar -v PORTAGE_ROOT PORTAGE_NICENESS EMERGE_DEFAULT_OPTS NOCOLOR SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK) |
149 |
+ export NOCOLOR |
150 |
+ |
151 |
+ SEARCH_DIRS="$ORIG_SEARCH_DIRS $SEARCH_DIRS" |
152 |
+ SEARCH_DIRS_MASK="$ORIG_SEARCH_DIRS_MASK $SEARCH_DIRS_MASK" |
153 |
+ LD_LIBRARY_MASK="$ORIG_LD_LIBRARY_MASK $LD_LIBRARY_MASK" |
154 |
+} |
155 |
+ |
156 |
## |
157 |
# Setup portage and the search paths |
158 |
setup_portage() { |
159 |
- PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) |
160 |
- PORTAGE_ROOT=$(portageq envvar ROOT) |
161 |
- |
162 |
# Obey PORTAGE_NICENESS (which is incremental to the current nice value) |
163 |
if [[ $PORTAGE_NICENESS ]]; then |
164 |
current_niceness=$(nice) |
165 |
@@ -1015,9 +1058,9 @@ |
166 |
# Read the incremental variables from environment and portage |
167 |
# Until such time as portage supports these variables as incrementals |
168 |
# The value will be what is in /etc/make.conf |
169 |
- SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS) |
170 |
- SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK) |
171 |
- LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK) |
172 |
+# SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS) |
173 |
+# SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK) |
174 |
+# LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK) |
175 |
|
176 |
# Add the defaults |
177 |
if [[ -d /etc/revdep-rebuild ]]; then |
178 |
@@ -1070,7 +1113,7 @@ |
179 |
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM |
180 |
|
181 |
einfo 'All prepared. Starting rebuild' |
182 |
- echo "emerge --oneshot ${EMERGE_OPTIONS[@]} $REBUILD_LIST" |
183 |
+ echo "emerge --oneshot ${EMERGE_OPTIONS[@]} ${EMERGE_DEFAULT_OPTS} $REBUILD_LIST" |
184 |
|
185 |
is_real_merge && countdown 10 |
186 |
|
187 |
@@ -1079,7 +1122,7 @@ |
188 |
|
189 |
# Run in background to correctly handle Ctrl-C |
190 |
{ |
191 |
- EMERGE_DEFAULT_OPTS="--oneshot ${EMERGE_OPTIONS[@]}" emerge $REBUILD_LIST <&6 |
192 |
+ emerge --oneshot ${EMERGE_OPTIONS[@]} ${EMERGE_DEFAULT_OPTS} $REBUILD_LIST <&6 |
193 |
echo $? > "$STATUS_FILE" |
194 |
} & |
195 |
wait |
196 |
@@ -1125,7 +1168,7 @@ |
197 |
if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then |
198 |
show_unowned_files |
199 |
fi |
200 |
- [[ $KEEP_TEMP ]] || rm "${FILES[@]}" |
201 |
+ [[ $KEEP_TEMP ]] || rm -f "${FILES[@]}" |
202 |
else |
203 |
einfo 'Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.' |
204 |
fi |