git生成patch,应用到rpmbuild 打补丁
来源:互联网 发布:怎样做网络推广话术 编辑:程序博客网 时间:2024/06/10 04:35
git diff > test.patch
git format-patch
不要再用diff命令 对比生成patch了,太土
原来的rpm制作,打patch方法(土):
http://blog.csdn.net/qq_26437925/article/details/73864258
centos下 rpm制作
运行环境
[root@localhost myrpm_build]# uname -aLinux localhost 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
不同的运行环境需要调整自己的spec文件
[root@localhost myrpm_build]# tree helloworld-0.1helloworld-0.1├── configure├── helloworld.c└── readme0 directories, 3 files[root@localhost myrpm_build]#
configure
#!/bin/shcat >Makefile << EOFall:helloworldhelloworld.o:helloworld.c gcc -c helloworld.chelloworld:helloworld.o gcc helloworld.o -o helloworldfresh: rm -f Makefileclean: rm -f helloworld helloworld.oinstall: cp helloworld /usr/binuninstall: rm -f /usr/bin/helloworldEOF
helloword.c
#include <stdio.h>int main(){ printf("Hello World!\n"); return 0;}
helloworld.spec
Summary:the first rpmName:helloworldVersion:0.1Release:1%{?dist}Vendor:johnLicense:ShareGroup:Applications/TextSource0:%{name}-%{version}.tar.gz# add patch%descriptionhelloworld.rpm build test%prepexport RPM_SOURCES_DIR=/root/rpmbuild/SOURCESexport RPM_BUILD_DIR=/root/rpmbuild/BUILDtar -xzvf $RPM_SOURCES_DIR/%{name}-%{version}.tar.gz%buildcd $RPM_BUILD_DIR/%{name}-%{version}./configuremake%installcd $RPM_BUILD_DIR/%{name}-%{version}make installmkdir -p /root/rpmbuild/BUILDROOT/%{name}-%{version}-1.el6.x86_64/usr/bin/cp $RPM_BUILD_DIR/%{name}-%{version}/%{name} /root/rpmbuild/BUILDROOT/%{name}-%{version}-1.el6.x86_64/usr/bin/%cleanrm -rf $RPM_BUILD_DIR/%{name}-%{version}%files%defattr(-,root,root)/usr/bin/%{name}%doc $RPM_BUILD_DIR/%{name}-%{version}/readme
如下两句是由于rpmbuild -ba helloworld.spec报错,根据报错信息添加的,可能不同的平台不同,也可能不需要
mkdir -p /root/rpmbuild/BUILDROOT/%{name}-%{version}-1.el6.x86_64/usr/bin/cp $RPM_BUILD_DIR/%{name}-%{version}/%{name} /root/rpmbuild/BUILDROOT/%{name}-%{version}-1.el6.x86_64/usr/bin/
文件全部完成后,tar,并rpmbuild检查结果
tar -czvf helloworld-0.1.tar.gz helloworld-0.1/cp helloworld-0.1.tar.gz /root/rpmbuild/SOURCESrpmbuild -ba helloworld.spec
git patch应用到rpmbuild
主要是git库可以方便的管理文件,并生成patch文件(这里都是本地操作,所以git push这种命令是没有的,用户配置也不需要,你只需要一个高版本的git)
修改helloworld.c后并提交
生成patch
确定git版本是支持 git format-patch命令的,下面是我用windows的实验(我的虚拟机centos没装好高版本的git)
仍然是两个提交日志
生成最近的两个patch文件
git format-patch -2
可以直接查看patch文件,linux下可以直接vim打开
如下把 0002-fix-bug.patch 打上,重新生成rpm
1 先把 0002-fix-bug.patch 文件复制到/root/rpmbuild/SOURCES下面,与原来的helloworld-0.1.tar.gz一起
2 修改helloworld.spec文件,修改后的文件如下
注意打patch的位置
Summary:the first rpmName:helloworldVersion:0.1Release:1%{?dist}Vendor:johnLicense:ShareGroup:Applications/TextSource0:%{name}-%{version}.tar.gz# add patchPatch1:0002-fix-bug.patch%descriptionhelloworld.rpm build test%prepexport RPM_SOURCES_DIR=/root/rpmbuild/SOURCESexport RPM_BUILD_DIR=/root/rpmbuild/BUILDtar -xzvf $RPM_SOURCES_DIR/%{name}-%{version}.tar.gz%setup%patch1 -p1%buildcd $RPM_BUILD_DIR/%{name}-%{version}./configuremake%installcd $RPM_BUILD_DIR/%{name}-%{version}make installmkdir -p /root/rpmbuild/BUILDROOT/%{name}-%{version}-1.el6.x86_64/usr/bin/cp $RPM_BUILD_DIR/%{name}-%{version}/%{name} /root/rpmbuild/BUILDROOT/%{name}-%{version}-1.el6.x86_64/usr/bin/%cleanrm -rf $RPM_BUILD_DIR/%{name}-%{version}%files%defattr(-,root,root)/usr/bin/%{name}%doc $RPM_BUILD_DIR/%{name}-%{version}/readme
- 3 rpmbuild -ba helloworld.spec ,并验证
阅读全文
0 0
- git生成patch,应用到rpmbuild 打补丁
- git打补丁(patch)
- linux打补丁patch应用
- linux打补丁patch应用
- 使用Git生成patch和应用patch
- 使用Git生成patch和应用patch
- git diff 生成patch, git apply patch 打补丁方法说明,以及分支管理的简单操作。
- Git 生成并应用 patch
- linux打补丁patch应用(转载)
- GIT 搭建、定制、生成patch及打补丁、git基础操作命令
- Git Patch生成和应用指南
- git 生成patch 并应用补丁
- diff & patch 制作及打补丁(两种生成补丁的方式(git和diff))
- linux打补丁和git打patch方法
- linux打补丁和git打patch方法
- linux打补丁和git打patch方法
- 生成补丁 与 打补丁 diff patch
- 生成补丁 与 打补丁 diff patch
- JMS_ActiveMQ的点对点消息模型的小例子
- 设计模式 Concurrency 之 ReadWriteLock 读写锁
- mybatils 数据库时间模糊查询
- Cloudkitty Data Flow(Newton版)
- 市场研究中的数据分析知识整理 (七)-结构方程模型
- git生成patch,应用到rpmbuild 打补丁
- 关于Activity
- Maven 构建配置文件
- lintcode刷题——搜索二维矩阵
- 矩阵构造+矩阵快速幂-HDU5950
- 用栈实现队列
- 单元测试,在控制台输入测试值。
- 20款优秀的免费代码编辑器
- 网络判断(广播)