openscap-1.2.5.ebuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python2_7 )
  5. inherit bash-completion-r1 eutils multilib python-single-r1
  6. DESCRIPTION="Framework which enables integration with Security Content Automation Protocol"
  7. HOMEPAGE="http://www.open-scap.org/"
  8. SRC_URI="https://fedorahosted.org/releases/o/p/${PN}/${P}.tar.gz"
  9. LICENSE="LGPL-2.1+"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="acl caps debug doc gconf ldap nss pcre perl python rpm selinux sce sql test xattr"
  13. RESTRICT="test"
  14. RDEPEND="!nss? ( dev-libs/libgcrypt:0 )
  15. nss? ( dev-libs/nss )
  16. acl? ( virtual/acl )
  17. caps? ( sys-libs/libcap )
  18. gconf? ( gnome-base/gconf )
  19. ldap? ( net-nds/openldap )
  20. pcre? ( dev-libs/libpcre )
  21. rpm? ( >=app-arch/rpm-4.9 )
  22. sql? ( dev-db/opendbx )
  23. xattr? ( sys-apps/attr )
  24. dev-libs/libpcre
  25. dev-libs/libxml2
  26. dev-libs/libxslt
  27. net-misc/curl
  28. ${PYTHON_DEPS}"
  29. DEPEND="${RDEPEND}
  30. doc? ( app-doc/doxygen )
  31. perl? ( dev-lang/swig )
  32. python? ( dev-lang/swig )
  33. test? (
  34. app-arch/unzip
  35. dev-perl/XML-XPath
  36. net-misc/ipcalc
  37. sys-apps/grep )"
  38. REQUIRED_USE="${PYTHON_REQUIRED_USE}"
  39. src_prepare() {
  40. # uncoment for debugging test
  41. # sed -i 's,set -e,&;set -x,' tests/API/XCCDF/unittests/test_remediate_simple.sh || die
  42. # sed -i 's,^ bash, LC_ALL=C bash,' tests/probes/process/test_probes_process.sh || die
  43. sed -i 's/uname -p/uname -m/' tests/probes/uname/test_probes_uname.xml.sh || die
  44. #probe runlevel for non-centos/redhat/fedora is not implemented
  45. sed -i 's,.*runlevel_test.*,echo "runlevel test bypassed",' tests/mitre/test_mitre.sh || die
  46. sed -i 's,probecheck "runlevel,probecheck "runlevellllll,' tests/probes/runlevel/test_probes_runlevel.sh || die
  47. #According to comment of theses tests, we must modify it. For the moment disable it
  48. sed -i 's,.*linux-def_inetlisteningservers_test,#&,' tests/mitre/test_mitre.sh || die
  49. sed -i 's,.*ind-def_environmentvariable_test,#&,' tests/mitre/test_mitre.sh || die
  50. # theses tests are hardcoded for checking hald process...,
  51. # but no good solution for the moment, disabling them with a fake echo
  52. # because encased in a if then
  53. # sed -i 's,ha.d,/sbin/udevd --daemon,g' tests/mitre/unix-def_process_test.xml || die
  54. # sed -i 's,ha.d,/sbin/udevd --daemon,g' tests/mitre/unix-def_process58_test.xml || die
  55. sed -i 's,.*process_test.*,echo "process test bypassed",' tests/mitre/test_mitre.sh || die
  56. sed -i 's,.*process58_test.*,echo "process58 test bypassed",' tests/mitre/test_mitre.sh || die
  57. #This test fail
  58. sed -i 's,.*generate report: xccdf,#&,' tests/API/XCCDF/unittests/all.sh || die
  59. if ! use rpm ; then
  60. sed -i 's,probe_rpminfo_req_deps_ok=yes,probe_rpminfo_req_deps_ok=no,' configure || die
  61. sed -i 's,probe_rpminfo_opt_deps_ok=yes,probe_rpminfo_opt_deps_ok=no,' configure || die
  62. sed -i 's,probe_rpmverify_req_deps_ok=yes,probe_rpmverify_req_deps_ok=no,' configure || die
  63. sed -i 's,probe_rpmverify_opt_deps_ok=yes,probe_rpmverify_opt_deps_ok=no,' configure || die
  64. sed -i 's,^probe_rpm.*_deps_missing=,&disabled_by_USE_flag,' configure || die
  65. sed -i 's,.*rpm.*,#&,' tests/mitre/test_mitre.sh || die
  66. fi
  67. if ! use selinux ; then
  68. einfo "Disabling SELinux probes"
  69. sed -i 's,.*selinux.*, echo "SELinux test bypassed",' tests/mitre/test_mitre.sh || die
  70. #process58 need selinux
  71. sed -i 's,.*process58,#&,' tests/mitre/test_mitre.sh || die
  72. fi
  73. if ! use ldap; then
  74. einfo "Disabling LDAP probes"
  75. sed -i 's,ldap.h,ldapp.h,g' configure || die
  76. fi
  77. epatch_user
  78. }
  79. src_configure() {
  80. python_setup
  81. local myconf
  82. if use debug ; then
  83. myconf+=" --enable-debug"
  84. fi
  85. if use python ; then
  86. myconf+=" --enable-python"
  87. else
  88. myconf+=" --enable-python=no"
  89. fi
  90. if use perl ; then
  91. myconf+=" --enable-perl"
  92. fi
  93. if use nss ; then
  94. myconf+=" --with-crypto=nss3"
  95. else
  96. myconf+=" --with-crypto=gcrypt"
  97. fi
  98. if use sce ; then
  99. myconf+=" --enable-sce"
  100. else
  101. myconf+=" --enable-sce=no"
  102. fi
  103. econf ${myconf}
  104. }
  105. src_compile() {
  106. emake
  107. if use doc ; then
  108. cd docs && doxygen Doxyfile || die
  109. fi
  110. }
  111. src_install() {
  112. emake install DESTDIR="${D}"
  113. prune_libtool_files --all
  114. if use doc ; then
  115. dohtml -r docs/html/.
  116. dodoc docs/examples/.
  117. fi
  118. dobashcomp "${D}"/etc/bash_completion.d/oscap
  119. rm -rf "${D}"/etc/bash_completion.d || die
  120. }