We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remote lookup in offline mode 
Hello,

Following up the small issue that I had during my demo at swampUP:

I was trying to create a package for which I had every build requirement recipe already exported and thus available.

I was expecting to get an error:

>no such package with current options/settings: **build requirement package**

However, it seems that Conan did try to check this package in remotes (with no internet access, it failed). The expected behavior would be for Conan to check the local cache after remotes.

Passing `--build missing` to `conan create` did not fix the issue.

Using Conan v1.3.3

- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conans/client/graph/graph_binaries.py`
Content:
```
1 import os
2 
3 from conans.client.graph.graph import (BINARY_BUILD, BINARY_CACHE, BINARY_DOWNLOAD, BINARY_MISSING,
4                                        BINARY_SKIP, BINARY_UPDATE,
5                                        RECIPE_EDITABLE, BINARY_EDITABLE,
6                                        RECIPE_CONSUMER, RECIPE_VIRTUAL)
7 from conans.errors import NoRemoteAvailable, NotFoundException,\
8     conanfile_exception_formatter
9 from conans.model.info import ConanInfo
10 from conans.model.manifest import FileTreeManifest
11 from conans.model.ref import PackageReference
12 from conans.util.files import is_dirty, rmdir
13 
14 
15 class GraphBinariesAnalyzer(object):
16 
17     def __init__(self, cache, output, remote_manager):
18         self._cache = cache
19         self._out = output
20         self._remote_manager = remote_manager
21         self._registry = cache.registry
22 
23     def _check_update(self, upstream_manifest, package_folder, output, node):
24         read_manifest = FileTreeManifest.load(package_folder)
25         if upstream_manifest != read_manifest:
26             if upstream_manifest.time > read_manifest.time:
27                 output.warn("Current package is older than remote upstream one")
28                 node.update_manifest = upstream_manifest
29                 return True
30             else:
31                 output.warn("Current package is newer than remote upstream one")
32 
33     def _evaluate_node(self, node, build_mode, update, evaluated_nodes, remote_name):
34         assert node.binary is None, "Node.binary should be None"
35         assert node.package_id is not None, "Node.package_id shouldn't be None"
36 
37         ref, conanfile = node.ref, node.conanfile
38         pref = PackageReference(ref, node.package_id)
39 
40         # Check that this same reference hasn't already been checked
41         previous_nodes = evaluated_nodes.get(pref)
42         if previous_nodes:
43             previous_nodes.append(node)
44             previous_node = previous_nodes[0]
45             node.binary = previous_node.binary
46             node.binary_remote = previous_node.binary_remote
47             node.prev = previous_node.prev
48             return
49         evaluated_nodes[pref] = [node]
50 
51         output = conanfile.output
52 
53         if node.recipe == RECIPE_EDITABLE:
54             node.binary = BINARY_EDITABLE
55             # TODO: PREV?
56             return
57 
58         if build_mode.forced(conanfile, ref):
59             output.warn('Forced build from source')
60             node.binary = BINARY_BUILD
61             node.prev = None
62             return
63 
64         package_folder = self._cache.package(pref, short_paths=conanfile.short_paths)
65 
66         # Check if dirty, to remove it
67         with self._cache.package_lock(pref):
68             assert node.recipe != RECIPE_EDITABLE, "Editable package shouldn't reach this code"
69             if is_dirty(package_folder):
70                 output.warn("Package is corrupted, removing folder: %s" % package_folder)
71                 rmdir(package_folder)  # Do not remove if it is EDITABLE
72 
73             if self._cache.config.revisions_enabled:
74                 metadata = self._cache.package_layout(pref.ref).load_metadata()
75                 rec_rev = metadata.packages[pref.id].recipe_revision
76                 if rec_rev and rec_rev != node.ref.revision:
77                     output.warn("The package {} doesn't belong "
78                                 "to the installed recipe revision, removing folder".format(pref))
79                     rmdir(package_folder)
80 
81         if remote_name:
82             remote = self._registry.remotes.get(remote_name)
83         else:
84             # If the remote_name is not given, follow the binary remote, or
85             # the recipe remote
86             # If it is defined it won't iterate (might change in conan2.0)
87             remote = self._registry.prefs.get(pref) or self._registry.refs.get(ref)
88         remotes = self._registry.remotes.list
89 
90         if os.path.exists(package_folder):
91             if update:
92                 if remote:
93                     try:
94                         tmp = self._remote_manager.get_package_manifest(pref, remote)
95                         upstream_manifest, pref = tmp
96                     except NotFoundException:
97                         output.warn("Can't update, no package in remote")
98                     except NoRemoteAvailable:
99                         output.warn("Can't update, no remote defined")
100                     else:
101                         if self._check_update(upstream_manifest, package_folder, output, node):
102                             node.binary = BINARY_UPDATE
103                             node.prev = pref.revision  # With revision
104                             if build_mode.outdated:
105                                 info, pref = self._remote_manager.get_package_info(pref, remote)
106                                 package_hash = info.recipe_hash
107                 elif remotes:
108                     pass
109                 else:
110                     output.warn("Can't update, no remote defined")
111             if not node.binary:
112                 node.binary = BINARY_CACHE
113                 metadata = self._cache.package_layout(pref.ref).load_metadata()
114                 node.prev = metadata.packages[pref.id].revision
115                 package_hash = ConanInfo.load_from_package(package_folder).recipe_hash
116 
117         else:  # Binary does NOT exist locally
118             remote_info = None
119             if remote:
120                 try:
121                     remote_info, pref = self._remote_manager.get_package_info(pref, remote)
122                 except NotFoundException:
123                     pass
124 
125             # If the "remote" came from the registry but the user didn't specified the -r, with
126             # revisions iterate all remotes
127             if not remote or (not remote_info and self._cache.config.revisions_enabled
128                               and not remote_name):
129                 for r in remotes:
130                     try:
131                         remote_info, pref = self._remote_manager.get_package_info(pref, r)
132                     except NotFoundException:
133                         pass
134                     else:
135                         if remote_info:
136                             remote = r
137                             break
138 
139             if remote_info:
140                 node.binary = BINARY_DOWNLOAD
141                 node.prev = pref.revision
142                 package_hash = remote_info.recipe_hash
143             else:
144                 if build_mode.allowed(conanfile):
145                     node.binary = BINARY_BUILD
146                 else:
147                     node.binary = BINARY_MISSING
148                 node.prev = None
149 
150         if build_mode.outdated:
151             if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE):
152                 local_recipe_hash = self._cache.package_layout(ref).recipe_manifest().summary_hash
153                 if local_recipe_hash != package_hash:
154                     output.info("Outdated package!")
155                     node.binary = BINARY_BUILD
156                     node.prev = None
157                 else:
158                     output.info("Package is up to date")
159 
160         node.binary_remote = remote
161 
162     @staticmethod
163     def _compute_package_id(node, default_package_id_mode):
164         conanfile = node.conanfile
165         neighbors = node.neighbors()
166         direct_reqs = []  # of PackageReference
167         indirect_reqs = set()   # of PackageReference, avoid duplicates
168         for neighbor in neighbors:
169             ref, nconan = neighbor.ref, neighbor.conanfile
170             direct_reqs.append(neighbor.pref)
171             indirect_reqs.update(nconan.info.requires.refs())
172             conanfile.options.propagate_downstream(ref, nconan.info.full_options)
173             # Might be never used, but update original requirement, just in case
174             conanfile.requires[ref.name].ref = ref
175 
176         # Make sure not duplicated
177         indirect_reqs.difference_update(direct_reqs)
178         # There might be options that are not upstream, backup them, might be
179         # for build-requires
180         conanfile.build_requires_options = conanfile.options.values
181         conanfile.options.clear_unused(indirect_reqs.union(direct_reqs))
182         conanfile.options.freeze()
183 
184         conanfile.info = ConanInfo.create(conanfile.settings.values,
185                                           conanfile.options.values,
186                                           direct_reqs,
187                                           indirect_reqs,
188                                           default_package_id_mode=default_package_id_mode)
189 
190         # Once we are done, call package_id() to narrow and change possible values
191         with conanfile_exception_formatter(str(conanfile), "package_id"):
192             conanfile.package_id()
193 
194         info = conanfile.info
195         node.package_id = info.package_id()
196 
197     def _handle_private(self, node):
198         if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE, BINARY_SKIP):
199             private_neighbours = node.private_neighbors()
200             for neigh in private_neighbours:
201                 # Current closure contains own node to be skipped
202                 for n in neigh.public_closure.values():
203                     n.binary = BINARY_SKIP
204                     self._handle_private(n)
205 
206     def evaluate_graph(self, deps_graph, build_mode, update, remote_name):
207         default_package_id_mode = self._cache.config.default_package_id_mode
208         evaluated = deps_graph.evaluated
209         for node in deps_graph.ordered_iterate():
210             self._compute_package_id(node, default_package_id_mode)
211             if node.recipe in (RECIPE_CONSUMER, RECIPE_VIRTUAL):
212                 continue
213             self._evaluate_node(node, build_mode, update, evaluated, remote_name)
214             self._handle_private(node)
215
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conans/client/graph/graph_binaries.py b/conans/client/graph/graph_binaries.py
--- a/conans/client/graph/graph_binaries.py
+++ b/conans/client/graph/graph_binaries.py
@@ -121,6 +121,9 @@
                     remote_info, pref = self._remote_manager.get_package_info(pref, remote)
                 except NotFoundException:
                     pass
