blob: 988e48bd81015373df495b3dea8c9c442fdf0e04 [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 Geissler80d41842023-09-11 08:36:15 -04009SRCREV = "3a1012bc9ec2b01b3b71c6feefd3cff0f52bd64d"
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 \
Andrew Geissler80d41842023-09-11 08:36:15 -040013 file://0001-scap-security-guide-add-openembedded-distro-support.patch \
Patrick Williams2a254922023-08-11 09:48:11 -050014 file://0002-scap-security-guide-Add-Poky-support.patch \
Patrick Williams520786c2023-06-25 16:20:36 -050015 "
16
17
18DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native"
19
20S = "${WORKDIR}/git"
21B = "${S}/build"
22
Patrick Williams2a254922023-08-11 09:48:11 -050023inherit cmake pkgconfig python3native python3targetconfig ptest
Patrick Williams520786c2023-06-25 16:20:36 -050024
25OECMAKE_GENERATOR = "Unix Makefiles"
26
Andrew Geissler80d41842023-09-11 08:36:15 -040027EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_OE=ON"
Patrick Williams520786c2023-06-25 16:20:36 -050028
29do_configure[depends] += "openscap-native:do_install"
30
31do_configure:prepend () {
32 sed -i -e 's:NAMES\ sed:NAMES\ ${HOSTTOOLS_DIR}/sed:g' ${S}/CMakeLists.txt
33 sed -i -e 's:NAMES\ grep:NAMES\ ${HOSTTOOLS_DIR}/grep:g' ${S}/CMakeLists.txt
34}
35
36do_install:append() {
37 install -d ${D}${datadir}/openscap
38 install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/.
39}
40
Patrick Williams2a254922023-08-11 09:48:11 -050041do_compile_ptest() {
42 cd ${S}/build
43 cmake ../
44 make
45}
46
47do_install_ptest() {
48
49 # remove host & work dir from tests
50 for x in $(find ${S}/build -type f) ;
51 do
52 sed -e 's#${HOSTTOOLS_DIR}/##g' \
53 -e 's#${RECIPE_SYSROOT_NATIVE}##g' \
54 -e 's#${WORKDIR}#${PTEST_PATH}#g' \
55 -e 's#/.*/xmllint#/usr/bin/xmllint#g' \
56 -e 's#/.*/oscap#/usr/bin/oscap#g' \
57 -e 's#/python3-native##g' \
58 -i ${x}
59 done
60
61 for x in $(find ${S}/build-scripts -type f) ;
62 do
63 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
64 done
65
66 for x in $(find ${S}/tests -type f) ;
67 do
68 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
69 done
70
71 for x in $(find ${S}/utils -type f) ;
72 do
73 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x}
74 done
75
76 PDIRS="apple_os build controls products shared components applications linux_os ocp-resources tests utils ssg build-scripts"
77 t=${D}/${PTEST_PATH}/git
78 for d in ${PDIRS}; do
79 install -d ${t}/$d
80 cp -fr ${S}/$d/* ${t}/$d/.
81 done
82}
83
Patrick Williams520786c2023-06-25 16:20:36 -050084FILES:${PN} += "${datadir}/xml ${datadir}/openscap"
85
86RDEPENDS:${PN} = "openscap"
Patrick Williams2a254922023-08-11 09:48:11 -050087RDEPENDS:${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 -050088
89COMPATIBLE_HOST:libc-musl = "null"