Bug 2029175 - fedpkg request-branch produces Python errors on RHEL7
Summary: fedpkg request-branch produces Python errors on RHEL7
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: fedpkg
Version: epel7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ondřej Nosek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-05 14:58 UTC by Trey Dockendorf
Modified: 2022-02-17 02:43 UTC (History)
6 users (show)

Fixed In Version: fedpkg-1.42-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-17 02:43:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Trey Dockendorf 2021-12-05 14:58:14 UTC
Description of problem:


Version-Release number of selected component (if applicable):

fedpkg-1.41-2.el7


How reproducible:

$ fedpkg request-branch epel9
Could not execute request_branch: rsplit() takes no keyword arguments


Steps to Reproduce:
1. Install latest fedpkg on RHEL7
2. Try to request epel9 branch

Actual results:

$ fedpkg request-branch epel9
Could not execute request_branch: rsplit() takes no keyword arguments


Expected results:

Expect to get epel9 branch request submitted


Additional info:

Comment 1 Dmitry Butskoy 2021-12-06 18:07:59 UTC
The problem is python3 things in python2 code (since it is still el7).

The fast fix for the issue above is just:
```
--- /usr/lib/python2.7/site-packages/fedpkg/utils.py.orig	2021-11-10 21:47:04.000000000 +0300
+++ /usr/lib/python2.7/site-packages/fedpkg/utils.py	2021-12-06 20:26:40.111785202 +0300
@@ -361,7 +361,7 @@
         rv_json = rv.json()
         pkg_names = {
             # convert name-epoch:version-release.arch key to just the name
-            nevra.rsplit('.', maxsplit=1)[0].rsplit('-', maxsplit=2)[0]
+            nevra.rsplit('.', 1)[0].rsplit('-', 2)[0]
             # only packages from these repos are forbidden in epel
             for repo in ['BaseOS', 'AppStream', 'CRB']
             for arch in rv_json['payload']['rpms'][repo].keys()
```

but then request-branch wrongly report about bad certificate, whereas it was just expired token.

After the token is updated (manually):
> $ fedpkg request-branch epel9
>Could not execute request_branch: The following error occurred while creating a new issue > in Pagure: Invalid or expired token. Please visit https://pagure.io/settings#nav-api-tab > to get or renew your API token.
> For invalid or expired tokens please set a new token in your user configuration with:
>
> 	fedpkg set-pagure-token <token>
>

and then:
> fedpkg set-pagure-token ....token....
> updating config '/home/buc/.config/rpkg/fedpkg.conf'
> Could not execute set_pagure_token: argument of type 'instance' is not iterable

Thus it seems there are a couple of things ported "as-is" from a new python3 code to the old el7's python2 one.

Comment 2 Trey Dockendorf 2021-12-06 19:12:45 UTC
I did open a pull request for rsplit issue: https://pagure.io/fedpkg/pull-request/459 , with identical change as you described.

Comment 3 Dmitry Butskoy 2021-12-07 20:52:20 UTC
Well, for:
> fedpkg set-pagure-token ....token....
> updating config '/home/buc/.config/rpkg/fedpkg.conf'
> Could not execute set_pagure_token: argument of type 'instance' is not iterable

yet another fix is needed:
```
--- /usr/lib/python2.7/site-packages/fedpkg/cli.py.orig	2021-08-25 05:52:09.000000000 +0300
+++ /usr/lib/python2.7/site-packages/fedpkg/cli.py	2021-12-07 23:33:05.201378082 +0300
@@ -1411,7 +1411,7 @@
             section = "{0}.{1}".format(self.name, token_type)
 
             # add the section if it doesn't already exist
-            if section not in local_config:
+            if not local_config.has_section(section):
                 local_config.add_section(section)
 
             # set the distgit / pagure urls as needed (might already be set)
```

after that, I can set new token and then request the needed branch from el7 system.


Besides that, the url "https://pagure.io/settings/token/new" reported from the help output seems to be obsoleted. The true one is "https://pagure.io/settings#nav-api-tab" (which explains why it reported an "obsoleted certificate" in my case above -- it was just a wrong one generated from the old link).

Comment 4 Ondřej Nosek 2022-01-10 22:55:06 UTC
@treydock, @dmitry

Thanks for the code, I merged both of your suggestions in one commit.
https://pagure.io/fedpkg/c/130e794

About links, I think both can be used and I see them as valid. In the fedpkg's code, there is only "...settings/token/new".

Comment 5 Dmitry Butskoy 2022-01-11 00:00:49 UTC
It could be fine for the author(s) of recent changes to examine all of them for compatibility with the old python2.

I suspect it is likely that those two fixed are not the only ones. ;)

Comment 6 Trey Dockendorf 2022-01-27 21:23:11 UTC
If there is a place to get the fedpkg RPM with these changes, I'd be happy to test. I'm not real familiar with how the fedpkg could be tested otherwise, I'm still somewhat new to using it.

Comment 7 Fedora Update System 2022-02-09 01:40:54 UTC
FEDORA-EPEL-2022-dee661f2dc has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-dee661f2dc

Comment 8 Fedora Update System 2022-02-17 02:43:41 UTC
FEDORA-EPEL-2022-dee661f2dc has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.