summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2002-11-25 06:45:53 +0000
committerMartin Schlemmer <azarah@gentoo.org>2002-11-25 06:45:53 +0000
commit927d35165ec267e4ba0f98021a1c3d59eb8878f1 (patch)
treec52a56e8ac5c00832cca9e509b8cc46e83c8abd5 /sys-devel
parentMasked out for all architectures. (diff)
downloadhistorical-927d35165ec267e4ba0f98021a1c3d59eb8878f1.tar.gz
historical-927d35165ec267e4ba0f98021a1c3d59eb8878f1.tar.bz2
historical-927d35165ec267e4ba0f98021a1c3d59eb8878f1.zip
add some better error checking
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk25
-rw-r--r--sys-devel/gcc/files/fix_libtool_files.sh4
2 files changed, 25 insertions, 4 deletions
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk
index 2a8d82e5e223..d849d604ffde 100644
--- a/sys-devel/gcc/files/awk/fixlafiles.awk
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk
@@ -1,7 +1,7 @@
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# Author: Martin Schlemmer <azarah@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.2 2002/11/24 04:03:55 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.3 2002/11/25 06:45:53 azarah Exp $
function einfo(string)
{
@@ -18,6 +18,18 @@ function eerror(string)
system("echo -e \" \\e[31;01m*\\e[0m " string "\"")
}
+# assert --- assert that a condition is true. Otherwise exit.
+# This is from the gawk info manual.
+function assert(condition, string)
+{
+ if (! condition) {
+ printf("%s:%d: assertion failed: %s\n",
+ FILENAME, FNR, string) > "/dev/stderr"
+ _assert_exit = 1
+ exit 1
+ }
+}
+
BEGIN {
@@ -43,11 +55,16 @@ BEGIN {
}
}
}
+
+ if (i == 0) {
+ eerror("Could not read from /etc/ld.so.conf!")
+ exit 1
+ }
close("/etc/ld.so.conf")
pipe = "/usr/bin/python -c 'import portage; print portage.settings[\"CHOST\"];'"
- (pipe) | getline CHOST
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
close(pipe)
GCCLIB = "/usr/lib/gcc-lib/" CHOST
@@ -55,7 +72,7 @@ BEGIN {
sub(/\/$/, "", GCCLIB)
pipe = "gcc -dumpversion"
- (pipe) | getline NEWVER
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
close(pipe)
for (x in DIRLIST) {
@@ -102,3 +119,5 @@ BEGIN {
}
}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh
index 8cab2b813aa8..9d1865fc7e1a 100644
--- a/sys-devel/gcc/files/fix_libtool_files.sh
+++ b/sys-devel/gcc/files/fix_libtool_files.sh
@@ -2,7 +2,7 @@
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# Author: Martin Schlemmer <azarah@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.3 2002/11/24 02:13:16 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.4 2002/11/25 06:45:53 azarah Exp $
source /etc/profile
source /etc/init.d/functions.sh
@@ -45,3 +45,5 @@ fi
/bin/gawk -v OLDVER="$1" -f ${AWKDIR}/fixlafiles.awk
+
+# vim:ts=4