Bug 48950 - econf should include || die in ebuilds
|
Bug#:
48950
|
Product: Gentoo Linux
|
Version: 1.4_rc4
|
Platform: All
|
|
OS/Version: All
|
Status: RESOLVED
|
Severity: minor
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: qa@gentoo.org
|
Reported By: agriffis@gentoo.org
|
|
Component: Unspecified
|
|
|
URL:
|
|
Summary: econf should include || die in ebuilds
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2004-04-25 09:43 0000
|
resently the econf function in /usr/sbin/ebuild.sh calls die on its
own. This is unfortunate, because die is designed to tell you at what
line, with a custom message, an ebuild failed. When functions in
ebuild.sh call die directly, then both those features are thwarted.
The line number is useless (we don't _care_ where it died in
ebuild.sh) and the message is hard-coded.
It would be really good to (1) educate developers to never assume that
die() is called automatically from ebuild.sh, (2) fix the ebuilds to
call die when econf fails, (3) remove the automatic die from econf()
Created an attachment (id=30019) [details]
updated attachment to fix false hits
find . -name \*.ebuild | xargs perl -0777 -ne 's/\\\n/ /g; s/\n\s*assert\b/ ||
die/g; s/\beconf\b.*\bdie\b//g; s/#.*econf//g; /^.*\beconf\b.*$/m && print
"$ARGV: $&\n"' > econf-no-die.txt
Created an attachment (id=30021) [details]
sorted list
find . -name \*.ebuild | xargs perl -0777 -ne 's/\\\n/ /g; s/\n\s*assert\b/ ||
die/g; s/\beconf\b.*\bdie\b//g; s/#.*econf//g; while (/^.*\beconf\b.*$/mg) {
print "$ARGV: $&\n" }' | sort > econf-no-die.txt
Created an attachment (id=30039) [details]
remove more false positives
find . -name \*.ebuild | xargs perl -0777 -ne 's/\\\n/ /g; s/\n\s*assert\b/ ||
die/g; s/^.*\beconf\b.*\bdie\b.*//gm; s/#.*econf.*//g; while
(/^.*\beconf\b.*$/mg) { print "$ARGV: $&\n" }' | sort > econf-no-die.txt
Ok, I finished #2, now for #1 and #3
Here is what I did for #2, btw
$ sed -e 's/^..//; s|/[^/]*:.*||;' econf-no-die.txt | sort -u | while read p; do pushd $p; rm *.ebuild .#* ChangeLog; cvs up; echo "**** $p **************************************"; perl -0777 -i -pe 's/^[^#\n]*\beconf\b(?:.*?[^\\\n])*?(?=\n)/($t = $&) =~ m{\bdie\b} ? $t : $t . " || die \"econf failed\""/mges' *.ebuild; cvs diff || { read -p "Look good?" yesno </dev/tty; if [[ $yesno != [nN]* ]]; then echangelog "Add die following econf for bug 48950"; rc; else xterm; fi; }; popd; done
rc is a bash function that runs repoman commit with the most recent ChangeLog entry as the commit message. This bash one-liner let me verify each cvs diff before hitting <enter> to make the commit.
I'm just posting this for interest's sake, and for future reference.
How about adding rc as an attachment for completion?
I don't think it needs to be an attachment. Here is rc() and er(). I didn't
use er() in this exercise, but it is useful in other cases. Most developers
would need to modify the list of architectures in rc(). I develop for alpha,
ia64 and x86, so I ignore repoman's complaining if it is made up of entirely
other-architecture-specific problems. Of course, this means that I refrain
from using rc() in situations where I might have actually broken something
related to another architecture.
# repoman commit with the message from the ChangeLog
rc ()
{
local msg=`perl <ChangeLog -00 -ne \
's/^ \d{2} \w{3} \d{4};.*?:\n //s and chomp, s/\s+/ /g, print($_), exit'`
if [[ -z "$msg" ]]; then
echo "no ChangeLog message found" 1>&2
return 1
fi
local out=`repoman commit -m "$msg" "$@" | tee /dev/tty`
echo "$out" | grep -Eq 'CVS commit complete' && return 0
echo "$out" | grep -Eq 'alpha|ia64|x86' && return 1
repoman commit -m "$msg" --ignore-other-arches "$@"
}
# echangelog and repoman combined
er() {
rm -f ChangeLog
cvs up ChangeLog || return 1
echangelog "$*" || return 1
rc
}
testing bugzilla ... ignore this comment
Can probably close this, die has supported tracebacks for nearly 12 months. It
should no longer matter if econf has || die after it or not.