如何给源文件打补丁

发布于 2024-08-27 00:45:14 字数 246 浏览 3 评论 0原文

我正在尝试使用此处提供的文件修补 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

大姐,你呐 2024-09-03 00:45:14

实际上,它是 patch < the_patchcat the_patch |补丁

您可能需要使用 -p 选项,该选项用于删除补丁中存储的路径名片段。例如,如果补丁是从源树上方的一层创建的(就像您将一棵树与另一棵树进行比较)并且您想要从源树内应用补丁,则需要 -p 。

另一个有用的选项是--dry-run。这就像应用补丁一样,但不会修改任何文件。最好用它来测试 -p 选项是否正确并查看是否
补丁会干净地应用。

我通常做的是更改到源树的根目录,然后运行 ​​cat; |补丁-p1 --dry-run。如果我收到有关找不到文件的错误,我将切换到 -p0。一旦其中任何一个起作用,我就会删除 --dry-run 并真正执行它。

Actually, it's patch < the_patch or cat 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 the
patch 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文