Bug#892091: [Pkg-ayatana-devel] Bug#892091: ayatana-indicator-power: FTBFS randomly - gschemas.compiled generated twice

2018-03-12 Thread Mike Gabriel

Hi James,

On  Mo 12 Mär 2018 15:08:11 CET, James Cowgill wrote:


Hi,

On 12/03/18 13:47, Mike Gabriel wrote:

On  Mo 12 Mär 2018 14:29:18 CET, James Cowgill wrote:

On 11/03/18 15:40, Mike Gabriel wrote:

On  Mo 05 Mär 2018 12:31:34 CET, James Cowgill wrote:

From cmake-commands(7) - add_custom_command:
"Do not list the output in more than one independent target that may
build in parallel or the two instances of the rule may conflict
(instead
use the add_custom_target() command to drive the command and make the
other targets depend on that one)."

There are three independent targets here which use gschemas.compiled
(the three tests).

I found this blog which tries to explain it (number 4):
https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/



James


Thanks for your research on this.

Would this feel like a valid fix?

```
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2c45057..714fa6c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,6 +32,14 @@ add_custom_command (OUTPUT gschemas.compiled
 COMMAND cp -f ${CMAKE_BINARY_DIR}/data/*gschema.xml
${SCHEMA_DIR}
 COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})

+add_custom_target(
+    test-notify-gschemas ALL DEPENDS gschemas.compiled
+)
+
+add_custom_target(
+    test-device-gschemas ALL DEPENDS gschemas.compiled
+)


I don't think this will work because these two targets might be built in
parallel and we end up with the same problem as before. I think you want
a single custom target which all the tests depend on.

James


Hmm, but what you say above would contradict the howto provided under
(4.) at this URL [1] (the one you quoted earlier).

I think, I exactly immitated what Sam Thursfield wrote on his blog.
Don't you think?


I think the code directly under the section 4 heading is a failing test
case and an example of what you should _not_ do.

James


Then this would be the next approach:

```
commit 891b1549a3d20db69e4335c1a74bcba1c84c3bb3
Author: Mike Gabriel 
Date:   Sun Mar 11 21:32:24 2018 +0100

