3

I am trying to create a rpm package for a library I wrote in Qt. Here is my spec file:

Name:           blabla
Version:        1.3.2
Release:        0.1
License:        GPL
Summary:        my awsome lib
Url:            http://me.home.mrz.net
Group:          Core Applictaion
Source:         http://svn.me.home.mrz.net/svn/Core/blabla-1.3.2.tar
Vendor:         mrz Inc.
BuildArch:      x86_64
Packager:       mrz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description

%prep
%setup

%build
qmake

%install
make install

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%files:
%defattr(-,root,root)
/home/mrz/local/lib/libBlabla.so
/home/mrz/local/lib/libBlabla.so.%{version}

after running

rpmbuild -ba blabla.spec

The rpmbuild finishes normally (exit 0) indicating it worte the src.rpm, say nothing about .rpm file. I can see the blabla-1.3.2-01.src.rpm in SRPMS folder but the RMPS folder is empty, here is some part of the output I get:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.WwW6ps
+ unmask 022
+ cd /home/mrz/rpmbuild/BUILD
+ rm -rf blabla-1.3.2
+ /usr/bin/gzip -dc /home/mrz/rpmbuild/SOURCES/blabla-1.3.2.tar
+ /bin/tar -xvvf -
.
.  
.
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd blabla-1.3.2
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.sNb2WS
+ umask 022
+ cd /home/mrz/rpmbuild/BUILD
+ /bin/rm -rf /home/mrz/rpmbuild/BUILDROOT/blabla-1.3.2-0.1.x86_64
++ dirname /home/mrz/rpmbuild/BUILDROOT/blabla-1.3.2-0.1.x86_64
+ /bin/mkdir -p /home/mrz/rpmbuild/BUILDROOT
+ /bin/mkdir /home/mrz/rpmbuild/BUILDROOT/blabla-1.3.2-0.1.x86_64
+ cd blabla-1.3.2
+ qmake
Project MESSAGE: ******************************************************************
Project MESSAGE: * Building blabla
Project MESSAGE: * project default message 
Project MESSAGE: ******************************************************************
.
.
.
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.qVk8KW
+ umask 022
+ cd /home/mrz/rpmbuild/BUILD
+ cd blabla-1.3.2
+ make install
cd src/ && /usr/bin/qmake /home/mrz/rpmbuild/BUILD/blabla-1.3.2/src/src.pro -o     
Makefile
Project MESSAGE: ******************************************************************
Project MESSAGE: * Building blabla
Project MESSAGE: * project default message
Project MESSAGE: ******************************************************************
cd src/ && make -f Makefile install
make[1]: Entering directory `/home/mrz/rpmbuild/BUILD/blabla-1.3.2/src'
g++ -c -m64 -pipe -O2 -fPIC -Wall -W 
. 
.
.
+ /usr/lib/rpm/brp-lib64-linux
sf@suse.de: if you find problems with this script, drop me a note
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-symlink
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/mrz/rpmbuild/BUILDROOT/blabla-1.3.2-0.1.x86_64
warning: Could not canonicalize hostname: linux-x1rh
Wrote: /home/mrz/rpmbuild/SRPMS/blabla-1.3.2-0.1.src.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.M4rJDm
+ umask 022
+ cd /home/mrz/rpmbuild/BUILD
+ cd blabla-1.3.2
+ /bin/rm -rf /home/mrz/rpmbuild/BUILDROOT/blabla-1.3.2-0.1.x86_64
+ exit 0

Anyone knows what I'm doing wrong...

mrz
  • 1,802
  • 2
  • 21
  • 32
  • 1
    Don't you get any output? What does it say? Besides, your spec file cannot work: 1. you have a `:` after `%files` and 2. you don't tell `make install` about your build root. – glglgl Nov 05 '12 at 20:41
  • 1
    and 3., a RPM file should not contain any files for `/home`. – glglgl Nov 05 '12 at 20:44
  • @glglgl: I do get an output as I mentioned, it says everything went ok (exit 0) and source rpm has been written in its relative folder, with not mentioning anything about binary rpm. Well, the spec file works (you can see the output in my updated post) but not as it supposed to, I believe. There wont be enough space to comment on these 3 problem, so I'm gonna create new comments. – mrz Nov 06 '12 at 07:39
  • @glglgl: I'm gonna answer in reverse starting from number 3. maybe I have misunderstood the `%file` section of spec file, but shouldn't it address the files I want to have in my .rpm? I have my make file to copy the .so file (output of my library compilation) in the path I wrote in `%file` section. So should I change my make file to have it copy the .so file in `/usr/lib` for example? – mrz Nov 06 '12 at 07:46
  • @glglgl: 2.I'm pretty sure my qmake and make install (to be more specific `%prep`, `%build`, and `%install` sections) just work fine from observing the output, beside after building the project using rpmbuilder I can see .so files have been located where they are supposed to. So I'm pretty sure the project has been made and install properly. Beside you can see rpmbuilder `cd` to the directory before invoking `qmake`, `make` and `make install`. – mrz Nov 06 '12 at 07:49
  • 3.: Right; your install script should put it to `$RPM_BUILD_ROOT/usr/lib/whatever.so` resp. `%{buildroot}/usr/lib/whatever.so` where it will be found when the `%files` section refers to `/usr/lib/whatever.so`. It may be useful to look at other `.spec` files how they do it. 2. Instead of modifying the makefile, you should *tell* it where to put stuff. 1. That is right - that is where it should look for: in the build root which "fakes" the root tree at install time. – glglgl Nov 06 '12 at 08:45

1 Answers1

3

I think you have misunderstood the directory concept during a rpmbuild.

There are 2 important directories: the build area and the build root.

  1. The build area is where the source is extracted to and compiled. On your side, it is /home/mrz/rpmbuild/BUILD. Here the tar is unpacked and in the so created sub directory, blabla-1.3.2, the source sits. (This comes from the convention to put one single directory into a tar file, potentially having other subdirectories under it but none next to it.)

  2. The build root is the place where your files will be arranged in a way how they should be at install time. You define that with

    BuildRoot:      %{_tmppath}/%{name}-%{version}-build
    

    Obviously, this translates to

    /home/mrz/rpmbuild/BUILDROOT/blabla-1.3.2-0.1.x86_64
    

    -- I don't know why. ~/.rpmrc or ~/.rpmmacros maybe?

More about the build root:

Normally, you tell your install script somehow to install everything below that build root. If it does so, everythin is as you want to and you define your %files where to find them.

I found Maximum RPM quite helpful, especially this section. Be aware, however, that it is quite outdated - in earlier times, there was no rpmbuild and you did everything with rpm. But the basic concepts are the same. Nowadays, rpm doesn't understand -ba any longer and you do all building with rpmbuild.

glglgl
  • 89,107
  • 13
  • 149
  • 217
  • @mrz As said, `rpm -ba` is outdated. Since several years, `rpmbuild -ba` has taken over this job. Besides of this, this old book can merely be used as a good guideline to learn how things work. – glglgl Nov 06 '12 at 09:34
  • Thank you once again for you answer. – mrz Nov 06 '12 at 10:01