blob: 52070f59a257b66b8903f624591b915dec415d54 [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 \
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060010 file://run-ptest \
Andrew Geissler3eeda902023-05-19 10:14:02 -050011 file://test.sh \
Andrew Geissler82c905d2020-04-13 13:39:40 -050012 "
13
Patrick Williams73bd93f2024-02-20 08:07:48 -060014SRC_URI[sha256sum] = "efa50ef983137eefc0a02fdb51509d624b5e3295c980aa127ceee4183455499e"
Andrew Geissler82c905d2020-04-13 13:39:40 -050015
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060016inherit autotools gettext texinfo ptest
Andrew Geissler82c905d2020-04-13 13:39:40 -050017
Andrew Geissler8f840682023-07-21 09:09:43 -050018CVE_STATUS[CVE-2010-4226] = "not-applicable-platform: Issue applies to use of cpio in SUSE/OBS"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070019
Andrew Geissler82c905d2020-04-13 13:39:40 -050020EXTRA_OECONF += "DEFAULT_RMT_DIR=${sbindir}"
21
22do_install () {
23 autotools_do_install
24 if [ "${base_bindir}" != "${bindir}" ]; then
25 install -d ${D}${base_bindir}/
26 mv "${D}${bindir}/cpio" "${D}${base_bindir}/cpio"
Andrew Geissler475cb722020-07-10 16:00:51 -050027 if [ "${sbindir}" != "${bindir}" ]; then
28 rmdir ${D}${bindir}/
29 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -050030 fi
31
32 # Avoid conflicts with the version from tar
33 mv "${D}${mandir}/man8/rmt.8" "${D}${mandir}/man8/rmt-cpio.8"
34}
35
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060036do_compile_ptest() {
37 oe_runmake -C ${B}/gnu/ check
38 oe_runmake -C ${B}/lib/ check
39 oe_runmake -C ${B}/rmt/ check
40 oe_runmake -C ${B}/src/ check
41 oe_runmake -C ${B}/tests/ genfile
42}
43
44do_install_ptest() {
45 install -d ${D}${PTEST_PATH}/tests/
46 sed -i "/abs_/d" ${B}/tests/atconfig
47 install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
48 sed -i "s%${B}/tests:%%g" ${B}/tests/atlocal
49 sed -i "s%${B}/src:%%g" ${B}/tests/atlocal
50 install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/
51 install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/
52 install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
Andrew Geissler3eeda902023-05-19 10:14:02 -050053 install --mode=755 ${WORKDIR}/test.sh ${D}${PTEST_PATH}/test.sh
54 sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/test.sh
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060055}
56
Andrew Geissler3eeda902023-05-19 10:14:02 -050057# ptest.bbclass currently chowns the ptest directory explicitly, so we need to
58# change permission after that has happened so the ptest user can write a
59# temporary directory.
60do_install_ptest_base:append() {
61 chgrp -R ptest ${D}${PTEST_PATH}/
62 chmod -R g+w ${D}${PTEST_PATH}/
63}
64
65# The tests need to run as a non-root user, so pull in the ptest user
66DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
Patrick Williams73bd93f2024-02-20 08:07:48 -060067PACKAGE_WRITE_DEPS += "ptest-runner"
Andrew Geissler3eeda902023-05-19 10:14:02 -050068
69RDEPENDS:${PN}-ptest += "ptest-runner"
70
Andrew Geissler82c905d2020-04-13 13:39:40 -050071PACKAGES =+ "${PN}-rmt"
72
Patrick Williams213cb262021-08-07 19:21:33 -050073FILES:${PN}-rmt = "${sbindir}/rmt*"
Andrew Geissler82c905d2020-04-13 13:39:40 -050074
75inherit update-alternatives
76
77ALTERNATIVE_PRIORITY = "100"
78
Patrick Williams213cb262021-08-07 19:21:33 -050079ALTERNATIVE:${PN} = "cpio"
80ALTERNATIVE:${PN}-rmt = "rmt"
Andrew Geissler82c905d2020-04-13 13:39:40 -050081
82ALTERNATIVE_LINK_NAME[cpio] = "${base_bindir}/cpio"
83
84ALTERNATIVE_PRIORITY[rmt] = "50"
85ALTERNATIVE_LINK_NAME[rmt] = "${sbindir}/rmt"
86
Andrew Geissler475cb722020-07-10 16:00:51 -050087BBCLASSEXTEND = "native nativesdk"