StupidBeauty
Read times:431Posted at:Mon Dec 12 19:06:57 2011
- no title specified

打包时又犯個错,整個/usr目录打入包中

今天在RHEL5.2上给protobuf-c-0.15打包,写咯個spec文件,但是写错咯好几個地方,导致整个/usr都差点被打入包中咯,最开始是这样写的:

Summary: protobuf-c,C binding of protobuf

Name: protobuf-c

Version: 0.15

Release: 3

Source0: %{name} - %{version} .tar.gz

License: Other

Group: Develop/Networking

%define debug_package %{nil}

%description

C binding of protobuf.

%prep

%setup -q

%build

./configure --prefix=/usr

make

%install

make install

%files

%defattr(-,root,root)

/usr

结果把rpmbuild命令一运行,等咯好长时间还不结束,一看当前进程列表,rpmbuild命令在哪里死转。一开始还以为是RHEL5.2这個老古董性能不行而造成的,后来等咯半天,不耐烦咯,重新去看看spec文件,这才突然发现把它写错咯。

有这些错误:

  1. 1.把安装目录写成咯绝对路径。写成咯这样的:./configure –prefix=/usr。其实老实用%configure宏就行。

  2. 2. 没有写上打包时的根目录。应该加上 BuildRoot: %{_builddir} / %{name} -root

  3. 3. 对包中的文件进行“安装”时,没有指定相对于 BuildRoot 根目录的安装路径。 %install 中应该改成这样的:make DESTDIR= $RPM_BUILD_ROOT install

  4. 4. 另外,没有写清除指令。应该加上 %clean

rm -rf $RPM_BUILD_ROOT

最后形成的正确的spec文件:

Summary: protobuf-c,C binding of protobuf

Name: protobuf-c

Version: 0.15

Release: 3

Source0: %{name} - %{version} .tar.gz

License: Other

Group: Develop/Networking

BuildRoot: %{_builddir} / %{name} -root

%define debug_package %{nil}

%description

C binding of protobuf.

%prep

%setup -q

%build

%configure

make

%install

make DESTDIR=$RPM_BUILD_ROOT install

%clean

rm -rf $RPM_BUILD_ROOT

%files

%defattr(-,root,root)

/usr

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4