Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 97073 | Differences between
and this patch

Collapse All | Expand All

(-)revdep-rebuild.old (-127 / +138 lines)
Lines 42-47 Link Here
42
	echo "      --library=NAME   NAME can be a full path to the library or a basic"
42
	echo "      --library=NAME   NAME can be a full path to the library or a basic"
43
	echo "                       regular expression (man grep)"
43
	echo "                       regular expression (man grep)"
44
	echo " -nc, --no-color       Turn off colored output"
44
	echo " -nc, --no-color       Turn off colored output"
45
	echo " -nw, --no-wait        Turn off safety delays"
45
	echo "  -i, --ignore         Ignore temporary files from previous runs"
46
	echo "  -i, --ignore         Ignore temporary files from previous runs"
46
	echo "  -q, --quiet          Be less verbose (also passed to emerge command)"
47
	echo "  -q, --quiet          Be less verbose (also passed to emerge command)"
47
	echo " -vv, --extra-verbose  Be extra verbose"
48
	echo " -vv, --extra-verbose  Be extra verbose"
Lines 52-58 Link Here
52
	exit 0
53
	exit 0
53
fi
54
fi
54
55
55
echo "Configuring search environment for revdep-rebuild"
56
echo_v() {
57
  $VERBOSE && echo "$@"
58
} 
59
60
PACKAGE_NAMES=false
61
SONAME="not found"
62
SONAME_GREP=grep
63
SEARCH_BROKEN=true
64
VERBOSE=true
65
EXTRA_VERBOSE=false
66
KEEP_TEMP=false
67
WAIT=true
68
69
EMERGE_OPTIONS=""
70
PRELIMINARY_CALLED_OPTIONS=""
71
while [ ! -z "$1" ] ; do
72
	case "$1" in
73
	-X | --package-names )
74
		PACKAGE_NAMES=true
75
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names"
76
		shift
77
		;;
78
	-q | --quiet )
79
		VERBOSE=false
80
		EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
81
		shift
82
		;;
83
	--library=* | --soname=* | --soname-regexp=* )
84
		SONAME="${1#*=}"
85
		SEARCH_BROKEN=false
86
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
87
		shift
88
		;;
89
	--library | --soname | --soname-regexp )
90
		SONAME="$2"
91
		SEARCH_BROKEN=false
92
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
93
		shift 2
94
		;;
95
	-nc | --no-color )
96
		NOCOLOR=true
97
		shift
98
		;;
99
	-nw | --no-wait )
100
		WAIT=false
101
		shift
102
		;;
103
	-i | --ignore )
104
		rm -f ${LIST}*
105
		shift
106
		;;
107
	--keep-temp )
108
		KEEPTEMP=true
109
		shift
110
		;;
111
	-vv | --extra-verbose )
112
		EXTRA_VERBOSE=true
113
		shift
114
		;;
115
	-- )
116
		shift
117
		;;
118
	* )
119
		EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
120
		shift
121
		;;
122
	esac
123
done
124
125
EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //')
126
127
if [ -z "$PRELIMINARY_CALLED_OPTIONS" ]
128
then
129
	CALLED_OPTIONS=""
130
else
131
	for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort)
132
	do
133
		CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)"
134
	done
135
fi
136
137
echo_v "Configuring search environment for revdep-rebuild"
56
138
57
# Obey PORTAGE_NICENESS
139
# Obey PORTAGE_NICENESS
58
PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
140
PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
Lines 129-207 Link Here
129
YL="\x1b[33;01m"
211
YL="\x1b[33;01m"
130
BL="\x1b[34;01m"
212
BL="\x1b[34;01m"
131
213
132
alias echo_v=echo
133
134
PACKAGE_NAMES=false
135
SONAME="not found"
136
SONAME_GREP=grep
137
SEARCH_BROKEN=true
138
EXTRA_VERBOSE=false
139
KEEP_TEMP=false
140
141
EMERGE_OPTIONS=""
142
PRELIMINARY_CALLED_OPTIONS=""
143
while [ ! -z "$1" ] ; do
144
	case "$1" in
145
	-X | --package-names )
146
		PACKAGE_NAMES=true
147
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names"
148
		shift
149
		;;
150
	-q | --quiet )
151
		alias echo_v=:
152
		EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
153
		shift
154
		;;
155
	--library=* | --soname=* | --soname-regexp=* )
156
		SONAME="${1#*=}"
157
		SEARCH_BROKEN=false
158
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
159
		shift
160
		;;
161
	--library | --soname | --soname-regexp )
162
		SONAME="$2"
163
		SEARCH_BROKEN=false
164
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
165
		shift 2
166
		;;
167
	-nc | --no-color )
168
		NOCOLOR=true
169
		shift
170
		;;
171
	-i | --ignore )
