Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 1 | # Copyright (C) 2017 - 2023 Armin Kuster <akuster808@gmail.com> |
| 2 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 3 | |
| 4 | SUMARRY = "SCAP content for various platforms, upstream version" |
| 5 | HOME_URL = "https://www.open-scap.org/security-policies/scap-security-guide/" |
| 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=9bfa86579213cb4c6adaffface6b2820" |
| 7 | LICENSE = "BSD-3-Clause" |
| 8 | |
Andrew Geissler | 2edf064 | 2023-09-11 08:24:07 -0400 | [diff] [blame^] | 9 | SRCREV = "d09e81ae00509a9be4b01359166cfbece06e47f4" |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 10 | SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=master;protocol=https \ |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 11 | file://run_eval.sh \ |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 12 | file://run-ptest \ |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 13 | file://0002-scap-security-guide-Add-Poky-support.patch \ |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 14 | " |
| 15 | |
| 16 | |
| 17 | DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native" |
| 18 | |
| 19 | S = "${WORKDIR}/git" |
| 20 | B = "${S}/build" |
| 21 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 22 | inherit cmake pkgconfig python3native python3targetconfig ptest |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 23 | |
Andrew Geissler | 2edf064 | 2023-09-11 08:24:07 -0400 | [diff] [blame^] | 24 | STAGING_OSCAP_BUILDDIR = "${TMPDIR}/work-shared/openscap/oscap-build-artifacts" |
| 25 | export OSCAP_CPE_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/cpe" |
| 26 | export OSCAP_SCHEMA_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/schemas" |
| 27 | export OSCAP_XSLT_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/xsl" |
| 28 | |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 29 | OECMAKE_GENERATOR = "Unix Makefiles" |
| 30 | |
Andrew Geissler | 2edf064 | 2023-09-11 08:24:07 -0400 | [diff] [blame^] | 31 | EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_OPENEMBEDDED=ON" |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 32 | |
| 33 | do_configure[depends] += "openscap-native:do_install" |
| 34 | |
| 35 | do_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 | |
| 40 | do_install:append() { |
| 41 | install -d ${D}${datadir}/openscap |
| 42 | install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/. |
| 43 | } |
| 44 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 45 | do_compile_ptest() { |
| 46 | cd ${S}/build |
| 47 | cmake ../ |
| 48 | make |
| 49 | } |
| 50 | |
| 51 | do_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 Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 88 | FILES:${PN} += "${datadir}/xml ${datadir}/openscap" |
| 89 | |
| 90 | RDEPENDS:${PN} = "openscap" |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 91 | RDEPENDS:${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 Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 92 | |
| 93 | COMPATIBLE_HOST:libc-musl = "null" |