prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  conan export-pkg with --package-folder does not set the metadata info
  When an export-pkg command is used with the ``--package-folder``, the *metadata.json* is not updated with the package ID and package revision.
  
  Then, when the user tries to upload the package ir errors with:
  ```
  ERROR: Binary package hello/1.0@user/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 not found
  ```
  
  Here is a test reproducing the issue:
  
  ```
      def upload_export_pkg_test(self):
          """
          Package metadata is created when doing an export-pkg and then uploading the package
          """
          server1 = TestServer([("*/*@*/*", "*")], [("*/*@*/*", "*")], users={"lasote": "mypass"})
          servers = OrderedDict()
          servers["server1"] = server1
          client = TestClient(servers=servers)
          client.save({"release/kk.lib": ""})
          client.run("user lasote -r server1 -p mypass")
          client.run("new hello/1.0 --header")
          client.run("export-pkg . user/testing -pf release")
          client.run("upload hello/1.0@user/testing --all -r server1")
  ```
  
  The original issue comes from #4768
  
  </issue>
  <code>
  [start of conans/client/cmd/export_pkg.py]
  1 import os
  2 
  3 from conans.client import packager
  4 from conans.client.graph.graph_manager import load_deps_info
  5 from conans.errors import ConanException
  6 from conans.model.manifest import FileTreeManifest
  7 from conans.model.ref import PackageReference
  8 from conans.util.files import rmdir
  9 
  10 
  11 def export_pkg(cache, graph_manager, hook_manager, recorder, output,
  12                ref, source_folder, build_folder, package_folder, install_folder,
  13                graph_info, force):
  14 
  15     conan_file_path = cache.conanfile(ref)
  16     if not os.path.exists(conan_file_path):
  17         raise ConanException("Package recipe '%s' does not exist" % str(ref))
  18 
  19     # The graph has to be loaded with build_mode=[ref.name], so that node is not tried
  20     # to be downloaded from remotes
  21     deps_graph, _ = graph_manager.load_graph(ref, None, graph_info=graph_info, build_mode=[ref.name],
  22                                              check_updates=False, update=False,
  23                                              remote_name=None, recorder=recorder)
  24     # this is a bit tricky, but works. The root (virtual), has only 1 neighbor,
  25     # which is the exported pkg
  26     nodes = deps_graph.root.neighbors()
  27     conanfile = nodes[0].conanfile
  28     from conans.client.conan_api import existing_info_files
  29     if install_folder and existing_info_files(install_folder):
  30         load_deps_info(install_folder, conanfile, required=True)
  31     package_id = nodes[0].package_id
  32     output.info("Packaging to %s" % package_id)
  33     pref = PackageReference(ref, package_id)
  34     dest_package_folder = cache.package(pref, short_paths=conanfile.short_paths)
  35 
  36     if os.path.exists(dest_package_folder):
  37         if force:
  38             rmdir(dest_package_folder)
  39         else:
  40             raise ConanException("Package already exists. Please use --force, -f to "
  41                                  "overwrite it")
  42 
  43     recipe_hash = cache.package_layout(ref).recipe_manifest().summary_hash
  44     conanfile.info.recipe_hash = recipe_hash
  45     conanfile.develop = True
  46     if package_folder:
  47         packager.export_pkg(conanfile, package_id, package_folder, dest_package_folder,
  48                             hook_manager, conan_file_path, ref)
  49     else:
  50         packager.create_package(conanfile, package_id, source_folder, build_folder,
  51                                 dest_package_folder, install_folder, hook_manager, conan_file_path,
  52                                 ref, local=True)
  53         with cache.package_layout(ref).update_metadata() as metadata:
  54             readed_manifest = FileTreeManifest.load(dest_package_folder)
  55             metadata.packages[package_id].revision = readed_manifest.summary_hash
  56             metadata.packages[package_id].recipe_revision = metadata.recipe.revision
  57 
  58     recorder.package_exported(pref)
  59
  [end of conans/client/cmd/export_pkg.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/conans/client/cmd/export_pkg.py b/conans/client/cmd/export_pkg.py
  --- a/conans/client/cmd/export_pkg.py
  +++ b/conans/client/cmd/export_pkg.py
  @@ -50,9 +50,9 @@
           packager.create_package(conanfile, package_id, source_folder, build_folder,
                                   dest_package_folder, install_folder, hook_manager, conan_file_path,
                                   ref, local=True)
  -        with cache.package_layout(ref).update_metadata() as metadata:
  -            readed_manifest = FileTreeManifest.load(dest_package_folder)
  -            metadata.packages[package_id].revision = readed_manifest.summary_hash
  -            metadata.packages[package_id].recipe_revision = metadata.recipe.revision
  +    with cache.package_layout(ref).update_metadata() as metadata:
  +        readed_manifest = FileTreeManifest.load(dest_package_folder)
  +        metadata.packages[package_id].revision = readed_manifest.summary_hash
  +        metadata.packages[package_id].recipe_revision = metadata.recipe.revision
   
       recorder.package_exported(pref)
  
verification_info: {"golden_diff": "diff --git a/conans/client/cmd/export_pkg.py b/conans/client/cmd/export_pkg.py\n--- a/conans/client/cmd/export_pkg.py\n+++ b/conans/client/cmd/export_pkg.py\n@@ -50,9 +50,9 @@\n         packager.create_package(conanfile, package_id, source_folder, build_folder,\n                                 dest_package_folder, install_folder, hook_manager, conan_file_path,\n                                 ref, local=True)\n-        with cache.package_layout(ref).update_metadata() as metadata:\n-            readed_manifest = FileTreeManifest.load(dest_package_folder)\n-            metadata.packages[package_id].revision = readed_manifest.summary_hash\n-            metadata.packages[package_id].recipe_revision = metadata.recipe.revision\n+    with cache.package_layout(ref).update_metadata() as metadata:\n+        readed_manifest = FileTreeManifest.load(dest_package_folder)\n+        metadata.packages[package_id].revision = readed_manifest.summary_hash\n+        metadata.packages[package_id].recipe_revision = metadata.recipe.revision\n \n     recorder.package_exported(pref)\n", "issue": "conan export-pkg with --package-folder does not set the metadata info\nWhen an export-pkg command is used with the ``--package-folder``, the *metadata.json* is not updated with the package ID and package revision.\r\n\r\nThen, when the user tries to upload the package ir errors with:\r\n```\r\nERROR: Binary package hello/1.0@user/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 not found\r\n```\r\n\r\nHere is a test reproducing the issue:\r\n\r\n```\r\n    def upload_export_pkg_test(self):\r\n        \"\"\"\r\n        Package metadata is created when doing an export-pkg and then uploading the package\r\n        \"\"\"\r\n        server1 = TestServer([(\"*/*@*/*\", \"*\")], [(\"*/*@*/*\", \"*\")], users={\"lasote\": \"mypass\"})\r\n        servers = OrderedDict()\r\n        servers[\"server1\"] = server1\r\n        client = TestClient(servers=servers)\r\n        client.save({\"release/kk.lib\": \"\"})\r\n        client.run(\"user lasote -r server1 -p mypass\")\r\n        client.run(\"new hello/1.0 --header\")\r\n        client.run(\"export-pkg . user/testing -pf release\")\r\n        client.run(\"upload hello/1.0@user/testing --all -r server1\")\r\n```\r\n\r\nThe original issue comes from #4768\n", "before_files": [{"content": "import os\n\nfrom conans.client import packager\nfrom conans.client.graph.graph_manager import load_deps_info\nfrom conans.errors import ConanException\nfrom conans.model.manifest import FileTreeManifest\nfrom conans.model.ref import PackageReference\nfrom conans.util.files import rmdir\n\n\ndef export_pkg(cache, graph_manager, hook_manager, recorder, output,\n               ref, source_folder, build_folder, package_folder, install_folder,\n               graph_info, force):\n\n    conan_file_path = cache.conanfile(ref)\n    if not os.path.exists(conan_file_path):\n        raise ConanException(\"Package recipe '%s' does not exist\" % str(ref))\n\n    # The graph has to be loaded with build_mode=[ref.name], so that node is not tried\n    # to be downloaded from remotes\n    deps_graph, _ = graph_manager.load_graph(ref, None, graph_info=graph_info, build_mode=[ref.name],\n                                             check_updates=False, update=False,\n                                             remote_name=None, recorder=recorder)\n    # this is a bit tricky, but works. The root (virtual), has only 1 neighbor,\n    # which is the exported pkg\n    nodes = deps_graph.root.neighbors()\n    conanfile = nodes[0].conanfile\n    from conans.client.conan_api import existing_info_files\n    if install_folder and existing_info_files(install_folder):\n        load_deps_info(install_folder, conanfile, required=True)\n    package_id = nodes[0].package_id\n    output.info(\"Packaging to %s\" % package_id)\n    pref = PackageReference(ref, package_id)\n    dest_package_folder = cache.package(pref, short_paths=conanfile.short_paths)\n\n    if os.path.exists(dest_package_folder):\n        if force:\n            rmdir(dest_package_folder)\n        else:\n            raise ConanException(\"Package already exists. Please use --force, -f to \"\n                                 \"overwrite it\")\n\n    recipe_hash = cache.package_layout(ref).recipe_manifest().summary_hash\n    conanfile.info.recipe_hash = recipe_hash\n    conanfile.develop = True\n    if package_folder:\n        packager.export_pkg(conanfile, package_id, package_folder, dest_package_folder,\n                            hook_manager, conan_file_path, ref)\n    else:\n        packager.create_package(conanfile, package_id, source_folder, build_folder,\n                                dest_package_folder, install_folder, hook_manager, conan_file_path,\n                                ref, local=True)\n        with cache.package_layout(ref).update_metadata() as metadata:\n            readed_manifest = FileTreeManifest.load(dest_package_folder)\n            metadata.packages[package_id].revision = readed_manifest.summary_hash\n            metadata.packages[package_id].recipe_revision = metadata.recipe.revision\n\n    recorder.package_exported(pref)\n", "path": "conans/client/cmd/export_pkg.py"}]}