Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude or delete directory path from %files in rpm.spec file

My spec files path looks like below :

/opt/OV
/opt/OV/NonOV
/opt/OV/NonOV/ABCD
/opt/OV/NonOV/ABCD/ABC
/opt/OV/NonOV/ABCD/ABC/Test1
/opt/OV/NonOV/ABCD/ABC/Test1/test1.txt
/opt/OV/NonOV/ABCD/ABC/Test2
/opt/OV/NonOV/ABCD/ABC/Test2/test2.txt
/opt/OV/newconfig
/opt/OV/newconfig/inventory
/opt/OV/newconfig/inventory/HPOvXYZ.xml

I don't want to this path to be included in spec file /opt/OV/newconfig/inventory" because if more than one rpm has this common path it gives error "conflict with file from package."

I have checked with %excludes command like below:

%files
%exclude /opt/OV/newconfig/inventory

So problem with this command is, it is excluding directly and files recursively. The rpm.spec files path look like this:

/opt/OV
/opt/OV/NonOV
/opt/OV/NonOV/ABCD
/opt/OV/NonOV/ABCD/ABC
/opt/OV/NonOV/ABCD/ABC/Test1
/opt/OV/NonOV/ABCD/ABC/Test1/test1.txt
/opt/OV/NonOV/ABCD/ABC/Test2
/opt/OV/NonOV/ABCD/ABC/Test2/test2.txt
/opt/OV/newconfig

It is excluding /opt/OV/newconfig/inventory/HPOvXYZ.xml this path as well. Is there any command so the I an exclude/delete only directory path.

Thanks in Advance.

like image 392
Prem Avatar asked Mar 18 '16 09:03

Prem


People also ask

What is %install in RPM spec file?

The section of the . spec file following the %build section is the %install section. This script installs the binaries, man pages, configuration files, and all other components that belong in your RPM package to their respective locations in our virtual build root directory.

What are sources in RPM build directory?

The BUILD directory is where the software is unpacked and built. 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 Buildroot in RPM?

Macros set for the RPM (and SRPM) build process spec files is %{buildroot} , which points to the root of the installation target directory. It is used for setting DESTDIR in the package's %install step. The other macros are usually only used outside . spec files.


1 Answers

%files
/opt/OV
%exclude %dir /opt/OV/newconfig/inventory

This will leave /opt/OV/newconfig/inventory/HPOvXYZ.xml in the file list.

like image 96
msuchy Avatar answered Oct 04 '22 02:10

msuchy