+                except Exception:
+                    conanfile.output.error("Error downloading binary package: '{}'".format(pref))
+                    raise
 
             # If the "remote" came from the registry but the user didn't specified the -r, with
             # revisions iterate all remotes

{"golden_diff": "diff --git a/conans/client/graph/graph_binaries.py b/conans/client/graph/graph_binaries.py\n--- a/conans/client/graph/graph_binaries.py\n+++ b/conans/client/graph/graph_binaries.py\n@@ -121,6 +121,9 @@\n                     remote_info, pref = self._remote_manager.get_package_info(pref, remote)\n                 except NotFoundException:\n                     pass\n+                except Exception:\n+                    conanfile.output.error(\"Error downloading binary package: '{}'\".format(pref))\n+                    raise\n \n             # If the \"remote\" came from the registry but the user didn't specified the -r, with\n             # revisions iterate all remotes\n", "issue": "Remote lookup in offline mode \nHello,\r\n\r\nFollowing up the small issue that I had during my demo at swampUP:\r\n\r\nI was trying to create a package for which I had every build requirement recipe already exported and thus available.\r\n\r\nI was expecting to get an error:\r\n\r\n>no such package with current options/settings: **build requirement package**\r\n\r\nHowever, it seems that Conan did try to check this package in remotes (with no internet access, it failed). The expected behavior would be for Conan to check the local cache after remotes.\r\n\r\nPassing `--build missing` to `conan create` did not fix the issue.\r\n\r\nUsing Conan v1.3.3\r\n\r\n- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).\r\n- [x] I've specified the Conan version, operating system version and any tool that can be relevant.\r\n- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.\r\n\r\n\n", "before_files": [{"content": "import os\n\nfrom conans.client.graph.graph import (BINARY_BUILD, BINARY_CACHE, BINARY_DOWNLOAD, BINARY_MISSING,\n                                       BINARY_SKIP, BINARY_UPDATE,\n                                       RECIPE_EDITABLE, BINARY_EDITABLE,\n                                       RECIPE_CONSUMER, RECIPE_VIRTUAL)\nfrom conans.errors import NoRemoteAvailable, NotFoundException,\\\n    conanfile_exception_formatter\nfrom conans.model.info import ConanInfo\nfrom conans.model.manifest import FileTreeManifest\nfrom conans.model.ref import PackageReference\nfrom conans.util.files import is_dirty, rmdir\n\n\nclass GraphBinariesAnalyzer(object):\n\n    def __init__(self, cache, output, remote_manager):\n        self._cache = cache\n        self._out = output\n        self._remote_manager = remote_manager\n        self._registry = cache.registry\n\n    def _check_update(self, upstream_manifest, package_folder, output, node):\n        read_manifest = FileTreeManifest.load(package_folder)\n        if upstream_manifest != read_manifest:\n            if upstream_manifest.time > read_manifest.time:\n                output.warn(\"Current package is older than remote upstream one\")\n                node.update_manifest = upstream_manifest\n                return True\n            else:\n                output.warn(\"Current package is newer than remote upstream one\")\n\n    def _evaluate_node(self, node, build_mode, update, evaluated_nodes, remote_name):\n        assert node.binary is None, \"Node.binary should be None\"\n        assert node.package_id is not None, \"Node.package_id shouldn't be None\"\n\n        ref, conanfile = node.ref, node.conanfile\n        pref = PackageReference(ref, node.package_id)\n\n        # Check that this same reference hasn't already been checked\n        previous_nodes = evaluated_nodes.get(pref)\n        if previous_nodes:\n            previous_nodes.append(node)\n            previous_node = previous_nodes[0]\n            node.binary = previous_node.binary\n            node.binary_remote = previous_node.binary_remote\n            node.prev = previous_node.prev\n            return\n        evaluated_nodes[pref] = [node]\n\n        output = conanfile.output\n\n        if node.recipe == RECIPE_EDITABLE:\n            node.binary = BINARY_EDITABLE\n            # TODO: PREV?\n            return\n\n        if build_mode.forced(conanfile, ref):\n            output.warn('Forced build from source')\n            node.binary = BINARY_BUILD\n            node.prev = None\n            return\n\n        package_folder = self._cache.package(pref, short_paths=conanfile.short_paths)\n\n        # Check if dirty, to remove it\n        with self._cache.package_lock(pref):\n            assert node.recipe != RECIPE_EDITABLE, \"Editable package shouldn't reach this code\"\n            if is_dirty(package_folder):\n                output.warn(\"Package is corrupted, removing folder: %s\" % package_folder)\n                rmdir(package_folder)  # Do not remove if it is EDITABLE\n\n            if self._cache.config.revisions_enabled:\n                metadata = self._cache.package_layout(pref.ref).load_metadata()\n                rec_rev = metadata.packages[pref.id].recipe_revision\n                if rec_rev and rec_rev != node.ref.revision:\n                    output.warn(\"The package {} doesn't belong \"\n                                \"to the installed recipe revision, removing folder\".format(pref))\n                    rmdir(package_folder)\n\n        if remote_name:\n            remote = self._registry.remotes.get(remote_name)\n        else:\n            # If the remote_name is not given, follow the binary remote, or\n            # the recipe remote\n            # If it is defined it won't iterate (might change in conan2.0)\n            remote = self._registry.prefs.get(pref) or self._registry.refs.get(ref)\n        remotes = self._registry.remotes.list\n\n        if os.path.exists(package_folder):\n            if update:\n                if remote:\n                    try:\n                        tmp = self._remote_manager.get_package_manifest(pref, remote)\n                        upstream_manifest, pref = tmp\n                    except NotFoundException:\n                        output.warn(\"Can't update, no package in remote\")\n                    except NoRemoteAvailable:\n                        output.warn(\"Can't update, no remote defined\")\n                    else:\n                        if self._check_update(upstream_manifest, package_folder, output, node):\n                            node.binary = BINARY_UPDATE\n                            node.prev = pref.revision  # With revision\n                            if build_mode.outdated:\n                                info, pref = self._remote_manager.get_package_info(pref, remote)\n                                package_hash = info.recipe_hash\n                elif remotes:\n                    pass\n                else:\n                    output.warn(\"Can't update, no remote defined\")\n            if not node.binary:\n                node.binary = BINARY_CACHE\n                metadata = self._cache.package_layout(pref.ref).load_metadata()\n                node.prev = metadata.packages[pref.id].revision\n                package_hash = ConanInfo.load_from_package(package_folder).recipe_hash\n\n        else:  # Binary does NOT exist locally\n            remote_info = None\n            if remote:\n                try:\n                    remote_info, pref = self._remote_manager.get_package_info(pref, remote)\n                except NotFoundException:\n                    pass\n\n            # If the \"remote\" came from the registry but the user didn't specified the -r, with\n            # revisions iterate all remotes\n            if not remote or (not remote_info and self._cache.config.revisions_enabled\n                              and not remote_name):\n                for r in remotes:\n                    try:\n                        remote_info, pref = self._remote_manager.get_package_info(pref, r)\n                    except NotFoundException:\n                        pass\n                    else:\n                        if remote_info:\n                            remote = r\n                            break\n\n            if remote_info:\n                node.binary = BINARY_DOWNLOAD\n                node.prev = pref.revision\n                package_hash = remote_info.recipe_hash\n            else:\n                if build_mode.allowed(conanfile):\n                    node.binary = BINARY_BUILD\n                else:\n                    node.binary = BINARY_MISSING\n                node.prev = None\n\n        if build_mode.outdated:\n            if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE):\n                local_recipe_hash = self._cache.package_layout(ref).recipe_manifest().summary_hash\n                if local_recipe_hash != package_hash:\n                    output.info(\"Outdated package!\")\n                    node.binary = BINARY_BUILD\n                    node.prev = None\n                else:\n                    output.info(\"Package is up to date\")\n\n        node.binary_remote = remote\n\n    @staticmethod\n    def _compute_package_id(node, default_package_id_mode):\n        conanfile = node.conanfile\n        neighbors = node.neighbors()\n        direct_reqs = []  # of PackageReference\n        indirect_reqs = set()   # of PackageReference, avoid duplicates\n        for neighbor in neighbors:\n            ref, nconan = neighbor.ref, neighbor.conanfile\n            direct_reqs.append(neighbor.pref)\n            indirect_reqs.update(nconan.info.requires.refs())\n            conanfile.options.propagate_downstream(ref, nconan.info.full_options)\n            # Might be never used, but update original requirement, just in case\n            conanfile.requires[ref.name].ref = ref\n\n        # Make sure not duplicated\n        indirect_reqs.difference_update(direct_reqs)\n        # There might be options that are not upstream, backup them, might be\n        # for build-requires\n        conanfile.build_requires_options = conanfile.options.values\n        conanfile.options.clear_unused(indirect_reqs.union(direct_reqs))\n        conanfile.options.freeze()\n\n        conanfile.info = ConanInfo.create(conanfile.settings.values,\n                                          conanfile.options.values,\n                                          direct_reqs,\n                                          indirect_reqs,\n                                          default_package_id_mode=default_package_id_mode)\n\n        # Once we are done, call package_id() to narrow and change possible values\n        with conanfile_exception_formatter(str(conanfile), \"package_id\"):\n            conanfile.package_id()\n\n        info = conanfile.info\n        node.package_id = info.package_id()\n\n    def _handle_private(self, node):\n        if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE, BINARY_SKIP):\n            private_neighbours = node.private_neighbors()\n            for neigh in private_neighbours:\n                # Current closure contains own node to be skipped\n                for n in neigh.public_closure.values():\n                    n.binary = BINARY_SKIP\n                    self._handle_private(n)\n\n    def evaluate_graph(self, deps_graph, build_mode, update, remote_name):\n        default_package_id_mode = self._cache.config.default_package_id_mode\n        evaluated = deps_graph.evaluated\n        for node in deps_graph.ordered_iterate():\n            self._compute_package_id(node, default_package_id_mode)\n            if node.recipe in (RECIPE_CONSUMER, RECIPE_VIRTUAL):\n                continue\n            self._evaluate_node(node, build_mode, update, evaluated, remote_name)\n            self._handle_private(node)\n", "path": "conans/client/graph/graph_binaries.py"}], "after_files": [{"content": "import os\n\nfrom conans.client.graph.graph import (BINARY_BUILD, BINARY_CACHE, BINARY_DOWNLOAD, BINARY_MISSING,\n                                       BINARY_SKIP, BINARY_UPDATE,\n                                       RECIPE_EDITABLE, BINARY_EDITABLE,\n                                       RECIPE_CONSUMER, RECIPE_VIRTUAL)\nfrom conans.errors import NoRemoteAvailable, NotFoundException,\\\n    conanfile_exception_formatter\nfrom conans.model.info import ConanInfo\nfrom conans.model.manifest import FileTreeManifest\nfrom conans.model.ref import PackageReference\nfrom conans.util.files import is_dirty, rmdir\n\n\nclass GraphBinariesAnalyzer(object):\n\n    def __init__(self, cache, output, remote_manager):\n        self._cache = cache\n        self._out = output\n        self._remote_manager = remote_manager\n        self._registry = cache.registry\n\n    def _check_update(self, upstream_manifest, package_folder, output, node):\n        read_manifest = FileTreeManifest.load(package_folder)\n        if upstream_manifest != read_manifest:\n            if upstream_manifest.time > read_manifest.time:\n                output.warn(\"Current package is older than remote upstream one\")\n                node.update_manifest = upstream_manifest\n                return True\n            else:\n                output.warn(\"Current package is newer than remote upstream one\")\n\n    def _evaluate_node(self, node, build_mode, update, evaluated_nodes, remote_name):\n        assert node.binary is None, \"Node.binary should be None\"\n        assert node.package_id is not None, \"Node.package_id shouldn't be None\"\n\n        ref, conanfile = node.ref, node.conanfile\n        pref = PackageReference(ref, node.package_id)\n\n        # Check that this same reference hasn't already been checked\n        previous_nodes = evaluated_nodes.get(pref)\n        if previous_nodes:\n            previous_nodes.append(node)\n            previous_node = previous_nodes[0]\n            node.binary = previous_node.binary\n            node.binary_remote = previous_node.binary_remote\n            node.prev = previous_node.prev\n            return\n        evaluated_nodes[pref] = [node]\n\n        output = conanfile.output\n\n        if node.recipe == RECIPE_EDITABLE:\n            node.binary = BINARY_EDITABLE\n            # TODO: PREV?\n            return\n\n        if build_mode.forced(conanfile, ref):\n            output.warn('Forced build from source')\n            node.binary = BINARY_BUILD\n            node.prev = None\n            return\n\n        package_folder = self._cache.package(pref, short_paths=conanfile.short_paths)\n\n        # Check if dirty, to remove it\n        with self._cache.package_lock(pref):\n            assert node.recipe != RECIPE_EDITABLE, \"Editable package shouldn't reach this code\"\n            if is_dirty(package_folder):\n                output.warn(\"Package is corrupted, removing folder: %s\" % package_folder)\n                rmdir(package_folder)  # Do not remove if it is EDITABLE\n\n            if self._cache.config.revisions_enabled:\n                metadata = self._cache.package_layout(pref.ref).load_metadata()\n                rec_rev = metadata.packages[pref.id].recipe_revision\n                if rec_rev and rec_rev != node.ref.revision:\n                    output.warn(\"The package {} doesn't belong \"\n                                \"to the installed recipe revision, removing folder\".format(pref))\n                    rmdir(package_folder)\n\n        if remote_name:\n            remote = self._registry.remotes.get(remote_name)\n        else:\n            # If the remote_name is not given, follow the binary remote, or\n            # the recipe remote\n            # If it is defined it won't iterate (might change in conan2.0)\n            remote = self._registry.prefs.get(pref) or self._registry.refs.get(ref)\n        remotes = self._registry.remotes.list\n\n        if os.path.exists(package_folder):\n            if update:\n                if remote:\n                    try:\n                        tmp = self._remote_manager.get_package_manifest(pref, remote)\n                        upstream_manifest, pref = tmp\n                    except NotFoundException:\n                        output.warn(\"Can't update, no package in remote\")\n                    except NoRemoteAvailable:\n                        output.warn(\"Can't update, no remote defined\")\n                    else:\n                        if self._check_update(upstream_manifest, package_folder, output, node):\n                            node.binary = BINARY_UPDATE\n                            node.prev = pref.revision  # With revision\n                            if build_mode.outdated:\n                                info, pref = self._remote_manager.get_package_info(pref, remote)\n                                package_hash = info.recipe_hash\n                elif remotes:\n                    pass\n                else:\n                    output.warn(\"Can't update, no remote defined\")\n            if not node.binary:\n                node.binary = BINARY_CACHE\n                metadata = self._cache.package_layout(pref.ref).load_metadata()\n                node.prev = metadata.packages[pref.id].revision\n                package_hash = ConanInfo.load_from_package(package_folder).recipe_hash\n\n        else:  # Binary does NOT exist locally\n            remote_info = None\n            if remote:\n                try:\n                    remote_info, pref = self._remote_manager.get_package_info(pref, remote)\n                except NotFoundException:\n                    pass\n                except Exception:\n                    conanfile.output.error(\"Error downloading binary package: '{}'\".format(pref))\n                    raise\n\n            # If the \"remote\" came from the registry but the user didn't specified the -r, with\n            # revisions iterate all remotes\n            if not remote or (not remote_info and self._cache.config.revisions_enabled\n                              and not remote_name):\n                for r in remotes:\n                    try:\n                        remote_info, pref = self._remote_manager.get_package_info(pref, r)\n                    except NotFoundException:\n                        pass\n                    else:\n                        if remote_info:\n                            remote = r\n                            break\n\n            if remote_info:\n                node.binary = BINARY_DOWNLOAD\n                node.prev = pref.revision\n                package_hash = remote_info.recipe_hash\n            else:\n                if build_mode.allowed(conanfile):\n                    node.binary = BINARY_BUILD\n                else:\n                    node.binary = BINARY_MISSING\n                node.prev = None\n\n        if build_mode.outdated:\n            if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE):\n                local_recipe_hash = self._cache.package_layout(ref).recipe_manifest().summary_hash\n                if local_recipe_hash != package_hash:\n                    output.info(\"Outdated package!\")\n                    node.binary = BINARY_BUILD\n                    node.prev = None\n                else:\n                    output.info(\"Package is up to date\")\n\n        node.binary_remote = remote\n\n    @staticmethod\n    def _compute_package_id(node, default_package_id_mode):\n        conanfile = node.conanfile\n        neighbors = node.neighbors()\n        direct_reqs = []  # of PackageReference\n        indirect_reqs = set()   # of PackageReference, avoid duplicates\n        for neighbor in neighbors:\n            ref, nconan = neighbor.ref, neighbor.conanfile\n            direct_reqs.append(neighbor.pref)\n            indirect_reqs.update(nconan.info.requires.refs())\n            conanfile.options.propagate_downstream(ref, nconan.info.full_options)\n            # Might be never used, but update original requirement, just in case\n            conanfile.requires[ref.name].ref = ref\n\n        # Make sure not duplicated\n        indirect_reqs.difference_update(direct_reqs)\n        # There might be options that are not upstream, backup them, might be\n        # for build-requires\n        conanfile.build_requires_options = conanfile.options.values\n        conanfile.options.clear_unused(indirect_reqs.union(direct_reqs))\n        conanfile.options.freeze()\n\n        conanfile.info = ConanInfo.create(conanfile.settings.values,\n                                          conanfile.options.values,\n                                          direct_reqs,\n                                          indirect_reqs,\n                                          default_package_id_mode=default_package_id_mode)\n\n        # Once we are done, call package_id() to narrow and change possible values\n        with conanfile_exception_formatter(str(conanfile), \"package_id\"):\n            conanfile.package_id()\n\n        info = conanfile.info\n        node.package_id = info.package_id()\n\n    def _handle_private(self, node):\n        if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE, BINARY_SKIP):\n            private_neighbours = node.private_neighbors()\n            for neigh in private_neighbours:\n                # Current closure contains own node to be skipped\n                for n in neigh.public_closure.values():\n                    n.binary = BINARY_SKIP\n                    self._handle_private(n)\n\n    def evaluate_graph(self, deps_graph, build_mode, update, remote_name):\n        default_package_id_mode = self._cache.config.default_package_id_mode\n        evaluated = deps_graph.evaluated\n        for node in deps_graph.ordered_iterate():\n            self._compute_package_id(node, default_package_id_mode)\n            if node.recipe in (RECIPE_CONSUMER, RECIPE_VIRTUAL):\n                continue\n            self._evaluate_node(node, build_mode, update, evaluated, remote_name)\n            self._handle_private(node)\n", "path": "conans/client/graph/graph_binaries.py"}]}