#539 add back support for ,priority= suffix
Closed 5 years ago by praiskup. Opened 5 years ago by clime.

file modified
+7
@@ -218,6 +218,13 @@ 

              'srpm_build_method': args.srpm_build_method,

          })

  

+     if task.get('repos'):

+         for i in range(len(task['repos'])):

+             match = re.match('(.*),priority=([0-9]+)$', task['repos'][i]['baseurl'])

+             if match:

+                 task['repos'][i]['baseurl'] = match.group(1)

+                 task['repos'][i]['priority'] = match.group(2)

+ 

      return task

  

  

This is the patch currently applied for copr-rpmbuild by downstream. It implements setting custom priority for any external repository. The syntax is:

https://rpm.nodesource.com/pub_10.x/fc/28/x86_64/,priority=90

This is the patch currently applied for copr-rpmbuild by downstream

That's fine with me, the patch was already implemented for a previous release and @luminoso needed it, so thank you for reapplying it, @clime.

add back support for ,priority= suffix

I was thinking about this issue and I am definitely for fixing it, but I would like to propose a different solution.

There are several points, that I want to suggest. First, I think, that it shouldn't be implemented in copr-rpmbuild, but rather on frontend, particularly in helpers.parse_repo_params. This way it can be basically one-liner because the rest of the components expect it to be set there. Basically, this behavior needs to be removed/changed

if not repo.startswith("copr://"):
    return {}

The other thing, that I would prefer to do is sticking with standard parameters after a question mark, instead of commas. I would let the URL untouched and set it as is to baseurl. However, I would parse its parameters and if it has any supported params (at this point we care only about priority), then I would set them into repo dict. So, for this example URL

https://rpm.nodesource.com/pub_10.x/fc/28/x86_64?priority=90

we would generate

"repos": [
    ...
    {   
      "baseurl": "https://copr-be.cloud.fedoraproject.org/results/frostyx/copr-dev/fedora-28-x86_64?priority=90",
      "id": "copr_frostyx_copr_dev_priority_90", 
      "name": "Additional repo copr_frostyx_copr_dev_priority_90", 
      "priority": 90
    }   
  ],

For this, the current implementation of copr-rpmbuild sets the priority to the mock config. And I think, that the ?priority=90 left in baseurl shouldn't break anything. I think, I am not sure though.

it shouldn't be implemented in copr-rpmbuild, but rather on frontend

Implementing this on all clients is not ideal, so +1 to this.

My preference also would be to solve the problem once and forever by something like copr-cli create PROJECT --repo-json '{"url": "example.com", "priority": 99}' -- and store the repo urls with parameters (only priority for now) as a separate table in database.

Metadata Update from @msuchy:
- Pull-request tagged with: needs-work

5 years ago

Alternative implementation proposed in PR#601

per mtg discussion, resolved via #601

Pull-Request has been closed by praiskup

5 years ago
Metadata