This commit is contained in:
Stan Cox 2011-06-16 11:09:38 -04:00
parent 997a62b0ad
commit 54568463b4
2 changed files with 88 additions and 10 deletions

View File

@ -7,11 +7,52 @@ Date: Fri Jun 10 09:42:43 2011 -0400
dtrace.in (main): Use suffix for both -h and -G. Check gcc return code.
dtrace.exp: Massage results accordingly.
commit f6b267eb5f999ce380f1169ba4aa81945b8b8fd2
Author: Stan Cox <scox@redhat.com>
Date: Tue Jun 14 16:16:59 2011 -0400
Improve dtrace handling of CC environment variable.
* dtrace.in (main): Split CC to allow for application Makefile abuse.
commit 4c353c3a6d5a7b75c3e897f1605ae6a98b0b1951
Author: Stan Cox <scox@redhat.com>
Date: Tue Jun 14 17:36:23 2011 -0400
Split command line pieces with shlex
dtrace.in (main): Use shlex.split for CPP, CC, and CFLAGS
commit 12aad6f0ee85529fa29d6b0790f7afc6f075a808
Author: Stan Cox <scox@redhat.com>
Date: Wed Jun 15 15:52:38 2011 -0400
Do status setting and exit at the top level.
* dtrace.in (main): Use return instead of sys.exit; move sys.exit to top.
diff --git a/dtrace.in b/dtrace.in
index a64d110..91762bd 100755
index a64d110..c1ea1fe 100755
--- a/dtrace.in
+++ b/dtrace.in
@@ -191,7 +191,7 @@ def main():
@@ -17,6 +17,7 @@ import os
import posix
import string
import sys
+import shlex
from subprocess import call
from tempfile import mkstemp
@@ -179,7 +180,7 @@ def help ():
def main():
if (len(sys.argv) < 2):
usage()
- sys.exit(1)
+ return 1
i = 1
build_header = False
@@ -187,7 +188,7 @@ def main():
add_typedefs = False
keep_temps = False
use_cpp = False
@ -20,7 +61,7 @@ index a64d110..91762bd 100755
filename = ""
s_filename = ""
includes = []
@@ -209,10 +209,12 @@ def main():
@@ -205,10 +206,12 @@ def main():
defines.append(sys.argv[i])
elif (sys.argv[i] == "-h"):
build_header = True
@ -33,9 +74,33 @@ index a64d110..91762bd 100755
elif (sys.argv[i] == "-k"):
keep_temps = True
elif (sys.argv[i] == "--types"):
@@ -242,13 +244,10 @@ def main():
@@ -218,17 +221,16 @@ def main():
i += 1
if (build_header == False and build_source == False):
usage()
- sys.exit(1)
+ return 1
if (s_filename != "" and use_cpp):
(d,fn) = mkstemp(suffix=".d")
CPP = os.environ.get("CPP", "cpp")
- args = [CPP] + includes + defines + [s_filename, fn]
- retcode = call(args)
+ retcode = call(shlex.split(CPP) + includes + defines + [s_filename, fn])
if (retcode != 0):
print "\"cpp includes s_filename\" failed"
usage()
sys.exit(1)
- sys.exit(1)
+ return 1
s_filename = fn
if (filename == ""):
if (s_filename != ""):
@@ -236,15 +238,12 @@ def main():
filename = os.path.basename(filename)
else:
usage()
- sys.exit(1)
+ return 1
else:
- if (build_header):
- h_ext = ""
@ -49,22 +114,32 @@ index a64d110..91762bd 100755
elif (build_source):
(basename,ext) = os.path.splitext(s_filename)
@@ -269,9 +268,13 @@ def main():
@@ -265,9 +264,13 @@ def main():
f.close()
CC = os.environ.get("CC", "gcc")
CFLAGS = "-g " + os.environ.get("CFLAGS", "")
- call([CC, "-fPIC"] + defines + includes + CFLAGS.split() +
+ retcode = call([CC, "-fPIC"] + defines + includes + CFLAGS.split() +
["-I.", "-I@prefix@/include", "-c", fn, "-o",
- ["-I.", "-I@prefix@/include", "-c", fn, "-o",
- filename + ".o"], shell=False)
+ retcode = call(shlex.split(CC) + defines + includes + shlex.split(CFLAGS) +
+ ["-fPIC", "-I.", "-I@prefix@/include", "-c", fn, "-o",
+ filename + suffix], shell=False)
+ if (retcode != 0):
+ print "\"gcc " + fn + "\" failed"
+ usage()
+ sys.exit(1)
+ return 1
if (not keep_temps):
os.remove(fn)
else:
@@ -277,6 +280,7 @@ def main():
os.remove(s_filename)
else:
print "cpp: " + s_filename
+ return 0
if __name__ == "__main__":
- main()
+ sys.exit(main())
diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp
index b301793..cd97c79 100644
--- a/testsuite/systemtap.base/dtrace.exp

View File

@ -16,7 +16,7 @@
Name: systemtap
Version: 1.5
Release: 3%{?dist}
Release: 4%{?dist}
# for version, see also configure.ac
Summary: Instrumentation System
Group: Development/System
@ -503,6 +503,9 @@ exit 0
%changelog
* Fri Jun 10 2011 Stan Cox <scox@redhat.com> - 1.5-4
- Split $CC
* Fri Jun 10 2011 Stan Cox <scox@redhat.com> - 1.5-3
- Don't massage dtrace -o FILENAME arg