Hi Tim,
Thank you very much for extensive explanation.
I did run rpm -bi myspec.spec and at the end of the installation noticed find-requires script
requires /usr/local/bin/python.
Finding Provides: (using /opt/freeware/lib/rpm/find-provides)...
Finding Requires: (using /opt/freeware/lib/rpm/find-requires)...
Provides: ******
Requires: /bin/sh /usr/bin/env /usr/local/bin/python /usr/local/bin/python3.4 ******
Finding Requires: (using /opt/freeware/lib/rpm/find-requires)...
Provides: ******
Requires: /bin/sh /usr/bin/env /usr/local/bin/python /usr/local/bin/python3.4 ******
Then ran the find command you provided through root directory and found cgi.py file contain that line
and still not sure why this module which is for version 2.6 is being built.
#! /usr/local/bin/python
# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
# intentionally NOT "/usr/bin/env python". On many systems
# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
# scripts, and /usr/local/bin is the default directory where Python is
# installed, so /usr/bin/env would be unable to find python. Granted,
# binary installations by Linux vendors often install Python in
# /usr/bin. So let those vendors patch cgi.py to match their choice
# of installation.
# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
# intentionally NOT "/usr/bin/env python". On many systems
# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
# scripts, and /usr/local/bin is the default directory where Python is
# installed, so /usr/bin/env would be unable to find python. Granted,
# binary installations by Linux vendors often install Python in
# /usr/bin. So let those vendors patch cgi.py to match their choice
# of installation.
editted cgi.py and then tried building the RPM, but the cgi.py file is being recreated even
by using rpm --short-circuit -bb myspec.spec.
I have checked the myspec.spec file and I am not deleting the root directory on spec file
so the only explanation that I can find is rpm --short-circuit -bb myspec.spec is still running the install
section even though I specified the --short-circut.
how can I prevent the installation when I am building the package ?
I thought --short-circuit should do that.
Thanks for all your help.
while I was reading find-requires file, noticed the find-requires originally is written by you.
# Original Author: Ralph Goers(rgoer@xxxxxxxxxx)
# Borrowed heavily from Tim Mooney's HP version.
# This file is distributed under the terms of the GNU General Public License
# Borrowed heavily from Tim Mooney's HP version.
# This file is distributed under the terms of the GNU General Public License
From: Tim Mooney <Tim.Mooney@xxxxxxxx>
To: Blaxton <blaxxton@xxxxxxxxx>; General discussion about the RPM package manager <rpm-list@xxxxxxxxxxxxx>
Sent: Friday, February 20, 2015 10:39 AM
Subject: Re: Building my first RPM
In regard to: Re: Building my first RPM, Blaxton said (at 12:53pm on Feb...:
> How may find which script has this line #!/usr/local/bin/python ?
It's one of the files that are getting copied into your build root, so
instead of doing a full package build (rpmbuild -ba yourspec.spec)
run the process through the install step (rpmbuild -bi yourspec.spec)
and then use UNIX tools to find which scripts reference the incorrect
path, e.g.
find /your/RPM/BUILD/ROOT -type f \
-exec egrep '#!/usr/local/bin/python' {} /dev/null \;
When you build a package, RPM searches the files in your build root, using
various methods depending on platform, to find what dependencies those
files have. To control what gets recorded in the binary RPM, you need
to control what's discovered for dependencies during the build process.
One trick that's often used: files that are really meant as documentation
or *examples* shouldn't have the execute bit set on them; if they're
not executable, the script that checks for the sh-bang (#!) header
in a script will ignore them. So having your %install do something like
find $RPM_BUILD_ROOT/usr/local/share/python \
-type f -name '*.py' -exec chmod a-x {} \;
(or any other directory that has docs/examples that are being found and
included by the dependency generator) is common when packaging
interpreters. Packaging interpreters (python, perl, ruby, etc.) often
has this type of issue.
>Where or which script checks dependencies when we install RPM and how to
> retrieve it ?
That depends on platform and version of RPM, as well as what RPM macros
are set in your build environment, but way back in previous century, I
had a hand in the find-provides and find-requires that were used on AIX.
Wherever RPM has its "lib" directory, there's probably a file named
"find-requires" or "find-requires.sh", and that's likely what's getting
called to search the buildroot for dependencies.
Also, note that find-requires and find-provides are run when you *build*
the RPM. Their output is then encoded in the binary package, and it's
RPM itself that checks as part of the install process to see that
everything that the package claims it needs is present. And before you
ask: it doesn't check the filesystem -- it checks its database
(primarily), and it probably also checks files in its personal config
directory (/etc/rpm or its equivalent for your build).
Tim
> From: Florian Festi <ffesti@xxxxxxxxxx>
> To: rpm-list@xxxxxxxxxxxxx
> Sent: Friday, February 20, 2015 2:04 AM
> Subject: Re: Building my first RPM
>
> On 02/20/2015 05:49 AM, Blaxton wrote:
>> I am trying to build Python RPM and trying to keep .spec file as simple
>> as I can.
>>
>> build, compile, install and package is completed and now I have the
>> binary RPM
>> to install, but getting below error at the time of installation:
>>
>> error: failed dependencies:
>> /usr/local/bin/python is needed by Python-3.4.2-1
>>
>> any idea what I am doing wrong ?
>
> There is probably a script somewhere having a #!/usr/local/bin/python
> line. Either include a symlink link /usr/local/bin/python -> python3
> (which may break other packages you might build later and expect Python
> 2) or change the #! line.
>
> As you are kinda building your own distribution you kinda can decide on
> your own what /usr/local/bin/python should mean. But a lot of other
> distros are still on Python2 as default and the plain "python" binary is
> Python 2.
>
>
>
>> Do I need to have python 2 ? to have python 3 installed ?
>> or I am missing some thing in .spec file ?
>>
>> For now I am packaging what ever it is in buildroot directory.
>>
>> make DESTDIR=${RPM_BUILD_ROOT} install
>>
>>
>> %files
>> %defattr(-,root,system,-)
>> /usr/local/bin/*
>> /usr/local/lib/*
>> /usr/local/share/*
>> /usr/local/include/*
>>
>> thanks
>>
>>
>>
>>
>> _______________________________________________
>> Rpm-list mailing list
>> Rpm-list@xxxxxxxxxxxxx
>> http://lists.rpm.org/mailman/listinfo/rpm-list
>>
>
>
>
--
Tim Mooney Tim.Mooney@xxxxxxxx
Enterprise Computing & Infrastructure 701-231-1076 (Voice)
Room 242-J6, Quentin Burdick Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
_______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxxxxx http://lists.rpm.org/mailman/listinfo/rpm-list