Re: Building my first RPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


In regard to: Re: Building my first RPM, Blaxton said (at 3:24am on Feb 23,...:

editted and then tried building the RPM, but the file is
being recreated evenby using rpm --short-circuit -bb myspec.spec.

Yeah, that's very much intentional.  If short-circuit allowed you to
proceed to building a binary RPM, it would just make it that much easier
for people to generate non-reproducible builds.

The right way to fix this is to

1) do your make install in the %install section, to your $RPM_BUILD_ROOT,
so all the files are laid out waiting to be scooped up and packaged into
the binary RPM.

2) add code after "make install" to "fix up" any files that have problems.
For example:

	# after make install has dropped everything into the buildroot

	cd $RPM_BUILD_ROOT/path/to/some/dir
	sed -e 's@/usr/local/bin/python@/path/to/your/python@' \
		< >
	# may need to fix permissions on, does it need +x?
	rm -f

3) do your rpmbuild -bb as normal.

Disabling requires and provides entirely should only be used as a last

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.

Ralph and I collaborated on that, yeah.  He did most of the work, though.
You must be using a really ancient version of RPM, because the attribution
at the top of the most recent one that I have looks a little different.


# 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 "", 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).


    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



Rpm-list mailing 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

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux