问题描述
我尝试在内部rpm包中为我们的geoserver打包一些地图文件。对于构建部分,这只是复制文件。我认为这是按预期工作。但是打包这20GB的图片需要花费相当长的时间。
我读过,rpm内部压缩数据,这可以用几种不同的压缩算法。但是,我没有一个线索哪个压缩我的rpm选择,我怎么能影响这一点。我找不到任何选项rpmbuild命令,也不是specfile和一般rpm选项我可以列出 rpmbuild --showrc
我对rpmbuild和specfiles不是很有经验,但是在rpm.org上阅读了大量的手册页面和教程后,我没有更多的想法了。
我使用的spec文件如下:
%define debug_package%{nil}
% mapsversion 0.9
#如果这是快照,请将日期放在此处,取消注释
#global snapshot_version 20100519
#这是可接受的表单中的版本
#an一个RPM版本字符串(即没有' - ')
#Hier werden die Makros definiert。
%global rpmversion%(echo%{mapsversion} | tr' - ''_')
%全局pkgversion%{mapsversion}%{?snapshot_version:-SNAPSHOT}
%全局pkgname% {name}
名称:geoserver-maps-part2
版本:%{rpmversion}
发布:1%{?dist}
摘要:
组:Application / ourApp
许可证:版权所有(c)2011
网址:http://doc.polyalert.local
#Source0:%{name} - %{version } .tgz
BuildArch:noarch
BuildRoot:%{_ tmppath} /%{name} - %{version} - %{release} -root - %(%{__ id_u} -n)
需要:geoserver
%define mapshome / opt / geoserver / swisstopo
%define mapssource / home / user / polyalert_env / geoserver / swisstopo
%description
Swiss地图服务器
%准备
%build
/ bin / true
%install
rm - rf $ RPM_BUILD_ROOT
mkdir -p $ RPM_BUILD_ROOT%{mapshome}
cp -a%{mapssource} / pk100 $ RPM_BUILD_ROOT%{mapshome}
%clean
rm -rf $ RPM_BUILD_ROOT
%pre
%post
%preun
%files
%{mapshome} / pk100
%changelog
* Tue Feb 14 2012 user - 1.0
- specfile的第一个版本
我像这样调用rpmbuild:
rpmbuild - bb --define_topdir $ TOP_DIR--define_gpg_name ourkey--define_signature gpg--sign $ TOP_DIR / SPECS / $ SPEC_FILE_NAME $ RPM_BUILD_PARAMETER
有任何建议吗?
解决方案
把这些放在你的
spec
文件中:%define _source_payload w0.gzdio
%define _binary_payload w0.gzdio
仍然使用
gzip
,但传递-0
一个级别,应该只存储。在我的RPM,它使它从21MB增长到76MB,所以我很确定这是你的回答!
BTW,我发现在
宏
文件 - 也可以bzdio
和0
到9
以使用bzip2
。这是在RHEL4;以后的RPM版本似乎支持更多的压缩选项;但再次,对于你想要的,上面应该是你需要的。I try to pack some map files for our geoserver in an internal rpm package. For the build part, this is just to copy the files. I think this works as expected. But it takes terribly long to pack those 20GB of images.
I've read that rpm internally compresses the data and that this can be done with several different compression algorithms. But, I don't have a clue which compression my rpm chooses and how I can influence this. I could not find any options for the rpmbuild command, nor for the specfile nor for the general rpm options I can list with
rpmbuild --showrc
I´m not very experienced with rpmbuild and specfiles, but after reading lots of man pages and tutorials on rpm.org I have no further ideas.
The specfile I use looks like:
%define debug_package %{nil} %global mapsversion 0.9 # If this is a snapshot, put the date here and uncomment #global snapshot_version 20100519 # This is the version in a form acceptable # an an RPM version string (i.e. no '-') # Hier werden die Makros definiert. %global rpmversion %(echo %{mapsversion} | tr '-' '_') %global pkgversion %{mapsversion}%{?snapshot_version:-SNAPSHOT} %global pkgname %{name} Name: geoserver-maps-part2 Version: %{rpmversion} Release: 1%{?dist} Summary: Swiss Maps for GeoServer Group: Application/ourApp License: Copyright (c) 2011 URL: http://doc.polyalert.local #Source0: %{name}-%{version}.tgz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: geoserver %define mapshome /opt/geoserver/swisstopo %define mapssource /home/user/polyalert_env/geoserver/swisstopo %description Swiss Maps for GeoServer %prep %build /bin/true %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{mapshome} cp -a %{mapssource}/pk100 $RPM_BUILD_ROOT%{mapshome} %clean rm -rf $RPM_BUILD_ROOT %pre %post %preun %files %{mapshome}/pk100 %changelog * Tue Feb 14 2012 user - 1.0 - First version of specfile
I call rpmbuild like this:
rpmbuild -bb --define "_topdir $TOP_DIR" --define "_gpg_name ourkey" --define "_signature gpg" --sign $TOP_DIR/SPECS/$SPEC_FILE_NAME $RPM_BUILD_PARAMETER
Any suggestions?
解决方案I was working with some RPM stuff today and accidentally stumbled upon the answer for ya!
Put these in your
spec
file:%define _source_payload w0.gzdio %define _binary_payload w0.gzdio
That will still use
gzip
but pass it-0
for a level, which should just store. On my RPM, it made it grow from 21MB to 76MB, so I'm pretty sure this is your answer!BTW, I found that in one of the
macro
files - you can also dobzdio
and any number from0
to9
to usebzip2
. This was on RHEL4; later versions of RPM seem to support more compression options; but again, for what you want, the above should be what you need.这篇关于rpmbuild更改压缩格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!