172
		rm -f ${LIST}*
173
		shift
174
		;;
175
	--keep-temp )
176
		KEEPTEMP=true
177
		shift
178
		;;
179
	-vv | --extra-verbose )
180
		EXTRA_VERBOSE=true
181
		shift
182
		;;
183
	-- )
184
		shift
185
		;;
186
	* )
187
		EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
188
		shift
189
		;;
190
	esac
191
done
192
193
EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //')
194
195
if [ -z "$PRELIMINARY_CALLED_OPTIONS" ]
196
then
197
	CALLED_OPTIONS=""
198
else
199
	for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort)
200
	do
201
		CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)"
202
	done
203
fi
204
205
if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ]
214
if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ]
206
then
215
then
207
	NOCOLOR=true
216
	NOCOLOR=true
Lines 291-308 Link Here
291
	cat $LIST.0_env
300
	cat $LIST.0_env
292
fi
301
fi
293
302
294
echo
303
echo_v
295
echo "Checking reverse dependencies..."
304
echo_v "Checking reverse dependencies..."
296
echo
305
echo_v
297
echo "Packages containing binaries and libraries $HEAD_TEXT"
306
echo_v "Packages containing binaries and libraries $HEAD_TEXT"
298
echo "will be emerged."
307
echo_v "will be emerged."
299
308
300
echo
309
echo_v
301
echo -n -e "${GR}Collecting system binaries and libraries...${NO}"
310
echo_v -n -e "${GR}Collecting system binaries and libraries...${NO}"
302
311
303
if [ -f $LIST.1_files ]
312
if [ -f $LIST.1_files ]
304
then
313
then
305
	echo " using existing $LIST.1_files."
314
	echo_v " using existing $LIST.1_files."
306
else
315
else
307
	# Be safe and remove any extraneous temporary files
316
	# Be safe and remove any extraneous temporary files
308
	rm -f ${LIST}.[1-9]_*
317
	rm -f ${LIST}.[1-9]_*
Lines 319-332 Link Here
319
	done
328
	done
320
	
329
	
321
	mv $LIST.0_files $LIST.1_files
330
	mv $LIST.0_files $LIST.1_files
322
	echo -e " done.\n  ($LIST.1_files)"
331
	echo_v -e " done.\n  ($LIST.1_files)"
323
fi
332
fi
324
333
325
if $SEARCH_BROKEN ; then
334
if $SEARCH_BROKEN ; then
326
	echo
335
	echo_v
327
	echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
336
	echo_v -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
328
	if [ -f $LIST.2_ldpath ] ; then
337
	if [ -f $LIST.2_ldpath ] ; then
329
		echo " using existing $LIST.2_ldpath."
338
		echo_v " using existing $LIST.2_ldpath."
330
	else
339
	else
331
		set_trap "$LIST.2_ldpath"
340
		set_trap "$LIST.2_ldpath"
332
		# Ensure that the "trusted" lib directories are at the start of the path
341
		# Ensure that the "trusted" lib directories are at the start of the path
Lines 335-349 Link Here
335
			sed '/^#/d;s/#.*$//' </etc/ld.so.conf
344
			sed '/^#/d;s/#.*$//' </etc/ld.so.conf
336
			sed 's:/[^/]*$::' <$LIST.1_files | sort -ru
345
			sed 's:/[^/]*$::' <$LIST.1_files | sort -ru
337
		) | tr '\n' : | tr -d '\r' | sed 's/:$//' >$LIST.2_ldpath
346
		) | tr '\n' : | tr -d '\r' | sed 's/:$//' >$LIST.2_ldpath
338
		echo -e " done.\n  ($LIST.2_ldpath)"
347
		echo_v -e " done.\n  ($LIST.2_ldpath)"
339
	fi
348
	fi
340
	export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
349
	export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
341
fi
350
fi
342
351
343
echo
352
echo_v
344
echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
353
echo_v -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
345
if [ -f $LLIST.3_rebuild ] ; then
354
if [ -f $LLIST.3_rebuild ] ; then
346
	echo " using existing $LLIST.3_rebuild."
355
	echo_v " using existing $LLIST.3_rebuild."
347
else
356
else
348
	echo_v
357
	echo_v
349
	set_trap "$LLIST.3_rebuild"
358
	set_trap "$LLIST.3_rebuild"
Lines 394-409 Link Here
394
		fi
403
		fi
395
	fi
404
	fi
396
	done
405
	done
397
	echo -e " done.\n  ($LLIST.3_rebuild)"
406
	echo_v -e " done.\n  ($LLIST.3_rebuild)"
398
fi
407
fi
399
408
400
if $PACKAGE_NAMES ; then
409
if $PACKAGE_NAMES ; then
401
	EXACT_EBUILDS=false
410
	EXACT_EBUILDS=false
