#2245 add support for repo runtime_dependencies into API
Merged 2 years ago by praiskup. Opened 2 years ago by praiskup.
Unknown source runtime_dependencies  into  main

file modified
+1 -1
@@ -6,7 +6,7 @@

  %global with_python2 1

  %endif

  

- %global min_python_copr_version 1.116.2.dev

+ %global min_python_copr_version 1.120.1.dev

  

  Name:       copr-cli

  Version:    1.101

file modified
+28 -4
@@ -466,6 +466,7 @@

              module_hotfixes=ON_OFF_MAP[args.module_hotfixes],

              fedora_review=args.fedora_review,

              appstream=ON_OFF_MAP[args.appstream],

+             runtime_dependencies=args.runtime_dependencies,

          )

          print("New project was successfully created.")

  
@@ -492,6 +493,7 @@

              module_hotfixes=ON_OFF_MAP[args.module_hotfixes],

              fedora_review=ON_OFF_MAP[args.fedora_review],

              appstream=ON_OFF_MAP[args.appstream],

+             runtime_dependencies=args.runtime_dependencies,

          )

  

      @requires_api_auth
@@ -962,6 +964,25 @@

                                                        request)

          print("success")

  

+ 

+ def create_and_modify_common_opts(parser):

+     """

+     De-duplicate options for 'copr create' and 'copr modify' options.

+     """

+     parser.add_argument(

+         "--repo", dest="repos", action="append", metavar="REPO_BASEURL", help=(

+             "Repository that will be enabled at package build time, can be "

+             "specified multiple times."

+     ))

+     parser.add_argument(

+         "--runtime-repo-dependency", dest="runtime_dependencies",

+         metavar="REPO_BASEURL", action="append", help=(

+             "Repository that will be automatically enabled together "

+             "with repository from this copr, e.g. by `dnf copr enable`. "

+             "This can be specified multiple times."

+     ))

+ 

+ 

  def setup_parser():

      """

      Set the main arguments.
@@ -1032,8 +1053,9 @@

                                 help="The name of the copr to create")

      parser_create.add_argument("--chroot", dest="chroots", action="append",

                                 help="Chroot to use for this copr")

-     parser_create.add_argument("--repo", dest="repos", action="append",

-                                help="Repository to add to this copr")

+ 

+ 

+ 

      parser_create.add_argument("--initial-pkgs", dest="initial_pkgs",

                                 action="append",

                                 help="List of packages URL to build in this "
@@ -1093,6 +1115,8 @@

          help=("Generate AppStream metadata for this project. Generating "

                "metadata slows down the builds in large Copr projects."))

  

+     create_and_modify_common_opts(parser_create)

+ 

      parser_create.set_defaults(func="action_create")

  

      # create the parser for the "modify_project" command
@@ -1105,8 +1129,6 @@

                                 help="Description of the copr")

      parser_modify.add_argument("--instructions",

                                 help="Instructions for the copr")

-     parser_modify.add_argument("--repo", dest="repos", action="append",

-                                help="Repository to add to this copr")

      parser_modify.add_argument("--disable_createrepo", type=str2bool,

                                 help="Disable metadata auto generation")

      parser_modify.add_argument("--enable-net", choices=["on", "off"],
@@ -1151,6 +1173,8 @@

          help=("Generate AppStream metadata for this project. Generating "

                "metadata slows down the builds in large Copr projects."))

  

+     create_and_modify_common_opts(parser_modify)

+ 

      parser_modify.set_defaults(func="action_modify_project")

  

      # create the parser for the "delete" command

file modified
+2
@@ -467,6 +467,7 @@

          "module_hotfixes": False,

          "fedora_review": False,

          "appstream": True,

+         "runtime_dependencies": None,

      }

      assert stdout == "New project was successfully created.\n"

  
@@ -560,6 +561,7 @@

          "module_hotfixes": False,

          "fedora_review": False,

          "appstream": True,

+         "runtime_dependencies": None,

      }

      assert stdout == "New project was successfully created.\n"

  

@@ -678,7 +678,7 @@

          """

          dependencies = set()

          if self.runtime_dependencies:

-             for dep in self.runtime_dependencies.split(" "):

+             for dep in self.runtime_dependencies.split():

                  if not dep:

                      continue

                  dependencies.add(dep)

@@ -143,9 +143,13 @@

          bootstrap = form.bootstrap.data

  

      try:

+ 

+         def _form_field_repos(form_field):

+             return " ".join(form_field.data.split())

+ 

          copr = CoprsLogic.add(

              name=form.name.data.strip(),

-             repos=" ".join(form.repos.data.split()),

+             repos=_form_field_repos(form.repos),

              user=user,

              selected_chroots=form.selected_chroots,

              description=form.description.data,
@@ -166,7 +170,7 @@

              module_hotfixes=form.module_hotfixes.data,

              fedora_review=form.fedora_review.data,

              follow_fedora_branching=form.follow_fedora_branching.data,

-             runtime_dependencies=form.runtime_dependencies.data,

+             runtime_dependencies=_form_field_repos(form.runtime_dependencies),

              appstream=form.appstream.data,

          )

          db.session.commit()

@@ -70,7 +70,7 @@

              auto_prune=True, use_bootstrap_container=None, devel_mode=False,

              delete_after_days=None, multilib=False, module_hotfixes=False,

              bootstrap=None, bootstrap_image=None, isolation=None,

-             fedora_review=None, appstream=True):

+             fedora_review=None, appstream=True, runtime_dependencies=None):

          """

          Create a project

  
@@ -102,6 +102,9 @@

          :param bool fedora_review: Run fedora-review tool for packages

                                     in this project

          :param bool appstream: Disable or enable generating the appstream metadata

+         :param string runtime_dependencies: List of external repositories

+             (== dependencies, specified as baseurls) that will be automatically

+             enabled together with this project repository.

          :return: Munch

          """

          endpoint = "/project/add/{ownername}"
@@ -129,6 +132,7 @@

              "module_hotfixes": module_hotfixes,

              "fedora_review": fedora_review,

              "appstream": appstream,

+             "runtime_dependencies": runtime_dependencies,

          }

  

          _compat_use_bootstrap_container(data, use_bootstrap_container)
@@ -147,7 +151,7 @@

               auto_prune=None, use_bootstrap_container=None, devel_mode=None,

               delete_after_days=None, multilib=None, module_hotfixes=None,

               bootstrap=None, bootstrap_image=None, isolation=None,

-              fedora_review=None, appstream=None):

+              fedora_review=None, appstream=None, runtime_dependencies=None):

          """

          Edit a project

  
@@ -204,6 +208,7 @@

              "module_hotfixes": module_hotfixes,

              "fedora_review": fedora_review,

              "appstream": appstream,

+             "runtime_dependencies": runtime_dependencies,

          }

  

          _compat_use_bootstrap_container(data, use_bootstrap_container)

file modified
+1 -1
@@ -9,7 +9,7 @@

  %endif

  

  Name:       python-copr

- Version:    1.120

+ Version:    1.120.1.dev

  Release:    1%{?dist}

  Summary:    Python interface for Copr

  

no initial comment

Build succeeded.

2 new commits added

  • frontend, cli, python: add API support for runtime_dependencies
  • frontend: runtime_dependencies may be separated by a newline
2 years ago

Build succeeded.

rebased onto e23df37

2 years ago

Build succeeded.

Commit 34a2bdb fixes this pull-request

Pull-Request has been merged by praiskup

2 years ago

Commit 7ecb767 fixes this pull-request

Pull-Request has been merged by praiskup

2 years ago