@@ -164,8 +164,9 @@ def _compatible_find_existing_binaries(self, node, compatibles, remotes, update)
164164 for package_id , compatible_package in compatibles .items ():
165165 node ._package_id = package_id # Modifying package id under the hood, FIXME
166166 node .binary = None # Invalidate it
167- self ._compatible_process_node_cache (node ) # Doesn't check remotes
168- if node .binary == BINARY_CACHE :
167+ cache_latest_prev = self ._compatible_cache_latest_prev (node ) # not check remotes
168+ if cache_latest_prev :
169+ self ._binary_in_cache (node , cache_latest_prev )
169170 self ._compatible_found (conanfile , package_id , compatible_package )
170171 return
171172 # If not found in the cache, then look first one in servers
@@ -185,9 +186,9 @@ def _compatible_find_existing_binaries(self, node, compatibles, remotes, update)
185186 f"{ conanfile .info .dump_diff (compatible_package )} " )
186187 node ._package_id = package_id # Modifying package id under the hood, FIXME
187188 node .binary = None # Invalidate it
188- self ._compatible_process_node_cache (node ) # Doesn't check remotes
189- if node . binary == BINARY_CACHE :
190- self ._evaluate_cache_update (node . pref , node , remotes , update )
189+ cache_latest_prev = self ._compatible_cache_latest_prev (node ) # Not check remotes
190+ if cache_latest_prev :
191+ self ._evaluate_cache_update (cache_latest_prev , node , remotes , update )
191192 else :
192193 self ._evaluate_download (node , remotes , update )
193194 if node .binary in (BINARY_CACHE , BINARY_UPDATE , BINARY_DOWNLOAD ):
@@ -198,7 +199,7 @@ def _compatible_find_existing_binaries(self, node, compatibles, remotes, update)
198199 node .binary = original_binary
199200 node ._package_id = original_package_id
200201
201- def _compatible_process_node_cache (self , node ):
202+ def _compatible_cache_latest_prev (self , node ):
202203 """ simplified checking of compatible_packages, that should be found existing, but
203204 will never be built, for example. They cannot be editable either at this point.
204205 """
@@ -220,14 +221,16 @@ def _compatible_process_node_cache(self, node):
220221 if not self ._evaluate_clean_pkg_folder_dirty (node , package_layout ):
221222 break
222223
223- if cache_latest_prev is not None :
224- # This binary already exists in the cache, maybe can be updated
225- assert cache_latest_prev .revision
226- assert node .binary is None
227- node .binary = BINARY_CACHE
228- node .binary_remote = None
229- node .prev = cache_latest_prev .revision
230- node .pref_timestamp = cache_latest_prev .timestamp
224+ return cache_latest_prev
225+
226+ @staticmethod
227+ def _binary_in_cache (node , cache_latest_prev ):
228+ assert cache_latest_prev .revision
229+ assert node .binary is None
230+ node .binary = BINARY_CACHE
231+ node .binary_remote = None
232+ node .prev = cache_latest_prev .revision
233+ node .pref_timestamp = cache_latest_prev .timestamp
231234
232235 def _compatible_find_build_binary (self , node , compatibles ):
233236 original_binary = node .binary
0 commit comments