Message ID | 20220819092002.31294-2-pavel@zhukoff.net |
---|---|
State | New |
Headers | show |
Series | [1/2] package_rpm: Do not replace square brackets in %files | expand |
Hi Pavel, On 2022-08-19 05:20, Pavel Zhukov wrote: > Escaping globs and quoting in rpm spec files is tricky and requires a > bit of dancing. In addition to that it changes from time to time. > Adding (simple) regression test for different types of filename > patterns. Cover bracket in first iteration Nice. > > [Yocto #13746] > > Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> > --- > .../recipes-test/testrpm/files/testfile.txt | 6 ++++++ > .../recipes-test/testrpm/testrpm_0.0.1.bb | 17 +++++++++++++++++ > meta/lib/oeqa/selftest/cases/rpmtests.py | 16 ++++++++++++++++ > 3 files changed, 39 insertions(+) > create mode 100644 meta-selftest/recipes-test/testrpm/files/testfile.txt > create mode 100644 meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb > create mode 100644 meta/lib/oeqa/selftest/cases/rpmtests.py > > diff --git a/meta-selftest/recipes-test/testrpm/files/testfile.txt b/meta-selftest/recipes-test/testrpm/files/testfile.txt > new file mode 100644 > index 00000000000..d1e50ff79a2 > --- /dev/null > +++ b/meta-selftest/recipes-test/testrpm/files/testfile.txt > @@ -0,0 +1,6 @@ > + /mnt/builds/yocto/sources/meta-selftest/recipes-test/testrpm: > + total used in directory 16 available 76.4 GiB > + drwxr-xr-x 2 pavel pavel 4096 Aug 19 08:59 . > + drwxr-xr-x 34 pavel pavel 4096 Aug 18 17:59 .. > + -rw-r--r-- 1 pavel pavel 408 Aug 19 08:59 testrpm_0.0.1.bb > + -rw-r--r-- 1 pavel pavel 355 Aug 18 21:54 testrpm_0.0.1.bb~ I assume that you just want a testfile.txt that doesn't have any special characters in the name. If so, maybe the body of the file should be text that explains that purpose. If for some reason, you want the output you have, it would be nice to remove the backup file: testrpm_0.0.1.bb~ because it seems out of place. > diff --git a/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb b/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb > new file mode 100644 > index 00000000000..e42c7db3b39 > --- /dev/null > +++ b/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb > @@ -0,0 +1,17 @@ > +SUMMARY = "Test recipe for testing rpm generated by oe-core" > +LICENSE = "CLOSED" Why did you pick a CLOSED license rather than MIT ? Our IP group would likely complain about this! ;-) > + > +SRC_URI = "file://testfile.txt" > + > +INHIBIT_DEFAULT_DEPS = "1" > + > +do_compile(){ > + echo "testdata" > ${B}/"file with [quotes].txt" > + echo "testdata" > ${B}/"file with (quites).txt" Since I'm being picky, would you rename these files to use the terms here: https://grammar.yourdictionary.com/punctuation/what/fourteen-punctuation-marks.html i.e.: Brackets, and Parentheses ? ../Randy > +} > + > +do_install(){ > + install ${B}/* ${D}/ > +} > + > +FILES:${PN} = "*" > diff --git a/meta/lib/oeqa/selftest/cases/rpmtests.py b/meta/lib/oeqa/selftest/cases/rpmtests.py > new file mode 100644 > index 00000000000..dafbbc21360 > --- /dev/null > +++ b/meta/lib/oeqa/selftest/cases/rpmtests.py > @@ -0,0 +1,16 @@ > +# > +# Copyright OpenEmbedded Contributors > +# > +# SPDX-License-Identifier: MIT > +# > + > + > +from oeqa.selftest.case import OESelftestTestCase > +from oeqa.utils.commands import bitbake > + > +class BitbakeTests(OESelftestTestCase): > + > + def test_rpm_filenames(self): > + test_recipe = "testrpm" > + bitbake(test_recipe) > + > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#169617): https://lists.openembedded.org/g/openembedded-core/message/169617 > Mute This Topic: https://lists.openembedded.org/mt/93121038/3616765 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [randy.macleod@windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Randy MacLeod <randy.macleod@windriver.com> writes: > Hi Pavel, > > On 2022-08-19 05:20, Pavel Zhukov wrote: >> Escaping globs and quoting in rpm spec files is tricky and requires a >> bit of dancing. In addition to that it changes from time to time. >> Adding (simple) regression test for different types of filename >> patterns. Cover bracket in first iteration > > Nice. > >> [Yocto #13746] >> Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> >> --- >> .../recipes-test/testrpm/files/testfile.txt | 6 ++++++ >> .../recipes-test/testrpm/testrpm_0.0.1.bb | 17 +++++++++++++++++ >> meta/lib/oeqa/selftest/cases/rpmtests.py | 16 ++++++++++++++++ >> 3 files changed, 39 insertions(+) >> create mode 100644 meta-selftest/recipes-test/testrpm/files/testfile.txt >> create mode 100644 meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb >> create mode 100644 meta/lib/oeqa/selftest/cases/rpmtests.py >> diff --git a/meta-selftest/recipes-test/testrpm/files/testfile.txt >> b/meta-selftest/recipes-test/testrpm/files/testfile.txt >> new file mode 100644 >> index 00000000000..d1e50ff79a2 >> --- /dev/null >> +++ b/meta-selftest/recipes-test/testrpm/files/testfile.txt >> @@ -0,0 +1,6 @@ >> + /mnt/builds/yocto/sources/meta-selftest/recipes-test/testrpm: >> + total used in directory 16 available 76.4 GiB >> + drwxr-xr-x 2 pavel pavel 4096 Aug 19 08:59 . >> + drwxr-xr-x 34 pavel pavel 4096 Aug 18 17:59 .. >> + -rw-r--r-- 1 pavel pavel 408 Aug 19 08:59 testrpm_0.0.1.bb >> + -rw-r--r-- 1 pavel pavel 355 Aug 18 21:54 testrpm_0.0.1.bb~ > > > I assume that you just want a testfile.txt that doesn't have any > special characters in the name. > If so, maybe the body of the file should be text that explains that purpose. > If for some reason, you want the output you have, it would be nice to > remove the backup file: testrpm_0.0.1.bb~ > because it seems out of place. > The file is there to serve the purposes of SRC_URI only. I didn't want to overload workers with downloading real tarball/git_repo so I put random file (well. it's content of Emacs's buffer which I have opened at the moment of writing :) ) . Fixed that in v2 > >> diff --git a/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb b/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb >> new file mode 100644 >> index 00000000000..e42c7db3b39 >> --- /dev/null >> +++ b/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb >> @@ -0,0 +1,17 @@ >> +SUMMARY = "Test recipe for testing rpm generated by oe-core" >> +LICENSE = "CLOSED" > > Why did you pick a CLOSED license rather than MIT ? > Our IP group would likely complain about this! ;-) Fixed as well (didn't know about the COMMON_LICENSE_DIR existense :) Now I do) > >> + >> +SRC_URI = "file://testfile.txt" >> + >> +INHIBIT_DEFAULT_DEPS = "1" >> + >> +do_compile(){ >> + echo "testdata" > ${B}/"file with [quotes].txt" >> + echo "testdata" > ${B}/"file with (quites).txt" > > > Since I'm being picky, would you rename these files to use the terms here: > > https://grammar.yourdictionary.com/punctuation/what/fourteen-punctuation-marks.html > i.e.: Brackets, and Parentheses ? Covered in v2 too > > > ../Randy > > >> +} >> + >> +do_install(){ >> + install ${B}/* ${D}/ >> +} >> + >> +FILES:${PN} = "*" >> diff --git a/meta/lib/oeqa/selftest/cases/rpmtests.py b/meta/lib/oeqa/selftest/cases/rpmtests.py >> new file mode 100644 >> index 00000000000..dafbbc21360 >> --- /dev/null >> +++ b/meta/lib/oeqa/selftest/cases/rpmtests.py >> @@ -0,0 +1,16 @@ >> +# >> +# Copyright OpenEmbedded Contributors >> +# >> +# SPDX-License-Identifier: MIT >> +# >> + >> + >> +from oeqa.selftest.case import OESelftestTestCase >> +from oeqa.utils.commands import bitbake >> + >> +class BitbakeTests(OESelftestTestCase): >> + >> + def test_rpm_filenames(self): >> + test_recipe = "testrpm" >> + bitbake(test_recipe) >> + >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> View/Reply Online (#169617): https://lists.openembedded.org/g/openembedded-core/message/169617 >> Mute This Topic: https://lists.openembedded.org/mt/93121038/3616765 >> Group Owner: openembedded-core+owner@lists.openembedded.org >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [randy.macleod@windriver.com] >> -=-=-=-=-=-=-=-=-=-=-=- >>
diff --git a/meta-selftest/recipes-test/testrpm/files/testfile.txt b/meta-selftest/recipes-test/testrpm/files/testfile.txt new file mode 100644 index 00000000000..d1e50ff79a2 --- /dev/null +++ b/meta-selftest/recipes-test/testrpm/files/testfile.txt @@ -0,0 +1,6 @@ + /mnt/builds/yocto/sources/meta-selftest/recipes-test/testrpm: + total used in directory 16 available 76.4 GiB + drwxr-xr-x 2 pavel pavel 4096 Aug 19 08:59 . + drwxr-xr-x 34 pavel pavel 4096 Aug 18 17:59 .. + -rw-r--r-- 1 pavel pavel 408 Aug 19 08:59 testrpm_0.0.1.bb + -rw-r--r-- 1 pavel pavel 355 Aug 18 21:54 testrpm_0.0.1.bb~ diff --git a/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb b/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb new file mode 100644 index 00000000000..e42c7db3b39 --- /dev/null +++ b/meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb @@ -0,0 +1,17 @@ +SUMMARY = "Test recipe for testing rpm generated by oe-core" +LICENSE = "CLOSED" + +SRC_URI = "file://testfile.txt" + +INHIBIT_DEFAULT_DEPS = "1" + +do_compile(){ + echo "testdata" > ${B}/"file with [quotes].txt" + echo "testdata" > ${B}/"file with (quites).txt" +} + +do_install(){ + install ${B}/* ${D}/ +} + +FILES:${PN} = "*" diff --git a/meta/lib/oeqa/selftest/cases/rpmtests.py b/meta/lib/oeqa/selftest/cases/rpmtests.py new file mode 100644 index 00000000000..dafbbc21360 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/rpmtests.py @@ -0,0 +1,16 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake + +class BitbakeTests(OESelftestTestCase): + + def test_rpm_filenames(self): + test_recipe = "testrpm" + bitbake(test_recipe) +
Escaping globs and quoting in rpm spec files is tricky and requires a bit of dancing. In addition to that it changes from time to time. Adding (simple) regression test for different types of filename patterns. Cover bracket in first iteration [Yocto #13746] Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> --- .../recipes-test/testrpm/files/testfile.txt | 6 ++++++ .../recipes-test/testrpm/testrpm_0.0.1.bb | 17 +++++++++++++++++ meta/lib/oeqa/selftest/cases/rpmtests.py | 16 ++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 meta-selftest/recipes-test/testrpm/files/testfile.txt create mode 100644 meta-selftest/recipes-test/testrpm/testrpm_0.0.1.bb create mode 100644 meta/lib/oeqa/selftest/cases/rpmtests.py