Changeset b1c2cb4 in rtems-source-builder
- Timestamp:
- 07/14/19 04:03:06 (4 years ago)
- Branches:
- 5, master
- Children:
- 831ae05
- Parents:
- f68f0d9
- git-author:
- Chris Johns <chrisj@…> (07/14/19 04:03:06)
- git-committer:
- Chris Johns <chrisj@…> (07/21/19 11:09:34)
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
rtems/config/5/rtems-libbsd.bset
rf68f0d9 rb1c2cb4 4 4 5 5 # 6 # Build the kernel.6 # Build the BSD library for RTEMS. 7 7 # 8 8 tools/rtems-libbsd-5 -
rtems/config/rtems-bsp.cfg
rf68f0d9 rb1c2cb4 25 25 # and BSPs. Only after the source to download. 26 26 # 27 %if %{_dry_run} && %{defined with_download}27 %if %{_dry_run} 28 28 %log BSP configuration errors ignored 29 29 %define rtems_bsp_error 0 … … 37 37 # 38 38 %if %{defined rtems_host} 39 % define _host %{rtems_host}39 %{triplet _host %{rtems_host}} 40 40 %endif 41 41 %if %{rtems_bsp_error} … … 56 56 57 57 # 58 # If no tools or RTEMS provided use the prefix. 58 # If no tools or RTEMS provided use the prefix. If staging use the staging 59 # root. 59 60 # 60 61 %ifn %{defined with_tools} 61 %define with_tools %{_prefix} 62 %define rtems_waf_tools %{nil} 62 %if %{install_mode} == staging 63 %define with_tools %{stagingroot} 64 %define rtems_waf_tools --rtems-tools=%{with_tools} 65 %else 66 %define with_tools %{_prefix} 67 %define rtems_waf_tools %{nil} 68 %endif 63 69 %else 64 70 %define rtems_waf_tools --rtems-tools=%{with_tools} … … 66 72 67 73 %ifn %{defined with_rtems} 68 %define with_rtems %{_prefix} 69 %define rtems_waf_rtems %{nil} 74 %if %{install_mode} == staging 75 %define with_rtems %{stagingroot} 76 %define rtems_waf_rtems --rtems=%{with_rtems} 77 %else 78 %define with_rtems %{_prefix} 79 %define rtems_waf_rtems %{nil} 80 %endif 70 81 %else 71 82 %define rtems_waf_rtems --rtems=%{with_rtems} … … 112 123 # 113 124 %define rtems_bsp_cc %{_host}-gcc 125 %define rtems_bsp_cxx %{_host}-g++ 114 126 %define rtems_bsp_incpath %{with_rtems}/%{_host}/%{rtems_bsp}/include 115 127 %define rtems_bsp_libpath %{with_rtems}/%{_host}/%{rtems_bsp}/lib … … 161 173 # Map to names used for cross compiling. 162 174 # 175 %define host_cc %{rtems_bsp_cc} 176 %define host_cxx %{rtems_bsp_cxx} 163 177 %define host_includes -I%{_includedir} 164 178 %define host_cflags %{rtems_bsp_cflags} -
rtems/config/tools/rtems-libbsd-common.cfg
rf68f0d9 rb1c2cb4 63 63 --prefix=%{_prefix} \ 64 64 %{rtems_waf_tools} \ 65 %{rtems_waf_rtems} 65 %{rtems_waf_rtems} \ 66 66 --rtems-bsp=%{rtems_bsp_arch_bsp} 67 67 -
source-builder/defaults.mc
rf68f0d9 rb1c2cb4 75 75 build_includes: none, convert, '' 76 76 build_libs: none, convert, '' 77 78 # 79 # Build and staging paths. 80 # 81 buildroot: dir, none, '%{_tmppath}/%{buildname}-%{_uid}' 82 buildcxcroot: dir, none, '%{_tmppath}/%{buildname}-%{_uid}-cxc' 83 buildxcroot: dir, none, '%{_tmppath}/%{buildname}-%{_uid}-xx' 84 stagingroot: dir, none, '%{_tmppath}/sb-%{_uid}-staging' 85 86 # 87 # Install mode can be installing or staging. Defaults to installing. 88 # 89 install_mode: none, none, 'installing' 77 90 78 91 # Extra path a platform can override. … … 97 110 _tmproot: dir, none, '%{_tmppath}/sb-%{_uid}/%{_bset_tmp}' 98 111 _tmpcxcroot: dir, none, '%{_tmppath}/sb-%{_uid}-cxc/%{_bset_tmp}' 99 buildroot: dir, none, '%{_tmppath}/%{buildname}-%{_uid}'100 buildcxcroot: dir, none, '%{_tmppath}/%{buildname}-%{_uid}-cxc'101 buildxcroot: dir, none, '%{_tmppath}/%{buildname}-%{_uid}-xx'102 112 _datadir: dir, none, '%{_prefix}/share' 103 113 _defaultdocdir: dir, none, '%{_prefix}/share/doc' -
source-builder/sb/setbuilder.py
rf68f0d9 rb1c2cb4 42 42 import path 43 43 import reports 44 import shell 44 45 import sources 45 46 import version … … 51 52 sys.exit(1) 52 53 54 def macro_expand(macros, _str): 55 cstr = None 56 while cstr != _str: 57 cstr = _str 58 _str = macros.expand(_str) 59 _str = shell.expand(macros, _str) 60 return _str 61 53 62 class log_capture(object): 54 63 def __init__(self): … … 72 81 73 82 def __init__(self, bset, _configs, opts, macros = None): 74 log.trace('_bset: %s: init' % (bset))83 log.trace('_bset: : %s: init' % (bset)) 75 84 self.configs = _configs 76 85 self.opts = opts … … 79 88 else: 80 89 self.macros = copy.copy(macros) 81 log.trace('_bset: %s: macro defaults' % (bset))90 log.trace('_bset: : %s: macro defaults' % (bset)) 82 91 log.trace(str(self.macros)) 83 92 self.bset = bset 84 _target = self.macros.expand('%{_target}')93 _target = macro_expand(self.macros, '%{_target}') 85 94 if len(_target): 86 95 pkg_prefix = _target 87 96 else: 88 pkg_prefix = self.macros.expand('%{_host}')97 pkg_prefix = macro_expand(self.macros, '%{_host}') 89 98 self.bset_pkg = '%s-%s-set' % (pkg_prefix, self.bset) 90 99 self.mail_header = '' … … 153 162 raise error.general('invalid report format: %s' % (format)) 154 163 buildroot = _build.config.abspath('%{buildroot}') 155 prefix = _build.macros.expand('%{_prefix}')164 prefix = macro_expand(_build.macros, '%{_prefix}') 156 165 name = _build.main_package().name() + ext 157 166 log.notice('reporting: %s -> %s' % (_config, name)) … … 183 192 what = '%s -> %s' % \ 184 193 (os.path.relpath(path.host(src)), os.path.relpath(path.host(dst))) 185 log.trace('_bset: %s: collecting: %s' % (self.bset, what))194 log.trace('_bset: : %s: collecting: %s' % (self.bset, what)) 186 195 self.copy(src, dst) 187 196 188 def install(self, name, buildroot, prefix): 189 dst = prefix 190 src = path.join(buildroot, prefix) 191 log.notice('installing: %s -> %s' % (name, path.host(dst))) 197 def install(self, mode, name, src, dst): 198 log.notice('%s: %s -> %s' % (mode, name, path.host(dst))) 192 199 self.copy(src, dst) 193 200 201 def install_mode(self): 202 return macro_expand(self.macros, '%{install_mode}') 203 204 def installing(self): 205 return self.install_mode() == 'installing' 206 207 def staging(self): 208 return not self.installing() 209 194 210 def canadian_cross(self, _build): 195 log.trace('_bset: Cxc for build machine: _build => _host')211 log.trace('_bset: : Cxc for build machine: _build => _host') 196 212 macros_to_copy = [('%{_host}', '%{_build}'), 197 213 ('%{_host_alias}', '%{_build_alias}'), … … 205 221 cxc_macros = _build.copy_init_macros() 206 222 for m in macros_to_copy: 207 log.trace('_bset: Cxc: %s <= %s' % (m[0], cxc_macros[m[1]]))223 log.trace('_bset: : Cxc: %s <= %s' % (m[0], cxc_macros[m[1]])) 208 224 cxc_macros[m[0]] = cxc_macros[m[1]] 209 225 _build.set_macros(cxc_macros) … … 230 246 and not _build.macros.get('%{_disable_packaging}'): 231 247 path.mkdir(tardir) 232 tar = path.join(tardir, _build.config.expand('%s.tar.bz2' % (_build.main_package().name()))) 248 tar = path.join(tardir, 249 _build.config.expand('%s.tar.bz2' % \ 250 (_build.main_package().name()))) 233 251 log.notice('tarball: %s' % (os.path.relpath(path.host(tar)))) 234 252 if not self.opts.dry_run(): 235 253 tmproot = _build.config.expand('%{_tmproot}') 236 254 cmd = _build.config.expand('"cd ' + tmproot + \ 237 ' && %{__tar} -cf - . | %{__bzip2} > ' + tar + '"') 255 ' && %{__tar} -cf - . | %{__bzip2} > ' + \ 256 tar + '"') 238 257 _build.run(cmd, shell_opts = '-c', cwd = tmproot) 239 258 … … 250 269 251 270 if not path.exists(bsetname): 252 for cp in self.macros.expand('%{_configdir}').split(':'):271 for cp in macro_expand(self.macros, '%{_configdir}').split(':'): 253 272 configdir = path.abspath(cp) 254 273 bsetname = path.join(configdir, bset) … … 259 278 raise error.general('no build set file found: %s' % (bset)) 260 279 try: 261 log.trace('_bset: %s: open: %s' % (self.bset, bsetname))280 log.trace('_bset: : %s: open: %s' % (self.bset, bsetname)) 262 281 bset = open(path.host(bsetname), 'r') 263 282 except IOError as err: … … 273 292 if len(l) == 0: 274 293 continue 275 log.trace('_bset: %s: %03d: %s' % (self.bset, lc, l))294 log.trace('_bset: : %s: %03d: %s' % (self.bset, lc, l)) 276 295 ls = l.split() 277 296 if ls[0][-1] == ':' and ls[0][:-1] == 'package': … … 289 308 elif ls[0] == '%undefine': 290 309 if len(ls) > 2: 291 raise error.general('%s:%d: %undefine requires just the name' %\292 310 raise error.general('%s:%d: %undefine requires ' \ 311 'just the name' % (self.bset, lc)) 293 312 self.macros.undefine(ls[1].strip()) 294 313 elif ls[0] == '%include': … … 302 321 c = build.find_config(l, self.configs) 303 322 if c is None: 304 raise error.general('%s:%d: cannot find file: %s' % (self.bset, lc, l)) 323 raise error.general('%s:%d: cannot find file: %s' % (self.bset, 324 lc, l)) 305 325 configs += [c] 306 326 except: … … 321 341 configs = [self.bset] 322 342 else: 323 exbset = self.macros.expand(self.bset)343 exbset = macro_expand(self.macros, self.bset) 324 344 self.macros['_bset'] = exbset 325 self.macros['_bset_tmp'] = build.short_name(exbset) 345 bset_tmp = build.short_name(exbset) 346 if bset_tmp.endswith('.bset'): 347 bset_tmp = bset_tmp[:-5] 348 self.macros['_bset_tmp'] = bset_tmp 326 349 root, ext = path.splitext(exbset) 327 350 if exbset.endswith('.bset'): … … 341 364 mail['output'].clear() 342 365 343 log.trace('_bset: % s: make' % (self.bset))366 log.trace('_bset: %2d: %s: make' % (nesting_count, self.bset)) 344 367 log.notice('Build Set: %s' % (self.bset)) 345 368 … … 351 374 start = datetime.datetime.now() 352 375 353 mail_report = False354 have_errors = False376 mail_report = False 377 have_errors = False 355 378 356 379 if mail: 357 380 mail['output'].clear() 358 381 382 # 383 # If this is the outter most buildset it's files installed. Nested 384 # build sets staged their installed file. The staged files are install 385 # when the outtter most build finishes. 386 # 387 if nesting_count != 1: 388 if self.installing(): 389 self.macros['install_mode'] = 'staging' 390 # 391 # Prepend staging areas, bin directory tothe 392 # path. Lets the later package depend on the eailier 393 # ones. 394 # 395 pathprepend = ['%{stagingroot}/bin'] + \ 396 macro_expand(self.macros, '%{_pathprepend}').split(':') 397 pathprepend = [pp for pp in pathprepend if len(pp)] 398 if len(pathprepend) == 1: 399 self.macros['_pathprepend'] = pathprepend[0] 400 else: 401 self.macros['_pathprepend'] = ':'.join(pathprepend) 402 403 # 404 # Only the outter build set can have staging to install. Get the staging 405 # root via the config because it could require a valid config. 406 # 407 have_staging = False 408 359 409 try: 360 410 configs = self.load() 361 411 362 log.trace('_bset: %s: configs: %s' % (self.bset, ','.join(configs))) 412 log.trace('_bset: %2d: %s: configs: %s' % (nesting_count, 413 self.bset, ', '.join(configs))) 363 414 364 415 sizes_valid = False … … 375 426 macros = copy.copy(self.macros) 376 427 if configs[s].endswith('.bset'): 377 log.trace('_bset: == %2d %s' % (nesting_count + 1, '=' * 75)) 428 log.trace('_bset: %2d: %s %s' % (nesting_count, 429 configs[s], 430 '=' * (74 - len(configs[s])))) 378 431 bs = buildset(configs[s], self.configs, opts, macros) 379 432 bs.build(deps, nesting_count, mail) 433 if self.installing(): 434 have_staging = True 380 435 del bs 381 436 elif configs[s].endswith('.cfg'): 382 437 if mail: 383 438 mail_report = True 384 log.trace('_bset: -- %2d %s' % (nesting_count + 1, '-' * 75)) 439 log.trace('_bset: %2d: %s %s' % (nesting_count, 440 configs[s], 441 '=' * (74 - len(configs[s])))) 385 442 try: 386 443 b = build.build(configs[s], … … 413 470 # Dump post build macros. 414 471 # 415 log.trace('_bset: macros post-build')472 log.trace('_bset: : macros post-build') 416 473 log.trace(str(b.macros)) 417 474 else: … … 437 494 raise 438 495 # 439 # Installing ... 440 # 441 log.trace('_bset: installing: deps:%r no-install:%r' % \ 442 (deps is None, self.opts.no_install())) 443 if deps is None \ 444 and not self.opts.no_install() \ 445 and not have_errors: 496 # Installing or staging ... 497 # 498 log.trace('_bset: %2d: %s: deps:%r no-install:%r' % \ 499 (nesting_count, self.install_mode(), 500 deps is None, self.opts.no_install())) 501 log.trace('_bset: %2d: %s: builds: %s' % \ 502 (nesting_count, self.install_mode(), 503 ', '.join([b.name() for b in builds]))) 504 if deps is None and not have_errors: 446 505 for b in builds: 447 log.trace('_bset: installing: %r' % b.installable()) 506 log.trace('_bset: : %s: %r' % (self.install_mode(), 507 b.installable())) 448 508 if b.installable(): 449 self.install(b.name(), 450 b.config.expand('%{buildroot}'), 451 b.config.expand('%{_prefix}')) 509 prefix = b.config.expand('%{_prefix}') 510 buildroot = path.join(b.config.expand('%{buildroot}'), prefix) 511 if self.staging(): 512 prefix = b.config.expand('%{stagingroot}') 513 self.install(self.install_mode(), b.name(), buildroot, prefix) 514 452 515 # 453 516 # Sizes ... … … 470 533 size_patches += path.get_size(p) 471 534 size_total = size_sources + size_patches + size_installed 472 build_max_size_human = build.humanize_number(size_build_max + size_installed, 'B') 535 build_max_size_human = build.humanize_number(size_build_max + 536 size_installed, 'B') 473 537 build_total_size_human = build.humanize_number(size_total, 'B') 474 538 build_sources_size_human = build.humanize_number(size_sources, 'B') … … 500 564 for b in builds: 501 565 del b 566 567 # 568 # If builds have been staged install into the finaly prefix. 569 # 570 if have_staging and not self.opts.no_install() and not have_errors: 571 log.trace('_bset: %2d: install staging' % (nesting_count)) 572 stagingroot = macro_expand(self.macros, '%{stagingroot}') 573 prefix = macro_expand(self.macros, '%{_prefix}') 574 self.install(self.install_mode(), self.bset, stagingroot, prefix) 575 staging_size = path.get_size(stagingroot) 576 if not self.opts.no_clean() or self.opts.always_clean(): 577 log.notice('clean staging: %s' % (self.bset)) 578 log.trace('cleanup: %s' % (stagingroot)) 579 self.rmdir(stagingroot) 580 log.notice('Staging Size: %s' % (build.humanize_number(staging_size))) 502 581 except error.general as gerr: 503 582 if not build_error: … … 587 666 mail['to'] = to_addr[1] 588 667 else: 589 mail['to'] = opts.defaults.expand('%{_mail_tools_to}')668 mail['to'] = macro_expand(opts.defaults, '%{_mail_tools_to}') 590 669 mail['from'] = mail['mail'].from_address() 591 670 log.notice('RTEMS Source Builder - Set Builder, %s' % (version.str())) … … 607 686 deps = None 608 687 if not list_bset_cfg_files(opts, configs): 609 prefix = opts.defaults.expand('%{_prefix}')688 prefix = macro_expand(opts.defaults, '%{_prefix}') 610 689 if opts.canadian_cross(): 611 690 opts.disable_install()
Note: See TracChangeset
for help on using the changeset viewer.