Skip to content

Commit

Permalink
getdeps: fix builds with cached project downloads
Browse files Browse the repository at this point in the history
Summary:
D21364132 accidentally broke this; we can't run the fetcher
for projects for which we pulled the build out of cache, because there
is no source to update in that case.

This commit adjusts the logic so that we write out a marker file
to indicate that we installed a build from cache and to look for
that file being present to gate the new update logic.

Reviewed By: lnicco

Differential Revision: D21419122

fbshipit-source-id: 304670848add22531d88549d66f22c40ff255140
  • Loading branch information
wez authored and facebook-github-bot committed May 6, 2020
1 parent 8eb845b commit 76a9f07
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build/fbcode_builder/getdeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def is_cacheable(self):
""" We only cache third party projects """
return self.cache and self.m.shipit_project is None

def was_cached(self):
cached_marker = os.path.join(self.inst_dir, ".getdeps-cached-build")
return os.path.exists(cached_marker)

def download(self):
if self.is_cacheable() and not os.path.exists(self.inst_dir):
print("check cache for %s" % self.cache_file_name)
Expand All @@ -247,6 +251,11 @@ def download(self):
"Extracting %s -> %s..." % (self.cache_file_name, self.inst_dir)
)
tf.extractall(self.inst_dir)

cached_marker = os.path.join(self.inst_dir, ".getdeps-cached-build")
with open(cached_marker, "w") as f:
f.write("\n")

return True
except Exception as exc:
print("%s" % str(exc))
Expand Down Expand Up @@ -471,7 +480,7 @@ def run_project_cmd(self, args, loader, manifest):
cached_project, fetcher, m, built_marker, project_hash
)

if os.path.exists(built_marker):
if os.path.exists(built_marker) and not cached_project.was_cached():
# We've previously built this. We may need to reconfigure if
# our deps have changed, so let's check them.
dep_reconfigure, dep_build = self.compute_dep_change_status(
Expand Down

0 comments on commit 76a9f07

Please sign in to comment.