402
411
403
	echo
412
	echo_v
404
	echo -n -e "${GR}Assigning files to packages...${NO}"
413
	echo_v -n -e "${GR}Assigning files to packages...${NO}"
405
	if [ -f $LLIST.4_packages_raw ] ; then
414
	if [ -f $LLIST.4_packages_raw ] ; then
406
		echo " using existing $LLIST.4_packages_raw."
415
		echo_v " using existing $LLIST.4_packages_raw."
407
	else
416
	else
408
		set_trap "$LLIST.4_packages*"
417
		set_trap "$LLIST.4_packages*"
409
		echo -n >$LLIST.4_packages_raw
418
		echo -n >$LLIST.4_packages_raw
Lines 423-444 Link Here
423
			fi
432
			fi
424
		done
433
		done
425
		echo_v
434
		echo_v
426
		echo -e " done.\n  ($LLIST.4_packages_raw, $LLIST.4_package_owners)"
435
		echo_v -e " done.\n  ($LLIST.4_packages_raw, $LLIST.4_package_owners)"
427
	fi
436
	fi
428
437
429
	echo
438
	echo_v
430
	echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}"
439
	echo_v -n -e "${GR}Cleaning list of packages to rebuild...${NO}"
431
	if [ -f $LLIST.4_packages ] ; then
440
	if [ -f $LLIST.4_packages ] ; then
432
		echo " using existing $LLIST.4_packages."
441
		echo_v " using existing $LLIST.4_packages."
433
	else
442
	else
434
		sort -u $LLIST.4_packages_raw >$LLIST.4_packages
443
		sort -u $LLIST.4_packages_raw >$LLIST.4_packages
435
		echo -e " done.\n  ($LLIST.4_packages)"
444
		echo_v -e " done.\n  ($LLIST.4_packages)"
436
	fi
445
	fi
437
446
438
	echo
447
	echo_v
439
	echo -n -e "${GR}Assigning packages to ebuilds...${NO}"
448
	echo_v -n -e "${GR}Assigning packages to ebuilds...${NO}"
440
	if [ -f $LLIST.4_ebuilds ] ; then
449
	if [ -f $LLIST.4_ebuilds ] ; then
441
		echo " using existing $LLIST.4_ebuilds."
450
		echo_v " using existing $LLIST.4_ebuilds."
442
	else
451
	else
443
		if [ -s "$LLIST.4_packages" ]
452
		if [ -s "$LLIST.4_packages" ]
444
		then
453
		then
Lines 476-494 Link Here
476
					rm -f /etc/portage/package.mask
485
					rm -f /etc/portage/package.mask
477
				fi
486
				fi
478
			done > $LLIST.4_ebuilds
487
			done > $LLIST.4_ebuilds
479
			echo -e " done.\n  ($LLIST.4_ebuilds)"
488
			echo_v -e " done.\n  ($LLIST.4_ebuilds)"
480
		else
489
		else
481
			echo " Nothing to rebuild"
490
			echo_v " Nothing to rebuild"
482
			echo -n > $LLIST.4_ebuilds
491
			echo -n > $LLIST.4_ebuilds
483
		fi
492
		fi
484
	fi
493
	fi
485
else
494
else
486
	EXACT_EBUILDS=true
495
	EXACT_EBUILDS=true
487
496
488
	echo
497
	echo_v
489
	echo -n -e "${GR}Assigning files to ebuilds...${NO}"
498
	echo_v -n -e "${GR}Assigning files to ebuilds...${NO}"
490
	if [ -f $LLIST.4_ebuilds ] ; then
499
	if [ -f $LLIST.4_ebuilds ] ; then
491
		echo " using existing $LLIST.4_ebuilds."
500
		echo_v " using existing $LLIST.4_ebuilds."
492
	else
501
	else
493
		if [ -s "$LLIST.3_rebuild" ] ; then
502
		if [ -s "$LLIST.3_rebuild" ] ; then
494
			set_trap "$LLIST.4_ebuilds"
503
			set_trap "$LLIST.4_ebuilds"
Lines 497-515 Link Here
497
				cd /var/db/pkg
506
				cd /var/db/pkg
498
				fgrep -l -f - */*/CONTENTS
507
				fgrep -l -f - */*/CONTENTS
499
			) | sed s:/CONTENTS:: > $LLIST.4_ebuilds
508
			) | sed s:/CONTENTS:: > $LLIST.4_ebuilds
500
			echo -e " done.\n  ($LLIST.4_ebuilds)"
509
			echo_v -e " done.\n  ($LLIST.4_ebuilds)"
501
		else
510
		else
502
			echo " Nothing to rebuild"
511
			echo_v " Nothing to rebuild"
503
			echo -n > $LLIST.4_ebuilds
512
			echo -n > $LLIST.4_ebuilds
