Re: Need help with rpmbuild

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

 



Steve Blackwell wrote:
> Specifically the install section. I'm not understanding how the
> %install section works with the %files section.
> I hope this is not considered OT.
>
> Let's say I want my rpm to install the file "hello"
> in /tmp on a target system. The %prep and %build sections work OK and
> create my hello file in BUILD/hello-1. (Why BUILD/hello-1 and not just
> BUILD I don't know but for now it doesn't matter.)
>
> The install and files sections of my spec file look like this:
> (Obviously %{name} is defined as hello)
>
> %install
> cp %{name} $RPM_BUILD_ROOT/
>
> %files
> %defattr(-,root,root,-)
> /tmp/hello

The RPM_BUILD_ROOT should exactly mirror the direcotry structure you
want to have your package files installed into.  If you want the file
in /tmp, then you would want to use $RPM_BUILD_ROOT/tmp as the
destination.  You must create RPM_BUILD_ROOT/tmp.  If it was me, I'd
use the install command to do this in one step:

%install
install -p -m755 -D %{name} RPM_BUILD_ROOT/tmp/%{name}

But you could just as easily use "mkdir -p RPM_BUILD_ROOT/tmp" before
your cp command.

> %BuildRoot is defined (by default) to be
> %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
>
> What's with the XXXXX?
> The cp works as expected but then an error occurs saying:

The X's are part of the mktemp template.  They are replaced by random
characters when creating the tempdir.

> Extracting debug info ... blah ... blah...
> ...
> error: File not
> found: /home/steve/rpmbuild/BUILDROOT/hello-1-1.fc12.i386/tmp/hello

If you list /home/steve/rpmbuild/BUILDROOT/hello-1-1.fc12.i386 you
should see that there is no tmp dir there.  The hello file will be in
that dir.  It's ofetn helpful to add some verbosity to the commands in
your spec for debugging.  For cp, use cp -v, same for install.  That
will give you some helpful output when you run rpmbuild.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are two kinds of light - the glow that illuminates, and the
glare that obscures.
    -- James Thurber

Attachment: pgp4miQUIJA8K.pgp
Description: PGP signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux