Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the rpmbuild destination folder

Tags:

I noticed rpmbuild (-bb and --buildroot options) creates the .rpm in different locations depending of what OS are you using:

  • GNU/Linux Ubuntu <= 9.04: /usr/src/rpm/...
  • GNU/Linux Ubuntu >= 9.10: /home/rpmbuild/...
  • GNU/Linux Fedora: /usr/src/redhat/...

So how can I set manually the destination folder for all OS?

like image 984
Htechno Avatar asked May 06 '10 00:05

Htechno


People also ask

What are sources in RPM build directory?

The RPMS directory is where the newly created binary package files are written. The SOURCES directory contains the original sources, patches, and icon files. The SPECS directory contains the spec files for each package to be built.

What is Rpmbuild in Linux?

rpmbuild is used to build both binary and source software packages. A package consists of an archive of files and meta- data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package.

What is Buildroot in RPM spec file?

The build root is very similar to Root: (which is now legacy). By using Buildroot: in your spec file you are indicating that your package can be built (installed into and packaged from) a user-definable directory. This helps package building by normal users.

What is Rpmmacros?

In most Unix shells, ~ is an abbreviation for "your home directory". So ~/. rpmmacros is the file . rpmmacros in your home directory.


2 Answers

Replying myself, adding:

%define _rpmdir /outputdir 

to .spec file.

like image 131
Htechno Avatar answered Sep 18 '22 06:09

Htechno


You may want to use the command argument --define : For example, this will send the rpm files into the current directory.

rpmbuild anything.spec --bb --define "_rpmdir $(pwd)" 

This will send the rpmsto output dir

rpmbuild anything.spec --bb --define "_rpmdir /outputdir" 

Or perhaps something more complicated such as Custom gradle task for rpmbuild .

like image 43
MUY Belgium Avatar answered Sep 18 '22 06:09

MUY Belgium