如何给源文件打补丁
我正在尝试使用此处提供的文件修补 dmenu:http://aur.archlinux。 org/packages.php?ID=27334
我不知道该怎么做,我读到我应该修补文件到修补补丁
,但是在补丁的前提是涉及多个文件。我尝试过手动修补但失败了,它无法编译。
I am trying to patch dmenu with the files provided here: http://aur.archlinux.org/packages.php?ID=27334
I do not know how to do it, I've read that I should do patch file-to-patch the-patch
, but in the patch provided there is more than one file involved. I've tried patching manually but I failed, it will not compile.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,它是
patch < the_patch
或cat the_patch |补丁
。您可能需要使用
-p
选项,该选项用于删除补丁中存储的路径名片段。例如,如果补丁是从源树上方的一层创建的(就像您将一棵树与另一棵树进行比较)并且您想要从源树内应用补丁,则需要 -p 。另一个有用的选项是
--dry-run
。这就像应用补丁一样,但不会修改任何文件。最好用它来测试-p
选项是否正确并查看是否补丁会干净地应用。
我通常做的是更改到源树的根目录,然后运行
cat; |补丁-p1 --dry-run
。如果我收到有关找不到文件的错误,我将切换到-p0
。一旦其中任何一个起作用,我就会删除--dry-run
并真正执行它。Actually, it's
patch < the_patch
orcat the_patch | patch
.You may need to use the
-p<n>
option which is used to strip off segments of the pathnames stored in the patch. For example, if the patch was created from one level above the source tree (like you were diffing one tree against another) and you want to apply the patch from within the source tree, you would need-p
.Another useful option is
--dry-run
. That will act like it's applying the patch, but won't modify any files. It's a good thing to use to test if you have the-p
option correct and to see if thepatch will apply cleanly.
What I normally do is change to the root of the source tree and then run
cat <file> | patch -p1 --dry-run
. If I get errors about files not being found, I'll switch to-p0
. Once either of those works, I remove the--dry-run
and do it for real.