blob: e55fb70cb1c3ac0c454862f33b9bb1199cf75b3d [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "GNU cpio is a program to manage archives of files"
2DESCRIPTION = "GNU cpio is a tool for creating and extracting archives, or copying files from one place to \
3another. It handles a number of cpio formats as well as reading and writing tar files."
4HOMEPAGE = "http://www.gnu.org/software/cpio/"
5SECTION = "base"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00006LICENSE = "GPL-3.0-only"
Andrew Geissler82c905d2020-04-13 13:39:40 -05007LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
8
9SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
Patrick Williamse760df82023-05-26 11:10:49 -050010 file://0001-configure-Include-needed-header-for-major-minor-macr.patch \
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060011 file://run-ptest \
Andrew Geissler3eeda902023-05-19 10:14:02 -050012 file://test.sh \
Andrew Geissler82c905d2020-04-13 13:39:40 -050013 "
14
Patrick Williamse760df82023-05-26 11:10:49 -050015SRC_URI[sha256sum] = "145a340fd9d55f0b84779a44a12d5f79d77c99663967f8cfa168d7905ca52454"
Andrew Geissler82c905d2020-04-13 13:39:40 -050016
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060017inherit autotools gettext texinfo ptest
Andrew Geissler82c905d2020-04-13 13:39:40 -050018
William A. Kennington IIIac69b482021-06-02 12:28:27 -070019# Issue applies to use of cpio in SUSE/OBS, doesn't apply to us
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000020CVE_CHECK_IGNORE += "CVE-2010-4226"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070021
Andrew Geissler82c905d2020-04-13 13:39:40 -050022EXTRA_OECONF += "DEFAULT_RMT_DIR=${sbindir}"
23
24do_install () {
25 autotools_do_install
26 if [ "${base_bindir}" != "${bindir}" ]; then
27 install -d ${D}${base_bindir}/
28 mv "${D}${bindir}/cpio" "${D}${base_bindir}/cpio"
Andrew Geissler475cb722020-07-10 16:00:51 -050029 if [ "${sbindir}" != "${bindir}" ]; then
30 rmdir ${D}${bindir}/
31 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -050032 fi
33
34 # Avoid conflicts with the version from tar
35 mv "${D}${mandir}/man8/rmt.8" "${D}${mandir}/man8/rmt-cpio.8"
36}
37
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060038do_compile_ptest() {
39 oe_runmake -C ${B}/gnu/ check
40 oe_runmake -C ${B}/lib/ check
41 oe_runmake -C ${B}/rmt/ check
42 oe_runmake -C ${B}/src/ check
43 oe_runmake -C ${B}/tests/ genfile
44}
45
46do_install_ptest() {
47 install -d ${D}${PTEST_PATH}/tests/
48 sed -i "/abs_/d" ${B}/tests/atconfig
49 install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
50 sed -i "s%${B}/tests:%%g" ${B}/tests/atlocal
51 sed -i "s%${B}/src:%%g" ${B}/tests/atlocal
52 install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/
53 install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/
54 install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
Andrew Geissler3eeda902023-05-19 10:14:02 -050055 install --mode=755 ${WORKDIR}/test.sh ${D}${PTEST_PATH}/test.sh
56 sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/test.sh
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060057}
58
Andrew Geissler3eeda902023-05-19 10:14:02 -050059# ptest.bbclass currently chowns the ptest directory explicitly, so we need to
60# change permission after that has happened so the ptest user can write a
61# temporary directory.
62do_install_ptest_base:append() {
63 chgrp -R ptest ${D}${PTEST_PATH}/
64 chmod -R g+w ${D}${PTEST_PATH}/
65}
66
67# The tests need to run as a non-root user, so pull in the ptest user
68DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
69PACKAGE_WRITE_DEPS += "ptest-runner"
70
71RDEPENDS:${PN}-ptest += "ptest-runner"
72
Andrew Geissler82c905d2020-04-13 13:39:40 -050073PACKAGES =+ "${PN}-rmt"
74
Patrick Williams213cb262021-08-07 19:21:33 -050075FILES:${PN}-rmt = "${sbindir}/rmt*"
Andrew Geissler82c905d2020-04-13 13:39:40 -050076
77inherit update-alternatives
78
79ALTERNATIVE_PRIORITY = "100"
80
Patrick Williams213cb262021-08-07 19:21:33 -050081ALTERNATIVE:${PN} = "cpio"
82ALTERNATIVE:${PN}-rmt = "rmt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050083
84ALTERNATIVE_LINK_NAME[cpio] = "${base_bindir}/cpio"
85
86ALTERNATIVE_PRIORITY[rmt] = "50"
87ALTERNATIVE_LINK_NAME[rmt] = "${sbindir}/rmt"
88
Andrew Geissler475cb722020-07-10 16:00:51 -050089BBCLASSEXTEND = "native nativesdk"