diff options
author | Peter Volkov <pva@gentoo.org> | 2011-06-20 05:23:29 +0000 |
---|---|---|
committer | Peter Volkov <pva@gentoo.org> | 2011-06-20 05:23:29 +0000 |
commit | 6707c9d07fc380452e3c583ea8d835300be88232 (patch) | |
tree | 89d50df32623eb30910a9c565b5190d9146d4fc5 /dev-util/oprofile | |
parent | Mask dev-util/oprofile-0.9.7 release candidate (diff) | |
download | gentoo-2-6707c9d07fc380452e3c583ea8d835300be88232.tar.gz gentoo-2-6707c9d07fc380452e3c583ea8d835300be88232.tar.bz2 gentoo-2-6707c9d07fc380452e3c583ea8d835300be88232.zip |
Fixes privilege escalation with sudo (CVE-2011-1760), bug #366699 thank Tim Sammut for report. Bump release candidate: new qt4 gui added java support. Took maintaining.
(Portage version: 2.1.10.3/cvs/Linux x86_64)
Diffstat (limited to 'dev-util/oprofile')
10 files changed, 616 insertions, 2 deletions
diff --git a/dev-util/oprofile/ChangeLog b/dev-util/oprofile/ChangeLog index c411de3f1b6d..acd922dc53b3 100644 --- a/dev-util/oprofile/ChangeLog +++ b/dev-util/oprofile/ChangeLog @@ -1,6 +1,22 @@ # ChangeLog for dev-util/oprofile # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/ChangeLog,v 1.68 2011/06/18 17:15:07 spock Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/ChangeLog,v 1.69 2011/06/20 05:23:29 pva Exp $ + +*oprofile-0.9.7_rc1 (20 Jun 2011) +*oprofile-0.9.6-r1 (20 Jun 2011) + + 20 Jun 2011; Peter Volkov <pva@gentoo.org> +oprofile-0.9.6-r1.ebuild, + +files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch, + +files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch, + +files/oprofile-0.9.6-Avoid-using-bash.patch, + +files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch, + +files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch + , + +files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch + , +oprofile-0.9.7_rc1.ebuild, metadata.xml: + Fixes privilege escalation with sudo (CVE-2011-1760), bug #366699 thank Tim + Sammut for report. Bump release candidate: new qt4 gui added java support. + Took maintaining. 18 Jun 2011; Michał Januszewski <spock@gentoo.org> metadata.xml: Reassigning to maintainer-needed. diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch b/dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch new file mode 100644 index 000000000000..2e38a65628a8 --- /dev/null +++ b/dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch @@ -0,0 +1,74 @@ +commit 96c0ac657c59609d58c47d7ff2206d85a970f20b +Author: Maynard johnson <maynardj@us.ibm.com> +Date: Wed Jan 5 21:16:08 2011 +0000 + + Add argument checking for numerical arguments + +diff --git a/utils/opcontrol b/utils/opcontrol +index dc85c53..8c64af9 100644 +--- a/utils/opcontrol ++++ b/utils/opcontrol +@@ -49,6 +49,31 @@ error_if_empty() + fi + } + ++# guess_number_base() checks if string is a valid octal(8), hexidecimal(16), ++# or decimal number(10). The value is returned in $?. Returns 0, if string ++# isn't a octal, hexidecimal, or decimal number. ++guess_number_base() ++{ ++ if [[ "$1" =~ ^0[0-7]*$ ]] ; then ++ return 8; ++ elif [[ "$1" =~ ^0x[0-9a-fA-F]+$ ]] ; then ++ return 16; ++ elif [[ "$1" =~ ^[1-9][0-9]*$ ]] ; then ++ return 10; ++ else ++ return 0; ++ fi ++} ++ ++# check value is a valid number ++error_if_not_number() ++{ ++ guess_number_base $2 ++ if test "$?" -eq 0 ; then ++ echo "Argument for $1, $2, is not a valid number." >&2 ++ exit 1 ++ fi ++} + + # rm_device arguments $1=file_name + rm_device() +@@ -754,6 +779,7 @@ do_options() + ;; + --buffer-size) + error_if_empty $arg $val ++ error_if_not_number $arg $val + BUF_SIZE=$val + DO_SETUP=yes + ;; +@@ -763,6 +789,7 @@ do_options() + exit 1 + fi + error_if_empty $arg $val ++ error_if_not_number $arg $val + BUF_WATERSHED=$val + DO_SETUP=yes + ;; +@@ -772,6 +799,7 @@ do_options() + exit 1 + fi + error_if_empty $arg $val ++ error_if_not_number $arg $val + CPU_BUF_SIZE=$val + DO_SETUP=yes + ;; +@@ -802,6 +830,7 @@ do_options() + echo "Call-graph profiling unsupported on this kernel/hardware" >&2 + exit 1 + fi ++ error_if_not_number $arg $val + CALLGRAPH=$val + DO_SETUP=yes + ;; diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch new file mode 100644 index 000000000000..1892cc3e007a --- /dev/null +++ b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch @@ -0,0 +1,46 @@ +commit f427df4ed4b2ec540d496abc4afa984b2dd677b4 +Author: William Cohen <wcohen@redhat.com> +Date: Thu Jun 2 09:44:38 2011 -0400 + + Avoid blindly source $SETUP_FILE with '.' (PR3303383) + + There could be arbitrary commands in the $SETUP_FILE. The '.' command + would blindly execute them. This change limits do_load_setup to only + assigning values to variables. + +diff --git a/utils/opcontrol b/utils/opcontrol +index cdff19f..b981427 100644 +--- a/utils/opcontrol ++++ b/utils/opcontrol +@@ -496,12 +496,25 @@ do_load_setup() + || mv "$SEC_SETUP_FILE" "$SETUP_FILE" + fi + +- if test -f "$SETUP_FILE"; then +- # load the actual information from file +- # FIXME this is insecure, arbitrary commands could be added to +- # $SETUP_FILE and be executed as root +- . $SETUP_FILE +- fi ++ if test ! -f "$SETUP_FILE"; then return; fi ++ ++ while IFS== read -r arg val; do ++ case "$arg" in ++ # The following catches anything that is not ++ # 0-9, a-z, A-Z, or an '_' ++ *[![:alnum:]_]*) ++ echo "Invalid variable \"$arg\" in $SETUP_FILE." ++ exit 1;; ++ esac ++ case "$val" in ++ # The following catches anything that is not ++ # 0-9, a-z, A-Z, an '-', ':', ',', '.', or '/' ++ *[!-[:alnum:]_:,./]*) ++ echo "Invalid value \"$val\" for $arg in $SETUP_FILE." ++ exit 1;; ++ esac ++ eval "${arg}=${val}" ++ done < $SETUP_FILE + } + + diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch new file mode 100644 index 000000000000..49d06f4bc0ca --- /dev/null +++ b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch @@ -0,0 +1,19 @@ +commit 7cb560b4d52f27f9ccb86a9cd643d0288514335f +Author: William Cohen <wcohen@redhat.com> +Date: Thu May 26 11:21:39 2011 -0400 + + Avoid using [[ in error_if_not_basename() to improve posix compliance. + +diff --git a/utils/opcontrol b/utils/opcontrol +index f002f01..cdff19f 100644 +--- a/utils/opcontrol ++++ b/utils/opcontrol +@@ -89,7 +89,7 @@ error_if_not_number() + error_if_not_basename() + { + bname=`basename "$2"` +- if [[ "x$2" != "x$bname" ]] ; then ++ if test "$2" != "$bname"; then + echo "Argument for $1, $2, is not a base filename." >&2 + exit 1 + fi diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch b/dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch new file mode 100644 index 000000000000..25ed342f5126 --- /dev/null +++ b/dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch @@ -0,0 +1,182 @@ +commit 9578aed0a51f5c77fd20fd40cead126c7cdd5030 +Author: William Cohen <wcohen@redhat.com> +Date: Thu Jun 2 10:24:26 2011 -0400 + + Do additional checks on user supplied arguments + + Avoid blindly setting variable to user-supplied values. Check to the values + to make sure they do not contain odd punctuation. + + Signed-off-by: William Cohen <wcohen@redhat.com> + +diff --git a/utils/opcontrol b/utils/opcontrol +index 8f584ad..92baa0d 100644 +--- a/utils/opcontrol ++++ b/utils/opcontrol +@@ -78,7 +78,8 @@ guess_number_base() + # check value is a valid number + error_if_not_number() + { +- guess_number_base $2 ++ error_if_empty "$1" "$2" ++ guess_number_base "$2" + if test "$?" -eq 0 ; then + echo "Argument for $1, $2, is not a valid number." >&2 + exit 1 +@@ -86,13 +87,33 @@ error_if_not_number() + } + + # check value is a base filename +-error_if_not_basename() ++error_if_not_valid_savename() + { ++ error_if_empty "$1" "$2" + bname=`basename "$2"` + if test "$2" != "$bname"; then +- echo "Argument for $1, $2, is not a base filename." >&2 ++ echo "Argument for $1, $2, cannot change directory." >&2 + exit 1 + fi ++ case "$2" in ++ # The following catches anything that is not ++ # 0-9, a-z, A-Z, an '-', ':', ',', '.', or '/' ++ *[!-[:alnum:]_:,./]*) ++ echo "Argument for $1, $2, not allow to have special characters" >&2 ++ exit 1;; ++ esac ++} ++ ++error_if_invalid_arg() ++{ ++ error_if_empty "$1" "$2" ++ case "$2" in ++ # The following catches anything that is not ++ # 0-9, a-z, A-Z, an '-', ':', ',', '.', or '/' ++ *[!-[:alnum:]_:,./]*) ++ echo "Argument for $1, $2, is not valid argument." >&2 ++ exit 1;; ++ esac + } + + # rm_device arguments $1=file_name +@@ -814,8 +835,7 @@ do_options() + ;; + + --save) +- error_if_empty $arg $val +- error_if_not_basename $arg $val ++ error_if_not_valid_savename "$arg" "$val" + DUMP=yes + SAVE_SESSION=yes + SAVE_NAME=$val +@@ -840,8 +860,7 @@ do_options() + # already processed + ;; + --buffer-size) +- error_if_empty $arg $val +- error_if_not_number $arg $val ++ error_if_not_number "$arg" "$val" + BUF_SIZE=$val + DO_SETUP=yes + ;; +@@ -850,8 +869,7 @@ do_options() + echo "$arg unsupported for this kernel version" + exit 1 + fi +- error_if_empty $arg $val +- error_if_not_number $arg $val ++ error_if_not_number "$arg" "$val" + BUF_WATERSHED=$val + DO_SETUP=yes + ;; +@@ -860,13 +878,12 @@ do_options() + echo "$arg unsupported for this kernel version" + exit 1 + fi +- error_if_empty $arg $val +- error_if_not_number $arg $val ++ error_if_not_number "$arg" "$val" + CPU_BUF_SIZE=$val + DO_SETUP=yes + ;; + -e|--event) +- error_if_empty $arg $val ++ error_if_invalid_arg "$arg" "$val" + # reset any read-in defaults from daemonrc + if test "$SEEN_EVENT" = "0"; then + NR_CHOSEN=0 +@@ -887,17 +904,16 @@ do_options() + DO_SETUP=yes + ;; + -c|--callgraph) +- error_if_empty $arg $val + if test ! -f $MOUNT/backtrace_depth; then + echo "Call-graph profiling unsupported on this kernel/hardware" >&2 + exit 1 + fi +- error_if_not_number $arg $val ++ error_if_not_number "$arg" "$val" + CALLGRAPH=$val + DO_SETUP=yes + ;; + --vmlinux) +- error_if_empty $arg $val ++ error_if_invalid_arg "$arg" "$val" + VMLINUX=$val + DO_SETUP=yes + ;; +@@ -906,32 +922,32 @@ do_options() + DO_SETUP=yes + ;; + --kernel-range) +- error_if_empty $arg $val ++ error_if_invalid_arg "$arg" "$val" + KERNEL_RANGE=$val + DO_SETUP=yes + ;; + --xen) +- error_if_empty $arg $val ++ error_if_invalid_arg "$arg" "$val" + XENIMAGE=$val + DO_SETUP=yes + ;; + --active-domains) +- error_if_empty $arg $val ++ error_if_invalid_arg $arg $val + ACTIVE_DOMAINS=$val + DO_SETUP=yes + ;; + --note-table-size) +- error_if_empty $arg $val + if test "$KERNEL_SUPPORT" = "yes"; then + echo "\"$arg\" meaningless on this kernel" >&2 + exit 1 + else ++ error_if_not_number "$arg" "$val" + NOTE_SIZE=$val + fi + DO_SETUP=yes + ;; + -i|--image) +- error_if_empty $arg $val ++ error_if_invalid_arg "$arg" "$val" + if test "$val" = "all"; then + IMAGE_FILTER= + else +@@ -944,6 +960,7 @@ do_options() + if test -z "$val"; then + VERBOSE="all" + else ++ error_if_invalid_arg "$arg" "$val" + VERBOSE=$val + fi + ;; +@@ -1898,7 +1915,7 @@ check_options_early() + exit 0 + ;; + --session-dir) +- error_if_empty $arg $val ++ error_if_invalid_arg "$arg" "$val" + SESSION_DIR="$val" + DO_SETUP=yes + # do not exit early diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch b/dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch new file mode 100644 index 000000000000..3e0de57389ae --- /dev/null +++ b/dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch @@ -0,0 +1,35 @@ +commit 022cc07e4140c1ba1b9824124b29f36fd44d6040 +Author: William Cohen <wcohen@redhat.com> +Date: Mon May 23 14:59:41 2011 -0500 + + Ensure that --save only saves things in $SESSION_DIR + +diff --git a/utils/opcontrol b/utils/opcontrol +index e908f1f..0f04354 100644 +--- a/utils/opcontrol ++++ b/utils/opcontrol +@@ -75,6 +75,16 @@ error_if_not_number() + fi + } + ++# check value is a base filename ++error_if_not_basename() ++{ ++ bname=`basename "$2"` ++ if [[ "x$2" != "x$bname" ]] ; then ++ echo "Argument for $1, $2, is not a base filename." >&2 ++ exit 1 ++ fi ++} ++ + # rm_device arguments $1=file_name + rm_device() + { +@@ -753,6 +763,7 @@ do_options() + + --save) + error_if_empty $arg $val ++ error_if_not_basename $arg $val + DUMP=yes + SAVE_SESSION=yes + SAVE_NAME=$val diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch b/dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch new file mode 100644 index 000000000000..f29b79f7f848 --- /dev/null +++ b/dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch @@ -0,0 +1,97 @@ +commit a5012d86e87e1c59be4a221b7d47cc791b102555 +Author: Maynard Johnson <maynardj@us.ibm.com> +Date: Wed May 25 16:10:46 2011 -0500 + + Fix opcontrol --status to show accurate information for running daemon + +diff --git a/utils/opcontrol b/utils/opcontrol +index 0f04354..f002f01 100644 +--- a/utils/opcontrol ++++ b/utils/opcontrol +@@ -38,6 +38,16 @@ do_sysctl() + echo $val > /proc/sys/$dev_name + } + ++# Helper function to check if oprofile daemon is active. ++# Takes one argument: the "lock file" for the oprofile daemon. ++# The lock file may exist even if the daemon was killed or died in ++# some way. So we do a kill SIG_DFL to test whether the daemon is ++# truly alive. If the lock file is stale (daemon dead), the kill will ++# not return '0'. ++is_oprofiled_active() ++{ ++ [ -f "$1" ] && kill -0 `cat "$1"` 2>/dev/null ++} + + # check value is set + error_if_empty() +@@ -355,6 +365,7 @@ do_init() + # location for daemon setup information + SETUP_DIR="/root/.oprofile" + SETUP_FILE="$SETUP_DIR/daemonrc" ++ SEC_SETUP_FILE="$SETUP_DIR/daemonrc_new" + + # initialize daemon vars + decide_oprofile_device_mount +@@ -408,6 +419,19 @@ set_event() + do_save_setup() + { + create_dir "$SETUP_DIR" ++ SAVE_SETUP_FILE="$SETUP_FILE" ++ ++# If the daemon is currently running, we want changes to the daemon config ++# stored in the secondary cache file so that 'opcontrol --status' will ++# show actual config data for the running daemon. The next time the ++# daemon is restarted, we'll reload the config data from this secondary ++# cache file. ++ ++ if is_oprofiled_active "$LOCK_FILE"; then ++ SETUP_FILE="$SEC_SETUP_FILE" ++ echo "The profiling daemon is currently active, so changes to the configuration" ++ echo "will be used the next time you restart oprofile after a --shutdown or --deinit." ++ fi + + touch $SETUP_FILE + chmod 644 $SETUP_FILE +@@ -451,12 +475,27 @@ do_save_setup() + if test "$XEN_RANGE"; then + echo "XEN_RANGE=$XEN_RANGE" >> $SETUP_FILE + fi ++ SETUP_FILE="$SAVE_SETUP_FILE" + } + + + # reload all the setup-related information + do_load_setup() + { ++# If a secondary setup file exists and the daemon is not running, ++# then we'll move the data from the secondary file to the actual ++# setup file to prepare for daemon startup. ++ if test -z "$SESSION_DIR"; then ++ __TMP_SESSION_DIR="/var/lib/oprofile" ++ else ++ __TMP_SESSION_DIR="$SESSION_DIR" ++ fi ++ ++ if test -f "$SEC_SETUP_FILE"; then ++ is_oprofiled_active "$__TMP_SESSION_DIR/lock" \ ++ || mv "$SEC_SETUP_FILE" "$SETUP_FILE" ++ fi ++ + if test -f "$SETUP_FILE"; then + # load the actual information from file + # FIXME this is insecure, arbitrary commands could be added to +@@ -1572,7 +1611,12 @@ do_status() + { + OPROFILED_PID=`cat $SESSION_DIR/lock 2>/dev/null` + if test -n "$OPROFILED_PID" -a -d "/proc/$OPROFILED_PID"; then +- echo "Daemon running: pid $OPROFILED_PID" ++ if test "$KERNEL_SUPPORT" = yes \ ++ && test 0 != $(cat /dev/oprofile/enable); then ++ echo "Daemon running: pid $OPROFILED_PID" ++ else ++ echo "Daemon paused: pid $OPROFILED_PID" ++ fi + else + echo "Daemon not running" + fi diff --git a/dev-util/oprofile/metadata.xml b/dev-util/oprofile/metadata.xml index 616f0488f72e..6aba3ff95ba5 100644 --- a/dev-util/oprofile/metadata.xml +++ b/dev-util/oprofile/metadata.xml @@ -3,6 +3,6 @@ <pkgmetadata> <herd>no-herd</herd> <maintainer> - <email>maintainer-needed@gentoo.org</email> + <email>pva@gentoo.org</email> </maintainer> </pkgmetadata> diff --git a/dev-util/oprofile/oprofile-0.9.6-r1.ebuild b/dev-util/oprofile/oprofile-0.9.6-r1.ebuild new file mode 100644 index 000000000000..dd388d349b1e --- /dev/null +++ b/dev-util/oprofile/oprofile-0.9.6-r1.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/oprofile-0.9.6-r1.ebuild,v 1.1 2011/06/20 05:23:29 pva Exp $ + +EAPI=4 +inherit eutils linux-info + +DESCRIPTION="A transparent low-overhead system-wide profiler" +HOMEPAGE="http://oprofile.sourceforge.net" +SRC_URI="mirror://sourceforge/oprofile/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86" +IUSE="" + +DEPEND=">=dev-libs/popt-1.7-r1 + >=sys-devel/binutils-2.14.90.0.6-r3 + >=sys-libs/glibc-2.3.2-r1" +RDEPEND="${DEPEND}" + +pkg_setup() { + linux-info_pkg_setup + if ! linux_config_exists || ! linux_chkconfig_present OPROFILE; then + elog "In order for oprofile to work, you need to configure your kernel" + elog "with CONFIG_OPROFILE set to 'm' or 'y'." + fi +} + +src_prepare() { + epatch "${FILESDIR}/${P}-mutable.patch" + epatch "${FILESDIR}/${P}-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch" + epatch "${FILESDIR}/${P}-Fix-opcontrol-status-to-show-accurate-information.patch" + epatch "${FILESDIR}/${P}-Avoid-blindly-source-SETUP_FILE-with.patch" + epatch "${FILESDIR}/${P}-Add-argument-checking-for-numerical-arguments.patch" + epatch "${FILESDIR}/${P}-Avoid-using-bash.patch" + epatch "${FILESDIR}/${P}-Do-additional-checks-on-user-supplied-arguments.patch" +} + +src_configure() { + local myconf="--with-qt-dir=/void --with-x" + + case ${KV_FULL} in + 2.2.*|2.4.*) myconf="${myconf} --with-linux=${KV_DIR}";; + 2.5.*|2.6.*) myconf="${myconf} --with-kernel-support";; + *) die "Kernel version '${KV_FULL}' not supported";; + esac + econf ${myconf} +} + +src_compile() { + local mymake="" + sed -i -e "s,depmod -a,:,g" Makefile + emake ${mymake} || die +} + +src_install() { + local myinst="" + + myinst="${myinst} MODINSTALLDIR=${ED}/lib/modules/${KV_FULL}" + make DESTDIR="${D}" ${myinst} htmldir="/usr/share/doc/${PF}" install + + dodoc ChangeLog* README TODO +} + +pkg_postinst() { + if [[ ${ROOT} == / ]] ; then + [[ -x /sbin/update-modules ]] && /sbin/update-modules || /sbin/modules-update + fi + + echo + elog "Now load the oprofile module by running:" + elog " # opcontrol --init" + elog "Then read manpages and this html doc:" + elog " /usr/share/doc/${PF}/oprofile.html" + echo +} diff --git a/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild b/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild new file mode 100644 index 000000000000..c39fe8cb1d33 --- /dev/null +++ b/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild,v 1.1 2011/06/20 05:23:29 pva Exp $ + +EAPI=2 +inherit eutils linux-info java-pkg-opt-2 + +MY_P=${PN}-${PV/_/-} +DESCRIPTION="A transparent low-overhead system-wide profiler" +HOMEPAGE="http://oprofile.sourceforge.net" +SRC_URI="mirror://sourceforge/oprofile/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86" +IUSE="java pch qt4" + +DEPEND=">=dev-libs/popt-1.7-r1 + >=sys-devel/binutils-2.14.90.0.6-r3 + >=sys-libs/glibc-2.3.2-r1 + qt4? ( x11-libs/qt-gui[qt3support] ) + java? ( >=virtual/jdk-1.5 )" +RDEPEND="${DEPEND}" + +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + linux-info_pkg_setup + if ! linux_config_exists || ! linux_chkconfig_present OPROFILE; then + elog "In order for oprofile to work, you need to configure your kernel" + elog "with CONFIG_OPROFILE set to 'm' or 'y'." + fi + + # Required for JIT support, see README_PACKAGERS + enewgroup oprofile + enewuser oprofile -1 -1 -1 oprofile + + #sed -i -e "s/depmod -a/:/g" Makefile.in + + use java && java-pkg_init +} + +src_configure() { + econf \ + --with-kernel-support \ + $(use_with qt4 x) \ + $(use_enable qt4 gui qt4) \ + $(use_enable pch) \ + $(use_with java java ${JAVA_HOME}) +} + +src_install() { + make DESTDIR="${D}" htmldir="/usr/share/doc/${PF}" install || die + + dodoc ChangeLog* README TODO + + dodir /etc/env.d + echo "LDPATH=${PREFIX}/usr/$(get_libdir)/oprofile" > "${D}"/etc/env.d/10${PN} || die "env.d failed" +} + +pkg_postinst() { + echo + elog "Now load the oprofile module by running:" + elog " # opcontrol --init" + elog "Then read manpages and this html doc:" + elog " /usr/share/doc/${PF}/oprofile.html" + echo +} |