rpm子包未创建

时间:2014-08-13 11:24:35

标签: rpm rpmbuild rpm-spec

我正在尝试创建2 rpm包,但第二个包的操作要少得多。 我创建了这个spec文件:

%define name        @CPACK_PACKAGE_NAME@ 
%define version     @CPACK_PACKAGE_VERSION@
%define release     @CPACK_PACKAGE_RELEASE@
%define binarydir   @BINARY_DIR@ 
%define packagedir  @PACKAGE_DIR@ 


#component name - used for the rpm name
%{!?name:%{error:*** Name was not specified! ***}}

# passed as a parameter in the build - the release version 
# e.g OverhaulRelease.MajorRelease.MinorRelease
%{!?version:%{error:*** Version was not specified! ***}}

# passed as a parameter in the build - the 5 digit build number 
%{!?release:%{warn:*** Release was not specified, so Dev build ***} %define release 0}

## we need to redfine this here to avoid the pre-compilation of the python code
%define __os_install_post %{nil}

## disable RPM object stripping so the
## Qt GUI binaries don't get truncated
%define __strip /bin/true

# set up some commonly used variables
%define buildroot @CMAKE_BINARY_DIR@/_CPack_Packages/Linux/RPM/@CPACK_PACKAGE_FILE_NAME@
%define prefix %{name}
%define appdir /%{name}
%define _topdir @CMAKE_BINARY_DIR@/_CPack_Packages/Linux/RPM
%define _rpmdir @CMAKE_BINARY_DIR@/_CPack_Packages/Linux/RPM
%define _rpmfilename @CPACK_PACKAGE_FILE_NAME@.rpm
%define _unpackaged_files_terminate_build 0 



## Intro ##

Name:           %{name}
Version:        %{version}
Release:        %{release}
Vendor:         %{company}
URL:            %{url}
Packager:       %{company} 
License:        %{copyright}

# Define the other packages that this rpm depends on here
Requires:       bash

Provides:       %{name}


Summary:        %{name} %{version}_%{release}
Group:          Applications/Communications
BuildRoot:      %{buildroot}

%package -n @CPACK_PACKAGE_NAME@_run

## Intro ##

#Name:           %{name}
Version:        %{version}
Release:        %{release}
Vendor:         %{company}
URL:            %{url}
Packager:       %{company} 
License:        %{copyright}

# Define the other packages that this rpm depends on here
Requires:       bash

Provides:       %{name}

Summary:        %{name} %{version}_%{release}
Group:          Applications/Communications
BuildRoot:      %{buildroot}
#Icon:


%define _rpmfilename @CPACK_PACKAGE_FILE_NAME@_run.rpm

%description -n @CPACK_PACKAGE_NAME@_run

#%prep
#%build

######## clean ########
#%clean

######## pre-install ########
# Define any pre-install steps here
%pre -n @CPACK_PACKAGE_NAME@_run

######## install ########
%install -n @CPACK_PACKAGE_NAME@_run

# Make the required install directories
# there are made in the buildroot in the local repo,
# but translated when the rpm is installed - removing the buildroot


mkdir -p %{buildroot}%{opt_root}
mkdir -p %{buildroot}%{etc_root}
mkdir -p %{buildroot}%{var_root}


# Copy the required installed files to the buildroot dir to collect the 
# files required for installation
# Also, create any required symbolic links here

######## post-install ########
%post -n @CPACK_PACKAGE_NAME@_run

# Set up the symbolic version directory links
# This should eventually be moved to an enable rpm,
# But for now keep it as a single rpm
/bin/ln -s  %{opt_root} %{opt_link}
/bin/ln -s  %{etc_root} %{etc_link}
/bin/ln -s  %{var_root} %{var_link}

# Do other post install commands here, like starting the required process/services etc


######## pre-uninstall ########
%preun -n @CPACK_PACKAGE_NAME@_run

######## post-uninstall ########
%postun -n @CPACK_PACKAGE_NAME@_run

## FILES ##

# Define user attributes and permissions for files
# List the atcual files and paths as they will look on the installed server
# i.e. without the buildroot prefic

%files -n @CPACK_PACKAGE_NAME@_run

%dir %{opt_root}
%dir %{etc_root}
%dir %{var_root}



%package -n @CPACK_PACKAGE_NAME@_ena


#Name:           %{name}_ena
Version:        %{version}
Release:        %{release}
Vendor:         %{company}
URL:            %{url}
Packager:       %{company} 
License:        %{copyright}

# Define the other packages that this rpm depends on here
Requires:       bash

Provides:       %{name}

Summary:        %{name} %{version}_%{release}
Group:          Applications/Communications
BuildRoot:      %{buildroot}
#Icon:


%define _rpmfilename @CPACK_PACKAGE_FILE_NAME@_ena.rpm
%define _unpackaged_files_terminate_build 0 


%description -n @CPACK_PACKAGE_NAME@_ena

#%prep
#%build

######## clean ########
#%clean

######## pre-install ########
# Define any pre-install steps here
%pre -n @CPACK_PACKAGE_NAME@_ena

######## install ########
%install -n @CPACK_PACKAGE_NAME@_ena

mkdir -p %{buildroot}%{var_root}/output
cp    --sparse=never %{binarydir}/stub1 %{buildroot}%{opt_root}/bin/stub1
cp    --sparse=never %{binarydir}/stub2 %{buildroot}%{opt_root}/bin/stub2

######## post-install ########
%post -n @CPACK_PACKAGE_NAME@_ena

# Set up the symbolic version directory links
# This should eventually be moved to an enable rpm,
# But for now keep it as a single rpm
/bin/ln -s  %{opt_root} %{opt_link}
/bin/ln -s  %{etc_root} %{etc_link}
/bin/ln -s  %{var_root} %{var_link}

# Do other post install commands here, like starting the required process/services etc


######## pre-uninstall ########
%preun -n @CPACK_PACKAGE_NAME@_ena

######## post-uninstall ########
%postun -n @CPACK_PACKAGE_NAME@_ena


%files -n @CPACK_PACKAGE_NAME@_ena

所以我在这里有2个问题: 1.这里只生成2转/分钟 - 主要和第二个,我期待3个主要和2个子包 2.在第二个子包中,如果我指定%install部分,rpm build会在第二个%install中抛出错误。

很抱歉在这里发布详细规范:但是无法用几句话得到我问题的确切答案:)

我哪里错了?

1 个答案:

答案 0 :(得分:0)

只创建了两个包,因为您只有两个%files指令。为specfile中的每个不同%files指令创建一个包。我相信Etan在评论中回答了你的其他问题。