blob: 5e4533296e8bcc3c9987432d620e2976ec73f9ea [file] [log] [blame]
Patrick Williams73bd93f2024-02-20 08:07:48 -06001# Copyright (C) 2017 - 2024 Armin Kuster <akuster808@gmail.com>
Patrick Williams520786c2023-06-25 16:20:36 -05002# 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
Patrick Williams73bd93f2024-02-20 08:07:48 -06009SRCREV = "459f0abf2ac08d36e5fc4a2619bc75cff7000da9"
10SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=stable;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 Williams520786c2023-06-25 16:20:36 -050013 "
14
15
16DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native"
17
18S = "${WORKDIR}/git"
19B = "${S}/build"
20
Patrick Williams2a254922023-08-11 09:48:11 -050021inherit cmake pkgconfig python3native python3targetconfig ptest
Patrick Williams520786c2023-06-25 16:20:36 -050022
Andrew Geissler2edf0642023-09-11 08:24:07 -040023STAGING_OSCAP_BUILDDIR = "${TMPDIR}/work-shared/openscap/oscap-build-artifacts"
24export OSCAP_CPE_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/cpe"
25export OSCAP_SCHEMA_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/schemas"
26export OSCAP_XSLT_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/xsl"
27
Patrick Williams520786c2023-06-25 16:20:36 -050028OECMAKE_GENERATOR = "Unix Makefiles"
29
Andrew Geissler2edf0642023-09-11 08:24:07 -040030EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_OPENEMBEDDED=ON"
Patrick Williams520786c2023-06-25 16:20:36 -050031
32do_configure[depends] += "openscap-native:do_install"
33
34do_configure:prepend () {
35 sed -i -e 's:NAMES\ sed:NAMES\ ${HOSTTOOLS_DIR}/sed:g' ${S}/CMakeLists.txt
36 sed -i -e 's:NAMES\ grep:NAMES\ ${HOSTTOOLS_DIR}/grep:g' ${S}/CMakeLists.txt
37}
38
39do_install:append() {
40 install -d ${D}${datadir}/openscap
41 install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/.
42}
43
Patrick Williams2a254922023-08-11 09:48:11 -050044do_compile_ptest() {
45 cd ${S}/build
46 cmake ../
47 make
48}
49
50do_install_ptest() {
51
52 # remove host & work dir from tests
53 for x in $(find ${S}/build -type f) ;
54 do
55 sed -e 's#${HOSTTOOLS_DIR}/##g' \
56 -e 's#${RECIPE_SYSROOT_NATIVE}##g' \
57 -e 's#${WORKDIR}#${PTEST_PATH}#g' \
58 -e 's#/.*/xmllint#/usr/bin/xmllint#g' \
59 -e 's#/.*/oscap#/usr/bin/oscap#g' \
60 -e 's#/python3-native##g' \
61 -i ${x}
62 done
63
64 for x in $(find ${S}/build-scripts -type f) ;
65 do
66 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
67 done
68
69 for x in $(find ${S}/tests -type f) ;
70 do
71 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
72 done
73
74 for x in $(find ${S}/utils -type f) ;
75 do
76 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
77 done
78
79 PDIRS="apple_os build controls products shared components applications linux_os ocp-resources tests utils ssg build-scripts"
80 t=${D}/${PTEST_PATH}/git
81 for d in ${PDIRS}; do
82 install -d ${t}/$d
83 cp -fr ${S}/$d/* ${t}/$d/.
84 done
85}
86
Patrick Williams520786c2023-06-25 16:20:36 -050087FILES:${PN} += "${datadir}/xml ${datadir}/openscap"
88
89RDEPENDS:${PN} = "openscap"
Patrick Williams2a254922023-08-11 09:48:11 -050090RDEPENDS:${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 -050091
92COMPATIBLE_HOST:libc-musl = "null"