| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-forensics/openscap/openscap-0.8.0.ebuild,v 1.1 2011/12/26 14:30:28 swift Exp $
|
| 4 |
|
| 5 |
EAPI=3
|
| 6 |
|
| 7 |
PYTHON_DEPEND="2"
|
| 8 |
|
| 9 |
inherit eutils multilib python bash-completion-r1
|
| 10 |
|
| 11 |
DESCRIPTION="Framework which enables integration with the Security Content Automation Protocol (SCAP)"
|
| 12 |
HOMEPAGE="http://www.open-scap.org/"
|
| 13 |
SRC_URI="https://fedorahosted.org/releases/o/p/${PN}/${P}.tar.gz"
|
| 14 |
|
| 15 |
LICENSE="LGPL-2.1"
|
| 16 |
SLOT="0"
|
| 17 |
KEYWORDS="~amd64 ~x86"
|
| 18 |
IUSE="bash-completion doc nss perl python rpm selinux sql test"
|
| 19 |
#RESTRICT="test"
|
| 20 |
|
| 21 |
RDEPEND="!nss? ( dev-libs/libgcrypt )
|
| 22 |
nss? ( dev-libs/nss )
|
| 23 |
rpm? ( >=app-arch/rpm-4.9 )
|
| 24 |
sql? ( dev-db/opendbx )
|
| 25 |
dev-libs/libpcre
|
| 26 |
dev-libs/libxml2
|
| 27 |
dev-libs/libxslt
|
| 28 |
net-misc/curl"
|
| 29 |
DEPEND="${RDEPEND}
|
| 30 |
perl? ( dev-lang/swig )
|
| 31 |
python? ( dev-lang/swig )
|
| 32 |
test? (
|
| 33 |
app-arch/unzip
|
| 34 |
dev-perl/XML-XPath
|
| 35 |
net-misc/ipcalc
|
| 36 |
sys-apps/grep )"
|
| 37 |
|
| 38 |
pkg_setup() {
|
| 39 |
python_set_active_version 2
|
| 40 |
python_pkg_setup
|
| 41 |
}
|
| 42 |
|
| 43 |
src_prepare() {
|
| 44 |
sed -i 's/uname -p/uname -m/' tests/probes/uname/test_probes_uname.xml.sh || die
|
| 45 |
|
| 46 |
#probe runlevel for non-centos/redhat/fedora is not implemted
|
| 47 |
sed -i 's,.*runlevel_test,#&,' tests/mitre/test_mitre.sh || die
|
| 48 |
sed -i 's,probecheck "runlevel,probecheck "runlevellllll,' tests/probes/runlevel/test_probes_runlevel.sh || die
|
| 49 |
|
| 50 |
#According to comment of theses tests, we must modify it. For the moment disable it
|
| 51 |
sed -i 's,.*linux-def_inetlisteningservers_test,#&,' tests/mitre/test_mitre.sh || die
|
| 52 |
sed -i 's,.*ind-def_environmentvariable_test,#&,' tests/mitre/test_mitre.sh || die
|
| 53 |
|
| 54 |
#This test fail when testing process with [] in names https://fedorahosted.org/openscap/ticket/47
|
| 55 |
epatch "${FILESDIR}"/test_probes_process.patch || die
|
| 56 |
|
| 57 |
# theses tests are hardcoded for checking hald process...,
|
| 58 |
# but no good solution for the moment, disabling them with a fake echo
|
| 59 |
# because encased in a if then
|
| 60 |
# sed -i 's,ha.d,/sbin/udevd --daemon,g' tests/mitre/unix-def_process_test.xml || die
|
| 61 |
# sed -i 's,ha.d,/sbin/udevd --daemon,g' tests/mitre/unix-def_process58_test.xml || die
|
| 62 |
sed -i 's,.*process_test.*,echo "",' tests/mitre/test_mitre.sh || die
|
| 63 |
sed -i 's,.*process58_test.*,echo "",' tests/mitre/test_mitre.sh || die
|
| 64 |
|
| 65 |
if ! use rpm ; then
|
| 66 |
sed -i 's,probe_rpminfo_req_deps_ok=yes,probe_rpminfo_req_deps_ok=no,' configure || die
|
| 67 |
sed -i 's,probe_rpminfo_opt_deps_ok=yes,probe_rpminfo_opt_deps_ok=no,' configure || die
|
| 68 |
sed -i 's,probe_rpmverify_req_deps_ok=yes,probe_rpmverify_req_deps_ok=no,' configure || die
|
| 69 |
sed -i 's,probe_rpmverify_opt_deps_ok=yes,probe_rpmverify_opt_deps_ok=no,' configure || die
|
| 70 |
sed -i 's,^probe_rpm.*_deps_missing=,&disabled by USE flag,' configure || die
|
| 71 |
sed -i 's,.*rpm.*,#&,' tests/mitre/test_mitre.sh || die
|
| 72 |
fi
|
| 73 |
if ! use selinux ; then
|
| 74 |
sed -i 's,.*selinux.*,#&,' tests/mitre/test_mitre.sh || die
|
| 75 |
#process58 need selinux
|
| 76 |
sed -i 's,.*process58,#&,' tests/mitre/test_mitre.sh || die
|
| 77 |
fi
|
| 78 |
}
|
| 79 |
|
| 80 |
src_configure() {
|
| 81 |
local myconf
|
| 82 |
if use python || use perl ; then
|
| 83 |
myconf+=" --enable-bindings"
|
| 84 |
else
|
| 85 |
myconf+=" --disable-bindings"
|
| 86 |
fi
|
| 87 |
if use nss ; then
|
| 88 |
myconf+=" --with-crypto=nss3"
|
| 89 |
else
|
| 90 |
myconf+=" --with-crypto=gcrypt"
|
| 91 |
fi
|
| 92 |
econf ${myconf}
|
| 93 |
}
|
| 94 |
|
| 95 |
src_install() {
|
| 96 |
emake install DESTDIR="${D}" || die
|
| 97 |
find "${D}" -name '*.la' -delete || die
|
| 98 |
sed -i 's/^Description/&:/' "${D}"/usr/$(get_libdir)/pkgconfig/libopenscap.pc || die
|
| 99 |
#--enable-bindings enable all bindings, clean unwanted bindings
|
| 100 |
if use python && ! use perl ; then
|
| 101 |
rm -rf "${D}"/usr/$(get_libdir)/perl5 || die
|
| 102 |
fi
|
| 103 |
if ! use python && use perl ; then
|
| 104 |
rm -rf "${D}"/$(python_get_sitedir) || die
|
| 105 |
fi
|
| 106 |
if use doc ; then
|
| 107 |
dohtml -r docs/html/* || die
|
| 108 |
dodoc docs/examples/* || die
|
| 109 |
fi
|
| 110 |
if use bash-completion ; then
|
| 111 |
dobashcomp "${D}"/etc/bash_completion.d/oscap
|
| 112 |
fi
|
| 113 |
rm -rf "${D}"/etc/bash_completion.d || die
|
| 114 |
}
|