blob: ac839dee447a5ee5b22031bf1d54640506c3aba8 [file] [log] [blame]
Patrick Williams520786c2023-06-25 16:20:36 -05001# Copyright (C) 2017 - 2023 Armin Kuster <akuster808@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMARRY = "SCAP content for various platforms, upstream version"
5HOME_URL = "https://www.open-scap.org/security-policies/scap-security-guide/"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=9bfa86579213cb4c6adaffface6b2820"
7LICENSE = "BSD-3-Clause"
8
Andrew Geissler2edf0642023-09-11 08:24:07 -04009SRCREV = "d09e81ae00509a9be4b01359166cfbece06e47f4"
Patrick Williams520786c2023-06-25 16:20:36 -050010SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=master;protocol=https \
Patrick Williams520786c2023-06-25 16:20:36 -050011 file://run_eval.sh \
Patrick Williams2a254922023-08-11 09:48:11 -050012 file://run-ptest \
Patrick Williams2a254922023-08-11 09:48:11 -050013 file://0002-scap-security-guide-Add-Poky-support.patch \
Patrick Williams520786c2023-06-25 16:20:36 -050014 "
15
16
17DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native"
18
19S = "${WORKDIR}/git"
20B = "${S}/build"
21
Patrick Williams2a254922023-08-11 09:48:11 -050022inherit cmake pkgconfig python3native python3targetconfig ptest
Patrick Williams520786c2023-06-25 16:20:36 -050023
Andrew Geissler2edf0642023-09-11 08:24:07 -040024STAGING_OSCAP_BUILDDIR = "${TMPDIR}/work-shared/openscap/oscap-build-artifacts"
25export OSCAP_CPE_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/cpe"
26export OSCAP_SCHEMA_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/schemas"
27export OSCAP_XSLT_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/xsl"
28
Patrick Williams520786c2023-06-25 16:20:36 -050029OECMAKE_GENERATOR = "Unix Makefiles"
30
Andrew Geissler2edf0642023-09-11 08:24:07 -040031EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_OPENEMBEDDED=ON"
Patrick Williams520786c2023-06-25 16:20:36 -050032
33do_configure[depends] += "openscap-native:do_install"
34
35do_configure:prepend () {
36 sed -i -e 's:NAMES\ sed:NAMES\ ${HOSTTOOLS_DIR}/sed:g' ${S}/CMakeLists.txt
37 sed -i -e 's:NAMES\ grep:NAMES\ ${HOSTTOOLS_DIR}/grep:g' ${S}/CMakeLists.txt
38}
39
40do_install:append() {
41 install -d ${D}${datadir}/openscap
42 install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/.
43}
44
Patrick Williams2a254922023-08-11 09:48:11 -050045do_compile_ptest() {
46 cd ${S}/build
47 cmake ../
48 make
49}
50
51do_install_ptest() {
52
53 # remove host & work dir from tests
54 for x in $(find ${S}/build -type f) ;
55 do
56 sed -e 's#${HOSTTOOLS_DIR}/##g' \
57 -e 's#${RECIPE_SYSROOT_NATIVE}##g' \
58 -e 's#${WORKDIR}#${PTEST_PATH}#g' \
59 -e 's#/.*/xmllint#/usr/bin/xmllint#g' \
60 -e 's#/.*/oscap#/usr/bin/oscap#g' \
61 -e 's#/python3-native##g' \
62 -i ${x}
63 done
64
65 for x in $(find ${S}/build-scripts -type f) ;
66 do
67 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
68 done
69
70 for x in $(find ${S}/tests -type f) ;
71 do
72 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
73 done
74
75 for x in $(find ${S}/utils -type f) ;
76 do
77 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
78 done
79
80 PDIRS="apple_os build controls products shared components applications linux_os ocp-resources tests utils ssg build-scripts"
81 t=${D}/${PTEST_PATH}/git
82 for d in ${PDIRS}; do
83 install -d ${t}/$d
84 cp -fr ${S}/$d/* ${t}/$d/.
85 done
86}
87
Patrick Williams520786c2023-06-25 16:20:36 -050088FILES:${PN} += "${datadir}/xml ${datadir}/openscap"
89
90RDEPENDS:${PN} = "openscap"
Patrick Williams2a254922023-08-11 09:48:11 -050091RDEPENDS:${PN}-ptest = "cmake grep sed bash git python3 python3-modules python3-mypy python3-pyyaml python3-yamlpath python3-xmldiff python3-json2html python3-pandas python3-openpyxl python3-pytest libxml2-utils libxslt-bin"
Patrick Williams520786c2023-06-25 16:20:36 -050092
93COMPATIBLE_HOST:libc-musl = "null"