def STAGE3_loop(pkgdir_paths, nb_cpu): total = len(pkgdir_paths) job_queue = [] for pkgdir_path in pkgdir_paths: try: pkg = bbs.parse.getPkgFromDir(pkgdir_path) version = bbs.parse.getVersionFromDir(pkgdir_path) srcpkg_file = bbs.parse.getSrcPkgFileFromDir(pkgdir_path) except IOError: print "BBS> Can't read DESCRIPTION file!" else: cmd = BBSbase.getSTAGE3cmd(pkgdir_path) pkgdumps_prefix = pkg + '.buildsrc' pkgdumps = BBSbase.PkgDumps(srcpkg_file, pkgdumps_prefix) job = BBSbase.BuildPkg_Job(pkg, version, cmd, pkgdumps, BBSvars.buildsrc_rdir) job_queue.append(job) nb_jobs = len(job_queue) print "BBS> BEGIN STAGE3 loop." t0 = time.time() nb_products = bbs.jobs.processJobQueue(job_queue, None, nb_cpu, BBScorevars.r_cmd_timeout, True) dt = time.time() - t0 print "BBS> END STAGE3 loop." print "BBS> -------------------------------------------------------------" print "BBS> STAGE3 SUMMARY:" print "BBS> o Working dir: %s" % os.getcwd() print "BBS> o %d pkg(s) listed in file BBS_CENTRAL_BASEURL/%s" % (total, BBScorevars.meat_index_file) print "BBS> o %d pkg dir(s) queued and processed" % nb_jobs print "BBS> o %d srcpkg file(s) produced" % nb_products print "BBS> o Total time: %.2f seconds" % dt print "BBS> -------------------------------------------------------------" return
def STAGE3_loop(pkgdir_paths, nb_cpu): total = len(pkgdir_paths) job_queue = [] for pkgdir_path in pkgdir_paths: try: pkg = bbs.parse.getPkgFromDir(pkgdir_path) version = bbs.parse.getVersionFromDir(pkgdir_path) srcpkg_file = bbs.parse.getSrcPkgFileFromDir(pkgdir_path) except IOError: print "BBS> Can't read DESCRIPTION file!" else: cmd = BBSbase.getSTAGE3cmd(pkgdir_path) pkgdumps_prefix = pkg + '.buildsrc' pkgdumps = BBSbase.PkgDumps(srcpkg_file, pkgdumps_prefix) job = BBSbase.BuildPkg_Job(pkg, version, cmd, pkgdumps, BBSvars.buildsrc_rdir) job_queue.append(job) nb_jobs = len(job_queue) print "BBS> BEGIN STAGE3 loop." t0 = time.time() nb_products = bbs.jobs.processJobQueue(job_queue, None, nb_cpu, BBScorevars.r_cmd_timeout, True) dt = time.time() - t0 print "BBS> END STAGE3 loop." print "BBS> -------------------------------------------------------------" print "BBS> STAGE3 SUMMARY:" print "BBS> o Working dir: %s" % os.getcwd() print "BBS> o %d pkg(s) listed in file BBS_CENTRAL_BASEURL/%s" % ( total, BBScorevars.meat_index_file) print "BBS> o %d pkg dir(s) queued and processed" % nb_jobs print "BBS> o %d srcpkg file(s) produced" % nb_products print "BBS> o Total time: %.2f seconds" % dt print "BBS> -------------------------------------------------------------" return
def prepare_STAGE3_job_queue(pkgdir_paths): print "BBS> Preparing STAGE3 job queue ... ", stage = 'buildsrc' jobs = [] for pkgdir_path in pkgdir_paths: try: pkg = bbs.parse.getPkgFromDir(pkgdir_path) version = bbs.parse.getVersionFromDir(pkgdir_path) srcpkg_file = bbs.parse.getSrcPkgFileFromDir(pkgdir_path) except IOError: print "BBS> Can't read DESCRIPTION file!" else: cmd = BBSbase.getSTAGE3cmd(pkgdir_path) pkgdumps_prefix = pkg + '.' + stage pkgdumps = BBSbase.PkgDumps(srcpkg_file, pkgdumps_prefix) job = BBSbase.BuildPkg_Job(pkg, version, cmd, pkgdumps, BBSvars.buildsrc_rdir) jobs.append(job) print "OK" job_queue = bbs.jobs.JobQueue(stage, jobs, None) job_queue._total = len(pkgdir_paths) return job_queue
def prepare_STAGE3_job_queue(pkgsrctrees, out_dir): print("BBS> Preparing STAGE3 job queue ...", end=" ") sys.stdout.flush() stage = 'buildsrc' jobs = [] for pkgsrctree in pkgsrctrees: try: pkg = bbs.parse.get_Package_from_pkgsrctree(pkgsrctree) version = bbs.parse.get_Version_from_pkgsrctree(pkgsrctree) srcpkg_file = bbs.parse.make_srcpkg_file_from_pkgsrctree( pkgsrctree) except IOError: print("BBS> Can't read DESCRIPTION file!") else: cmd = BBSbase.getSTAGE3cmd(pkgsrctree) pkgdumps_prefix = pkg + '.' + stage pkgdumps = BBSbase.PkgDumps(srcpkg_file, pkgdumps_prefix) job = BBSbase.BuildPkg_Job(pkg, version, cmd, pkgdumps, out_dir) jobs.append(job) print("OK") sys.stdout.flush() job_queue = bbs.jobs.JobQueue(stage, jobs, None) job_queue._total = len(pkgsrctrees) return job_queue