LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-15-2012, 03:03 PM   #1
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 228

Rep: Reputation: 9
rpmbuild picking up default buildroot even after explicitily defining in spec file ?


Hello Guys,

I am caught up in a bit strange situation, i am trying to build a rpm package, everything is working fine and smoothly. However my BUILDROOT directory is not what i am specifying in my .spec file.

The rmpbuild program is picking the BUILDROOT as /home/rohit/rpm/BUILDROOT, whereas in my spec file i specified it to be as /home/rohit/rpm/tmp. First i created my own .rpmmacros file under my home directory and override the macros _tmppath and _topdir but i didn't worked then i defined it in my spec file even then also it is not working. If i display the value of _tmppath it displays the expected correct direcory but the buildroot directory is not being chnaged.

Infact i did not created the BUILDROOT directory in first place, it was created automatically.

I understand that this is probably being read from default /usr/lib/macros file but how can i change it.

So could you guys please explain me why it is happening and how can i change this default behavior.

Here is my spec file

Code:
%define _tmppath /home/rohit/rpm/tmp

Name:   pack
Version: 1
Release:        1
Summary:Simple hello rpm

Group:  test
License:GPL
Source0:        pack-1.tar.gz
BuildRoot:      %{_tmppath}%{name}-buildroot
Buildarch: noarch


%description
This is a simple rpm package that packages three files.

%prep
%setup -q

%build
echo "$RPM_BUILD_ROOT"


%install
install -m 0755 -d $RPM_BUILD_ROOT/opt/pack-1
install -m 0644 test1 $RPM_BUILD_ROOT/opt/pack-1/test1
install -m 0644 test2 $RPM_BUILD_ROOT/opt/pack-1/test2
install -m 0644 reply $RPM_BUILD_ROOT/opt/pack-1/reply
%clean
rm -rf $RPM_BUILD_ROOT


%files
%dir /opt/pack-1
/opt/pack-1/test1
/opt/pack-1/test2
/opt/pack-1/reply
#%defattr(-,root,root,-)
#%doc



%changelog
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-16-2012, 08:03 AM   #2
DaveG
Member
 
Registered: Nov 2001
Location: London, UK
Distribution: Fedora
Posts: 161

Rep: Reputation: 43
The BuildRoot tag has be deprecated by Fedora, who run RPM.

See http://fedoraproject.org/wiki/Packag...#BuildRoot_tag.

Quote:
Fedora (as of F-10) does not require the presence of the BuildRoot tag in the spec and if one is defined it will be ignored. The provided buildroot will automatically be cleaned before commands in %install are called.
--DaveG.
 
2 members found this post helpful.
Old 05-16-2012, 09:15 AM   #3
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 228

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by DaveG View Post
The BuildRoot tag has be deprecated by Fedora, who run RPM.

See http://fedoraproject.org/wiki/Packag...#BuildRoot_tag.



--DaveG.
Thanks Dave for the information, so is there no way to change that behavior ?
 
1 members found this post helpful.
Old 05-16-2012, 11:54 AM   #4
DaveG
Member
 
Registered: Nov 2001
Location: London, UK
Distribution: Fedora
Posts: 161

Rep: Reputation: 43
I believe that you can use ~/.rpmmacros to set the '_topdir' macro which BuildRoot uses:
===%<---
# ~/.rpmmacros
# Define the build root.
%_topdir %(echo $HOME)/rpmbuild
--->%===
The file /usr/lib/rpm/macros includes the lines:
%_buildrootdir %{_topdir}/BUILDROOT
and
%buildroot %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
... so changing _topdir should change the BuildRoot parent directory, if that helps.
As a last resort, take a backup and edit /usr/lib/rpm/macros directly to your liking.

Have fun!,

--DaveG.
 
1 members found this post helpful.
Old 05-16-2012, 01:01 PM   #5
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 228

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by DaveG View Post
I believe that you can use ~/.rpmmacros to set the '_topdir' macro which BuildRoot uses:
===%<---
# ~/.rpmmacros
# Define the build root.
%_topdir %(echo $HOME)/rpmbuild
--->%===
The file /usr/lib/rpm/macros includes the lines:
%_buildrootdir %{_topdir}/BUILDROOT
and
%buildroot %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
... so changing _topdir should change the BuildRoot parent directory, if that helps.
As a last resort, take a backup and edit /usr/lib/rpm/macros directly to your liking.

Have fun!,

--DaveG.
Thanks Dave for sharing the information, well i tried defining the buildrootdir and builddir in my .rpmmacros file and it worked then.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rpmbuild error --- Symlink points to BuildRoot: alexzander1211 Linux - Software 3 11-06-2011 08:05 AM
rpmbuild : need help with spec file. salilgk Linux - General 2 07-29-2011 10:05 AM
Rpmbuild spec file for virtual rpm - removing obsolete packages - CentOS/RHEL 5.3 DrLove73 Linux - Software 3 10-10-2009 10:22 AM
rpmbuild a spec file when a BuildRequires is not installed carltm Linux - Software 1 12-08-2008 06:45 PM
Problem with rpmbuild and template.spec file abefroman Linux - Software 0 11-27-2005 12:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration