Re: Update: Newbie's first RPM goes wrong

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

 



Again quite a simple problem, looking at the output you can see:

  + make install
  cp howdy /u/ek/pln/bin

Your makefile installs the binary to /u/ek/pln/bin, and your .spec file
calls "make install"

Normaly in a .spec file you would use the %makeinstall macro instead of
doing "make install", that macro includes things like prefix=(buildroot)
exec_prefix=(buildroot)/bin bindir=(buildroot)/bin sbindir=(buildroot)/sbin
etc etc... That prefix is what you should use in the make file to copy the
file to .. A whole new can of worms though, managing project with make :-)

A workaround not to have to fuck around with Makefiles (forgive my french),
would be to do the copying in the spec file.. (see sugested new spec file @
the end of my reply) and not from the Makefile.

Also as mentioned in another mail i send you on this ongoing project of
yours, you shouldn't hard specify the /u/ek/pln/bin in the spect file, but
use %{_bindir}, and then install the package using
rpm -ivh --prefix=/u/ek/pln ...

What your doing now is hard coding everything to /u/ek/pln/bin, then
changing some things around (specifying a build root), which causes rpm to
check %{build_root}/u/ek/pln/bin/howdy for the file, which ofcource failed
(it worked before, but only because of a another bug in your spec file)

Standardising the whole way is the only way to go, things like %{_bindir}
and %makeinstall in your spec file, and rpm -ivh --prefix
howdy-1.0-1.i386.rpm to install the package to a non standard prefix (ie
/u/ek/pln instead of /usr). Otherwise your gonna run into tons more of these
little problems..

Your spec file could then be simplified to this:

Summary: A hello world program
Name: howdy
Version: 1.0
Release: 1
Source: howdy-1.0.tar.gz
Group: Misc/Nonsense
Buildroot: /%{_tmppath}/%{name}-%{version}-%{release}-root

%description
A trivial program to practice on

%prep
%setup -q

%build
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
install -m755 $RPM_BUILD_DIR/howdy $RPM_BUILD_ROOT/%{_bindir}

 %clean
rm -rf $RPM_BUILD_ROOT

%files
%{_bindir}/howdy


----- Original Message ----- 
From: "Patrick L. Nolan" <pln@xxxxxxxxxxxxxxxxxxx>
To: <rpm-list@xxxxxxxxxx>
Cc: <pln@xxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, May 25, 2004 23:52
Subject: Update: Newbie's first RPM goes wrong


> I have made some progress since yesterday.  My trouble with
> check_files went away when I switched machines.  I went from
> RPM version 4.2 to 4.0.4.  Google showed me that I'm not the
> only one with this problem.  It's in the Redhat bugzilla as
> bug #87941.
>
> It appears that Redhat isn't going to fix this bug.  Status
> is CLOSED and resolution is DEFERRED.  The recommended
> workaround seems to be either to switch off check_files (which
> I did) or to use Buildroot.
>
> So I decided to use Buildroot.  Everyone seems to think it's
> a good idea, although I'm not sure why.  It's been a huge
> source of frustration to me.  Whatever I try, I end up with
> File Not Found errors.  Samples can be seen below.  There
> must be something I don't understand about the paths.
>
> I have been advised to avoid absolute paths in my .spec file
> and to use Prefix.  These seem like good ideas.  I will work
> on those things when I get this Buildroot problem solved.
> Until then I want to keep my .spec file as short and simple
> as possible.
>
> -------- rpmbuild output ---------------------
> noric15[pln](71): rpmbuild -ba -v howdy.spec
> Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.62997
> + umask 022
> + cd /u/ek/pln/rpm/BUILD
> + cd /u/ek/pln/rpm/BUILD
> + rm -rf howdy-1.0
> + /bin/gzip -dc /u/ek/pln/rpm/SOURCES/howdy-1.0.tar.gz
> + tar -xvvf -
> drwxrwxr-x pln/ek            0 2004-05-24 14:20:04 howdy-1.0/
> -rw-rw-r-- pln/ek           40 2004-05-24 14:08:48 howdy-1.0/howdy.c
> -rw-rw-r-- pln/ek           87 2004-05-24 14:18:16 howdy-1.0/Makefile
> + STATUS=0
> + '[' 0 -ne 0 ']'
> + cd howdy-1.0
> ++ /usr/bin/id -u
> + '[' 2542 = 0 ']'
> ++ /usr/bin/id -u
> + '[' 2542 = 0 ']'
> + /bin/chmod -Rf a+rX,g-w,o-w .
> + exit 0
> Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.62997
> + umask 022
> + cd /u/ek/pln/rpm/BUILD
> + cd howdy-1.0
> + make
> gcc -o howdy howdy.c
> + exit 0
> Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.62997
> + umask 022
> + cd /u/ek/pln/rpm/BUILD
> + cd howdy-1.0
> + rm -rf /var/tmp/howdy-1.0-1-root
> + make install
> cp howdy /u/ek/pln/bin
> + /usr/lib/rpm/brp-compress
> /usr/lib/rpm/brp-compress: cd: /var/tmp/howdy-1.0-1-root: No such file or
> directory
> + /usr/lib/rpm/brp-strip
> find: /var/tmp/howdy-1.0-1-root: No such file or directory
> + /usr/lib/rpm/brp-strip-comment-note
> find: /var/tmp/howdy-1.0-1-root: No such file or directory
> Processing files: howdy-1.0-1
> error: File not found: /var/tmp/howdy-1.0-1-root/u/ek/pln/bin/howdy
> Provides: howdy
>
>
> RPM build errors:
>     File not found: /var/tmp/howdy-1.0-1-root/u/ek/pln/bin/howdy
>
> -------- SPEC file ---------------------------------
> Summary: A hello world program
> Copyright: none
> Group: Misc/Nonsense
> Name: howdy
> Buildroot: /%{_tmppath}/%{name}-%{version}-%{release}-root
> #Prefix: /u/ek/pln/bin
> Provides: howdy
> Release: 1
> Source: howdy-1.0.tar.gz
> Version: 1.0
> Vendor: The GLAST LAT Collaboration
> %define __check_files %{nil}
> AutoReq: no
>
> %description
> A trivial program to practice on
>
> %prep
> %setup
>
> %build
> make
>
> %install
> rm -rf $RPM_BUILD_ROOT
> make install
>
> %clean
> rm -rf $RPM_BUILD_ROOT
>
> %files
> /u/ek/pln/bin/howdy
>
> *   Patrick L. Nolan                                          *
> *   W. W. Hansen Experimental Physics Laboratory (HEPL)       *
> *   Stanford University                                       *
>
>
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/rpm-list
>


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-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