Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 1 | # Copyright (C) 2017 - 2024 Armin Kuster <akuster808@gmail.com> |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 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 | |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 9 | SRCREV = "459f0abf2ac08d36e5fc4a2619bc75cff7000da9" |
| 10 | SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=stable;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 | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 13 | " |
| 14 | |
| 15 | |
| 16 | DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native" |
| 17 | |
| 18 | S = "${WORKDIR}/git" |
| 19 | B = "${S}/build" |
| 20 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 21 | inherit cmake pkgconfig python3native python3targetconfig ptest |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 22 | |
Andrew Geissler | 2edf064 | 2023-09-11 08:24:07 -0400 | [diff] [blame] | 23 | STAGING_OSCAP_BUILDDIR = "${TMPDIR}/work-shared/openscap/oscap-build-artifacts" |
| 24 | export OSCAP_CPE_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/cpe" |
| 25 | export OSCAP_SCHEMA_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/schemas" |
| 26 | export OSCAP_XSLT_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/xsl" |
| 27 | |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 28 | OECMAKE_GENERATOR = "Unix Makefiles" |
| 29 | |
Andrew Geissler | 2edf064 | 2023-09-11 08:24:07 -0400 | [diff] [blame] | 30 | 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] | 31 | |
| 32 | do_configure[depends] += "openscap-native:do_install" |
| 33 | |
| 34 | do_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 | |
| 39 | do_install:append() { |
| 40 | install -d ${D}${datadir}/openscap |
| 41 | install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/. |
| 42 | } |
| 43 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 44 | do_compile_ptest() { |
| 45 | cd ${S}/build |
| 46 | cmake ../ |
| 47 | make |
| 48 | } |
| 49 | |
| 50 | do_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 Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 87 | FILES:${PN} += "${datadir}/xml ${datadir}/openscap" |
| 88 | |
| 89 | RDEPENDS:${PN} = "openscap" |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 90 | 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] | 91 | |
| 92 | COMPATIBLE_HOST:libc-musl = "null" |