[meta-oe,master] libtinyxml2: fix packaging of test files

Message ID 20220303102758.36283-1-nisha.m.parrakat@bmw.de
State New
Headers show
Series [meta-oe,master] libtinyxml2: fix packaging of test files | expand

Commit Message

Nisha Parrakat March 3, 2022, 10:27 a.m. UTC
The xml files inside the resources are to be used for the
run of test named xmltest
they were not getting copied from the source directory to the directory
where xmltest was installed

fixes the below error when code built with cmake
./xmltest
Error opening test file 'dream.xml'.
Is your working directory the same as where
the xmltest.cpp and dream.xml file are?

Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)

Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
---
 ...y_resources_with_tests_in_CMakelists.patch | 31 +++++++++++++++++++
 .../libtinyxml2/libtinyxml2_9.0.0.bb          |  4 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch

Comments

Khem Raj March 4, 2022, 7:07 a.m. UTC | #1
this patch does not apply cleanly, how has this patch been tested ?

patching file CMakeLists.txt
Hunk #1 FAILED at 50 (different line endings).
1 out of 1 hunk FAILED -- rejects in file CMakeLists.txt
Patch copy_resources_with_tests_in_CMakelists.patch does not apply
(enforce with -f)

also see

https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1479

On Thu, Mar 3, 2022 at 2:28 AM Nisha Parrakat <nishaparrakat@gmail.com> wrote:
>
> The xml files inside the resources are to be used for the
> run of test named xmltest
> they were not getting copied from the source directory to the directory
> where xmltest was installed
>
> fixes the below error when code built with cmake
> ./xmltest
> Error opening test file 'dream.xml'.
> Is your working directory the same as where
> the xmltest.cpp and dream.xml file are?
>
> Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)
>
> Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
> ---
>  ...y_resources_with_tests_in_CMakelists.patch | 31 +++++++++++++++++++
>  .../libtinyxml2/libtinyxml2_9.0.0.bb          |  4 ++-
>  2 files changed, 34 insertions(+), 1 deletion(-)
>  create mode 100644 meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
>
> diff --git a/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
> new file mode 100644
> index 000000000..ac05dc2ae
> --- /dev/null
> +++ b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
> @@ -0,0 +1,31 @@
> +The xml files inside the resources are to be used for the
> +run of test named xmltest
> +they were not getting copied from the source directory to the directory
> +where xmltest was installed
> +
> +fixes the below error when code built with cmake
> +./xmltest
> +Error opening test file 'dream.xml'.
> +Is your working directory the same as where
> +the xmltest.cpp and dream.xml file are?
> +
> +Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
> +Signed-off-by: Nisha Parrakat <nishaparrakat@gmail.com>
> +
> +Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)
> +--- a/CMakeLists.txt   2022-03-01 12:28:46.780447542 +0000
> ++++ b/CMakeLists.txt   2022-03-01 12:28:55.951951478 +0000
> +@@ -50,7 +50,12 @@
> +         COMMAND xmltest
> +         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
> +     )
> +-
> ++     # Copy test resources and create test output directory
> ++    add_custom_command(TARGET xmltest POST_BUILD
> ++        COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
> ++        COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
> ++        COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
> ++    )
> +     set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
> + endif ()
> +
> diff --git a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
> index 7f205987f..06410ab6e 100644
> --- a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
> +++ b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
> @@ -4,7 +4,9 @@ SECTION = "libs"
>  LICENSE = "Zlib"
>  LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=135624eef03e1f1101b9ba9ac9b5fffd"
>
> -SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https"
> +SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https \
> +           file://copy_resources_with_tests_in_CMakelists.patch \
> +          "
>
>  SRCREV = "1dee28e51f9175a31955b9791c74c430fe13dc82"
>
> --
> 2.17.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#95737): https://lists.openembedded.org/g/openembedded-devel/message/95737
> Mute This Topic: https://lists.openembedded.org/mt/89522514/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Nisha Parrakat March 5, 2022, 9:40 p.m. UTC | #2
i could build it in my local clone of poky and meta-openembedded

i have taken the file from upstream pull request, i recreated the patch 
file from the

code that is fetched by the yocto setup and again built locally to see 
if it is ok.

please try with new patch that i sent at

https://lists.openembedded.org/g/openembedded-devel/message/95806

regards

Nisha P

