Danilo's Tech Blog

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 11 October 2012

Problems with new version of rpmbuild

Posted on 11:50 by Unknown

The Problem

With the new version of rpmbuild installed on CentOS 6.x, if you try to use an old RPM spec file, you will get an error like the following:

error: File not found: <path>/BUILDROOT/<product>-6.7.x86_64/<filename>

Previously rpmbuild would install and look for files under the rpm_top/BUILD directory, while now it looks under the new BUILDROOT directory.

The Solution

This is what I ended up doing to solve the problem. When I call rpmbuild I now define a new variable, for example:

$ centos_release=$(lsb_release -rs | sed 's/\.//')
$ rpmbuild --define "centos_release $centos_release" ... -bb specfile 



then I changed my spec file to contain something like the following:

%if %{centos_release} >= 60

%setup -q -c -n %{buildroot}/usr/local/
cp -a -r %{buildroot}/usr/local/ /usr/
 
%else
 
%setup -q -c -n usr/local/
%install
cp -a -r $PWD /usr/
 
%endif

Another related problem

Suppose you have a single tar ball and you want to create two or more RPMs using different spec files. The new version of rpmbuild automatically cleans the BUILDROOT directory after completing the targets for a given spec file. If you want to save time and have the second spec file just look for the BUILDROOT created by the first spec it won't find it because of the automatic clean. So it seems like you are forced to untar and install under the BUILDROOT your file over and over again.
A simple solution to this problem is to add a %clean directive to your spec file and do nothing to disable to automatic cleaning done by rpmbuild. Add the following line at the bottom of your spec file:

%clean

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in CentOS, Linux | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How to build Python-4-Android for the ARM Neon
    Currently the Py4A project does not compile for the ARM Neon architecture. If you try to run ndk-build on the project by setting the APP_A...
  • Problems with new version of rpmbuild
    The Problem With the new version of rpmbuild installed on CentOS 6.x, if you try to use an old RPM spec file, you will get an error like the...
  • How to build the gcc Fortran cross-compiler for Android (ARM and x86)
    If you need to cross-compile for Android a program written in Fortran, you know already that the official Android NDK does not come with the...
  • Upgrading mid-2007 24in iMac with an SSD and a 2.5in HDD in the optical bay
    I own a mid-2007 24in iMac with a 2.4 GHz Intel Core 2 Duo processor, 4GB of DDR2 DRAM, running Mac OS Mountain Lion, and for the past few m...
  • Porting your Legacy C/C++ project to Android
    This is a recurring problem people have often: trying to port a big C/C++ project to the Android platform. You have thousands of lines of te...
  • How to inspect expanded C macros with gcc/gcc+
    Sometimes you get compilation errors in gcc/g++ and you'd like to inspect the output from the C compiler pre-processor to figure out why...
  • Android: Trying to load native library results in a process terminated by signal (11)
    Symptoms You are trying to load your native C/C++ library in an Android application and when at runtime your app calls the System.loadLibrar...
  • Arduino and 7-segment LED counter driven by two tactile switches
    I have posted on YouTube a couple of videos about a project I made with the Arduino prototype board. The circuit uses an Arduino mini and ...
  • How to build Python-4-Android for the x86
    Currently the Py4A project only compiles for the ARM architecture. The following patch for the python-build sub-directory allows you to cros...
  • How to port Mozilla SpiderMonkey 1.7 to Android
    Another third-party package I needed to cross-compile for Android was Mozilla's SpiderMonkey 1.7 Javascript engine. I found two issues h...

Categories

  • Android
  • Apple
  • Arduino
  • ARM
  • busybox
  • CentOS
  • DHCP
  • Fortran
  • GNU
  • GPON
  • iMac
  • Javascript
  • ksh
  • Linux
  • MacOSX
  • Mips
  • Network
  • Python
  • Router
  • UNIX
  • Windows
  • x86

Blog Archive

  • ►  2013 (12)
    • ►  October (1)
    • ►  August (1)
    • ►  May (1)
    • ►  February (3)
    • ►  January (6)
  • ▼  2012 (11)
    • ►  December (2)
    • ►  November (2)
    • ▼  October (7)
      • How to cross-compile Python for Android
      • Installing the Android NDK
      • Problems with new version of rpmbuild
      • Installing the Android SDK
      • Porting your Legacy C/C++ project to Android
      • Transferring Files from a computer to your Android...
      • Welcome
Powered by Blogger.

About Me

Unknown
View my complete profile