504
		fi
513
		fi
505
	fi
514
	fi
506
515
507
fi
516
fi
508
517
509
echo
518
echo_v
510
echo -n -e "${GR}Evaluating package order...${NO}"
519
echo_v -n -e "${GR}Evaluating package order...${NO}"
511
if [ -f $LLIST.5_order ] ; then
520
if [ -f $LLIST.5_order ] ; then
512
	echo " using existing $LLIST.5_order."
521
	echo_v " using existing $LLIST.5_order."
513
else
522
else
514
	RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')"
523
	RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')"
515
	if [ ! -z "$RAW_REBUILD_LIST" ] ; then
524
	if [ ! -z "$RAW_REBUILD_LIST" ] ; then
Lines 522-531 Link Here
522
			echo "- An ebuild is no longer in the portage tree."
531
			echo "- An ebuild is no longer in the portage tree."
523
			echo "- An ebuild is masked, use /etc/portage/packages.keyword"
532
			echo "- An ebuild is masked, use /etc/portage/packages.keyword"
524
			echo "  and/or /etc/portage/package.unmask to unmask it"
533
			echo "  and/or /etc/portage/package.unmask to unmask it"
525
			for i in . . . . . ; do
534
			if $WAIT ; then
526
				echo -n -e '\a.'
535
				for i in . . . . . ; do
527
				sleep 1
536
					echo -n -e '\a.'
528
			done
537
					sleep 1
538
				done
539
			fi
529
			ln -f $LLIST.4_ebuilds $LLIST.5_order
540
			ln -f $LLIST.4_ebuilds $LLIST.5_order
530
		else
541
		else
531
			emerge --nospinner --pretend --oneshot --emptytree $RAW_REBUILD_LIST | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order
542
			emerge --nospinner --pretend --oneshot --emptytree $RAW_REBUILD_LIST | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order
Lines 533-539 Link Here
533
	else
544
	else
534
		echo -n "" >$LLIST.5_order
545
		echo -n "" >$LLIST.5_order
535
	fi
546
	fi
536
	echo -e " done.\n  ($LLIST.5_order)"
547
	echo_v -e " done.\n  ($LLIST.5_order)"
537
fi
548
fi
538
549
539
REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')"
550
REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')"
Lines 541-547 Link Here
541
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
552
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
542
553
543
if [ -z "$REBUILD_LIST" ] ; then
554
if [ -z "$REBUILD_LIST" ] ; then
544
	echo -e "\n${GR}$OK_TEXT... All done.${NO} "
555
	echo_v -e "\n${GR}$OK_TEXT... All done.${NO} "
545
	if [ ! $KEEPTEMP ]
556
	if [ ! $KEEPTEMP ]
546
	then
557
	then
547
		rm $LIST.[0-2]_*
558
		rm $LIST.[0-2]_*
Lines 553-564 Link Here
553
IS_REAL_MERGE=true
564
IS_REAL_MERGE=true
554
echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false
565
echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false
555
566
556
echo
567
echo_v
557
echo -e "${GR}All prepared. Starting rebuild...${NO}"
568
echo_v -e "${GR}All prepared. Starting rebuild...${NO}"
558
569
559
echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST"
570
echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST"
560
571
561
if $IS_REAL_MERGE ; then
572
if $IS_REAL_MERGE && $WAIT ; then
562
	for i in . . . . . . . . . . ; do
573
	for i in . . . . . . . . . . ; do
563
		echo -n -e '\a.'
574
		echo -n -e '\a.'
564
		sleep 1
575
		sleep 1
Lines 612-626 Link Here
612
	if $IS_REAL_MERGE ; then
623
	if $IS_REAL_MERGE ; then
613
		trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \
624
		trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \
614
			SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
625
			SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
615
		echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} "
626
		echo_v -n -e "${GR}Build finished correctly. Removing temporary files...${NO} "
616
		echo
627
		echo_v
617
		rm $LIST.[0-2]_*
628
		rm $LIST.[0-2]_*
618
		rm $LLIST.[3-9]_*
629
		rm $LLIST.[3-9]_*
619
		echo "You can re-run revdep-rebuild to verify that all libraries and binaries"
630
		echo_v "You can re-run revdep-rebuild to verify that all libraries and binaries"
620
		echo "are fixed. If some inconsistency remains, it can be orphaned file, deep"
631
		echo_v "are fixed. If some inconsistency remains, it can be orphaned file, deep"
621
		echo "dependency, binary package or specially evaluated library."
632
		echo_v "dependency, binary package or specially evaluated library."
622
	else
633
	else
623
		echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}"
634
		echo_v -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}"
624
	fi
635
	fi
625
fi
636
fi
626
exit 0
637
exit 0

Return to bug 97073