Bitbake配方未按预期应用补丁 [英] Bitbake recipe not applying patch as expected

查看:97
本文介绍了Bitbake配方未按预期应用补丁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个压缩包src.tar.gz,其内容已解压缩到src/中,并且使用以下命令生成了此源的补丁程序:

I have a tarball src.tar.gz whose contents are unpacked into src/ and a patch of this sources generated with this command:

$ diff -Nurp src/ src_mod/ > my.patch

补丁标题以以下三行开头:

The patch header starts with this three lines:

 diff -Nurp src/path/to/file src_PATCHED/path/to/file
 --- src/path/to/file  2012-10-22 05:52:59.000000000 +0200
 +++ src_PATCHED/path/to/file  2016-03-14 12:27:52.892802283 +0100

我的烘烤食谱使用此SRC_URI引用路径文件和tarball文件:

My bitbake recipe references both path and tarball files using this SRC_URI:

SRC_URI = " \
    file://my.patch \
    file://src.tar.gz \
"

do_fetch和do_unpack任务按预期工作,将my.patch和src/保留在$ {S}目录中,即:

do_fetch and do_unpack tasks work as expected, leaving my.patch and src/ inside ${S} directory, that is:

${S}/my.path
${S}/src.tar.gz

但是do_patch任务失败,并显示以下错误消息:

But do_patch task is failing with this ERROR message:

ERROR: Command Error: exit status: 1  Output:
Applying patch my.patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?

我已经测试了不同的替代方法,例如设置"patchdir"属性,如下所示:

I have tested different alternatives, for example setting "patchdir" attribute like showed below:

SRC_URI = " \
    file://my.patch;patchdir=${S}/src \
    file://src.tar.gz \
"

我希望"patchdir"与使用"patch -d dir"相同.但是它不能按预期工作,它总是返回相同的错误消息.

I expected "patchdir" being the same as using "patch -d dir". But it doesn't work as expected, it always returns the same ERROR message.

我做错了什么?

推荐答案

我的变量${S}已在我的配方中重新定义,内容如下:

My variable ${S} was re-defined inside my recipe with this content:

S = "${WORKDIR}/${PN}-${PV}"

但是获取程序会在${WORKDIR}内部而不是在${S}目录中下载my.patchsrc/,因此:

But the fetchers downloads my.patch and src/ inside ${WORKDIR}, not inside ${S} directory, so:

${WORKDIR}/my.path
${WORKDIR}/src.tar.gz

${WORKDIR}

${WORKDIR}/src/

此修复程序正确设置了"patchdir"属性,将${S}替换为${WORKDIR}

The fix was setting "patchdir" attribute properly, replacing ${S} by ${WORKDIR}

SRC_URI = " \
    file://my.patch;patchdir=${WORKDIR}/src \
    file://src.tar.gz \
"

已经开始工作了!

这篇关于Bitbake配方未按预期应用补丁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