1
1
import subprocess
2
2
import datetime
3
+ import re
4
+ import copy
3
5
4
6
repo_features = dict ()
5
7
214
216
### repo_features['qtbase'] += features_widgets
215
217
216
218
217
- repos = [
218
- 'qtbase' ,
219
- 'qtxmlpatterns' ,
220
- 'qtdeclarative' ,
221
- 'qtquickcontrols' ,
222
- 'qt3d' ,
223
- 'qtactiveqt' ,
224
- 'qtandroidextras' ,
225
- 'qtwayland' ,
226
- 'qtcanvas3d' ,
227
- 'qtcharts' ,
228
- 'qtconnectivity' ,
229
- 'qtdatavis3d' ,
230
- # 'qtdoc',
231
- 'qtgamepad' ,
232
- 'qtgraphicaleffects' ,
233
- 'qtimageformats' ,
234
- 'qtlocation' ,
235
- 'qtmacextras' ,
236
- 'qtmultimedia' ,
237
- #### 'qtnetworkauth',
238
- 'qtpurchasing' ,
239
- # 'qtqa',
240
- 'qtquickcontrols2' ,
241
- # 'qtrepotools',
242
- # 'qtscript',
243
- 'qtscxml' ,
244
- 'qtsensors' ,
245
- 'qtserialbus' ,
246
- 'qtserialport' ,
247
- 'qtspeech' ,
248
- 'qtsvg' ,
249
- # 'qttools',
250
- # 'qttranslations',
251
- 'qtvirtualkeyboard' ,
252
- # 'qtwebchannel',
253
- # 'qtwebsockets',
254
- # 'qtwebview',
255
- 'qtwinextras' ,
256
- 'qtx11extras' ,
257
- ]
258
-
259
-
260
-
261
- deps = dict ()
262
- deps ["qtdeclarative" ] = ('qtxmlpatterns' ,)
263
-
264
- deps ["qtmultimedia" ] = ('qtdeclarative' ,)
265
- deps ["qtlocation" ] = ('qtdeclarative' , 'qtquickcontrols' , 'qtserialport' ,)
266
- deps ["qtsensors" ] = ('qtdeclarative' , 'qtsvg' ,)
267
- ####deps["qtsystems"] = ('qtdeclarative',)
268
- ####deps["qtfeedback"] = ('qtdeclarative', 'qtmultimedia',)
269
- ####deps["qtpim"] = ('qtdeclarative',)
270
- deps ["qtconnectivity" ] = ('qtdeclarative' , 'qtandroidextras' ,)
271
- deps ["qtwayland" ] = ('qtdeclarative' ,)
272
- deps ["qt3d" ] = ('qtdeclarative' , 'qtimageformats' , 'qtgamepad' ,)
273
- deps ["qtgraphicaleffects" ] = ('qtdeclarative' ,)
274
- deps ["qtquickcontrols" ] = ('qtdeclarative' , 'qtgraphicaleffects' ,)
275
- deps ["qtserialbus" ] = ('qtserialport' ,)
276
- deps ["qtwinextras" ] = ('qtdeclarative' , 'qtmultimedia' ,)
277
- deps ["qtcanvas3d" ] = ('qtdeclarative' ,)
278
- deps ["qtquickcontrols2" ] = ('qtgraphicaleffects' ,)
279
- deps ["qtpurchasing" ] = ('qtandroidextras' , 'qtdeclarative' ,)
280
- deps ["qtcharts" ] = ('qtdeclarative' , 'qtmultimedia' ,)
281
- deps ["qtdatavis3d" ] = ('qtdeclarative' , 'qtmultimedia' ,)
282
- deps ["qtvirtualkeyboard" ] = ('qtdeclarative' , 'qtsvg' , 'qtmultimedia' , 'qtquickcontrols' ,)
283
- deps ["qtgamepad" ] = ('qtdeclarative' ,)
284
- deps ["qtscxml" ] = ('qtdeclarative' ,)
285
- deps ["qtspeech" ] = ('qtdeclarative' , 'qtmultimedia' ,)
286
- ####deps["qtnetworkauth"] = ('qtwebview',)
219
+ #-------------------------------------------------------------------
220
+ #
221
+ # Repos and dependencies
222
+ #
223
+ #-------------------------------------------------------------------
224
+
225
+ repo_run = subprocess .run (["git" , "submodule" , "foreach" , "-q" , r"echo $path" ], stdout = subprocess .PIPE , universal_newlines = True )
226
+
227
+ repo_list = repo_run .stdout .splitlines ();
228
+
229
+ #print(repo_list)
230
+ #print('-------------------------------------------')
231
+
232
+ tmp_repo_set = set (repo_list )
233
+ dependencies = dict ()
234
+
235
+ def add_dependency (parent , child ):
236
+ if parent in tmp_repo_set and child in tmp_repo_set :
237
+ dependencies .setdefault (parent , []).append (child )
238
+
239
+
240
+ current_sub = 'UNKNOWN'
241
+ #opt_deps = dict()
242
+ with open ('.gitmodules' ) as f :
243
+ for line in f :
244
+ match = re .search (r'^\[submodule "(.*)"\]' , line )
245
+ if match :
246
+ # print('Submodule found: ', match.group(1))
247
+ current_sub = match .group (1 )
248
+ continue
249
+ match = re .search (r'depends = (.*)' , line )
250
+ if match :
251
+ for dep in match .group (1 ).split (' ' ):
252
+ add_dependency (current_sub , dep )
253
+ continue
254
+ match = re .search (r'recommends = (.*)' , line )
255
+ if match :
256
+ for dep in match .group (1 ).split (' ' ):
257
+ add_dependency (current_sub , dep )
258
+ continue
259
+
260
+ #print('-------------------------------------------')
261
+
262
+ #print(dependencies)
263
+ #print('-------------------------------------------')
287
264
288
265
289
266
def deps_recursive (repo ):
290
267
retval = set ()
291
- if not repo in deps :
268
+ if not repo in dependencies :
292
269
return retval
293
- for r in deps [repo ]:
270
+ for r in dependencies [repo ]:
294
271
retval .add (r )
295
272
retval |= deps_recursive (r )
296
273
return retval
297
-
298
274
299
- rrdeps = {x :{x } for x in repos }
300
275
301
- #print("one", rrdeps)
276
+ rrdeps = {x :{x } for x in repo_list }
277
+
302
278
303
- for r in repos :
279
+ for r in repo_list :
304
280
dr = deps_recursive (r )
305
281
#print("deps of", r, "=", dr)
306
282
for rr in dr :
307
- rrdeps [rr ].add (r )
283
+ if rr in rrdeps :
284
+ rrdeps [rr ].add (r )
308
285
309
- #for key, value in deps.items():
310
- # for d in value:
311
- # print("dep", key, "is", d)
312
- # rdeps[d].append(key)
313
- #
286
+
287
+ #print(rrdeps)
288
+ #print('-------------------------------------------')
289
+
290
+ repos_to_sort = copy .deepcopy (rrdeps )
291
+ sorted_repos = []
292
+
293
+ for repo in repos_to_sort :
294
+ repos_to_sort [repo ].discard (repo )
295
+
296
+
297
+ while repos_to_sort :
298
+ rlist = list (repos_to_sort .keys ())
299
+ for repo in rlist :
300
+ if not repos_to_sort [repo ]:
301
+ for r in repos_to_sort :
302
+ repos_to_sort [r ].discard (repo )
303
+ del repos_to_sort [repo ]
304
+ sorted_repos .insert (0 , repo )
305
+
306
+ #print(sorted_repos)
307
+
308
+
309
+
310
+
311
+ #-------------------------------------------------------------------
314
312
#
315
- #rdeps['qtbase'] = repos.copy()
316
- #rdeps['qtbase'].remove('qtbase')
313
+ # Do the build tests
317
314
#
315
+ #-------------------------------------------------------------------
318
316
319
- rrdeps ['qtbase' ] = set (repos )
320
317
321
- print (rrdeps )
322
318
323
319
configuretemplate = [ "./configure" , "-recheck-all" , "-no-pch" , "-release" , "-developer-build" , "-no-warnings-are-errors" , "-nomake" , "examples" , "-nomake" , "tests" , "-opensource" , "-confirm-license" ]
324
320
@@ -331,15 +327,6 @@ def deps_recursive(repo):
331
327
def timestamp ():
332
328
return '{:%Y-%m-%d %H:%M:%S}' .format (datetime .datetime .now ())
333
329
334
-
335
- #def allrdeps(repo):
336
- # res = set(rdeps[repo])
337
- # for r in rdeps[repo]:
338
- # res |= allrdeps(r)
339
- # res.add(repo)
340
- # return res
341
- #
342
-
343
330
def clean_repos (repos_to_clean ):
344
331
for r in repos_to_clean :
345
332
print ("cleaning" , r )
@@ -381,7 +368,7 @@ def print_errors(log):
381
368
382
369
# test all features connected to each repo
383
370
384
- for current_repo in repos :
371
+ for current_repo in sorted_repos :
385
372
print ('hello' , current_repo )
386
373
if not current_repo in repo_features :
387
374
continue
@@ -397,7 +384,7 @@ def print_errors(log):
397
384
r_to_test = repos_to_test .copy ()
398
385
399
386
configure_qt (test_feature )
400
- for r in repos :
387
+ for r in sorted_repos :
401
388
if r in r_to_test :
402
389
print (timestamp (), "Building" , r , "with" , test_feature , file = outfile , flush = True )
403
390
print ("Building" , r , "..." )
0 commit comments