tests/CMakeLists.txt: Prohibit gschemas.compiled to be generated  
multiple times.


 Spotted by James Cogwill, see https://bugs.debian.org/892091.

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 651ddf4..bf53ee3 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,6 +32,10 @@ add_custom_command (OUTPUT gschemas.compiled
 COMMAND cp -f  
${CMAKE_BINARY_DIR}/data/*gschema.xml ${SCHEMA_DIR}

 COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})

+add_custom_target(
+gschemas-compiled ALL DEPENDS gschemas.compiled
+)
+
 # look for headers in our src dir, and also in the directories where  
we autogenerate files...

 include_directories (${CMAKE_SOURCE_DIR}/src)
 include_directories (${CMAKE_BINARY_DIR}/src)
@@ -42,9 +46,9 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR})

 function(add_test_by_name name)
   set (TEST_NAME ${name})
-  add_executable (${TEST_NAME} ${TEST_NAME}.cc gschemas.compiled)
+  add_executable (${TEST_NAME} ${TEST_NAME}.cc)
   add_test (${TEST_NAME} ${TEST_NAME})
-  add_dependencies (${TEST_NAME} ayatanaindicatorpowerservice)
+  add_dependencies (${TEST_NAME} ayatanaindicatorpowerservice  
gschemas-compiled)
   target_link_libraries (${TEST_NAME} ayatanaindicatorpowerservice  
gtest ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS}  
${URLDISPATCHER_LIBRARIES})

 endfunction()
 add_test_by_name(test-notify)
```

(and when re-reading the blog post, I realized that the example was  
indeed the bad test case.)


Mike
--

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de



pgpM_hVgooaXF.pgp
Description: Digitale PGP-Signatur


Bug#892091: [Pkg-ayatana-devel] Bug#892091: ayatana-indicator-power: FTBFS randomly - gschemas.compiled generated twice

2018-03-12 Thread James Cowgill
Hi,

On 12/03/18 13:47, Mike Gabriel wrote:
> On  Mo 12 Mär 2018 14:29:18 CET, James Cowgill wrote:
>> On 11/03/18 15:40, Mike Gabriel wrote:
>>> On  Mo 05 Mär 2018 12:31:34 CET, James Cowgill wrote:
 From cmake-commands(7) - add_custom_command:
 "Do not list the output in more than one independent target that may
 build in parallel or the two instances of the rule may conflict
 (instead
 use the add_custom_target() command to drive the command and make the
 other targets depend on that one)."

 There are three independent targets here which use gschemas.compiled
 (the three tests).

 I found this blog which tries to explain it (number 4):
 https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/



 James
>>>
>>> Thanks for your research on this.
>>>
>>> Would this feel like a valid fix?
>>>
>>> ```
>>> diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
>>> index 2c45057..714fa6c 100644
>>> --- a/tests/CMakeLists.txt
>>> +++ b/tests/CMakeLists.txt
>>> @@ -32,6 +32,14 @@ add_custom_command (OUTPUT gschemas.compiled
>>>  COMMAND cp -f ${CMAKE_BINARY_DIR}/data/*gschema.xml
>>> ${SCHEMA_DIR}
>>>  COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})
>>>
>>> +add_custom_target(
>>> +    test-notify-gschemas ALL DEPENDS gschemas.compiled
>>> +)
>>> +
>>> +add_custom_target(
>>> +    test-device-gschemas ALL DEPENDS gschemas.compiled
>>> +)
>>
>> I don't think this will work because these two targets might be built in
>> parallel and we end up with the same problem as before. I think you want
>> a single custom target which all the tests depend on.
>>
>> James
> 
> Hmm, but what you say above would contradict the howto provided under
> (4.) at this URL [1] (the one you quoted earlier).
> 
> I think, I exactly immitated what Sam Thursfield wrote on his blog.
> Don't you think?

I think the code directly under the section 4 heading is a failing test
case and an example of what you should _not_ do.

James



signature.asc
Description: OpenPGP digital signature


Bug#892091: [Pkg-ayatana-devel] Bug#892091: ayatana-indicator-power: FTBFS randomly - gschemas.compiled generated twice

2018-03-12 Thread Mike Gabriel

Hi James,

On  Mo 12 Mär 2018 14:29:18 CET, James Cowgill wrote:


Hi,

On 11/03/18 15:40, Mike Gabriel wrote:

On  Mo 05 Mär 2018 12:31:34 CET, James Cowgill wrote:

From cmake-commands(7) - add_custom_command:
"Do not list the output in more than one independent target that may
build in parallel or the two instances of the rule may conflict (instead
use the add_custom_target() command to drive the command and make the
other targets depend on that one)."

There are three independent targets here which use gschemas.compiled
(the three tests).

I found this blog which tries to explain it (number 4):
https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/


James


Thanks for your research on this.

Would this feel like a valid fix?

```
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2c45057..714fa6c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,6 +32,14 @@ add_custom_command (OUTPUT gschemas.compiled
 COMMAND cp -f ${CMAKE_BINARY_DIR}/data/*gschema.xml
${SCHEMA_DIR}
 COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})

+add_custom_target(
+    test-notify-gschemas ALL DEPENDS gschemas.compiled
+)
+
+add_custom_target(
+    test-device-gschemas ALL DEPENDS gschemas.compiled
+)


I don't think this will work because these two targets might be built in
parallel and we end up with the same problem as before. I think you want
a single custom target which all the tests depend on.

James


Hmm, but what you say above would contradict the howto provided under  
(4.) at this URL [1] (the one you quoted earlier).


I think, I exactly immitated what Sam Thursfield wrote on his blog.  
Don't you think?


Mike

[1]  
https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/

--

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de



pgpqMTfTfvGQ8.pgp
Description: Digitale PGP-Signatur


Bug#892091: [Pkg-ayatana-devel] Bug#892091: ayatana-indicator-power: FTBFS randomly - gschemas.compiled generated twice

2018-03-12 Thread James Cowgill
Hi,

On 11/03/18 15:40, Mike Gabriel wrote:
> On  Mo 05 Mär 2018 12:31:34 CET, James Cowgill wrote:
>> From cmake-commands(7) - add_custom_command:
>> "Do not list the output in more than one independent target that may
>> build in parallel or the two instances of the rule may conflict (instead
>> use the add_custom_target() command to drive the command and make the
>> other targets depend on that one)."
>>
>> There are three independent targets here which use gschemas.compiled
>> (the three tests).
>>
>> I found this blog which tries to explain it (number 4):
>> https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
>>
>>
>> James
> 
> Thanks for your research on this.
> 
> Would this feel like a valid fix?
> 
> ```
> diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
> index 2c45057..714fa6c 100644
> --- a/tests/CMakeLists.txt
> +++ b/tests/CMakeLists.txt
> @@ -32,6 +32,14 @@ add_custom_command (OUTPUT gschemas.compiled
>  COMMAND cp -f ${CMAKE_BINARY_DIR}/data/*gschema.xml
> ${SCHEMA_DIR}
>  COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})
> 
> +add_custom_target(
> +    test-notify-gschemas ALL DEPENDS gschemas.compiled
> +)
> +
> +add_custom_target(
> +    test-device-gschemas ALL DEPENDS gschemas.compiled
> +)

I don't think this will work because these two targets might be built in
parallel and we end up with the same problem as before. I think you want
a single custom target which all the tests depend on.

James



signature.asc
Description: OpenPGP digital signature


Bug#892091: [Pkg-ayatana-devel] Bug#892091: ayatana-indicator-power: FTBFS randomly - gschemas.compiled generated twice

2018-03-11 Thread Mike Gabriel

Hi James,

On  Mo 05 Mär 2018 12:31:34 CET, James Cowgill wrote:


Source: ayatana-indicator-power
Version: 2.0.92-1
Severity: serious
Tags: sid buster

Hi,

On the buildds, ayatana-indicator-power FTBFS on armhf, mips, ia64, m68k
and sh4 with an error similar to this:

[ 84%] Generating gschemas.compiled
cd /<>/obj-mips-linux-gnu/tests && cp -f  
/<>/obj-mips-linux-gnu/data/*gschema.xml  
/<>/obj-mips-linux-gnu/tests
cp: cannot create regular file  
'/<>/obj-mips-linux-gnu/tests/org.ayatana.indicator.power.gschema.xml': File  
exists
make[3]: *** [tests/CMakeFiles/test-device.dir/build.make:65:  
tests/gschemas.compiled] Error 1

make[3]: Leaving directory '/<>/obj-mips-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:464:  
tests/CMakeFiles/test-device.dir/all] Error 2

make[2]: *** Waiting for unfinished jobs
make[3]: Entering directory '/<>/obj-mips-linux-gnu'
[ 84%] Generating gschemas.compiled
cd /<>/obj-mips-linux-gnu/tests && cp -f  
/<>/obj-mips-linux-gnu/data/*gschema.xml  
/<>/obj-mips-linux-gnu/tests
cd /<>/obj-mips-linux-gnu/tests &&  
/usr/lib/mips-linux-gnu/glib-2.0/glib-compile-schemas  
/<>/obj-mips-linux-gnu/tests

make[3]: Leaving directory '/<>/obj-mips-linux-gnu'


This looks like a random error induced by parallel builds. Here you can
see that CMake is attempting to generate "gschemas.compiled" twice when
it should only generate it once.

tests/CMakeLists.txt contains:

set (SCHEMA_DIR ${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DSCHEMA_DIR="${SCHEMA_DIR}")
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0  
--variable glib_compile_schemas

 OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE
 OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_command (OUTPUT gschemas.compiled
DEPENDS  
${CMAKE_BINARY_DIR}/data/org.ayatana.indicator.power.gschema.xml
COMMAND cp -f  
${CMAKE_BINARY_DIR}/data/*gschema.xml ${SCHEMA_DIR}

COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})

[...]

function(add_test_by_name name)
  set (TEST_NAME ${name})
  add_executable (${TEST_NAME} ${TEST_NAME}.cc gschemas.compiled)
  add_test (${TEST_NAME} ${TEST_NAME})
  add_dependencies (${TEST_NAME} ayatanaindicatorpowerservice)
  target_link_libraries (${TEST_NAME} ayatanaindicatorpowerservice  
gtest ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS})

endfunction()
add_test_by_name(test-notify)
add_test(NAME dear-reader-the-next-test-takes-80-seconds COMMAND true)
add_test_by_name(test-device)


From cmake-commands(7) - add_custom_command:
"Do not list the output in more than one independent target that may
build in parallel or the two instances of the rule may conflict (instead
use the add_custom_target() command to drive the command and make the
other targets depend on that one)."

There are three independent targets here which use gschemas.compiled
(the three tests).

I found this blog which tries to explain it (number 4):
https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/

James


Thanks for your research on this.

Would this feel like a valid fix?

```
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2c45057..714fa6c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,6 +32,14 @@ add_custom_command (OUTPUT gschemas.compiled
 COMMAND cp -f  
${CMAKE_BINARY_DIR}/data/*gschema.xml ${SCHEMA_DIR}

 COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})

+add_custom_target(
+test-notify-gschemas ALL DEPENDS gschemas.compiled
+)
+
+add_custom_target(
+test-device-gschemas ALL DEPENDS gschemas.compiled
+)
+
 # look for headers in our src dir, and also in the directories where  
we autogenerate files...

 include_directories (${CMAKE_SOURCE_DIR}/src)
 include_directories (${CMAKE_BINARY_DIR}/src)
@@ -42,9 +50,9 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR})

 function(add_test_by_name name)
   set (TEST_NAME ${name})
-  add_executable (${TEST_NAME} ${TEST_NAME}.cc gschemas.compiled)
+  add_executable (${TEST_NAME} ${TEST_NAME}.cc)
   add_test (${TEST_NAME} ${TEST_NAME})
-  add_dependencies (${TEST_NAME} ayatanaindicatorpowerservice)
+  add_dependencies (${TEST_NAME} ayatanaindicatorpowerservice  
${TEST_NAME}-gschemas)
   target_link_libraries (${TEST_NAME} ayatanaindicatorpowerservice  
gtest ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS})

 endfunction()
 add_test_by_name(test-notify)
```

The build works with various levels of parallelism (-j2-6 tested).

Mike
--

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de



pgpQQZkF4yD8b.pgp
Description: Digitale PGP-Signatur