From 6c378a0eab64a6afafff0932d10f407cf10035a8 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 6 May 2020 09:21:06 -0700 Subject: [PATCH] getdeps: fix builds with cached project downloads 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 --- build/fbcode_builder/getdeps.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/fbcode_builder/getdeps.py b/build/fbcode_builder/getdeps.py index bf6e360ac..f488eb6c2 100755 --- a/build/fbcode_builder/getdeps.py +++ b/build/fbcode_builder/getdeps.py @@ -233,6 +233,10 @@ class CachedProject(object): """ 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) @@ -247,6 +251,11 @@ class CachedProject(object): "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)) @@ -471,7 +480,7 @@ class BuildCmd(ProjectCmdBase): 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(