def dump_file_hashes(conf): output = conf.system.dependency_cache o = { 'conf': conf.dict(), 'time': datetime.datetime.utcnow().strftime("%s"), 'files': { } } files = expand_tree(os.path.join(conf.paths.projectroot, conf.paths.source), None) fmap = o['files'] for fn in files: if os.path.exists(fn): fmap[fn] = md5_file(fn) output_dir = os.path.dirname(output) if not os.path.exists(output_dir): os.makedirs(output_dir) with open(output, 'w') as f: json.dump(o, f) logger.info('wrote dependency cache to: {0}'.format(output))
def needs_rebuild(t, d): if dep_map is None: return check_dependency(t, d) elif d in dep_map: fn_hash = md5_file(d) else: return check_dependency(t, d) if dep_map[d] == fn_hash: return False else: return True
def dump_file_hashes(conf): output = conf.system.dependency_cache o = {'time': datetime.datetime.utcnow().strftime("%s"), 'files': {}} files = expand_tree(os.path.join(conf.paths.projectroot, conf.paths.branch_source), None) fmap = o['files'] for fn in files: if os.path.exists(fn): fmap[fn] = md5_file(fn) safe_create_directory(os.path.dirname(output)) with open(output, 'w') as f: json.dump(o, f) logger.debug('wrote dependency cache to: {0}'.format(output))
def dump_file_hashes(conf): output = conf.system.dependency_cache o = {'time': datetime.datetime.utcnow().strftime("%s"), 'files': {}} files = expand_tree( os.path.join(conf.paths.projectroot, conf.paths.branch_source), None) fmap = o['files'] for fn in files: if os.path.exists(fn): fmap[fn] = md5_file(fn) safe_create_directory(os.path.dirname(output)) with open(output, 'w') as f: json.dump(o, f) logger.info('wrote dependency cache to: {0}'.format(output))
def check_hashed_dependency(fn, dep_map, conf): """ :return: ``True`` when any of the files that include ``fn`` have changed since the generation of the the ``dep_map``. Always returns ``True`` if ``dep_map`` is ``None`` (i.e. if this is the first build.) """ # logger.info('checking dependency for: ' + fan) fn = normalize_dep_path(fn, conf, branch=False) if dep_map is None: return True elif not os.path.exists(fn): return True elif fn in dep_map: if dep_map[fn] != md5_file(fn): return True else: return False else: return False