如何从社区邮件列表获取完整的补丁(pwclient)

如何从社区邮件列表获取完整的补丁

 

我们看邮件列表时,经常会对没有进入社区的patch,感兴趣。但是邮件列表里的补丁并不是完整的git仓库可用的补丁。对于少量的补丁,可以用复制和粘贴来获取patch。
但是如果patch是几十个的话,粘贴复制比较麻烦。有一个工具可以完成从邮件列表获取patch,并应用这个patch到代码里。
这个工具叫pwclient,下面是具体的步骤

  • 下载pwelient:

git clone https://github.com/getpatchwork/pwclient 

  • 编译(参见代码里的README):

pip install --user .

  • 配置.pwclientrc文件,主要是从哪个邮件列表下载补丁的配置

[root]#vim ~/.pwclientrc

# Sample .pwclientrc file for the patchwork project,
# running on patchwork.ozlabs.org.
#
# Just append this file to your existing ~/.pwclientrc
# If you do not already have a ~/.pwclientrc, then copy this file to
# ~/.pwclientrc, and uncomment the following two lines:
[options]
default=lkml

[lkml]
url = https://lore.kernel.org/patchwork/xmlrpc/

上面的配置,是Linux kernel的邮件列表的补丁,其它常用的邮件列表如下。
https://patchwork.kernel.org/ Linux kernel
https://patchwork.ozlabs.org/project/qemu-devel/list/ QEMU
https://patchwork.ozlabs.org/project/gcc/list/ GCC, which includes GDB which is your original use case
https://patchwork.ozlabs.org/project/glibc/list/ glibc

 

  • 如何使用pwclient

1  获取lkml补丁的patch id. 比如,我们看到邮件有一个[RFC 08/60] sched: Move init_entity_runnable_average() into init_tg_cfs_entry()这个标题的补丁。我们用pwclient search来获取这个补丁的id

root@yxf-ubuntu:~# pwclient search "sched: Move init_entity_runnable_average() into init_tg_cfs_entry()"
ID      State        Name
--      -----        ----
983638  New          [RFC,08/60] sched: Move init_entity_runnable_average() into init_tg_cfs_entry()

可以看到ID为983638,这个就是patch id

2 获取邮件列表的完整的补丁

root@yxf-ubuntu:~# pwclient get 983638
Saved patch to RFC-08-60-sched-Move-init_entity_runnable_average-into-init_tg_cfs_entry.patch
这个步骤完成补丁的下载。
3 将补丁打入git 代码仓库
root@yxf-ubuntu:~# cd linux
root@yxf-ubuntu:~# pwclient git-am 983638
执行完这个命令patch id为983638的补丁,就打入到了本地源码里

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值