Re: [scl.org] rh-python36 SPEC file question (circular dependency)

2018-06-08 Thread Nick Coghlan
On 9 June 2018 at 02:10, Charalampos Stratakis  wrote:

> I hope that helps (and I hope I didn't forget any steps :) ).
>

There's also https://github.com/ncoghlan/pyscl-devel/ from back when I was
looking at making an sclo-python rolling-release that tracked the latest
released version (even across major version bumps). My working notes for
that process: https://github.com/ncoghlan/pyscl-devel/issues/1

While I never ended up following through on that project (since I switched
jobs and aren't using SCLs for anything any more), I did get as far as
having a fully automated bootstrap build in a previously empty chroot. (The
current approach unfortunately doesn't work with COPR or Koji though, as
those don't offer a way to override the dist tag for the bootstrap builds
the way that mock does:
https://github.com/ncoghlan/pyscl-devel/blob/master/rpmlb/sclorg-distgit-download.yml#L59
)

Cheers,
Nick.

P.S. If anyone would like to take over pyscl-devel development with a view
to making maintenance of the Python SCLs more automated (and easier to
contribute to), just let me know and I'll unarchive the repo.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
SCLorg mailing list
SCLorg@redhat.com
https://www.redhat.com/mailman/listinfo/sclorg


Re: [scl.org] rh-python36 SPEC file question (circular dependency)

2018-06-08 Thread Charalampos Stratakis


- Original Message -
> From: "Joshua Kramer" 
> To: "Neal Gompa" 
> Cc: sclorg@redhat.com
> Sent: Thursday, June 7, 2018 2:22:56 PM
> Subject: Re: [scl.org] rh-python36 SPEC file question (circular dependency)
> 
> Thanks, Neal!  That got me a little farther.  Per the comments at the
> top of they python.spec file, I set with_rewheel to 0, then I built
> the Python RPM.  That seems to have worked.
> 
> Now, when I attempt to build setuptools, using this command:
> rpmbuild -ba ./python-setuptools.spec --define 'scl rh-python36' >
> python-setuptools-build.log 2>&1
> 
> ...the build command fails with these errors:
> error: Failed build dependencies:
> rh-python36-python-devel is needed by
> rh-python36-python-setuptools-36.5.0-1.el7.centos.noarch
> rh-python36-python-pip is needed by
> rh-python36-python-setuptools-36.5.0-1.el7.centos.noarch
> rh-python36-python-wheel is needed by
> rh-python36-python-setuptools-36.5.0-1.el7.centos.noarch
> 
> Attempting to build the python-pip package results in similar errors.
> 
> I have the following packages installed:
> rh-python36-2.0-1.el7.src.rpm
> rh-python36-python-3.6.3-3.el7.src.rpm
> rh-python36-python-pip-9.0.1-2.el7.src.rpm
> rh-python36-python-psycopg2-2.7.3-1.el7.src.rpm
> rh-python36-python-setuptools-36.5.0-1.el7.src.rpm
> rh-python36-python-virtualenv-15.1.0-2.el7.src.rpm
> rh-python36-python-wheel-0.30.0a0-1.el7.src.rpm
> rh-python36-scipy-0.19.1-2.el7.src.rpm
> 
> What should I look for next?
> 
> Thanks!
> 

Hello. I am one of the maintainers for that collection so feel free to ping me
directly, either on IRC or mail.

Sorry for the complications you are facing, bootstrapping the interpreter to an 
rpm
is indeed a quite complex procedure and it could be documented better.

I will try to outline the steps with some explanations.

Firstly, python bundles pip and setuptools, so ideally we'd like python to 
utilize the system
installed packages instead of the bundled ones. What happens is that we first 
compile python
including the bundled wheels (that's when we set the 'rewheel' macro to 0).

Then we'd like to build pip and setuptools in the wheel [0] format so they can 
be utilized by python.
However we still do not have the 'wheel' package built in order to do that, so 
we'll have to (byte)compile
them the usual way, then compile wheel, and then build again python and 
setuptools as wheels.

So you should set the build_wheel macro in python-pip's and python-setuptools' 
SPEC file to 0, build them and then
build the python-wheel package.

Then after you have built python-wheel, rebuild python-pip and 
python-setuptools with the build_wheel macro macro set to 1,
as we can create the wheel format now since we have the wheel package on our 
system.

Finally rebuild python with rewheel set to 1 in order for python to strip the 
bundled wheels and utilize the system installed
ones (with a little bit of magic [1].

Long story short:
1. Build python with rehweel set to 0.
2. Build python-setuptools and python-pip with build_wheel set to 0.
3. Build python-wheel.
4. Build python-setuptools and python-pip with build_wheel set to 1.
5. Build python with rehweel set to 1.

I hope that helps (and I hope I didn't forget any steps :) ).

[0] https://pythonwheels.com/
[1] https://github.com/fedora-python/rewheel/blob/master/rewheel/__init__.py

> On Mon, Jun 4, 2018 at 10:23 PM, Neal Gompa  wrote:
> > On Mon, Jun 4, 2018 at 9:38 PM Joshua Kramer 
> > wrote:
> >>
> >> Hello,
> >>
> >> I am trying to compile rh-python36 to use with CentOS on a Raspberry Pi.
> >>
> >> On line 192 of the SPEC file are these lines:
> >> %if 0%{?with_rewheel}
> >> BuildRequires: %{?scl_prefix}python-setuptools
> >> BuildRequires: %{?scl_prefix}python-pip
> >> %endif
> >>
> >> What is this supposed to do?  It prevents the package from building,
> >> because there is a circular dependency- if I try to build python36, it
> >> complains that python36-setuptools and python36-pip are not
> >> installed... but I can't install those without having Python installed
> >> first.  If I comment those lines out I get no error and the build
> >> almost completes.  (It then fails the "multiprocessing" test, but
> >> that's beside the point.)  However, I don't want to break something by
> >> commenting them out... so is there a better or "right" way to get rid
> >> of the circular dependency?
> >>
> >
> > Python is a two-cycle build. You build the first time with rewheel
> > disabled (that removes those BRs), then after that's successfully
> > built, you use those artifacts to build again with rewheel enabled.
> >
> >
> > --
> > 真実はいつも一つ!/ Always, there's only one truth!
> 
> ___
> SCLorg mailing list
> SCLorg@redhat.com
> https://www.redhat.com/mailman/listinfo/sclorg
> 

-- 
Regards,

Charalampos Stratakis
Software Engineer
Python Maintenance Team, Red Hat

___
SCLorg mailing list