From 06997f49f4b38c93edc0218ccd2674097daa8801 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 12 May 2015 07:58:47 +0000 Subject: [PATCH 1/1] - from PLD --- format-security.patch | 26 ++ stap-server.tmpfiles | 1 + systemtap-build.patch | 11 + systemtap-configure.patch | 12 + systemtap-dtrace-flexibility.patch | 383 +++++++++++++++++++++++++++++ systemtap-rpm5-support.patch | 114 +++++++++ systemtap.spec | 380 ++++++++++++++++++++++++++++ systemtap.tmpfiles | 1 + 8 files changed, 928 insertions(+) create mode 100644 format-security.patch create mode 100644 stap-server.tmpfiles create mode 100644 systemtap-build.patch create mode 100644 systemtap-configure.patch create mode 100644 systemtap-dtrace-flexibility.patch create mode 100644 systemtap-rpm5-support.patch create mode 100644 systemtap.spec create mode 100644 systemtap.tmpfiles diff --git a/format-security.patch b/format-security.patch new file mode 100644 index 0000000..1f37dfb --- /dev/null +++ b/format-security.patch @@ -0,0 +1,26 @@ +--- systemtap-2.6/cache.cxx~ 2014-09-05 21:33:21.000000000 +0000 ++++ systemtap-2.6/cache.cxx 2014-12-31 20:01:49.768965553 +0000 +@@ -294,7 +294,11 @@ + { + //interval not passed, don't continue + if (s.verbose > 1) ++#ifdef __ILP32__ ++ clog << _F("Cache cleaning skipped, interval not reached %llu s / %lu s.", ++#else + clog << _F("Cache cleaning skipped, interval not reached %lu s / %lu s.", ++#endif + (current_time.tv_sec-sb.st_mtime), cache_clean_interval) << endl; + return; + } +@@ -302,7 +306,11 @@ + { + //interval reached, continue + if (s.verbose > 1) ++#ifdef __ILP32__ ++ clog << _F("Cleaning cache, interval reached %llu s > %lu s.", ++#else + clog << _F("Cleaning cache, interval reached %lu s > %lu s.", ++#endif + (current_time.tv_sec-sb.st_mtime), cache_clean_interval) << endl; + } + diff --git a/stap-server.tmpfiles b/stap-server.tmpfiles new file mode 100644 index 0000000..c52865b --- /dev/null +++ b/stap-server.tmpfiles @@ -0,0 +1 @@ +d /var/run/stap-server 0755 stap-server stap-server - diff --git a/systemtap-build.patch b/systemtap-build.patch new file mode 100644 index 0000000..d91b9dd --- /dev/null +++ b/systemtap-build.patch @@ -0,0 +1,11 @@ +--- systemtap-2.2.1/Makefile.am.orig 2013-07-05 21:26:27.918188876 +0200 ++++ systemtap-2.2.1/Makefile.am 2013-07-05 21:34:45.071501358 +0200 +@@ -181,7 +181,7 @@ + stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx + stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS) + stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS) +-stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ ++stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ -pthread + stap_serverd_LDADD = $(nss_LIBS) -lpthread + if HAVE_AVAHI + stap_serverd_CFLAGS += $(avahi_CFLAGS) diff --git a/systemtap-configure.patch b/systemtap-configure.patch new file mode 100644 index 0000000..13e9b3a --- /dev/null +++ b/systemtap-configure.patch @@ -0,0 +1,12 @@ +--- systemtap-1.4/configure.ac~ 2011-01-17 12:31:41.000000000 +0100 ++++ systemtap-1.4/configure.ac 2011-05-17 11:16:21.590000069 +0200 +@@ -548,6 +548,9 @@ + AC_CHECK_HEADERS([elfutils/version.h]) + fi + ++CPPFLAGS="${CPPFLAGS} -I/usr/include/rpm" ++LIBS="${LIBS} -lrpmdb" ++ + dnl This is here mainly to make sure that configure --prefix=... changes + dnl the config.h files so files depending on it are recompiled + dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS. diff --git a/systemtap-dtrace-flexibility.patch b/systemtap-dtrace-flexibility.patch new file mode 100644 index 0000000..6cf9db0 --- /dev/null +++ b/systemtap-dtrace-flexibility.patch @@ -0,0 +1,383 @@ +From c486eff3f809b5ce544d5a032198e7680f2b7f2b Mon Sep 17 00:00:00 2001 +From: Stan Cox +Date: Tue, 9 Sep 2014 15:07:44 -0400 +Subject: [PATCH 1/3] Add -fpic -fPIC to the list of accepted but ignored + dtrace options. + +* dtrace.in (main): Add ignore_options. +--- + dtrace.in | 4 +++- + testsuite/systemtap.base/dtrace.exp | 8 ++++---- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/dtrace.in b/dtrace.in +index d5f189d4fc9e..2f9fb6307e28 100644 +--- a/dtrace.in ++++ b/dtrace.in +@@ -305,6 +305,8 @@ def main(): + s_filename = "" + includes = [] + defines = [] ++ ignore_options = ["-64", "-32", "-fpic", "-fPIC"] ++ + while i < len(sys.argv): + if sys.argv[i] == "-o": + i += 1 +@@ -330,7 +332,7 @@ def main(): + HAVE_PYP = False + elif sys.argv[i] == "--types": + print sys.argv[0] + ": note: obsolete option --types used" +- elif sys.argv[i] == "-64" or sys.argv[i] == "-32": ++ elif sys.argv[i] in ignore_options: + pass # dtrace users sometimes pass these flags + elif sys.argv[i] == "--help": + dtrace_help() +diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp +index 252dad90ede5..e029748100d6 100644 +--- a/testsuite/systemtap.base/dtrace.exp ++++ b/testsuite/systemtap.base/dtrace.exp +@@ -53,12 +53,12 @@ set incpath "/tmp/dtrace_inc" + # ----------------------------------------------------------------- + # test command line option and file handling + +-verbose -log "$dtrace -G -s $dpath -o XXX.o" +-catch {exec $dtrace -G -s $dpath -o XXX.o} ++verbose -log "$dtrace -G -64 -fPIC -s $dpath -o XXX.o" ++catch {exec $dtrace -G -64 -fPIC -s $dpath -o XXX.o} + if {[file exists XXX.o]} then { +- pass "dtrace -G -o XXX.o" ++ pass "dtrace -G -64 -fPIC -o XXX.o" + } else { +- fail "dtrace -G -o XXX.o" ++ fail "dtrace -G -64 -fPIC -o XXX.o" + } + exec rm -f XXX.o + +-- +1.9.3 + + +From 52cac9d8159a399b824201f4d2c98abe89a01767 Mon Sep 17 00:00:00 2001 +From: Stan Cox +Date: Tue, 23 Sep 2014 13:42:54 -0400 +Subject: [PATCH 2/3] Ignore C declarations in .d file and use string pattern + matching as a fallback mechanism. + +* dtrace.in (_PypProvider): SkipTo the provider{...} +(main): If pyparsing fails, then fallback to pattern matching. + +* dtrace.exp: Add a fallback test. +--- + dtrace.in | 39 +++++++++++++++++++++++++++--------- + testsuite/systemtap.base/dtrace.exp | 40 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 70 insertions(+), 9 deletions(-) + +diff --git a/dtrace.in b/dtrace.in +index 2f9fb6307e28..04ace92181d9 100644 +--- a/dtrace.in ++++ b/dtrace.in +@@ -29,13 +29,13 @@ try: + from pyparsing import alphas, cStyleComment, delimitedList, Group, \ + Keyword, lineno, Literal, nestedExpr, nums, oneOf, OneOrMore, \ + Optional, ParseException, ParserElement, restOfLine, restOfLine, \ +- Suppress, Word, ZeroOrMore ++ Suppress, SkipTo, Word, ZeroOrMore + HAVE_PYP = True + except ImportError: + HAVE_PYP = False + + +-# Common file creation methods for pyparsing and regexparsing ++# Common file creation methods for pyparsing and string pattern matching + + class _HeaderCreator(object): + def init_semaphores(self, fdesc): +@@ -149,7 +149,7 @@ class _PypProvider(_HeaderCreator): + + provider_decl = (PROVIDER + Optional(ident) + + lbrace + Group(probe_decls) + rbrace + Optional(semi)) +- dtrace_statement = Group(decls | provider_decl) ++ dtrace_statement = Group (SkipTo("provider", include=False) + provider_decl) + self.dtrace_statements = ZeroOrMore(dtrace_statement) + + cplusplus_linecomment = Literal("//") + restOfLine +@@ -167,7 +167,10 @@ class _PypProvider(_HeaderCreator): + for asti in self.ast: + if len(asti) == 0: + continue +- elif asti[0] == "provider": ++ # ignore SkipTo token ++ if asti[0] != "provider": ++ del asti[0] ++ if asti[0] == "provider": + # list of probes + for prb in asti[2]: + semaphores_def += self.add_semaphore(asti[1], prb[1]) +@@ -186,15 +189,18 @@ class _PypProvider(_HeaderCreator): + self.ast = self.bnf.parseFile(provider).asList() + except ParseException, err: + if len(self.current_probe): +- print "%s:%s:%d: syntax error near:\nprobe %s\n" % (sys.argv[0],provider, self.current_lineno, self.current_probe) ++ print "Warning: %s:%s:%d: syntax error near:\nprobe %s\n" % (sys.argv[0],provider, self.current_lineno, self.current_probe) + else: +- print "%s:%s:%d syntax error near:\n%s\n" % (sys.argv[0],provider,err.lineno, err.line) +- sys.exit(1) ++ print "Warning: %s:%s:%d syntax error near:\n%s\n" % (sys.argv[0],provider,err.lineno, err.line) ++ raise ParseException, err + + probes_def = "" + for asti in self.ast: + if len(asti) == 0: + continue ++ # ignore SkipTo token ++ if asti[0] != "provider": ++ del asti[0] + if asti[0] == "provider": + # list of probes + for prb in asti[2]: +@@ -369,14 +375,29 @@ def main(): + providers = _PypProvider() + else: + providers = _ReProvider() +- providers.probe_write(s_filename, filename + suffix) ++ while True: ++ try: ++ providers.probe_write(s_filename, filename + suffix) ++ break; ++ # complex C declarations can fool the pyparsing grammar. ++ # we could increase the complexity of the grammar ++ # instead we fall back to string pattern matching ++ except ParseException, err: ++ print "Warning: Proceeding as if --no-pyparsing was given.\n" ++ providers = _ReProvider() + elif build_source: + if HAVE_PYP: + providers = _PypProvider() + else: + providers = _ReProvider() + (ignore, fname) = mkstemp(suffix=".h") +- providers.probe_write(s_filename, fname) ++ while True: ++ try: ++ providers.probe_write(s_filename, fname) ++ break; ++ except ParseException, err: ++ print "Warning: Proceeding as if --no-pyparsing was given.\n" ++ providers = _ReProvider() + if not keep_temps: + os.remove(fname) + else: +diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp +index e029748100d6..60cab3f5abf2 100644 +--- a/testsuite/systemtap.base/dtrace.exp ++++ b/testsuite/systemtap.base/dtrace.exp +@@ -207,6 +207,46 @@ if { $ok == 4} { + } + exec rm -f XXX.h + ++set ok 0 ++set pypath "/tmp/pypath.d" ++set $fp [open $pypath "w"] ++puts $fp " ++#include ++ ++provider alpha { ++ probe request__start(string, uint8_t, uint16_t, int, void *); ++ probe request__one(string, uint8_t, uint32_t, int, int); ++ probe client__two(int, int); ++ probe client__three(int, string, pid_t, zoneid_t); ++ probe input__stop(int, int, uint32_t, uint32_t, int8_t, uint8_t*, double*); ++}; ++ ++#ifdef DCL_AFTER_PROVIDER ++typedef unsigned short int __u_short; ++typedef const static unsigned short __u_c_short; ++#endif ++ ++#pragma D attributes Unknown provider alpha provider ++" ++close $fp ++verbose -log "$dtrace -C -h -s $pypath -o XXX.h" ++spawn $dtrace -C -DDCL_AFTER_PROVIDER -h -s $pypath -o XXX.h ++expect { ++ -re {Warning.*syntax error} {incr ok; exp_continue} ++ -re {Warning.*--no-pyparsing} {incr ok; exp_continue} ++ eof { } ++} ++catch {close}; catch {wait} ++if {[file exists XXX.h]} then { ++ incr ok; ++} ++if { $ok == 3} { ++ pass "dtrace parser check" ++} else { ++ fail "dtrace parser check $ok" ++} ++exec rm -f XXX.h ++ + verbose -log "$dtrace -I$incpath -G -s $idpath" + catch {exec $dtrace -G -s $dpath} + if {[file exists test.o]} then { +-- +1.9.3 + + +From 3525152408f15e23dcffe2371bbd575f1646d691 Mon Sep 17 00:00:00 2001 +From: Stan Cox +Date: Thu, 25 Sep 2014 13:47:04 -0400 +Subject: [PATCH 3/3] Add pyparsing / no-parsing compatibility test. + +* dtrace.exp: Add pyparsing compatibility test. +--- + testsuite/systemtap.base/dtrace.exp | 93 ++++++++++++++++++++++++++++--------- + 1 file changed, 72 insertions(+), 21 deletions(-) + +diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp +index 60cab3f5abf2..e455c298737a 100644 +--- a/testsuite/systemtap.base/dtrace.exp ++++ b/testsuite/systemtap.base/dtrace.exp +@@ -8,6 +8,8 @@ if {[installtest_p]} { + set dtrace ../dtrace + } + ++# Create the test .d files ++ + exec mkdir -p /tmp/dtrace + + set dpath "/tmp/dtrace/test.d" +@@ -48,6 +50,29 @@ provider tstsyscall + " + close $fp + ++set pypath "/tmp/pypath.d" ++set $fp [open $pypath "w"] ++puts $fp " ++#include ++ ++provider alpha { ++ probe request__start(string, uint8_t, uint16_t, int, void *); ++ probe request__one(string, uint8_t, uint32_t, int, int); ++ probe client__two(int, int); ++ probe client__three(int, string, pid_t, zoneid_t); ++ probe input__stop(int, int, uint32_t, uint32_t, int8_t, uint8_t*, double*); ++}; ++ ++#ifdef DCL_AFTER_PROVIDER ++typedef unsigned short int __u_short; ++typedef const static unsigned short __u_c_short; ++#endif ++ ++#pragma D attributes Unknown provider alpha provider ++" ++close $fp ++ ++ + set incpath "/tmp/dtrace_inc" + + # ----------------------------------------------------------------- +@@ -156,6 +181,9 @@ if { $ok != 0} { + fail "dtrace CFLAGS= CC=" + } + ++# ----------------------------------------------------------------- ++# test -h header file creation ++ + set ok 0 + verbose -log "$dtrace -C -h -s $dpath -o XXX.h" + catch {exec $dtrace -C -h -s $dpath -o XXX.h} +@@ -189,6 +217,9 @@ if { $ok == 4} { + } + exec rm -f XXX.h + ++# ----------------------------------------------------------------- ++# test --no-pyparsing ++ + set ok 0 + verbose -log "$dtrace -C --no-pyparsing -I$incpath -h -s $idpath -o XXX.h" + catch {exec $dtrace -C --no-pyparsing -I$incpath -h -s $idpath -o XXX.h} +@@ -207,28 +238,10 @@ if { $ok == 4} { + } + exec rm -f XXX.h + +-set ok 0 +-set pypath "/tmp/pypath.d" +-set $fp [open $pypath "w"] +-puts $fp " +-#include +- +-provider alpha { +- probe request__start(string, uint8_t, uint16_t, int, void *); +- probe request__one(string, uint8_t, uint32_t, int, int); +- probe client__two(int, int); +- probe client__three(int, string, pid_t, zoneid_t); +- probe input__stop(int, int, uint32_t, uint32_t, int8_t, uint8_t*, double*); +-}; +- +-#ifdef DCL_AFTER_PROVIDER +-typedef unsigned short int __u_short; +-typedef const static unsigned short __u_c_short; +-#endif ++# ----------------------------------------------------------------- ++# test fallback to --no-pyparsing + +-#pragma D attributes Unknown provider alpha provider +-" +-close $fp ++set ok 0 + verbose -log "$dtrace -C -h -s $pypath -o XXX.h" + spawn $dtrace -C -DDCL_AFTER_PROVIDER -h -s $pypath -o XXX.h + expect { +@@ -247,6 +260,9 @@ if { $ok == 3} { + } + exec rm -f XXX.h + ++# ----------------------------------------------------------------- ++# test -G object file creation ++ + verbose -log "$dtrace -I$incpath -G -s $idpath" + catch {exec $dtrace -G -s $dpath} + if {[file exists test.o]} then { +@@ -256,5 +272,40 @@ if {[file exists test.o]} then { + } + exec rm -f test.o + ++# ----------------------------------------------------------------- ++# test dtrace for pyparsing / --no-pyparsing compatibility ++ ++set ok 0 ++set dfiles {dtrace} ++foreach i $dfiles { ++ verbose -log "$dtrace $srcdir/$subdir/$i.d" ++ catch {exec $dtrace -C -h -s $srcdir/$subdir/$i.d -o $i-1.h} ++ catch {exec $dtrace -C -h --no-pyparsing -s $srcdir/$subdir/$i.d -o $i-2.h} ++ spawn diff -wqs $i-1.h $i-2.h ++ expect { ++ -re {Files.*identical} {incr ok; exp_continue} ++ eof { } ++ } ++ catch {exec $dtrace -C -G -s $srcdir/$subdir/$i.d -o $i-1.o} ++ catch {exec $dtrace -C -G --no-pyparsing -s $srcdir/$subdir/$i.d -o $i-2.o} ++ verbose -log "exec nm $i-1.o > $i-1.od" ++ catch {exec nm $i-1.o > $i-1.od} ++ catch {exec nm $i-2.o > $i-2.od} ++ spawn diff -qs $i-1.od $i-2.od ++ expect { ++ -re {Files.*identical} {incr ok; exp_continue} ++ eof { } ++ } ++ catch {exec /bin/rm $i-1.h $i-2.h $i-1.o $i-2.o} ++} ++if { $ok == 2} { ++ pass "dtrace known uses" ++} else { ++ fail "dtrace known uses ${ok}" ++} ++ ++# ----------------------------------------------------------------- ++# cleanup ++ + exec /bin/rm -r /tmp/dtrace /tmp/dtrace_inc + # ----------------------------------------------------------------- +-- +1.9.3 + diff --git a/systemtap-rpm5-support.patch b/systemtap-rpm5-support.patch new file mode 100644 index 0000000..acd39d7 --- /dev/null +++ b/systemtap-rpm5-support.patch @@ -0,0 +1,114 @@ +--- systemtap-1.5/configure.ac.rpm5~ 2011-05-23 21:21:36.000000000 +0200 ++++ systemtap-1.5/configure.ac 2011-09-26 08:22:28.072465175 +0200 +@@ -449,6 +449,19 @@ AC_ARG_WITH([rpm], + [AS_HELP_STRING([--with-rpm], + [query rpm database for missing debuginfos])], [], [with_rpm="auto"]) + if test "$with_rpm" != "no"; then ++ PKG_CHECK_MODULES([RPM], [rpm], [ ++ AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available]) ++ CPPFLAGS="$RPM_CFLAGS $CPPFLAGS" ++ stap_LIBS="$stap_LIBS $RPM_LIBS" ++ ], [ ++ AC_PATH_PROG(RPM_PATH,rpm,none) ++ if test "$RPM_PATH" = "none"; then ++ AC_MSG_ERROR([RPM executable was not found in your system]) ++ else ++ AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available]) ++ fi ++ ] ++) + AC_CHECK_LIB(rpm, rpmtsInitIterator, [ + AC_DEFINE([HAVE_LIBRPM],[1],[have librpm]) + stap_LIBS="$stap_LIBS -lrpm" +--- systemtap-1.5/rpm_finder.cxx.rpm5~ 2011-05-23 21:21:36.000000000 +0200 ++++ systemtap-1.5/rpm_finder.cxx 2011-09-26 08:14:28.829226303 +0200 +@@ -20,21 +20,22 @@ using namespace std; + + #ifdef HAVE_LIBRPM + +-extern "C" { +- +-#define _RPM_4_4_COMPAT +-#include +-#include +-#include +-#include +-#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + + #ifndef xfree + #define xfree free + #endif + +-} +- + #if ! HAVE_LIBRPMIO && HAVE_NSS + extern "C" { + #include +@@ -51,7 +52,7 @@ missing_rpm_enlist (systemtap_session& s + { + static int rpm_init_done = 0; + rpmts ts; +- rpmdbMatchIterator mi; ++ rpmmi mi; + int count = 0; + + if (filename == NULL) +@@ -90,8 +91,8 @@ missing_rpm_enlist (systemtap_session& s + errmsg_t err; + size_t rpminfolen = strlen(rpm_type); + size_t srcrpmlen = sizeof (".src.rpm") - 1; +- rpmdbMatchIterator mi_rpminfo; +- h = rpmdbNextIterator(mi); ++ rpmmi mi_rpminfo; ++ h = rpmmiNext(mi); + if (h == NULL) + break; + /* Verify the kernel file is not already installed. */ +@@ -138,21 +139,23 @@ missing_rpm_enlist (systemtap_session& s + /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ + + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ +- /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ +- mi_rpminfo = rpmtsInitIterator(ts, (rpmTag) RPMDBI_LABEL, ++ /* RPMTAG_NVRA is an interface for NVR-based dbiFindByLabel(). */ ++ mi_rpminfo = rpmtsInitIterator(ts, (rpmTag) RPMTAG_NVRA, + rpminfo, 0); + if (mi_rpminfo) + { +- rpmdbFreeIterator(mi_rpminfo); ++ rpmmiFree(mi_rpminfo); + count = 0; + break; + } + /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ + if(strcmp(rpm_type,"-debuginfo")==0){ ++ char *nvra = rpmExpand("%{___NVRA}", NULL); + xfree(rpminfo); + rpminfo = headerSprintf(h, +- "%{name}-%{version}-%{release}.%{arch}", ++ nvra, + rpmTagTable, rpmHeaderFormats, &err); ++ free(nvra); + } + if (!rpminfo) + { +@@ -176,7 +179,7 @@ missing_rpm_enlist (systemtap_session& s + sess.rpms_to_install.insert(rpminfo); + } + count++; +- rpmdbFreeIterator(mi); ++ rpmmiFree(mi); + } + + rpmtsFree(ts); diff --git a/systemtap.spec b/systemtap.spec new file mode 100644 index 0000000..7aee501 --- /dev/null +++ b/systemtap.spec @@ -0,0 +1,380 @@ +# +# Conditional build: +%bcond_without doc # documentation build +%bcond_with publican # publican guides build (requires functional publican+wkhtmltopdf) +%bcond_without crash # crash extension +%bcond_without dyninst # dyninst support +%bcond_without java # Java runtime support +# +%ifnarch %{ix86} %{x8664} alpha arm ia64 ppc64 s390 s390x +%undefine with_crash +%endif +%ifnarch %{ix86} %{x8664} ppc ppc64 +%undefine with_dyninst +%endif +Summary: Instrumentation System +Summary(pl.UTF-8): System oprzyrządowania +Name: systemtap +Version: 2.6 +Release: 3 +License: GPL v2+ +Group: Base +Source0: http://sourceware.org/systemtap/ftp/releases/%{name}-%{version}.tar.gz +# Source0-md5: 65e6745f0ec103758c711dd1d12fb6bf +Source1: systemtap.tmpfiles +Source2: stap-server.tmpfiles +Patch0: %{name}-configure.patch +Patch1: %{name}-build.patch +Patch2: %{name}-rpm5-support.patch +Patch3: %{name}-dtrace-flexibility.patch +Patch4: format-security.patch +URL: http://sourceware.org/systemtap/ +BuildRequires: autoconf >= 2.63 +BuildRequires: automake +BuildRequires: avahi-devel +BuildRequires: boost-devel +%{?with_crash:BuildRequires: crash-devel} +BuildRequires: docbook-dtd412-xml +%{?with_dyninst:BuildRequires: dyninst-devel >= 8.0} +BuildRequires: elfutils-devel >= 0.148 +BuildRequires: gettext-tools >= 0.18.2 +BuildRequires: glib2-devel +%{?with_java:BuildRequires: jdk} +%if %{with dyninst} || %{with java} +BuildRequires: libselinux-devel +%endif +BuildRequires: libstdc++-devel +BuildRequires: libvirt-devel >= 1.0.2 +BuildRequires: libxml2-devel >= 2.0 +BuildRequires: mysql-devel +BuildRequires: nss-devel >= 3 +BuildRequires: rpm-devel +BuildRequires: sqlite3-devel >= 3 +BuildRequires: xmlto +%if %{with doc} +BuildRequires: latex2html +%{?with_publican:BuildRequires: publican} +BuildRequires: texlive-dvips +BuildRequires: texlive-fonts-bitstream +BuildRequires: texlive-fonts-type1-bitstream +BuildRequires: texlive-latex +%endif +# let base mean client+local development package +Requires: %{name}-client = %{version}-%{release} +Requires: %{name}-devel = %{version}-%{release} +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +SystemTap is an instrumentation system for systems running Linux 2.6. +Developers can write instrumentation to collect data on the operation +of the system. The base systemtap package provides the components +needed to locally develop and execute systemtap script. + +%description -l pl.UTF-8 +SystemTap to system oprzyrządowania dla systemów opartych na Linuksie +2.6. Programiści mogą pisać narzędzia do zbierania danych dotyczących +operacji w systemie. Główny pakiet dostarcza komponenty niezbędne do +lokalnego tworzenia i wykonywania skryptów systemtap. + +%package runtime +Summary: Programmable system-wide instrumentation system - runtime +Summary(pl.UTF-8): Programowalny systemowy system oprzyrządowania - środowisko uruchomieniowe +Group: Applications/System + +%description runtime +SystemTap runtime contains the components needed to execute a +systemtap script that was already compiled into a module using a local +or remote systemtap-devel installation. + +%description runtime -l pl.UTF-8 +Środowisko uruchomieniowe SystemTap zawiera komponenty niezbędne do +uruchomienia skryptu systemtap, który został już wkompilowany do +modułu przy użyciu lokalnej lub zdalnej instalacji systemtap-devel. + +%package runtime-java +Summary: SystemTap Java runtime support +Summary(pl.UTF-8): Obsługa Javy dla środowiska uruchomieniowego SystemTap +Group: Libraries +Requires: %{name}-runtime = %{version}-%{release} +Requires: byteman > 2.0 + +%description runtime-java +This package includes support files needed to run systemtap scripts +that probe Java processes running on the OpenJDK 1.6 and OpenJDK 1.7 +runtimes using Byteman. + +%description runtime-java -l pl.UTF-8 +Ten pakiet zawiera pliki niezbędne do uruchamiania skryptów systemtap +sondujące procesy Javy działające w środowiskach OpenJDK 1.6 i OpenJDK +1.7 przy użyciu Bytemana. + +%package client +Summary: Programmable system-wide instrumentation system - client +Summary(pl.UTF-8): Programowalny systemowy system oprzyrządowania - klient +Group: Applications/System +Requires: %{name}-runtime = %{version}-%{release} +Requires: coreutils +Requires: grep +Requires: libvirt >= 1.0.2 +Requires: openssh-clients +Requires: sed +Requires: unzip +Requires: zip + +%description client +This package provides the components needed to develop systemtap +scripts and compile them using a local systemtap-devel or a remote +systemtap-server installation, then run them using a local or remote +systemtap-runtime. It includes script samples and documentation, and a +copy of the tapset library for reference. + +%description client -l pl.UTF-8 +Ten pakiet dostarcza komponenty niezbędne do tworzenia skryptów +systemtap i kompilowania ich przy użyciu lokalnej instalacji +systemtap-devel lub zdalnej instalacji systemtap-server, a następnie +uruchamiania ich przy użyciu lokalnej lub zdalnej instalacji +systemtap-runtime. Zawiera przykłady skryptów oraz dokumentację, a +także kopię biblioteki tapset. + +%package devel +Summary: Programmable system-wide instrumentation system - development headers, tools +Summary(pl.UTF-8): Programowalny systemowy system oprzyrządowania - pliki nagłówkowe, narzędzia +Group: Development/Tools +Requires: %{name}-client = %{version}-%{release} +Requires: gcc +Requires: kernel-module-build +Requires: make + +%description devel +This package provides the components needed to compile a systemtap +script from source form into executable (.ko) forms. It may be +installed on a self-contained developer workstation (along with the +systemtap-client and systemtap-runtime packages), or on a dedicated +remote server (alongside the systemtap-server package). It includes a +copy of the standard tapset library and the runtime library C files. + +%description devel -l pl.UTF-8 +Ten pakiet dostarcza komponenty niezbędne do kompilowania skryptów +systemtap z postaci źródłowej do wykonywalnej (.ko). Może być +zainstalowany na samodzielnej stacji roboczej programisty (wraz z +pakietami systemtap-client i systemtap-runtime) lub dedykowanym +zdalnym serwerze (wraz z pakietem systemtap-server). Zawiera kopię +standardowej biblioteki tapset oraz pliki biblioteki uruchomieniowej +C. + +%package initscript +Summary: SystemTap Initscripts +Summary(pl.UTF-8): Skrypty startowe SystemTap +Group: Base +Requires(post,preun): /sbin/chkconfig +Requires: %{name} = %{version}-%{release} +Requires: rc-scripts + +%description initscript +SysVinit scripts to launch selected systemtap scripts at system +startup. + +%description initscript -l pl.UTF-8 +Skrypty SysVinit do uruchamiania wybranych skryptów systemtap w +trakcie startu systemu. + +%package server +Summary: Instrumentation System Server +Summary(pl.UTF-8): Serwer systemu oprzyrządowania +Group: Applications/System +Requires(post,preun): /sbin/chkconfig +Requires: %{name}-devel = %{version}-%{release} +Requires: /bin/mktemp +Requires: unzip +Requires: zip + +%description server +This is the remote script compilation server component of systemtap. +It announces itself to nearby clients with avahi (if available), and +compiles systemtap scripts to kernel objects on their demand. + +%description server -l pl.UTF-8 +Ten pakiet zawiera komponent serwera do zdalnej kompilacji skryptów +systemtap. Rozgłasza się pobliskim klientom przy użyciu avahi (jeśli +jest dostępny) i na żądanie kompiluje skrypty systemtap do obiektów +jądra. + +%package sdt-devel +Summary: Static probe support tools +Summary(pl.UTF-8): Narzędzia do obsługi sond statycznych +License: GPL v2+ and Public Domain +Group: Development/Libraries + +%description sdt-devel +This package includes the header file used for static +instrumentation compiled into userspace programs and libraries, along +with the optional dtrace-compatibility preprocessor to process related +.d files into tracing-macro-laden .h headers. + +%description sdt-devel -l pl.UTF-8 +Ten pakiet zawiera plik nagłówkowy służący do +wkompilowywania statycznego oprzyrządowania do programów i bibliotek +przestrzeni użytkownika, wraz z opcjonalnym preprocesorem zgodności z +dtrace, który przetwarza pliki .d na pliki nagłówkowe .h z makrami +śledzącymi. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch3 -p1 +%patch4 -p1 +%if "%{_rpmversion}" >= "5.0" +%patch2 -p1 +%endif + +%build +%{__gettextize} +%{__aclocal} +%{__autoconf} +%{__autoheader} +%{__automake} +%configure \ + --disable-silent-rules \ + %{?with_crash:--enable-crash} \ + --enable-docs%{!?with_doc:=no} \ + --enable-pie \ + --enable-publican%{!?with_publican:=no} \ + --enable-server \ + --enable-sqlite \ + --with-dyninst%{!?with_dyninst:=no} \ + --with-java=%{?with_java:%{_jvmdir}/java}%{!?with_java:no} +%{__make} + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{/var/{cache,run}/%{name},%{systemdtmpfilesdir},%{systemdunitdir}} \ + $RPM_BUILD_ROOT{%{_sysconfdir}/stap-server/conf.d,/etc/{sysconfig,logrotate.d,rc.d/init.d}} \ + $RPM_BUILD_ROOT/var/log/stap-server + +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT + +cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/systemtap.conf +cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/stap-server.conf + +# not installed by make +install stap-prep $RPM_BUILD_ROOT%{_bindir}/stap-prep + +install initscript/systemtap $RPM_BUILD_ROOT/etc/rc.d/init.d +install initscript/config.systemtap $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/config + +install initscript/stap-server $RPM_BUILD_ROOT/etc/rc.d/init.d +install initscript/config.stap-server $RPM_BUILD_ROOT/etc/sysconfig/stap-server +install initscript/logrotate.stap-server $RPM_BUILD_ROOT/etc/logrotate.d/stap-server +install stap-server.service $RPM_BUILD_ROOT%{systemdunitdir} + +install -d $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/{conf.d,script.d} +install -d $RPM_BUILD_ROOT/var/lib/stap-server/.systemtap +install -d $RPM_BUILD_ROOT/var/log/stap-server + +%{__mv} $RPM_BUILD_ROOT%{_docdir}/systemtap docs-installed + +%find_lang %{name} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) + +%files runtime -f %{name}.lang +%defattr(644,root,root,755) +%doc AUTHORS NEWS README* +%attr(755,root,root) %{_bindir}/stap-merge +%attr(755,root,root) %{_bindir}/stap-report +%{?with_dyninst:%attr(755,root,root) %{_bindir}/stapdyn} +%attr(755,root,root) %{_bindir}/stapsh +# XXX: %attr(4754,root,stapusr) staprun ? +%attr(755,root,root) %{_bindir}/staprun +%dir %{_libdir}/%{name} +%attr(755,root,root) %{_libdir}/%{name}/stap-authorize-cert +%attr(755,root,root) %{_libdir}/%{name}/stapio +%{?with_crash:%attr(755,root,root) %{_libdir}/%{name}/staplog.so} +%{_mandir}/man1/stap-merge.1* +%{_mandir}/man1/stap-report.1* +%{_mandir}/man3/function::*.3stap* +%{_mandir}/man3/probe::*.3stap* +%{_mandir}/man3/stapex.3stap* +%{_mandir}/man3/stapfuncs.3stap* +%{_mandir}/man3/stapprobes.3stap* +%{_mandir}/man3/stapvars.3stap* +%{_mandir}/man3/tapset::*.3stap* +%{_mandir}/man7/error::*.7stap* +%{_mandir}/man7/stappaths.7* +%{_mandir}/man7/warning::debuginfo.7stap* +%{_mandir}/man7/warning::symbols.7stap* +%{?with_dyninst:%{_mandir}/man8/stapdyn.8*} +%{_mandir}/man8/staprun.8* +%{_mandir}/man8/stapsh.8* +%{_mandir}/man8/systemtap.8* + +%if %{with java} +%files runtime-java +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/%{name}/stapbm +%attr(755,root,root) %{_libdir}/%{name}/libHelperSDT_*.so +%{_libdir}/%{name}/HelperSDT.jar +%endif + +%files client +%defattr(644,root,root,755) +%doc docs-installed/examples %{?with_docs:docs-installed/{tapsets,langref.pdf,tutorial.pdf}} +%attr(755,root,root) %{_bindir}/stap +%attr(755,root,root) %{_bindir}/stap-prep +%attr(755,root,root) %{_bindir}/stapvirt +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/tapset +%{_mandir}/man1/stap.1* +%{_mandir}/man1/stap-prep.1* +%{_mandir}/man1/stapvirt.1* + +%files devel +%defattr(644,root,root,755) +%{_datadir}/%{name}/runtime + +%files initscript +%defattr(644,root,root,755) +%attr(754,root,root) /etc/rc.d/init.d/systemtap +%dir %{_sysconfdir}/systemtap +%dir %{_sysconfdir}/systemtap/conf.d +%dir %{_sysconfdir}/systemtap/script.d +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/systemtap/config +%{systemdtmpfilesdir}/systemtap.conf +%dir /var/cache/%{name} +%dir /var/run/%{name} + +%files server +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/stap-server +%attr(755,root,root) %{_libdir}/%{name}/stap-env +%attr(755,root,root) %{_libdir}/%{name}/stap-gen-cert +%attr(755,root,root) %{_libdir}/%{name}/stap-serverd +%attr(755,root,root) %{_libdir}/%{name}/stap-sign-module +%attr(755,root,root) %{_libdir}/%{name}/stap-start-server +%attr(755,root,root) %{_libdir}/%{name}/stap-stop-server +%dir %{_sysconfdir}/stap-server +%dir %{_sysconfdir}/stap-server/conf.d +%attr(754,root,root) /etc/rc.d/init.d/stap-server +%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/stap-server +%config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/stap-server +%{systemdunitdir}/stap-server.service +%{systemdtmpfilesdir}/stap-server.conf +# TODO: create user/group +#%attr(750,stap-server,stap-server) %dir /var/lib/stap-server +#%attr(700,stap-server,stap-server) %dir /var/lib/stap-server/.systemtap +#%attr(755,stap-server,stap-server) %dir /var/log/stap-server +#%attr(755,stap-server,stap-server) %dir /var/run/stap-server +%{_mandir}/man8/stap-server.8* + +%files sdt-devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/dtrace +%{_includedir}/sys/sdt.h +%{_includedir}/sys/sdt-config.h +%{_mandir}/man1/dtrace.1* diff --git a/systemtap.tmpfiles b/systemtap.tmpfiles new file mode 100644 index 0000000..adbee7f --- /dev/null +++ b/systemtap.tmpfiles @@ -0,0 +1 @@ +d /var/run/systemtap 0755 root root - -- 2.46.0