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
%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:
Extracting debug info ... blah ... blah... ... error: File not found: /home/steve/rpmbuild/BUILDROOT/hello-1-1.fc12.i386/tmp/hello
I feel like I'm missing the big picture here. I'd appreciate any direct help or pointers to some good explanation. I've read a bunch of docs but they have not helped in this case.
Thanks, Steve
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.
On Thu, Mar 24, 2011 at 12:00 PM, Steve Blackwell zephod@cfl.rr.com 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.
AFAIK, the %install section is what you're actually copying as the contents of your package. You copy it from the location you extracted the source %{_buildroot} into a temporary location %{builddir}.
The %files section tells the package manager what files belong to that package, so everything that you put into the file %{builddir} should also go into this list. This is important so that the package manager knows how to manage the files.
-c
On 03/23/2011 06:00 PM, 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
%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:
Extracting debug info ... blah ... blah... ... error: File not found: /home/steve/rpmbuild/BUILDROOT/hello-1-1.fc12.i386/tmp/hello
I feel like I'm missing the big picture here. I'd appreciate any direct help or pointers to some good explanation. I've read a bunch of docs but they have not helped in this case.
Thanks, Steve
See these (long) URL's (sorry, my mail client broke each URL into 3 lines):
http://www.google.com/url?sa=t&source=web&cd=3&ved=0CCIQFjAC&...
http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&...
Centos (RHEL) rpmbuild tutorial- Part 1 http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&...
Centos (RHEL) rpmbuild tutorial- Part 2 http://www.google.com/url?sa=t&source=web&cd=2&ved=0CB0QFjAB&...
On 03/24/2011 09:41 AM, JD wrote:
See these (long) URL's (sorry, my mail client broke each URL into 3 lines):
http://www.google.com/url?sa=t&source=web&cd=3&ved=0CCIQFjAC&...
http://linuxtoolkit.blogspot.com/2010/06/rpmbuild-tutorial.html
http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&...
http://rpmbuildtut.wordpress.com/
Centos (RHEL) rpmbuild tutorial- Part 1 http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&...
http://www.lamolabs.org/blog/164/centos-rpm-tutorial-1/
Centos (RHEL) rpmbuild tutorial- Part 2 http://www.google.com/url?sa=t&source=web&cd=2&ved=0CB0QFjAB&...
http://www.lamolabs.org/blog/169/centos-rpm-tutorial-2/
Would have been a bit cleaner....
On Wed, 23 Mar 2011 21:21:16 -0400 Todd Zullinger tmz@pobox.com wrote:
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.
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}
Ah, Thanks. That helped. Now I need to lookup the syntax of the install macro. And thanks to Chris & JD too.
Steve
On Mar 24, 2011 7:20 AM, "Steve Blackwell" zephod@cfl.rr.com wrote:
Ah, Thanks. That helped. Now I need to lookup the syntax of the install macro.
The install I'm referring to here is a normal command, not a macro. Use man install.
On Thu, 24 Mar 2011 07:58:02 -0400 Todd Zullinger tmz@pobox.com wrote:
On Mar 24, 2011 7:20 AM, "Steve Blackwell" zephod@cfl.rr.com wrote:
Ah, Thanks. That helped. Now I need to lookup the syntax of the install macro.
The install I'm referring to here is a normal command, not a macro. Use man install.
I have got my rpm to build successfully but now I have a dependency problem.
My app depends on python so I have a Requires: python line in the .spec file. Python is installed on my target system but the python binary in located in /usr/bin as indicated by $ rpm -qil python When I try to install my rpm, it complains that it can't find /usr/local/bin/python.
Any idea why my rpm is looking for python in all the wrong places?
Thanks, Steve
On 03/30/2011 06:31 AM, Steve Blackwell wrote:
On Thu, 24 Mar 2011 07:58:02 -0400 Todd Zullingertmz@pobox.com wrote:
On Mar 24, 2011 7:20 AM, "Steve Blackwell"zephod@cfl.rr.com wrote:
Ah, Thanks. That helped. Now I need to lookup the syntax of the install macro.
The install I'm referring to here is a normal command, not a macro. Use man install.
I have got my rpm to build successfully but now I have a dependency problem.
My app depends on python so I have a Requires: python line in the .spec file. Python is installed on my target system but the python binary in located in /usr/bin as indicated by $ rpm -qil python When I try to install my rpm, it complains that it can't find /usr/local/bin/python.
Any idea why my rpm is looking for python in all the wrong places?
One or more python scripts in your package contain this shebang: #!/usr/local/bin/python
Rpm is right to complain: If you tried to execute that file, it would fail because no such python interpreter exists on a normal Fedora installation. You need to locate + patch those files to refer to the system python path instead.
- Panu -
On 03/29/2011 11:25 PM, Panu Matilainen wrote:
One or more python scripts in your package contain this shebang: #!/usr/local/bin/python
Rpm is right to complain: If you tried to execute that file, it would fail because no such python interpreter exists on a normal Fedora installation. You need to locate + patch those files to refer to the system python path instead.
That's a fair amount of work. It's a lot easier if you run this command as root:
ln /usr/bin/python /usr/local/bin/python
Because that makes link that the b0rken rpms can all use.
Joe Zeff wrote, at 03/30/2011 03:45 PM +9:00:
On 03/29/2011 11:25 PM, Panu Matilainen wrote:
One or more python scripts in your package contain this shebang: #!/usr/local/bin/python
Rpm is right to complain: If you tried to execute that file, it would fail because no such python interpreter exists on a normal Fedora installation. You need to locate + patch those files to refer to the system python path instead.
That's a fair amount of work. It's a lot easier if you run this command as root:
ln /usr/bin/python /usr/local/bin/python
Because that makes link that the b0rken rpms can all use.
Well, usually this method doesn't work - because (perhaps) "/usr/local/bin/python" is not installed by installing some rpm (but installed by compiling python package by sysadmin him/herself, for example), So, "/usr/local/bin/python" is not in rpm's database (rpm registers files' names or so only when they are installed from some rpm packages).
Then if you install a rpm package which has the dependency for "/usr/local/bin/python", rpm will still complain that such file is missing because such file is not in rpm's database, even if /usr/local/bin/python actually exists.
Regards, Mamoru
On Tue, Mar 29, 2011 at 10:31 PM, Steve Blackwell zephod@cfl.rr.com wrote:
I have got my rpm to build successfully but now I have a dependency problem.
My app depends on python so I have a Requires: python line in the .spec file. Python is installed on my target system but the python binary in located in /usr/bin as indicated by $ rpm -qil python When I try to install my rpm, it complains that it can't find /usr/local/bin/python.
Any idea why my rpm is looking for python in all the wrong places?
It's not a rpmbuild problem but a problem with the program you're building. The best practice solution is to put this[1] script in your spec file to automatically replace the shebangs with "#!/usr/bin/env python".
Depending on where the offending python scripts are located you may have to adjust where it looks for scripts but it should do the trick.
Richard
[1] http://fedoraproject.org/wiki/PackageMaintainers/Packaging_Tricks#Remove_she...
On Wed, 30 Mar 2011 09:25:41 +0300 Panu Matilainen pmatilai@laiskiainen.org wrote:
My app depends on python so I have a Requires: python line in the .spec file. Python is installed on my target system but the python binary in located in /usr/bin as indicated by $ rpm -qil python When I try to install my rpm, it complains that it can't find /usr/local/bin/python.
Any idea why my rpm is looking for python in all the wrong places?
One or more python scripts in your package contain this shebang: #!/usr/local/bin/python
Rpm is right to complain: If you tried to execute that file, it would fail because no such python interpreter exists on a normal Fedora installation. You need to locate + patch those files to refer to the system python path instead.
- Panu -
That was it, thanks. Only 2 instances so not too much work.
Steve