parameters: (args)
docstring: Check command args and run the build command.
docstring_summary: Check command args and run the build command.
docstring_tokens: Check command args and run the build command .
function: def build_cmd(args):
      """Check command args and run the build command."""
      features = _get_features(args)
      log.info('Enabled features: %s', ' '.join(features))
      if args.provider == 'local':
          # NOTE: working dir is /tmp/workspace/kea-dev/pkg
          pkgs_dir = "kea-pkg"
          if os.path.exists(pkgs_dir):
              execute('rm -rf %s' % pkgs_dir)
          os.makedirs(pkgs_dir)
  
          build_local(features, args.from_tarball, args.check_times, int(args.jobs), args.dry_run,
                      args.ccache_dir, args.pkg_version, args.pkg_isc_version, args.repository_url, pkgs_dir)
          # NOTE: upload the locally build packages and leave; the rest of the code is vagrant specific
          if args.upload:
              upload_to_repo(args,pkgs_dir)
  
          return
  
      _check_system_revision(args.system, args.revision)
  
      if 'native-pkg' in features and not args.repository_url:
          msg = "Enabling 'native-pkg' requires passing --repository-url."
          print(msg)
          sys.exit(1)
  
      _check_deps_presence()
  
      if args.provider == 'all':
          providers = ['lxc', 'virtualbox']
      else:
          providers = [args.provider]
  
      if args.system == 'all':
          systems = SYSTEMS.keys()
      else:
          systems = [args.system]
  
      plan = []
      results = {}
      log.info('Build plan:')
      for provider in providers:
          for system in systems:
              if args.revision == 'all':
                  revisions = SYSTEMS[system]
              else:
                  revisions = [args.revision]
  
              for revision in revisions:
                  if args.revision == 'all':
                      key = '%s-%s-%s' % (system, revision, provider)
                      if key not in IMAGE_TEMPLATES:
                          continue
                  plan.append((provider, system, revision))
                  log.info(' - %s, %s, %s', provider, system, revision)
                  results[(provider, system, revision)] = (0, 'not run')
  
      fail = False
      for provider, system, revision in plan:
          ccache_dir = _prepare_ccache_dir(args.ccache_dir, args.system, args.revision)
          result = build_in_vagrant(provider, system, revision, features, args.leave_system, args.from_tarball,
                                    args.dry_run, args.quiet, args.clean_start, args.check_times, int(args.jobs),
                                    ccache_dir, args.pkg_version, args.pkg_isc_version, args.upload, args.repository_url)
          results[(provider, system, revision)] = result
  
          error = result[1]
          if error:
              fail = True
              if isinstance(error, KeyboardInterrupt):
                  break
  
      _print_summary(results, features)
  
      if fail:
          sys.exit(1)
function_tokens: def build_cmd ( args ) : features = _get_features ( args ) log . info ( 'Enabled features: %s' , ' ' . join ( features ) ) if args . provider == 'local' : # NOTE: working dir is /tmp/workspace/kea-dev/pkg pkgs_dir = "kea-pkg" if os . path . exists ( pkgs_dir ) : execute ( 'rm -rf %s' % pkgs_dir ) os . makedirs ( pkgs_dir ) build_local ( features , args . from_tarball , args . check_times , int ( args . jobs ) , args . dry_run , args . ccache_dir , args . pkg_version , args . pkg_isc_version , args . repository_url , pkgs_dir ) # NOTE: upload the locally build packages and leave; the rest of the code is vagrant specific if args . upload : upload_to_repo ( args , pkgs_dir ) return _check_system_revision ( args . system , args . revision ) if 'native-pkg' in features and not args . repository_url : msg = "Enabling 'native-pkg' requires passing --repository-url." print ( msg ) sys . exit ( 1 ) _check_deps_presence ( ) if args . provider == 'all' : providers = [ 'lxc' , 'virtualbox' ] else : providers = [ args . provider ] if args . system == 'all' : systems = SYSTEMS . keys ( ) else : systems = [ args . system ] plan = [ ] results = { } log . info ( 'Build plan:' ) for provider in providers : for system in systems : if args . revision == 'all' : revisions = SYSTEMS [ system ] else : revisions = [ args . revision ] for revision in revisions : if args . revision == 'all' : key = '%s-%s-%s' % ( system , revision , provider ) if key not in IMAGE_TEMPLATES : continue plan . append ( ( provider , system , revision ) ) log . info ( ' - %s, %s, %s' , provider , system , revision ) results [ ( provider , system , revision ) ] = ( 0 , 'not run' ) fail = False for provider , system , revision in plan : ccache_dir = _prepare_ccache_dir ( args . ccache_dir , args . system , args . revision ) result = build_in_vagrant ( provider , system , revision , features , args . leave_system , args . from_tarball , args . dry_run , args . quiet , args . clean_start , args . check_times , int ( args . jobs ) , ccache_dir , args . pkg_version , args . pkg_isc_version , args . upload , args . repository_url ) results [ ( provider , system , revision ) ] = result error = result [ 1 ] if error : fail = True if isinstance ( error , KeyboardInterrupt ) : break _print_summary ( results , features ) if fail : sys . exit ( 1 )