Skip to content

rpm: Install python3-tox on >= fedora 29#25168

Closed
badone wants to merge 1 commit intoceph:masterfrom
badone:wip-python3-tox-install
Closed

rpm: Install python3-tox on >= fedora 29#25168
badone wants to merge 1 commit intoceph:masterfrom
badone:wip-python3-tox-install

Conversation

@badone
Copy link
Copy Markdown
Contributor

@badone badone commented Nov 20, 2018

Fix the error "No matching package to install: 'python-tox'"

Fixes: http://tracker.ceph.com/issues/37301

Signed-off-by: Brad Hubbard bhubbard@redhat.com

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Fix the error "No matching package to install: 'python-tox'"

Fixes: http://tracker.ceph.com/issues/37301

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
BuildRequires: python%{_python_buildid}-requests
BuildRequires: python%{_python_buildid}-six
%if 0%{?fedora} >= 29
BuildRequires: python3-tox
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange enough, _python_buildid should be 3 in this case. as %{without python2} should be false on fedora by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the logic in munge_ceph_spec_in I believe

Copy link
Copy Markdown
Contributor Author

@badone badone Nov 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ lsb_release -d
Description: Fedora release 29 (Twenty Nine)
$ type python2
python2 is /usr/bin/python2
$ echo $?
0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smithfarm could you take a look please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ bash -x ./install-deps.sh                 
+ '[' -z '' ']'
...
 + type python2
 + sed -i -e 's/%bcond_with python2/%bcond_without python2/g' /tmp/install-deps.1540/ceph.spec
 + '[' ']'

Copy link
Copy Markdown
Contributor Author

@badone badone Nov 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what we need?

diff --git a/install-deps.sh b/install-deps.sh
index da22e54bba..35b0c255ba 100755
--- a/install-deps.sh
+++ b/install-deps.sh
@@ -35,7 +35,7 @@ function install_seastar_deps {
 function munge_ceph_spec_in {
     local OUTFILE=$1
     sed -e 's/@//g' -e 's/%bcond_with make_check/%bcond_without make_check/g' < ceph.spec.in > $OUTFILE
-    if type python2 > /dev/null 2>&1 ; then
+    if ! type python2 > /dev/null 2>&1 ; then
         sed -i -e 's/%bcond_with python2/%bcond_without python2/g' $OUTFILE
     else
         sed -i -e 's/%bcond_without python2/%bcond_with python2/g' $OUTFILE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, that doesn't work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should default to python3 (i.e., 's/%bcond_without python2/%bcond_with python2/g') on fedora 29, where python3 is dominant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could create a special case in munge_ceph_spec_in for f29?

Copy link
Copy Markdown
Contributor

@tchaikov tchaikov Nov 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. we can even skip this step if it's on f29.

@smithfarm
Copy link
Copy Markdown
Contributor

In its unmunged form, the spec file will try to do a Python 3 build on Fedora. In other words, it will look for the python3-... form of all the python build deps (including tox).

However, as you already have zeroed in on, if install-deps.sh is being used, there is a twist. Inside install-deps.sh, there's a function munge_ceph_spec_in which tries to be clever. It looks at the system and if there is a python2 binary, it clobbers the python2 bcond in the spec file, unconditionally, to produce a Python 2 build.

However, if the system doesn't have the right repos providing all the py2 versions of the build dependencies, then the build will still fail.

Have you tried uninstalling Python 2 before running install-deps.sh?

@smithfarm
Copy link
Copy Markdown
Contributor

smithfarm commented Nov 20, 2018

Also, when looking at %bcond it's good to be aware that the meaning is non-intuitive:

%bcond_with foo means "foo is disabled by default"
%bcond_without foo means "foo is enabled by default"

WTF, you say? But actually it makes sense. The macro %bcond_with foo macro creates a --with-foo option to rpmbuild, and this necessarily implies that %bcond_with foo in the spec file means "foo is disabled by default".

For more info, see http://rpm.org/user_doc/conditional_builds.html

@smithfarm
Copy link
Copy Markdown
Contributor

Please see #25181 for a different approach.

@smithfarm smithfarm closed this Nov 20, 2018
@badone
Copy link
Copy Markdown
Contributor Author

badone commented Nov 21, 2018

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants