Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps pinning prototype 1 (#146) #147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions mod/dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def get_imports(fips_dir, proj_dir) :
proj_name = util.get_project_name_from_dir(proj_dir)
imports = {}
if util.is_valid_project_dir(proj_dir) :
# TODO: Load .fips.pinned_deps instead on `fips update --from-pinned-deps`.
dic = util.load_fips_yml(proj_dir)
if 'imports' in dic :
imports = dic['imports']
Expand Down Expand Up @@ -483,7 +484,7 @@ def _rec_update_imports(fips_dir, proj_dir, handled) :
ws_dir = util.get_workspace_dir(fips_dir)
proj_name = util.get_project_name_from_dir(proj_dir)
if proj_name not in handled :
handled.append(proj_name)
handled[proj_name] = None
imports = get_imports(fips_dir, proj_dir)
for dep in imports:
dep_proj_name = dep
Expand All @@ -509,6 +510,7 @@ def _rec_update_imports(fips_dir, proj_dir, handled) :
log.warn(" '{}' does not exist, please run 'fips fetch'".format(dep_proj_dir))
# recuse
if dep_ok :
handled[dep_proj_name] = [dep['git'], git.get_local_rev(dep_proj_dir, "HEAD")]
handled = _rec_update_imports(fips_dir, dep_proj_dir, handled)
# done, return the new handled array
return handled
Expand All @@ -521,4 +523,10 @@ def update_imports(fips_dir, proj_dir):
:param proj_dir: absolute project directory
:returns: True if checks were valid
"""
_rec_update_imports(fips_dir, proj_dir, [])
handled = _rec_update_imports(fips_dir, proj_dir, OrderedDict())
# TODO: Write to a file, e.g., .fips.pinned_deps, instead of printing.
print 'imports:'
for dep, git_rev in reversed(handled.items()[1:]):
print ' ' + dep + ':'
print ' git: ' + git_rev[0]
print ' rev: ' + git_rev[1]