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

(-)gentoolkit-0.2.1_rc2/src/revdep-rebuild/revdep-rebuild (-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 139-217 Link Here
139
YL="\x1b[33;01m"
221
YL="\x1b[33;01m"
140
BL="\x1b[34;01m"
222
BL="\x1b[34;01m"
141
223
142
alias echo_v=echo
143
144
PACKAGE_NAMES=false
145
SONAME="not found"
146
SONAME_GREP=grep
147
SEARCH_BROKEN=true
148
EXTRA_VERBOSE=false
149
KEEP_TEMP=false
150
151
EMERGE_OPTIONS=""
152
PRELIMINARY_CALLED_OPTIONS=""
153
while [ ! -z "$1" ] ; do
154
	case "$1" in
155
	-X | --package-names )
156
		PACKAGE_NAMES=true
157
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names"
158
		shift
159
		;;
160
	-q | --quiet )
161
		alias echo_v=:
162
		EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
163
		shift
164
		;;
165
	--library=* | --soname=* | --soname-regexp=* )
166
		SONAME="${1#*=}"
167
		SEARCH_BROKEN=false
168
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
169
		shift
170
		;;
171
	--library | --soname | --soname-regexp )
172
		SONAME="$2"
173
		SEARCH_BROKEN=false
174
		PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
175
		shift 2
176
		;;
177
	-nc | --no-color )
178
		NOCOLOR=true
179
		shift
180
		;;
181
	-i | --ignore )
182
		rm -f ${LIST}*
183
		shift
184
		;;
185
	--keep-temp )
186
		KEEPTEMP=true
187
		shift
188
		;;
189
	-vv | --extra-verbose )
190
		EXTRA_VERBOSE=true
191
		shift
192
		;;
193
	-- )
194
		shift
195
		;;
196
	* )
197
		EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
198
		shift
199
		;;
200
	esac
201
done
202
203
EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //')
204
205
if [ -z "$PRELIMINARY_CALLED_OPTIONS" ]
206
then
207
	CALLED_OPTIONS=""
208
else
209
	for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort)
210
	do
211
		CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)"
212
	done
213
fi
214
215
if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ]
224
if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ]
216
then
225
then
217
	NOCOLOR=true
226
	NOCOLOR=true
Lines 301-318 Link Here
301
	cat $LIST.0_env
310
	cat $LIST.0_env
302
fi
311
fi
303
312
304
echo
313
echo_v
305
echo "Checking reverse dependencies..."
314
echo_v "Checking reverse dependencies..."
306
echo
315
echo_v
307
echo "Packages containing binaries and libraries $HEAD_TEXT"
316
echo_v "Packages containing binaries and libraries $HEAD_TEXT"
308
echo "will be emerged."
317
echo_v "will be emerged."
309
318
310
echo
319
echo_v
311
echo -n -e "${GR}Collecting system binaries and libraries...${NO}"
320
echo_v -n -e "${GR}Collecting system binaries and libraries...${NO}"
312
321
313
if [ -f $LIST.1_files ]
322
if [ -f $LIST.1_files ]
314
then
323
then
315
	echo " using existing $LIST.1_files."
324
	echo_v " using existing $LIST.1_files."
316
else
325
else
317
	# Be safe and remove any extraneous temporary files
326
	# Be safe and remove any extraneous temporary files
318
	rm -f ${LIST}.[1-9]_*
327
	rm -f ${LIST}.[1-9]_*
Lines 338-351 Link Here
338
	done
347
	done
339
	
348
	
340
	mv $LIST.0_files $LIST.1_files
349
	mv $LIST.0_files $LIST.1_files
341
	echo -e " done.\n  ($LIST.1_files)"
350
	echo_v -e " done.\n  ($LIST.1_files)"
342
fi
351
fi
343
352
344
if $SEARCH_BROKEN ; then
353
if $SEARCH_BROKEN ; then
345
	echo
354
	echo_v
346
	echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
355
	echo_v -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
347
	if [ -f $LIST.2_ldpath ] ; then
