Bug 1455800 - "fedpkg build" fails with DeprecationWarning: fedora.client.bodhi has been deprecated.
Summary: "fedpkg build" fails with DeprecationWarning: fedora.client.bodhi has been de...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: fedpkg
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: cqi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1476820 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-26 07:40 UTC by MartinKG
Modified: 2017-08-31 02:42 UTC (History)
16 users (show)

Fixed In Version: rpkg-1.50-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1490766 (view as bug list)
Environment:
Last Closed: 2017-08-31 02:42:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description MartinKG 2017-05-26 07:40:14 UTC
Description of problem:

"fedpkg build" fails with the following.  I seem to have the latest available packages. 
I don't know if this is actually a python-fedora problem -- reporting against the command that failed.


$ fedpkg build --nowait
/usr/lib/python2.7/site-packages/fedora/client/bodhi.py:48: DeprecationWarning: fedora.client.bodhi has been deprecated. Please use bodhi.client.bindings instead.
  DeprecationWarning)


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

$ rpm -qf `which fedpkg`
fedpkg-1.28-1.fc25.noarch
$ rpm -q bodhi-client
bodhi-client-0.9.12.2-6.fc25.noarch
$ rpm -q python-fedora
python-fedora-0.9.0-3.fc25.noarch

Comment 1 Randy Barlow 2017-05-26 16:04:24 UTC
This is just a harmless warning. What had been fedora.client.bodhi has been moved to bodhi.client.bindings and the warning is there to let authors of the various programs that still use the old version of the bindings to switch over before they get removed from python-fedora.

bodhi-client-0.9 will not be fixed for this problem, but bodhi-2.6 (in Fedora 26+) is already converted to use the new location for the bindings.

I wouldn't expect fedpkg build to use the Bodhi bindings, so it might be good to move this ticket to be for fedpkg so they can look into what they might be using fedora.client.bindings for.

Comment 2 Randy Barlow 2017-05-26 16:22:27 UTC
I believe the problem is that python-fedora is importing BodhiClient in it's fedora.client __init__.py:

from fedora.client.bodhi import BodhiClient, BodhiClientException

This is done so users can say:

from fedora.client import BodhiClient

instead of:

from fedora.client.bodhi import BodhiClient

Unfortunately, it would not be feasible to remove this import because we can't know what third party software might be importing BodhiClient that way and thus it would be a backwards incompatible change.

Thus the error will remain until we actually remove BodhiClient from python-fedora, which won't happen until Fedora 25 goes end of life.

Comment 3 Randy Barlow 2017-05-26 16:28:09 UTC
Python DeprecationWarnings should not be shown to users by default:

https://docs.python.org/2/library/warnings.html#warning-categories

Perhaps you have PYTHONWARNINGS set in your environment to a non-defaul value?

Comment 4 MartinKG 2017-05-30 12:57:39 UTC
(In reply to Randy Barlow from comment #3)
> Python DeprecationWarnings should not be shown to users by default:
> 
> https://docs.python.org/2/library/warnings.html#warning-categories
> 
> Perhaps you have PYTHONWARNINGS set in your environment to a non-defaul
> value?

An environment variable PYTHONWARNINGS isn't set.
$ env |grep PYTHONWARNINGS

Therefore i will ignore the warning message for now and hope that it will
be solved in f26.

Comment 5 Randy Barlow 2017-05-30 19:33:24 UTC
Hmmm, I'm not sure why, but I don't see this on my F24 machine with the
bodhi client (which has the same version of bodhi and python-fedora
though obviously a different release since it's F24):

$ bodhi | head -n 1
No handlers could be found for logger "fedora.client.bodhi"
Usage: bodhi [options] [build...|package]

If I set the PYTHONWARNINGS away from default, I do see the warning:

$ PYTHONWARNINGS=once bodhi | head -n 1
/usr/lib/python2.7/site-packages/fedora/client/bodhi.py:48: DeprecationWarning: fedora.client.bodhi has been deprecated. Please use bodhi.client.bindings instead.
  DeprecationWarning)
No handlers could be found for logger "fedora.client.bodhi"
Usage: bodhi [options] [build...|package]

However, I *do* see it when I use fedpkg:

$ fedpkg | head -n 1
/usr/lib/python2.7/site-packages/fedora/client/bodhi.py:48: DeprecationWarning: fedora.client.bodhi has been deprecated. Please use bodhi.client.bindings instead.
  DeprecationWarning)
usage: fedpkg [-h] [--config CONFIG] [--release RELEASE | --dist DIST]
<snip>

I wonder if fedpkg, python-fedora, or one of their dependencies might
be altering the warning settings away from the default? In any case,
the bodhi client does correctly hide the warning, so I don't believe it
is an issue in Bodhi itself. I'm going to reassign the component to fedpkg for now since it occurs with it and not with the Bodhi CLI directly.

Also to reiterate, it is just a warning and the library will remain
supported as-is until Fedora 25 reaches end of life. Thus, there is no
true harm here, just a scary sounding warning.

Comment 6 Lubomír Sedlář 2017-05-31 06:32:57 UTC
Apparently it's rpkg that is enabling the warnings.

https://pagure.io/rpkg/blob/master/f/pyrpkg/utils.py#_32

It's using them to report deprecations to the the user though, so that piece of code should be modified to print the warning directly to stderr. That way we can be sure that only warnings we care about will be reported.

This should fix it: https://pagure.io/rpkg/pull-request/221

Comment 7 Robbie Harwood 2017-06-26 20:04:14 UTC
The version drop doesn't make sense - this affects rawhide as well.

Comment 8 Randy Barlow 2017-06-26 22:01:12 UTC
Hi Robbie, I agree and I'll set it back. Thanks!

Comment 9 Lubomír Sedlář 2017-07-31 15:37:32 UTC
*** Bug 1476820 has been marked as a duplicate of this bug. ***

Comment 10 Jan Kurik 2017-08-15 07:08:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 11 Tim Landscheidt 2017-08-29 20:02:22 UTC
Is the version field supposed to contain the first or last release that this issue occurs in?  (I'm using F25 and seeing this warning.)

Comment 12 Göran Uddeborg 2017-08-29 20:43:05 UTC
Formally, the version where the bug was found.  You might theoretically create a bug for each version it appears in.  In practice there isn't any point in doing that except in a few special cases.  It would just spam the system.  Most maintainers will update in all affected versions in any case.

Comment 13 Tomasz Kłoczko 2017-08-30 08:18:01 UTC
ATM in rawhide I don't see fedpkg warnings.
I think that this bug can be closed or reassigned to exact Fedora version.


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