#466 Rewrite `copr-cli mock-config` to use APIv3
Merged 5 years ago by msuchy. Opened 5 years ago by frostyx.
copr/ frostyx/copr apiv3-build-config  into  master

file modified
+5 -2
@@ -10,7 +10,7 @@ 

  

  include('/etc/mock/{{chroot}}.cfg')

  

- config_opts['root'] = '{{project_id}}_{{chroot}}'

+ config_opts['root'] = '{{ rootdir }}'

  config_opts['chroot_additional_packages'] = '

  {%- for pkg in additional_packages -%}

  {%- if loop.last -%}
@@ -24,7 +24,10 @@ 

  {% for repo in repos %}

  [{{ repo.id }}]

  name="{{ repo.name }}"

- baseurl={{ repo.url }}

+ baseurl={{ repo.baseurl }}

+ {%- if repo.priority %}

+ priority={{ repo.priority }}

+ {%- endif %}

  gpgcheck=0

  enabled=1

  skip_if_unavailable=1

file modified
+3 -8
@@ -423,14 +423,9 @@ 

          """

          sys.stderr.write("# This command is deprecated and will be removed in a future release.\n")

          ownername, projectname = self.parse_name(args.project)

-         client = CoprClient.create_from_file_config()

-         result = client.get_build_config('{0}/{1}'.format(ownername, projectname), args.chroot)

- 

-         if result.output != "ok":

-             sys.stderr.write(result.error + "\n")

-             sys.stderr.write("Un-expected data returned, please report this issue\n")

- 

-         print(MockProfile(result.build_config))

+         build_config = self.client.project_chroot_proxy.get_build_config(ownername, projectname, args.chroot)

+         build_config.rootdir = "{}-{}_{}".format(ownername.replace("@", "group_"), projectname, args.chroot)

+         print(MockProfile(build_config))

  

  

      @check_username_presence

These changes were picked out from PR#450
This PR switches copr-cli mock-config back to APIv3 (after PR#452) and fixes #427.

+1, #450 is prerequisite though. There's no reason to keep using apiv1, and this is trivial enough. I'll follow up soon with more tests/documentation/blogpost/etc. for the 'mock-config' feature.

PR#450 is prerequisite though

Yes, it is. I forgot to mention it in the description, sorry.

Hello, I think we don't need to port mock-config to API3. It has been fixed, which is the important part but I suggest keeping it on API1 and then drop both things together.

First, (said above) I do plan to keep copr mock-config working, so merging this would be really appreciated. Second, it sounds really unprofessional to hear that you want to use APIv1 in copr cli for no reason (since this feature will be supported in APIv3).

Kept opened because there's still neutral feedback o this (-1 +1 = 0).

I understand the controversy and discussion over PR#450 (because of the API changes, etc), but I don't understand why not to go with this PR.

It can be justified why we don't have to bother with implementing this code and fixing the issue #427 properly (aka it is deprecated and we want to throw it away together with APIv1), but there is no reason to not merge this code, that already exists (because it was picked from PR#450). IMHO there is no downside of doing it.

rebased onto e973fd0

5 years ago

Pull-Request has been merged by msuchy

5 years ago