356
	if [ -f $LIST.2_ldpath ] ; then
348
		echo " using existing $LIST.2_ldpath."
357
		echo_v " using existing $LIST.2_ldpath."
349
	else
358
	else
350
		set_trap "$LIST.2_ldpath"
359
		set_trap "$LIST.2_ldpath"
351
		# Ensure that the "trusted" lib directories are at the start of the path
360
		# Ensure that the "trusted" lib directories are at the start of the path
Lines 354-368 Link Here
354
			sed '/^#/d;s/#.*$//' </etc/ld.so.conf
363
			sed '/^#/d;s/#.*$//' </etc/ld.so.conf
355
			sed 's:/[^/]*$::' <$LIST.1_files | sort -ru
364
			sed 's:/[^/]*$::' <$LIST.1_files | sort -ru
356
		) | tr '\n' : | tr -d '\r' | sed 's/:$//' >$LIST.2_ldpath
365
		) | tr '\n' : | tr -d '\r' | sed 's/:$//' >$LIST.2_ldpath
357
		echo -e " done.\n  ($LIST.2_ldpath)"
366
		echo_v -e " done.\n  ($LIST.2_ldpath)"
358
	fi
367
	fi
359
	export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
368
	export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
360
fi
369
fi
361
370
362
echo
371
echo_v
363
echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
372
echo_v -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
364
if [ -f $LLIST.3_rebuild ] ; then
373
if [ -f $LLIST.3_rebuild ] ; then
365
	echo " using existing $LLIST.3_rebuild."
374
	echo_v " using existing $LLIST.3_rebuild."
366
else
375
else
367
	echo_v
376
	echo_v
368
	set_trap "$LLIST.3_rebuild"
377
	set_trap "$LLIST.3_rebuild"
Lines 413-428 Link Here
413
		fi
422
		fi
414
	fi
423
	fi
415
	done
424
	done
416
	echo -e " done.\n  ($LLIST.3_rebuild)"
425
	echo_v -e " done.\n  ($LLIST.3_rebuild)"
417
fi
426
fi
418
427
419
if $PACKAGE_NAMES ; then
428
if $PACKAGE_NAMES ; then
420
	EXACT_EBUILDS=false
429
	EXACT_EBUILDS=false
421
430
422
	echo
431
	echo_v
423
	echo -n -e "${GR}Assigning files to packages...${NO}"
432
	echo_v -n -e "${GR}Assigning files to packages...${NO}"
424
	if [ -f $LLIST.4_packages_raw ] ; then
433
	if [ -f $LLIST.4_packages_raw ] ; then
425
		echo " using existing $LLIST.4_packages_raw."
434
		echo_v " using existing $LLIST.4_packages_raw."
426
	else
435
	else
427
		set_trap "$LLIST.4_packages*"
436
		set_trap "$LLIST.4_packages*"
428
		echo -n >$LLIST.4_packages_raw
437
		echo -n >$LLIST.4_packages_raw
Lines 442-463 Link Here
442
			fi
451
			fi
443
		done
452
		done
444
		echo_v
453
		echo_v
445
		echo -e " done.\n  ($LLIST.4_packages_raw, $LLIST.4_package_owners)"
454
		echo_v -e " done.\n  ($LLIST.4_packages_raw, $LLIST.4_package_owners)"
446
	fi
455
	fi
447
456
448
	echo
457
	echo_v
449
	echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}"
458
	echo_v -n -e "${GR}Cleaning list of packages to rebuild...${NO}"
450
	if [ -f $LLIST.4_packages ] ; then
459
	if [ -f $LLIST.4_packages ] ; then
451
		echo " using existing $LLIST.4_packages."
460
		echo_v " using existing $LLIST.4_packages."
452
	else
461
	else
453
		sort -u $LLIST.4_packages_raw >$LLIST.4_packages
462
		sort -u $LLIST.4_packages_raw >$LLIST.4_packages
454
		echo -e " done.\n  ($LLIST.4_packages)"
