selftest-ed: Upgrade to version 1.21/1.20.2

Older versions do not compile with GCC 15. We had different versions to test
GPLv3 exclusion.

1.21 compiles with gcc 15 and 1.20.2 has a CFLAGS tweak to allow it to work
with gcc 15 too.

1.21 is licensed under GPL-2.0 so we need to rework some of the tests.

Tweak the gplv3 test by adding a special override of LICENSE to then test
the license exclusion code.

Modify the archiver selftests to use the new version.

Based on a patch from Khem Raj <raj.khem@gmail.com>

(From OE-Core rev: 3b17355ad1ecad17d12c5eb0e6403a59ef11f7d7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2025-04-26 20:44:23 -07:00
parent 6f6a9ec39b
commit cf9c5ac2c1
6 changed files with 97 additions and 71 deletions

View File

@ -1,23 +0,0 @@
SUMMARY = "Line-oriented text editor -- selftest GPL-2.0-or-later version"
HOMEPAGE = "http://www.gnu.org/software/ed/"
SECTION = "base"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=6ddd5335ef96fb858a138230af773710 \
file://main.c;beginline=1;endline=17;md5=36d4b85e5ae9028e918d1cc775c2475e"
SRC_URI = "${SAVANNAH_GNU_MIRROR}/ed/ed-${PV}.tar.bz2"
SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632"
SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e"
inherit autotools texinfo
S = "${WORKDIR}/ed-${PV}"
EXTRA_OECONF = "'CC=${CC}' 'CXX=${CXX}' 'CFLAGS=${CFLAGS}' 'CXXFLAGS=${CXXFLAGS}' 'CPPFLAGS=${CPPFLAGS}' 'LDFLAGS=${LDFLAGS}'"
CONFIGUREOPTS:remove = "--disable-dependency-tracking"
CONFIGUREOPTS:remove = "--disable-silent-rules"
EXTRA_OECONF:remove = "--disable-static"
BBCLASSEXTEND = "native"

View File

@ -1,38 +0,0 @@
SUMMARY = "Line-oriented text editor -- selftest variant"
HOMEPAGE = "http://www.gnu.org/software/ed/"
LICENSE = "GPL-3.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=0c7051aef9219dc7237f206c5c4179a7 \
file://ed.h;endline=20;md5=4e36b7a40e137f42aee718165590d125 \
file://main.c;endline=17;md5=c5b8f78f115df187af76868a2aead16a"
SECTION = "base"
# LSB states that ed should be in /bin/
bindir = "${base_bindir}"
SRC_URI = "${GNU_MIRROR}/ed/ed-${PV}.tar.lz"
RECIPE_NO_UPDATE_REASON = "This recipe is used in selftest and shouldn't be updated otherwise"
SRC_URI[md5sum] = "7f4a54fa7f366479f03654b8af645fd0"
SRC_URI[sha256sum] = "ffb97eb8f2a2b5a71a9b97e3872adce953aa1b8958e04c5b7bf11d556f32552a"
S = "${WORKDIR}/ed-${PV}"
EXTRA_OEMAKE = "-e MAKEFLAGS="
inherit texinfo
do_configure() {
${S}/configure
}
do_install() {
oe_runmake 'DESTDIR=${D}' install
# Info dir listing isn't interesting at this point so remove it if it exists.
if [ -e "${D}${infodir}/dir" ]; then
rm -f ${D}${infodir}/dir
fi
}
BBCLASSEXTEND = "native"

View File

@ -0,0 +1,44 @@
SUMMARY = "Line-oriented text editor"
HOMEPAGE = "http://www.gnu.org/software/ed/"
DESCRIPTION = "GNU ed is a line-oriented text editor. It is used to create, display, modify and otherwise manipulate text files, both interactively and via shell scripts. A restricted version of ed, red, can only edit files in the current directory and cannot execute shell commands."
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=76d6e300ffd8fb9d18bd9b136a9bba13 \
file://ed.h;endline=20;md5=c3212b6c53b09668107420af9368c0ef \
file://main.c;endline=17;md5=e5d2ae5ddd1ecb87dc71702c06dd06dc \
"
SECTION = "base"
CVE_PRODUCT = "gnu:ed"
# LSB states that ed should be in /bin/
bindir = "${base_bindir}"
# Upstream regularly removes previous releases from https://ftp.gnu.org/gnu/ed/
SRC_URI = "${GNU_MIRROR}/ed/ed-${PV}.tar.lz"
UPSTREAM_CHECK_URI = "${GNU_MIRROR}/ed/"
SRC_URI[sha256sum] = "65fec7318f48c2ca17f334ac0f4703defe62037bb13cc23920de077b5fa24523"
S = "${WORKDIR}/ed-${PV}"
EXTRA_OEMAKE = "-e MAKEFLAGS="
# for gcc 15 true/false change
CFLAGS += "-std=gnu17"
inherit texinfo
do_configure() {
${S}/configure
}
do_install() {
oe_runmake 'DESTDIR=${D}' install
# Info dir listing isn't interesting at this point so remove it if it exists.
if [ -e "${D}${infodir}/dir" ]; then
rm -f ${D}${infodir}/dir
fi
}
BBCLASSEXTEND = "native"

View File

@ -0,0 +1,42 @@
SUMMARY = "Line-oriented text editor"
HOMEPAGE = "http://www.gnu.org/software/ed/"
DESCRIPTION = "GNU ed is a line-oriented text editor. It is used to create, display, modify and otherwise manipulate text files, both interactively and via shell scripts. A restricted version of ed, red, can only edit files in the current directory and cannot execute shell commands."
LICENSE = "GPL-2.0-only"
LICENSE:gplv3test = "GPL-3.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=cca7f74ec83b7a9ce7ccd195aad471bd \
file://ed.h;endline=20;md5=a24e7f91c0fb83e65a746f5994762a49 \
file://main.c;endline=17;md5=fd6ad9f1853f123f4ae7a31d59761f09 \
"
SECTION = "base"
CVE_PRODUCT = "gnu:ed"
# LSB states that ed should be in /bin/
bindir = "${base_bindir}"
# Upstream regularly removes previous releases from https://ftp.gnu.org/gnu/ed/
SRC_URI = "${GNU_MIRROR}/ed/ed-${PV}.tar.lz"
UPSTREAM_CHECK_URI = "${GNU_MIRROR}/ed/"
SRC_URI[sha256sum] = "d6d0c7192b02b0519c902a93719053e865ade5a784a3b327d93d888457b23c4b"
S = "${WORKDIR}/ed-${PV}"
EXTRA_OEMAKE = "-e MAKEFLAGS="
inherit texinfo
do_configure() {
${S}/configure
}
do_install() {
oe_runmake 'DESTDIR=${D}' install
# Info dir listing isn't interesting at this point so remove it if it exists.
if [ -e "${D}${infodir}/dir" ]; then
rm -f ${D}${infodir}/dir
fi
}
BBCLASSEXTEND = "native"

View File

@ -190,28 +190,28 @@ class Archiver(OESelftestTestCase):
Test that the archiver works with `ARCHIVER_MODE[src] = "original"`.
"""
self._test_archiver_mode('original', 'ed-1.14.1.tar.lz')
self._test_archiver_mode('original', 'ed-1.21.1.tar.lz')
def test_archiver_mode_patched(self):
"""
Test that the archiver works with `ARCHIVER_MODE[src] = "patched"`.
"""
self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-patched.tar.xz')
self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-patched.tar.xz')
def test_archiver_mode_configured(self):
"""
Test that the archiver works with `ARCHIVER_MODE[src] = "configured"`.
"""
self._test_archiver_mode('configured', 'selftest-ed-native-1.14.1-r0-configured.tar.xz')
self._test_archiver_mode('configured', 'selftest-ed-native-1.21.1-r0-configured.tar.xz')
def test_archiver_mode_recipe(self):
"""
Test that the archiver works with `ARCHIVER_MODE[recipe] = "1"`.
"""
self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-recipe.tar.xz',
self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-recipe.tar.xz',
'ARCHIVER_MODE[recipe] = "1"\n')
def test_archiver_mode_diff(self):
@ -220,7 +220,7 @@ class Archiver(OESelftestTestCase):
Exclusions controlled by `ARCHIVER_MODE[diff-exclude]` are not yet tested.
"""
self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-diff.gz',
self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-diff.gz',
'ARCHIVER_MODE[diff] = "1"\n')
def test_archiver_mode_dumpdata(self):
@ -228,7 +228,7 @@ class Archiver(OESelftestTestCase):
Test that the archiver works with `ARCHIVER_MODE[dumpdata] = "1"`.
"""
self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-showdata.dump',
self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-showdata.dump',
'ARCHIVER_MODE[dumpdata] = "1"\n')
def test_archiver_mode_mirror(self):
@ -236,7 +236,7 @@ class Archiver(OESelftestTestCase):
Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`.
"""
self._test_archiver_mode('mirror', 'ed-1.14.1.tar.lz',
self._test_archiver_mode('mirror', 'ed-1.21.1.tar.lz',
'BB_GENERATE_MIRROR_TARBALLS = "1"\n')
def test_archiver_mode_mirror_excludes(self):
@ -247,7 +247,7 @@ class Archiver(OESelftestTestCase):
"""
target='selftest-ed'
target_file_name = 'ed-1.14.1.tar.lz'
target_file_name = 'ed-1.21.1.tar.lz'
features = 'INHERIT += "archiver"\n'
features += 'ARCHIVER_MODE[src] = "mirror"\n'
@ -285,7 +285,7 @@ class Archiver(OESelftestTestCase):
bitbake('-c deploy_archives %s' % (target))
bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
for target_file_name in ['ed-1.14.1.tar.lz', 'hello.c']:
for target_file_name in ['ed-1.21.1.tar.lz', 'hello.c']:
glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
glob_result = glob.glob(glob_str)
self.assertTrue(glob_result, 'Missing archive file %s' % (target_file_name))

View File

@ -233,6 +233,7 @@ INHERIT:remove = \"report-error\"
def test_non_gplv3(self):
self.write_config('''INCOMPATIBLE_LICENSE = "GPL-3.0-or-later"
OVERRIDES .= ":gplv3test"
require conf/distro/include/no-gplv3.inc
''')
result = bitbake('selftest-ed', ignore_status=True)
@ -241,7 +242,7 @@ require conf/distro/include/no-gplv3.inc
arch = get_bb_var('SSTATE_PKGARCH')
filename = os.path.join(lic_dir, arch, 'selftest-ed', 'generic_GPL-3.0-or-later')
self.assertFalse(os.path.isfile(filename), msg="License file %s exists and shouldn't" % filename)
filename = os.path.join(lic_dir, arch, 'selftest-ed', 'generic_GPL-2.0-or-later')
filename = os.path.join(lic_dir, arch, 'selftest-ed', 'generic_GPL-2.0-only')
self.assertTrue(os.path.isfile(filename), msg="License file %s doesn't exist" % filename)
def test_setscene_only(self):