def diff_(): global cfg layout_packages = [] cfg["update"] = False if len(sys.argv) < 3: buildconf.fetchPackages(cfg, layout_packages) else: if sys.argv[2] == "buildconf": diff_remotes() else: buildconf.fetchPackage(cfg, sys.argv[2], layout_packages) deps = [] checked = [] if cfg["checkDeps"]: for p in layout_packages: bob_package.getDeps(cfg, p, deps, checked) toInstall = [] diffs = [] for d in deps[::-1]: if d not in toInstall: toInstall.append(d) for p in layout_packages: if p not in toInstall: toInstall.append(p) for p in toInstall: if p in cfg["osdeps"]: continue if p in cfg["ignorePackages"] or "orogen" in p: continue if p in cfg["overrides"] and "fetch" in cfg["overrides"][p]: continue path = cfg["devDir"] + "/" + p p2 = p while not os.path.isdir(path + "/.git"): path = "/".join(path.split("/")[:-1]) p2 = "/".join(p2.split("/")[:-1]) if path == cfg["devDir"]: break if path == cfg["devDir"]: cfg["errors"].append("missing: git for " + p) continue if path not in diffs: diffs.append(path) out, err, r = execute.do( ["git", "diff"], cfg, None, path) #, p2.replace("/", "_")+"_diff.txt") if out: logFile = cfg["devDir"] + "/autoproj/bob/logs/" + p2.replace( "/", "_") + "_diff.txt" print(p2 + ": ", end="") c.printWarning("has diff") print(" check: less " + logFile) sys.stdout.flush() with open(logFile, "w") as f: f.write(out) else: print(p2 + ": ", end="") c.printBold("no diff")
def fetchi(package, returnPackages = False): layout_packages = [] if len(package) == 0: buildconf.fetchPackages(cfg, layout_packages) else: buildconf.fetchPackage(cfg, package, layout_packages) if not cfg["continueOnError"] and len(cfg["errors"]) > 0: printErrors() return # track dependencies and do the same for build and rebuild deps = [] mans = [] if cfg["checkDeps"]: mans = list(layout_packages) handled = [] output = [] checked = [] while len(mans) > 0: p = mans.pop() bob_package.getDeps(cfg, p, deps, None) while len(deps) > 0: d = deps.pop() if d not in layout_packages and d not in handled: mans2 = list(layout_packages) if not buildconf.fetchPackage(cfg, d, mans2): if d in cfg["depsInverse"]: output.append([d, cfg["depsInverse"][d]]) handled.append(d) for m in mans2: if m not in layout_packages: layout_packages.append(m) mans.append(m) print sys.stdout.flush() for i in output: print c.ERROR + i[0] + c.END + " is dep from: " + ", ".join(i[1]) sys.stdout.flush() if returnPackages: return layout_packages
def install_(): global cfg layout_packages = [] cfg["update"] = False if len(sys.argv) < 3: buildconf.fetchPackages(cfg, layout_packages) else: buildconf.fetchPackage(cfg, sys.argv[2], layout_packages) deps = [] checked = [] if cfg["checkDeps"]: for p in layout_packages: bob_package.getDeps(cfg, p, deps, checked) #print deps toInstall = [] for d in deps[::-1]: if d not in toInstall: toInstall.append(d) for p in layout_packages: if p not in toInstall: toInstall.append(p) while len(toInstall) > 0: threads = [] jobs = [] iList = list(toInstall) toInstall = [] for p in iList: wait = False #c.printWarning(str(cfg["deps"][p])) if p in cfg["deps"]: for d in cfg["deps"][p]: if d in iList: wait = True break if not wait: jobs.append(p) if p in cfg["overrides"] and "install" in cfg["overrides"][p]: if cfg["multiprocessing"]: threads.append(Thread(target=cfg["overrides"][p]["install"], args=(cfg,))) else: c.printNormal("Install: "+p) le = len(cfg["errors"]) cfg["overrides"][p]["install"](cfg) if len(cfg["errors"]) <= le: c.printWarning("done") else: c.printError("error") elif p in cfg["osdeps"]: # os deps are installed in fetch phase continue else: if cfg["multiprocessing"]: threads.append(Thread(target=bob_package.installPackage, args=(cfg, p))) else: c.printNormal("Install: "+p) le = len(cfg["errors"]) bob_package.installPackage(cfg, p) if len(cfg["errors"]) <= le: c.printWarning("done") else: c.printError("error") else: toInstall.append(p) if cfg["multiprocessing"]: c.printBold("Install: "+str(jobs)) le = len(cfg["errors"]) for t in threads: t.start() for t in threads: t.join() if len(cfg["errors"]) > le: foo = ""
def install_(): global cfg layout_packages = [] cfg["update"] = False filterArgs = ["-n", "-k"] if len(sys.argv) < 3 or sys.argv[2] in filterArgs: # search path upwards for a manifest.xml # if not found build manifest from buildconf pathToCheck = os.getcwd() found = False done = False while not done: if os.path.isfile(pathToCheck + "/manifest.xml"): found = True done = True elif os.path.exists(pathToCheck + "/autoproj"): # found dev root done = True else: arrPath = pathToCheck.split("/") if len(arrPath) == 1: done = True else: pathToCheck = "/".join(arrPath[:-1]) if found: layout_packages.append(os.path.relpath(pathToCheck, cfg["devDir"])) else: buildconf.fetchPackages(cfg, layout_packages) else: pathToCheck = os.path.join(os.getcwd(), sys.argv[2]) if os.path.isfile(pathToCheck + "/manifest.xml"): layout_packages.append(os.path.relpath(pathToCheck, cfg["devDir"])) else: buildconf.fetchPackage(cfg, sys.argv[2], layout_packages) deps = [] checked = [] if cfg["checkDeps"]: for p in layout_packages: bob_package.getDeps(cfg, p, deps, checked) toInstall = [] for d in deps[::-1]: if d not in toInstall: toInstall.append(d) for p in layout_packages: if p not in toInstall: toInstall.append(p) iList = [] while len(toInstall) > 0: threads = [] jobs = [] oldList = iList iList = list(toInstall) if oldList == iList: # detect unresolved deps loop for p in oldList: c.printError("detect dependency cycle:\n " + str(p)) c.printWarning(" deps:") if p in cfg["deps"]: for d in cfg["deps"][p]: if d in iList: c.printWarning(" - " + str(d)) exit(-1) toInstall = [] for p in iList: wait = False if p in cfg["deps"]: for d in cfg["deps"][p]: if d in iList: wait = True break if not wait: jobs.append(p) if p in cfg["overrides"] and "install" in cfg["overrides"][p]: if cfg["multiprocessing"]: threads.append( Thread(target=cfg["overrides"][p]["install"], args=(cfg, ))) else: c.printNormal("Install: " + p) le = len(cfg["errors"]) cfg["overrides"][p]["install"](cfg) if len(cfg["errors"]) <= le: c.printWarning("done") else: c.printError("error") elif p in cfg["osdeps"]: # os deps are installed in fetch phase continue else: if cfg["multiprocessing"]: threads.append( Thread(target=bob_package.installPackage, args=(cfg, p))) else: c.printNormal("Install: " + p) le = len(cfg["errors"]) bob_package.installPackage(cfg, p) if len(cfg["errors"]) <= le: c.printWarning("done") else: c.printError("error") else: toInstall.append(p) if cfg["multiprocessing"]: c.printBold("Install: " + str(jobs)) le = len(cfg["errors"]) for t in threads: t.start() for t in threads: t.join() if len(cfg["errors"]) > le: foo = ""