463
		echo_v -e " done.\n  ($LLIST.4_packages)"
455
	fi
464
	fi
456
465
457
	echo
466
	echo_v
458
	echo -n -e "${GR}Assigning packages to ebuilds...${NO}"
467
	echo_v -n -e "${GR}Assigning packages to ebuilds...${NO}"
459
	if [ -f $LLIST.4_ebuilds ] ; then
468
	if [ -f $LLIST.4_ebuilds ] ; then
460
		echo " using existing $LLIST.4_ebuilds."
469
		echo_v " using existing $LLIST.4_ebuilds."
461
	else
470
	else
462
		if [ -s "$LLIST.4_packages" ]
471
		if [ -s "$LLIST.4_packages" ]
463
		then
472
		then
Lines 495-513 Link Here
495
					rm -f /etc/portage/package.mask
504
					rm -f /etc/portage/package.mask
496
				fi
505
				fi
497
			done > $LLIST.4_ebuilds
506
			done > $LLIST.4_ebuilds
498
			echo -e " done.\n  ($LLIST.4_ebuilds)"
507
			echo_v -e " done.\n  ($LLIST.4_ebuilds)"
499
		else
508
		else
500
			echo " Nothing to rebuild"
509
			echo_v " Nothing to rebuild"
501
			echo -n > $LLIST.4_ebuilds
510
			echo -n > $LLIST.4_ebuilds
502
		fi
511
		fi
503
	fi
512
	fi
504
else
513
else
505
	EXACT_EBUILDS=true
514
	EXACT_EBUILDS=true
506
515
507
	echo
516
	echo_v
508
	echo -n -e "${GR}Assigning files to ebuilds...${NO}"
517
	echo_v -n -e "${GR}Assigning files to ebuilds...${NO}"
509
	if [ -f $LLIST.4_ebuilds ] ; then
518
	if [ -f $LLIST.4_ebuilds ] ; then
510
		echo " using existing $LLIST.4_ebuilds."
519
		echo_v " using existing $LLIST.4_ebuilds."
511
	else
520
	else
512
		if [ -s "$LLIST.3_rebuild" ] ; then
521
		if [ -s "$LLIST.3_rebuild" ] ; then
513
			set_trap "$LLIST.4_ebuilds"
522
			set_trap "$LLIST.4_ebuilds"
Lines 516-534 Link Here
516
				cd /var/db/pkg
525
				cd /var/db/pkg
517
				fgrep -l -f - */*/CONTENTS
526
				fgrep -l -f - */*/CONTENTS
518
			) | sed s:/CONTENTS:: > $LLIST.4_ebuilds
527
			) | sed s:/CONTENTS:: > $LLIST.4_ebuilds
519
			echo -e " done.\n  ($LLIST.4_ebuilds)"
528
			echo_v -e " done.\n  ($LLIST.4_ebuilds)"
520
		else
529
		else
521
			echo " Nothing to rebuild"
530
			echo_v " Nothing to rebuild"
522
			echo -n > $LLIST.4_ebuilds
531
			echo -n > $LLIST.4_ebuilds
523
		fi
532
		fi
524
	fi
533
	fi
525
534
526
fi
535
fi
527
536
528
echo
537
echo_v
529
echo -n -e "${GR}Evaluating package order...${NO}"
538
echo_v -n -e "${GR}Evaluating package order...${NO}"
530
if [ -f $LLIST.5_order ] ; then
539
if [ -f $LLIST.5_order ] ; then
531
	echo " using existing $LLIST.5_order."
540
	echo_v " using existing $LLIST.5_order."
532
else
541
else
533
	RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')"
542
	RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')"
534
	if [ ! -z "$RAW_REBUILD_LIST" ] ; then
543
	if [ ! -z "$RAW_REBUILD_LIST" ] ; then
Lines 541-550 Link Here
541
			echo "- An ebuild is no longer in the portage tree."
550
			echo "- An ebuild is no longer in the portage tree."
