From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 830 invoked by alias); 24 Mar 2009 23:00:39 -0000 Received: (qmail 817 invoked by uid 22791); 24 Mar 2009 23:00:37 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43,J_CHICKENPOX_53,J_CHICKENPOX_83,J_CHICKENPOX_92,J_CHICKENPOX_93,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Mar 2009 23:00:30 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n2ON0SqW019530 for ; Tue, 24 Mar 2009 19:00:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2ON0X46009283 for ; Tue, 24 Mar 2009 19:00:33 -0400 Received: from [10.11.231.126] (dhcp231-126.rdu.redhat.com [10.11.231.126]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n2ON0Smv007141 for ; Tue, 24 Mar 2009 19:00:28 -0400 Message-ID: <49C9660A.2020502@redhat.com> Date: Wed, 25 Mar 2009 01:15:00 -0000 From: William Cohen User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: systemTAP Subject: Making the scripts used in the beginner's guide available Content-Type: multipart/mixed; boundary="------------040901090508080201010709" X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00892.txt.bz2 This is a multi-part message in MIME format. --------------040901090508080201010709 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 493 Hi, There was some requests to make the scripts described in the SystemTap Beginners Guide available. The attached patch makes to those scripts available. The following changes were made: 1) Move the scripts from doc/SystemTap_Beginners_Guide to scripts 2) Modify the make file of the Beginners Guide to copy the scripts 3) Modify the main make files to install the scripts 4) List the installed script in the systemtap.spec I would like some feedback before checking in this patch. -Will --------------040901090508080201010709 Content-Type: text/plain; name="scripts.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="scripts.diff" Content-length: 8223 diff --git a/Makefile.am b/Makefile.am index 580c417..ea119c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,7 +24,9 @@ man/stapprobes.tcp.3stap man/stapprobes.udp.3stap # see also configure.ac bin_PROGRAMS = stap staprun -bin_SCRIPTS = stap-report +bin_SCRIPTS = stap-report \ + scripts/stapprep.sh scripts/fedoradebugurl.sh \ + scripts/rheldebugurl.sh oldinclude_HEADERS = includes/sys/sdt.h if BUILD_SERVER man_MANS += stap-server.8 diff --git a/Makefile.in b/Makefile.in index 35bcd48..3a0ea19 100644 --- a/Makefile.in +++ b/Makefile.in @@ -289,6 +289,7 @@ staplog_CPPFLAGS = @staplog_CPPFLAGS@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @@ -306,7 +307,9 @@ man_MANS = stap.1 stapprobes.3stap stapfuncs.3stap stapvars.3stap \ man/stapprobes.scsi.3stap man/stapprobes.signal.3stap \ man/stapprobes.socket.3stap man/stapprobes.tcp.3stap \ man/stapprobes.udp.3stap $(am__append_1) -bin_SCRIPTS = stap-report $(am__append_3) dtrace +bin_SCRIPTS = stap-report scripts/stapprep.sh \ + scripts/fedoradebugurl.sh scripts/rheldebugurl.sh \ + $(am__append_3) dtrace oldinclude_HEADERS = includes/sys/sdt.h stap_SOURCES = main.cxx \ parse.cxx staptree.cxx elaborate.cxx translate.cxx \ diff --git a/doc/Makefile.in b/doc/Makefile.in index 9375366..e23a669 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -163,6 +163,7 @@ staplog_CPPFLAGS = @staplog_CPPFLAGS@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PDF_FILES = tutorial.pdf langref.pdf diff --git a/doc/SystemTap_Beginners_Guide/Makefile b/doc/SystemTap_Beginners_Guide/Makefile index 32dc0d5..2805f3f 100644 --- a/doc/SystemTap_Beginners_Guide/Makefile +++ b/doc/SystemTap_Beginners_Guide/Makefile @@ -15,8 +15,10 @@ include $(COMMON_CONFIG)/make/Makefile.common pre:: cp -a ../../testsuite en-US/extras/; + cp -a ../../scripts/*.sh en-US/extras/; post:: rm -rf en-US/extras/testsuite + rm -rf en-US/extras/*.sh sed -i -e 's/Fedora/Red Hat Enterprise Linux/g' en-US/Book_Info.xml; sed -i -e 's/10/5/g' en-US/Book_Info.xml; diff --git a/doc/SystemTap_Beginners_Guide/en-US/extras/fedoradebugurl.sh b/doc/SystemTap_Beginners_Guide/en-US/extras/fedoradebugurl.sh deleted file mode 100755 index ac6b525..0000000 --- a/doc/SystemTap_Beginners_Guide/en-US/extras/fedoradebugurl.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash -echo -n "Enter nvr of kernel-debuginfo (e.g. 2.6.25-14.fc9.x86_64) " ; \ -read NVR; \ -BASE=`uname -m` ; \ -NVR=`echo $NVR | sed s/.$BASE//` ; \ -VERSION=`echo $NVR | awk -F- '{print $1}'` ; \ -RELEASE=`echo $NVR | awk -F- '{print $2}'` ; \ -echo "http://kojipkgs.fedoraproject.org/\ -packages/kernel/$VERSION/$RELEASE/$BASE/" diff --git a/doc/SystemTap_Beginners_Guide/en-US/extras/rheldebugurl.sh b/doc/SystemTap_Beginners_Guide/en-US/extras/rheldebugurl.sh deleted file mode 100755 index 0449843..0000000 --- a/doc/SystemTap_Beginners_Guide/en-US/extras/rheldebugurl.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/bash -pkg="redhat-release" -releasever=`rpm -q --qf "%{version}" $pkg` -base=`uname -m` -echo "ftp://ftp.redhat.com/pub/redhat/linux/\ -enterprise/$releasever/en/os/$base/Debuginfo" diff --git a/doc/SystemTap_Beginners_Guide/en-US/extras/stapprep.sh b/doc/SystemTap_Beginners_Guide/en-US/extras/stapprep.sh deleted file mode 100755 index 6905c9c..0000000 --- a/doc/SystemTap_Beginners_Guide/en-US/extras/stapprep.sh +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/bash -check_error() { if test $1 != 0; then echo $2; exit $1; fi } - -if [ "$#" -lt 1 ]; then - UNAME=`uname -r` # determine the kernel running on the machine -else - UNAME=$1 #user passed in uname value -fi -UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace -KERNEL="kernel" -for VARIANT in debug kdump PAE xen; do - TMP=`echo $UNAME | sed s/$VARIANT//` - if [ "$TMP" != "$UNAME" ]; then - UNAME=$TMP; KERNEL="kernel-$VARIANT" - fi -done -KERN_ARCH=`uname -m` -KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname -CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \ - $KERNEL-devel-$KERN_REV.$KERN_ARCH \ - $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH \ - kernel-debuginfo-common-$KERN_REV.$KERN_ARCH" -NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \ - -q $CANDIDATES | grep "is not installed" | awk '{print $2}'` -if [ "$NEEDED" != "" ]; then - echo -e "Need to install the following packages:\n$NEEDED" - if [ `id -u` = "0" ]; then #attempt download and install - DIR=`mktemp -d` || exit 1 - yumdownloader --enablerepo="*debuginfo*" $NEEDED --destdir=$DIR - check_error $? "problem downloading rpm(s) $NEEDED" - rpm --force -ivh $DIR/*.rpm - check_error $? "problem installing rpm(s) $NEEDED" - rm -r $DIR #cleanup - fi -fi diff --git a/doc/SystemTap_Tapset_Reference/Makefile.in b/doc/SystemTap_Tapset_Reference/Makefile.in index 06286d6..6fe6bab 100644 --- a/doc/SystemTap_Tapset_Reference/Makefile.in +++ b/doc/SystemTap_Tapset_Reference/Makefile.in @@ -166,6 +166,7 @@ staplog_CPPFLAGS = @staplog_CPPFLAGS@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DOC_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap diff --git a/scripts/fedoradebugurl.sh b/scripts/fedoradebugurl.sh new file mode 100755 index 0000000..ac6b525 --- /dev/null +++ b/scripts/fedoradebugurl.sh @@ -0,0 +1,9 @@ +#! /bin/bash +echo -n "Enter nvr of kernel-debuginfo (e.g. 2.6.25-14.fc9.x86_64) " ; \ +read NVR; \ +BASE=`uname -m` ; \ +NVR=`echo $NVR | sed s/.$BASE//` ; \ +VERSION=`echo $NVR | awk -F- '{print $1}'` ; \ +RELEASE=`echo $NVR | awk -F- '{print $2}'` ; \ +echo "http://kojipkgs.fedoraproject.org/\ +packages/kernel/$VERSION/$RELEASE/$BASE/" diff --git a/scripts/rheldebugurl.sh b/scripts/rheldebugurl.sh new file mode 100755 index 0000000..0449843 --- /dev/null +++ b/scripts/rheldebugurl.sh @@ -0,0 +1,6 @@ +#! /bin/bash +pkg="redhat-release" +releasever=`rpm -q --qf "%{version}" $pkg` +base=`uname -m` +echo "ftp://ftp.redhat.com/pub/redhat/linux/\ +enterprise/$releasever/en/os/$base/Debuginfo" diff --git a/scripts/stapprep.sh b/scripts/stapprep.sh new file mode 100755 index 0000000..6905c9c --- /dev/null +++ b/scripts/stapprep.sh @@ -0,0 +1,35 @@ +#! /bin/bash +check_error() { if test $1 != 0; then echo $2; exit $1; fi } + +if [ "$#" -lt 1 ]; then + UNAME=`uname -r` # determine the kernel running on the machine +else + UNAME=$1 #user passed in uname value +fi +UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace +KERNEL="kernel" +for VARIANT in debug kdump PAE xen; do + TMP=`echo $UNAME | sed s/$VARIANT//` + if [ "$TMP" != "$UNAME" ]; then + UNAME=$TMP; KERNEL="kernel-$VARIANT" + fi +done +KERN_ARCH=`uname -m` +KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname +CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \ + $KERNEL-devel-$KERN_REV.$KERN_ARCH \ + $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH \ + kernel-debuginfo-common-$KERN_REV.$KERN_ARCH" +NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \ + -q $CANDIDATES | grep "is not installed" | awk '{print $2}'` +if [ "$NEEDED" != "" ]; then + echo -e "Need to install the following packages:\n$NEEDED" + if [ `id -u` = "0" ]; then #attempt download and install + DIR=`mktemp -d` || exit 1 + yumdownloader --enablerepo="*debuginfo*" $NEEDED --destdir=$DIR + check_error $? "problem downloading rpm(s) $NEEDED" + rpm --force -ivh $DIR/*.rpm + check_error $? "problem installing rpm(s) $NEEDED" + rm -r $DIR #cleanup + fi +fi diff --git a/systemtap.spec b/systemtap.spec index 020cd00..e27817d 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -249,6 +249,9 @@ exit 0 %{_bindir}/stap %{_bindir}/stap-report +%{_bindir}/stapprep.sh +%{_bindir}/fedoradebugurl.sh +%{_bindir}/rheldebugurl.sh %{_mandir}/man1/* %{_mandir}/man3/* --------------040901090508080201010709--