rpmbuild

How to package a .tar.gz file into rpm package

佐手、 提交于 2019-12-04 10:12:22
I worked on Redhat Linux, I have a tar.gz file. I want to package this tar.gz file to a rpm package file. In the rpm package phase, I just want to extract the tar.gz file and package all of the staff into the rpm package, when I install the rpm package in linux server, it will just simply copy all of the files into the destination folder. I have tried a lot. Here goes some code for my SPEC file, but it has problems: %prep %build pwd %install rm -rf /usr/local/sample mkdir /usr/local/sample cd %{_sourcedir} tar -xzvf sample.tar.gz -C /usr/local/sample %clean rm -rf %{buildroot} %files %defattr(

RPM spec file - Is it possible to dynamically populate a spec file variable

自古美人都是妖i 提交于 2019-12-04 08:15:23
问题 I have a spec file. I need to %define a spec variable that gets its value from a one line file on the system. For example %define path `cat /home/user/path_file` and in path_file is one line /var/www/html/hosts This partially works. I say that begins in the RPM BUILD output sometimes the value of ${path} is literally my command cat /home/user/path_file and sometimes the value is the line in the path_file (/var/www/html/hosts) as it should be? 回答1: You can define rpmbuild variables with %(cmd)

rpm & rpmbuild - using global environment variable in the %files section

本秂侑毒 提交于 2019-12-04 05:17:48
I have been struggling for a while with this one. So I wrote a .specs file for my project and everything went fine. The rpm is built, the installation is smooth... but then I got some trouble because now, I have to use a custom global environment variable to set the install path. This would give a %files section as such : %files %defattr(-,root,root) $INSTALLPATH/Crystal/bin/Crystal.jar Where Crystal is my project name, and INSTALLPATH is defined within env thanks to the export commandline. Then, when running buildrpm -ba Crystal.specs I have the following error: error: File must begin with "/

Disable rpmbuild automatic requirement finding

杀马特。学长 韩版系。学妹 提交于 2019-12-04 03:23:27
问题 The default behavior of rpmbuild seems to be to scan every file in the buildroot for #! lines and add those interpreters as hard requirements. Is it possible to disable this? I've run into a situation where people are committing scripts with #!/path/to/local/install/of/something and that requirement is becoming embedded in the rpm. I haven't been able to find a command line or spec file option that suppresses this behavior. Hopefully I just didn't look hard enough. 回答1: I think the question

Bad exit status from /var/tmp/rpm-tmp.ajKra4 (%prep)

爷,独闯天下 提交于 2019-12-03 12:29:22
I am having a weird RPM issue, I am new to it so bear with me... I have the spec file created and when I run to do the build I get an error: /var/tmp/rpm-tmp.ajKra4: line 36: cd: hero-01: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.ajKra4 (%prep) Then I check that temp file and it is trying to CD to a directory that does not exist.. Should it be creating this in the spec file? if so where? Here is my spec file: Summary: Install Hero Name: hero Version: 01 Release: 1 Group: Billing reporting Source: %{name}-%{version}.tar.gz License: SLA %description Hero billing

How do I get rpmbuild to download all of the sources for a particular .spec?

旧街凉风 提交于 2019-12-03 10:45:52
问题 I am adding some sources to an existing rpm .spec file by URL and don't have them downloaded yet. Is there a way to get rpmbuild to download the sources rather than doing it manually? 回答1: The spectool utility from the rpmdevtools package can do this. Just install rpmdevtools and point spectools at the .spec like so: spectool -g -R SPECS/nginx.spec It will download any missing sources into rpm's %{_sourcedir} (usually SOURCES ) directory. 回答2: For posterity, there is another way to do it,

How to set the rpmbuild destination folder

一曲冷凌霜 提交于 2019-12-03 06:06:12
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? Replying myself, adding: %define _rpmdir /outputdir to .spec file. 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

How do I get rpmbuild to download all of the sources for a particular .spec?

三世轮回 提交于 2019-12-03 01:14:47
I am adding some sources to an existing rpm .spec file by URL and don't have them downloaded yet. Is there a way to get rpmbuild to download the sources rather than doing it manually? joeforker The spectool utility from the rpmdevtools package can do this. Just install rpmdevtools and point spectools at the .spec like so: spectool -g -R SPECS/nginx.spec It will download any missing sources into rpm's %{_sourcedir} (usually SOURCES ) directory. For posterity, there is another way to do it, which does not need any additional tools or downloads: rpmbuild --undefine=_disable_source_fetch -ba /path

制作RPM包

匿名 (未验证) 提交于 2019-12-03 00:39:02
RPM包制作过程 1.1 前期工作 1)创建打包用的目录rpmbuild/{BUILD,SPECS,RPMS, SOURCES,SRPMS} 建议使用普通用户,在用户家目录中创建 2)确定好制作的对象,是源码包编译打包还只是一些库文件打包 3)编写SPEC文件 4)开始制作 1.2 RPM制作过程 1)读取并解析 filename.spec 文件 2)运行 %prep 部分来将源代码解包到一个临时目录,并应用所有的补丁程序。 3)运行 %build 部分来编译代码。 4)运行 %install 部分将代码安装到构建机器的目录中。 5)读取 %files 部分的文件列表,收集文件并创建二进制和源 RPM 文件。 6)运行 %clean 部分来除去临时构建目录。 补充说明: BUILD目录:制作车间,二进制tar.gz包的解压后存放的位置,并在此目录进行编译安装 SPECS目录:存放SPEC文件 RPMS目录:存放制作好的rpm包 SOURCES目录:存放源代码 SRPMS目录:存放编译好的二进制rpm包 BUILDROOT目录:此目录是在BUILD目录中执行完make install之后生成的目录,里面存放的是编译安装好的文件,他是./configure中―prefix指定path的根目录 1.3制作工具:rpmbuild 制作过程的几个状态 rpmbuild -bp 执行到

rpm包制作rpmbuild

匿名 (未验证) 提交于 2019-12-03 00:18:01
rpm常用命令 rpm -ivh:安装 rpm -e:卸载 rpm -q:查询 rpmbuild使用 spec文件语法 %postun: %preun: 安装rpm包spec语法 %pre -> %install -> %post 卸载rpm包spec语法 %preun -> %postun 更新rpm包spec语法 %pre -> %install -> %post -> %preun -> %postun 注:前三个命令均运行新包中的命令;后两个运行旧包中的命令 文章来源: rpm包制作rpmbuild