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 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 9 | SRCREV = "3a1012bc9ec2b01b3b71c6feefd3cff0f52bd64d" |
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 \ |
| 13 | file://0001-scap-security-guide-add-openembedded-distro-support.patch \ |
| 14 | file://0002-scap-security-guide-Add-Poky-support.patch \ |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 15 | " |
| 16 | |
| 17 | |
| 18 | DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native" |
| 19 | |
| 20 | S = "${WORKDIR}/git" |
| 21 | B = "${S}/build" |
| 22 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 23 | inherit cmake pkgconfig python3native python3targetconfig ptest |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 24 | |
| 25 | OECMAKE_GENERATOR = "Unix Makefiles" |
| 26 | |
| 27 | EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_OE=ON" |
| 28 | |
| 29 | do_configure[depends] += "openscap-native:do_install" |
| 30 | |
| 31 | do_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 | |
| 36 | do_install:append() { |
| 37 | install -d ${D}${datadir}/openscap |
| 38 | install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/. |
| 39 | } |
| 40 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 41 | do_compile_ptest() { |
| 42 | cd ${S}/build |
| 43 | cmake ../ |
| 44 | make |
| 45 | } |
| 46 | |
| 47 | do_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 Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 84 | FILES:${PN} += "${datadir}/xml ${datadir}/openscap" |
| 85 | |
| 86 | RDEPENDS:${PN} = "openscap" |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 87 | 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] | 88 | |
| 89 | COMPATIBLE_HOST:libc-musl = "null" |