542
			echo "- An ebuild is masked, use /etc/portage/packages.keyword"
551
			echo "- An ebuild is masked, use /etc/portage/packages.keyword"
543
			echo "  and/or /etc/portage/package.unmask to unmask it"
552
			echo "  and/or /etc/portage/package.unmask to unmask it"
544
			for i in . . . . . ; do
553
			if $WAIT ; then
545
				echo -n -e '\a.'
554
				for i in . . . . . ; do
546
				sleep 1
555
					echo -n -e '\a.'
547
			done
556
					sleep 1
557
				done
558
			fi
548
			ln -f $LLIST.4_ebuilds $LLIST.5_order
559
			ln -f $LLIST.4_ebuilds $LLIST.5_order
549
		else
560
		else
550
			emerge --nospinner --pretend --oneshot --emptytree $RAW_REBUILD_LIST | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order
561
			emerge --nospinner --pretend --oneshot --emptytree $RAW_REBUILD_LIST | sed -n 's/ //g;s/^.*\]//p' | grep "$REBUILD_GREP" >$LLIST.5_order
Lines 552-558 Link Here
552
	else
563
	else
553
		echo -n "" >$LLIST.5_order
564
		echo -n "" >$LLIST.5_order
554
	fi
565
	fi
555
	echo -e " done.\n  ($LLIST.5_order)"
566
	echo_v -e " done.\n  ($LLIST.5_order)"
556
fi
567
fi
557
568
558
REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')"
569
REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')"
Lines 560-566 Link Here
560
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
571
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
561
572
562
if [ -z "$REBUILD_LIST" ] ; then
573
if [ -z "$REBUILD_LIST" ] ; then
563
	echo -e "\n${GR}$OK_TEXT... All done.${NO} "
574
	echo_v -e "\n${GR}$OK_TEXT... All done.${NO} "
564
	if [ ! $KEEPTEMP ]
575
	if [ ! $KEEPTEMP ]
565
	then
576
	then
566
		rm $LIST.[0-2]_*
577
		rm $LIST.[0-2]_*
Lines 572-583 Link Here
572
IS_REAL_MERGE=true
583
IS_REAL_MERGE=true
573
echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false
584
echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false
574
585
575
echo
586
echo_v
576
echo -e "${GR}All prepared. Starting rebuild...${NO}"
587
echo_v -e "${GR}All prepared. Starting rebuild...${NO}"
577
588
578
echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST"
589
echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST"
579
590
580
if $IS_REAL_MERGE ; then
591
if $IS_REAL_MERGE && $WAIT ; then
581
	for i in . . . . . . . . . . ; do
592
	for i in . . . . . . . . . . ; do
582
		echo -n -e '\a.'
593
		echo -n -e '\a.'
583
		sleep 1
594
		sleep 1
Lines 631-645 Link Here
631
	if $IS_REAL_MERGE ; then
642
	if $IS_REAL_MERGE ; then
632
		trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \
643
		trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \
633
			SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
644
			SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
634
		echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} "
645
		echo_v -n -e "${GR}Build finished correctly. Removing temporary files...${NO} "
635
		echo
646
		echo_v
636
		rm $LIST.[0-2]_*
647
		rm $LIST.[0-2]_*
637
		rm $LLIST.[3-9]_*
648
		rm $LLIST.[3-9]_*
638
		echo "You can re-run revdep-rebuild to verify that all libraries and binaries"
649
		echo_v "You can re-run revdep-rebuild to verify that all libraries and binaries"
639
		echo "are fixed. If some inconsistency remains, it can be orphaned file, deep"
650
		echo_v "are fixed. If some inconsistency remains, it can be orphaned file, deep"
640
		echo "dependency, binary package or specially evaluated library."
651
		echo_v "dependency, binary package or specially evaluated library."
641
	else
652
	else
642
		echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}"
653
		echo_v -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}"
643
	fi
654
	fi
644
fi
655
fi
645
exit 0
656
exit 0

Return to bug 97073