On 04.03.22 08:07, Khem Raj wrote:
> this patch does not apply cleanly, how has this patch been tested ?
>
> patching file CMakeLists.txt
> Hunk #1 FAILED at 50 (different line endings).
> 1 out of 1 hunk FAILED -- rejects in file CMakeLists.txt
> Patch copy_resources_with_tests_in_CMakelists.patch does not apply
> (enforce with -f)
>
> also see
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1479
>
> On Thu, Mar 3, 2022 at 2:28 AM Nisha Parrakat <nishaparrakat@gmail.com> wrote:
>> The xml files inside the resources are to be used for the
>> run of test named xmltest
>> they were not getting copied from the source directory to the directory
>> where xmltest was installed
>>
>> fixes the below error when code built with cmake
>> ./xmltest
>> Error opening test file 'dream.xml'.
>> Is your working directory the same as where
>> the xmltest.cpp and dream.xml file are?
>>
>> Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)
>>
>> Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
>> ---
>>   ...y_resources_with_tests_in_CMakelists.patch | 31 +++++++++++++++++++
>>   .../libtinyxml2/libtinyxml2_9.0.0.bb          |  4 ++-
>>   2 files changed, 34 insertions(+), 1 deletion(-)
>>   create mode 100644 meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
>>
>> diff --git a/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
>> new file mode 100644
>> index 000000000..ac05dc2ae
>> --- /dev/null
>> +++ b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
>> @@ -0,0 +1,31 @@
>> +The xml files inside the resources are to be used for the
>> +run of test named xmltest
>> +they were not getting copied from the source directory to the directory
>> +where xmltest was installed
>> +
>> +fixes the below error when code built with cmake
>> +./xmltest
>> +Error opening test file 'dream.xml'.
>> +Is your working directory the same as where
>> +the xmltest.cpp and dream.xml file are?
>> +
>> +Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
>> +Signed-off-by: Nisha Parrakat <nishaparrakat@gmail.com>
>> +
>> +Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)
>> +--- a/CMakeLists.txt   2022-03-01 12:28:46.780447542 +0000
>> ++++ b/CMakeLists.txt   2022-03-01 12:28:55.951951478 +0000
>> +@@ -50,7 +50,12 @@
>> +         COMMAND xmltest
>> +         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
>> +     )
>> +-
>> ++     # Copy test resources and create test output directory
>> ++    add_custom_command(TARGET xmltest POST_BUILD
>> ++        COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
>> ++        COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
>> ++        COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
>> ++    )
>> +     set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
>> + endif ()
>> +
>> diff --git a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
>> index 7f205987f..06410ab6e 100644
>> --- a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
>> +++ b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
>> @@ -4,7 +4,9 @@ SECTION = "libs"
>>   LICENSE = "Zlib"
>>   LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=135624eef03e1f1101b9ba9ac9b5fffd"
>>
>> -SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https"
>> +SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https \
>> +           file://copy_resources_with_tests_in_CMakelists.patch \
>> +          "
>>
>>   SRCREV = "1dee28e51f9175a31955b9791c74c430fe13dc82"
>>
>> --
>> 2.17.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#95737): https://lists.openembedded.org/g/openembedded-devel/message/95737
>> Mute This Topic: https://lists.openembedded.org/mt/89522514/1997914
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>

Patch

diff --git a/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
new file mode 100644
index 000000000..ac05dc2ae
--- /dev/null
+++ b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
@@ -0,0 +1,31 @@ 
+The xml files inside the resources are to be used for the
+run of test named xmltest
+they were not getting copied from the source directory to the directory
+where xmltest was installed
+
+fixes the below error when code built with cmake
+./xmltest
+Error opening test file 'dream.xml'.
+Is your working directory the same as where
+the xmltest.cpp and dream.xml file are?
+
+Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
+Signed-off-by: Nisha Parrakat <nishaparrakat@gmail.com>
+
+Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)
+--- a/CMakeLists.txt	2022-03-01 12:28:46.780447542 +0000
++++ b/CMakeLists.txt	2022-03-01 12:28:55.951951478 +0000
+@@ -50,7 +50,12 @@
+         COMMAND xmltest
+         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+     )
+-
++     # Copy test resources and create test output directory
++    add_custom_command(TARGET xmltest POST_BUILD
++        COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
++        COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
++        COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
++    ) 
+     set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
+ endif ()
+ 
diff --git a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
index 7f205987f..06410ab6e 100644
--- a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
+++ b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
@@ -4,7 +4,9 @@  SECTION = "libs"
 LICENSE = "Zlib"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=135624eef03e1f1101b9ba9ac9b5fffd"
 
-SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https \
+           file://copy_resources_with_tests_in_CMakelists.patch \
+          "
 
 SRCREV = "1dee28e51f9175a31955b9791c74c430fe13dc82"