prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `snapcraft remote-build --launchpad-timeout` does not work
  ### Bug Description
  
  The argument `--launchpad-timeout` for remote-build stopped being accepted when snapcraft 7 was release.
  
  Scope of work:
  1.  Add `--launchpad-timeout` as an argparse argument in `snapcraft/commands/remote.py`
  2. Test that it gets passed to the new and fallback remote builders.
  
  ### To Reproduce
  
  `snapcraft remote-build --launchpad-timeout <seconds>`
  
  ### Environment
  
  n/a
  
  ### snapcraft.yaml
  
  ```shell
  n/a
  ```
  
  
  ### Relevant log output
  
  ```shell
  Usage: snapcraft [options] command [args]...
  Try 'snapcraft remote-build -h' for help.
  
  Error: unrecognized arguments: --launchpad-timeout 3600
  ```
  
  
  ### Additional context
  
  _No response_
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `snapcraft/commands/remote.py`
  Content:
  ```
  1 # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
  2 #
  3 # Copyright 2022 Canonical Ltd.
  4 #
  5 # This program is free software: you can redistribute it and/or modify
  6 # it under the terms of the GNU General Public License version 3 as
  7 # published by the Free Software Foundation.
  8 #
  9 # This program is distributed in the hope that it will be useful,
  10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12 # GNU General Public License for more details.
  13 #
  14 # You should have received a copy of the GNU General Public License
  15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16 
  17 """Snapcraft remote build command."""
  18 
  19 import argparse
  20 import os
  21 import textwrap
  22 
  23 from craft_cli import BaseCommand, emit
  24 from craft_cli.helptexts import HIDDEN
  25 from overrides import overrides
  26 
  27 from snapcraft.legacy_cli import run_legacy
  28 from snapcraft.parts.lifecycle import get_snap_project, process_yaml
  29 from snapcraft.utils import confirm_with_user
  30 from snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError
  31 
  32 _CONFIRMATION_PROMPT = (
  33     "All data sent to remote builders will be publicly available. "
  34     "Are you sure you want to continue?"
  35 )
  36 
  37 
  38 class RemoteBuildCommand(BaseCommand):
  39     """Command passthrough for the remote-build command."""
  40 
  41     name = "remote-build"
  42     help_msg = "Dispatch a snap for remote build"
  43     overview = textwrap.dedent(
  44         """
  45         Command remote-build sends the current project to be built
  46         remotely.  After the build is complete, packages for each
  47         architecture are retrieved and will be available in the
  48         local filesystem.
  49 
  50         If not specified in the snapcraft.yaml file, the list of
  51         architectures to build can be set using the --build-on option.
  52         If both are specified, an error will occur.
  53 
  54         Interrupted remote builds can be resumed using the --recover
  55         option, followed by the build number informed when the remote
  56         build was originally dispatched. The current state of the
  57         remote build for each architecture can be checked using the
  58         --status option."""
  59     )
  60 
  61     @overrides
  62     def fill_parser(self, parser: argparse.ArgumentParser) -> None:
  63         parser.add_argument(
  64             "--recover", action="store_true", help="recover an interrupted build"
  65         )
  66         parser.add_argument(
  67             "--status", action="store_true", help="display remote build status"
  68         )
  69         parser_target = parser.add_mutually_exclusive_group()
  70         parser_target.add_argument(
  71             "--build-on",
  72             metavar="arch",
  73             nargs="+",
  74             help=HIDDEN,
  75         )
  76         parser_target.add_argument(
  77             "--build-for",
  78             metavar="arch",
  79             nargs="+",
  80             help="architecture to build for",
  81         )
  82         parser.add_argument(
  83             "--build-id", metavar="build-id", help="specific build id to retrieve"
  84         )
  85         parser.add_argument(
  86             "--launchpad-accept-public-upload",
  87             action="store_true",
  88             help="acknowledge that uploaded code will be publicly available.",
  89         )
  90 
  91     @overrides
  92     def run(self, parsed_args):
  93         if os.getenv("SUDO_USER") and os.geteuid() == 0:
  94             emit.message(
  95                 "Running with 'sudo' may cause permission errors and is discouraged."
  96             )
  97 
  98         emit.message(
  99             "snapcraft remote-build is experimental and is subject to change - use with caution."
  100         )
  101 
  102         if parsed_args.build_on:
  103             emit.message("Use --build-for instead of --build-on")
  104             parsed_args.build_for = parsed_args.build_on
  105 
  106         if not parsed_args.launchpad_accept_public_upload and not confirm_with_user(
  107             _CONFIRMATION_PROMPT
  108         ):
  109             raise AcceptPublicUploadError()
  110 
  111         snap_project = get_snap_project()
  112         # TODO proper core22 support would mean we need to load the project
  113         # yaml_data = process_yaml(snap_project.project_file)
  114         # for now, only log explicitly that we are falling back to legacy to
  115         # remote build for core22
  116         process_yaml(snap_project.project_file)
  117 
  118         emit.debug(
  119             "core22 not yet supported in new code base: re-executing into legacy for remote-build"
  120         )
  121         run_legacy()
  122
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/snapcraft/commands/remote.py b/snapcraft/commands/remote.py
  --- a/snapcraft/commands/remote.py
  +++ b/snapcraft/commands/remote.py
  @@ -55,7 +55,13 @@
           option, followed by the build number informed when the remote
           build was originally dispatched. The current state of the
           remote build for each architecture can be checked using the
  -        --status option."""
  +        --status option.
  +
  +        To set a timeout on the remote-build command, use the option
  +        ``--launchpad-timeout=<seconds>``. The timeout is local, so the build on
  +        launchpad will continue even if the local instance of snapcraft is
  +        interrupted or times out.
  +        """
       )
   
       @overrides
  @@ -87,6 +93,13 @@
               action="store_true",
               help="acknowledge that uploaded code will be publicly available.",
           )
  +        parser.add_argument(
  +            "--launchpad-timeout",
  +            type=int,
  +            default=0,
  +            metavar="<seconds>",
  +            help="Time in seconds to wait for launchpad to build.",
  +        )
   
       @overrides
       def run(self, parsed_args):
  
verification_info: {"golden_diff": "diff --git a/snapcraft/commands/remote.py b/snapcraft/commands/remote.py\n--- a/snapcraft/commands/remote.py\n+++ b/snapcraft/commands/remote.py\n@@ -55,7 +55,13 @@\n         option, followed by the build number informed when the remote\n         build was originally dispatched. The current state of the\n         remote build for each architecture can be checked using the\n-        --status option.\"\"\"\n+        --status option.\n+\n+        To set a timeout on the remote-build command, use the option\n+        ``--launchpad-timeout=<seconds>``. The timeout is local, so the build on\n+        launchpad will continue even if the local instance of snapcraft is\n+        interrupted or times out.\n+        \"\"\"\n     )\n \n     @overrides\n@@ -87,6 +93,13 @@\n             action=\"store_true\",\n             help=\"acknowledge that uploaded code will be publicly available.\",\n         )\n+        parser.add_argument(\n+            \"--launchpad-timeout\",\n+            type=int,\n+            default=0,\n+            metavar=\"<seconds>\",\n+            help=\"Time in seconds to wait for launchpad to build.\",\n+        )\n \n     @overrides\n     def run(self, parsed_args):\n", "issue": "`snapcraft remote-build --launchpad-timeout` does not work\n### Bug Description\n\nThe argument `--launchpad-timeout` for remote-build stopped being accepted when snapcraft 7 was release.\r\n\r\nScope of work:\r\n1.  Add `--launchpad-timeout` as an argparse argument in `snapcraft/commands/remote.py`\r\n2. Test that it gets passed to the new and fallback remote builders.\n\n### To Reproduce\n\n`snapcraft remote-build --launchpad-timeout <seconds>`\n\n### Environment\n\nn/a\n\n### snapcraft.yaml\n\n```shell\nn/a\n```\n\n\n### Relevant log output\n\n```shell\nUsage: snapcraft [options] command [args]...\r\nTry 'snapcraft remote-build -h' for help.\r\n\r\nError: unrecognized arguments: --launchpad-timeout 3600\n```\n\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-\n#\n# Copyright 2022 Canonical Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 3 as\n# published by the Free Software Foundation.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"Snapcraft remote build command.\"\"\"\n\nimport argparse\nimport os\nimport textwrap\n\nfrom craft_cli import BaseCommand, emit\nfrom craft_cli.helptexts import HIDDEN\nfrom overrides import overrides\n\nfrom snapcraft.legacy_cli import run_legacy\nfrom snapcraft.parts.lifecycle import get_snap_project, process_yaml\nfrom snapcraft.utils import confirm_with_user\nfrom snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError\n\n_CONFIRMATION_PROMPT = (\n    \"All data sent to remote builders will be publicly available. \"\n    \"Are you sure you want to continue?\"\n)\n\n\nclass RemoteBuildCommand(BaseCommand):\n    \"\"\"Command passthrough for the remote-build command.\"\"\"\n\n    name = \"remote-build\"\n    help_msg = \"Dispatch a snap for remote build\"\n    overview = textwrap.dedent(\n        \"\"\"\n        Command remote-build sends the current project to be built\n        remotely.  After the build is complete, packages for each\n        architecture are retrieved and will be available in the\n        local filesystem.\n\n        If not specified in the snapcraft.yaml file, the list of\n        architectures to build can be set using the --build-on option.\n        If both are specified, an error will occur.\n\n        Interrupted remote builds can be resumed using the --recover\n        option, followed by the build number informed when the remote\n        build was originally dispatched. The current state of the\n        remote build for each architecture can be checked using the\n        --status option.\"\"\"\n    )\n\n    @overrides\n    def fill_parser(self, parser: argparse.ArgumentParser) -> None:\n        parser.add_argument(\n            \"--recover\", action=\"store_true\", help=\"recover an interrupted build\"\n        )\n        parser.add_argument(\n            \"--status\", action=\"store_true\", help=\"display remote build status\"\n        )\n        parser_target = parser.add_mutually_exclusive_group()\n        parser_target.add_argument(\n            \"--build-on\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=HIDDEN,\n        )\n        parser_target.add_argument(\n            \"--build-for\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=\"architecture to build for\",\n        )\n        parser.add_argument(\n            \"--build-id\", metavar=\"build-id\", help=\"specific build id to retrieve\"\n        )\n        parser.add_argument(\n            \"--launchpad-accept-public-upload\",\n            action=\"store_true\",\n            help=\"acknowledge that uploaded code will be publicly available.\",\n        )\n\n    @overrides\n    def run(self, parsed_args):\n        if os.getenv(\"SUDO_USER\") and os.geteuid() == 0:\n            emit.message(\n                \"Running with 'sudo' may cause permission errors and is discouraged.\"\n            )\n\n        emit.message(\n            \"snapcraft remote-build is experimental and is subject to change - use with caution.\"\n        )\n\n        if parsed_args.build_on:\n            emit.message(\"Use --build-for instead of --build-on\")\n            parsed_args.build_for = parsed_args.build_on\n\n        if not parsed_args.launchpad_accept_public_upload and not confirm_with_user(\n            _CONFIRMATION_PROMPT\n        ):\n            raise AcceptPublicUploadError()\n\n        snap_project = get_snap_project()\n        # TODO proper core22 support would mean we need to load the project\n        # yaml_data = process_yaml(snap_project.project_file)\n        # for now, only log explicitly that we are falling back to legacy to\n        # remote build for core22\n        process_yaml(snap_project.project_file)\n\n        emit.debug(\n            \"core22 not yet supported in new code base: re-executing into legacy for remote-build\"\n        )\n        run_legacy()\n", "path": "snapcraft/commands/remote.py"}], "after_files": [{"content": "# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-\n#\n# Copyright 2022 Canonical Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 3 as\n# published by the Free Software Foundation.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"Snapcraft remote build command.\"\"\"\n\nimport argparse\nimport os\nimport textwrap\n\nfrom craft_cli import BaseCommand, emit\nfrom craft_cli.helptexts import HIDDEN\nfrom overrides import overrides\n\nfrom snapcraft.legacy_cli import run_legacy\nfrom snapcraft.parts.lifecycle import get_snap_project, process_yaml\nfrom snapcraft.utils import confirm_with_user\nfrom snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError\n\n_CONFIRMATION_PROMPT = (\n    \"All data sent to remote builders will be publicly available. \"\n    \"Are you sure you want to continue?\"\n)\n\n\nclass RemoteBuildCommand(BaseCommand):\n    \"\"\"Command passthrough for the remote-build command.\"\"\"\n\n    name = \"remote-build\"\n    help_msg = \"Dispatch a snap for remote build\"\n    overview = textwrap.dedent(\n        \"\"\"\n        Command remote-build sends the current project to be built\n        remotely.  After the build is complete, packages for each\n        architecture are retrieved and will be available in the\n        local filesystem.\n\n        If not specified in the snapcraft.yaml file, the list of\n        architectures to build can be set using the --build-on option.\n        If both are specified, an error will occur.\n\n        Interrupted remote builds can be resumed using the --recover\n        option, followed by the build number informed when the remote\n        build was originally dispatched. The current state of the\n        remote build for each architecture can be checked using the\n        --status option.\n\n        To set a timeout on the remote-build command, use the option\n        ``--launchpad-timeout=<seconds>``. The timeout is local, so the build on\n        launchpad will continue even if the local instance of snapcraft is\n        interrupted or times out.\n        \"\"\"\n    )\n\n    @overrides\n    def fill_parser(self, parser: argparse.ArgumentParser) -> None:\n        parser.add_argument(\n            \"--recover\", action=\"store_true\", help=\"recover an interrupted build\"\n        )\n        parser.add_argument(\n            \"--status\", action=\"store_true\", help=\"display remote build status\"\n        )\n        parser_target = parser.add_mutually_exclusive_group()\n        parser_target.add_argument(\n            \"--build-on\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=HIDDEN,\n        )\n        parser_target.add_argument(\n            \"--build-for\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=\"architecture to build for\",\n        )\n        parser.add_argument(\n            \"--build-id\", metavar=\"build-id\", help=\"specific build id to retrieve\"\n        )\n        parser.add_argument(\n            \"--launchpad-accept-public-upload\",\n            action=\"store_true\",\n            help=\"acknowledge that uploaded code will be publicly available.\",\n        )\n        parser.add_argument(\n            \"--launchpad-timeout\",\n            type=int,\n            default=0,\n            metavar=\"<seconds>\",\n            help=\"Time in seconds to wait for launchpad to build.\",\n        )\n\n    @overrides\n    def run(self, parsed_args):\n        if os.getenv(\"SUDO_USER\") and os.geteuid() == 0:\n            emit.message(\n                \"Running with 'sudo' may cause permission errors and is discouraged.\"\n            )\n\n        emit.message(\n            \"snapcraft remote-build is experimental and is subject to change - use with caution.\"\n        )\n\n        if parsed_args.build_on:\n            emit.message(\"Use --build-for instead of --build-on\")\n            parsed_args.build_for = parsed_args.build_on\n\n        if not parsed_args.launchpad_accept_public_upload and not confirm_with_user(\n            _CONFIRMATION_PROMPT\n        ):\n            raise AcceptPublicUploadError()\n\n        snap_project = get_snap_project()\n        # TODO proper core22 support would mean we need to load the project\n        # yaml_data = process_yaml(snap_project.project_file)\n        # for now, only log explicitly that we are falling back to legacy to\n        # remote build for core22\n        process_yaml(snap_project.project_file)\n\n        emit.debug(\n            \"core22 not yet supported in new code base: re-executing into legacy for remote-build\"\n        )\n        run_legacy()\n", "path": "snapcraft/commands/remote.py"}]}