我正试图在yocto映像中安装微处理器的已编译固件。此固件在启动时被发送到微处理器。此固件的编译器仅在windows上运行,因此不可能只克隆git存储库并在构建过程中进行编译。我从一个GitLab CI CD管道的工件中获得这个固件文件。
为了调试的目的,我想下载这个固件文件从主分支,每次我构建映像。
我以前处理过一个定制的do_fetch
任务,并设置了do_fetch[nostamp] = "1"
。这起作用了,但当curl
将404错误放入文件时,我遇到了麻烦。现在我已经尝试切换到wget
和SRC_URI
,但是即使仍然设置了nostamp
,它也会生成一个.done
文件。现在它再也不会下载文件了。
下面是我使用的菜谱文件:
S = "${WORKDIR}/"
PRIVATE_TOKEN = "xxxxxxxxxxx" # redacted
PROJECT_ID = "224"
VERSION = "2.00.01"
TAG = "master"
DOWNLOAD_FILE_PATH = "Production/firmware.bin"
INSTALL_NAME = "my-firmware-file.bin"
VERSION_FILE = "version.txt"
URL = "https://git.mycompany.com/api/v4/projects/${PROJECT_ID}/jobs/artifacts/${TAG}/raw/${DOWNLOAD_FILE_PATH}?job=publish_executable"
FETCHCMD_wget = "/usr/bin/env wget --header "PRIVATE-TOKEN: ${PRIVATE_TOKEN}""
BB_STRICT_CHECKSUM = "0"
SRC_URI = "${URL};downloadfilename=${INSTALL_NAME}"
do_fetch[nostamp] = "1"
do_patch(){
echo ${VERSION} > ${VERSION_FILE}
}
do_install(){
install -d ${D}${libdir}/test-dir/${PN}
# Install binary from artifacts
install -m 644 ${S}${INSTALL_NAME} ${D}${libdir}/test-dir/${PN}/${INSTALL_NAME}
# Instal version file created from tag
install -m 644 ${S}${VERSION_FILE} ${D}${libdir}/test-dir/${PN}/${VERSION_FILE}
}
FILES_${PN} += "${libdir}/test-dir/${PN}"
在运行菜谱( bitbake <PN>
或bitbake <PN> -c fetch -f
)之后,我可以运行ls -la build/download | grep my-firmware-file
,它显示了两个条目:
-rw-rw-r-- 1 root root 613924 Nov 11 11:50 my-firmware-file.bin
-rw-rw-r-- 1 root root 463 Nov 14 14:26 my-firmware-file.bin.done
正如您所看到的,它生成了一个.done
文件,这个文件比实际文件的最后一次下载更新。即使在更改TAG
变量时,也不会下载新文件。但是,出于某种原因,它总是将正确的版本放入version.txt
文件中。
我遗漏了什么?我可以在每次构建之前运行一个cleanall
,但这似乎不是一个永久的解决方案。此外,最终目标是对配方进行版本化,并使用包版本从正确的版本中提取,但目前它从主版中提取,因此这没有多大意义。
更新:我检查了日志文件,似乎没有问题,因为命令从未执行过。第一次清理之后,do_fetch
的日志如下所示:
DEBUG: Executing python function extend_recipe_sysroot
NOTE: Direct dependencies are []
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: []
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing python function do_fetch
DEBUG: Executing python function base_do_fetch
DEBUG: Trying PREMIRRORS
DEBUG: Trying Upstream
DEBUG: Fetching https://git.mycompany.com/api/v4/projects/224/jobs/artifacts/master/raw/Production/firmware.bin?job=publish_executable;downloadfilename=my-firmware-file.bin using command '/usr/bin/env wget -r --header "PRIVATE-TOKEN: xxxxxxxxxxxxxx" -O /home/.../build/downloads/my-firmware-file.bin.tmp -P /home/.../build/downloads 'https://git.mycompany.com/api/v4/projects/224/jobs/artifacts/master/raw/Production/firmware.bin?job=publish_executable''
DEBUG: Fetcher accessed the network with the command /usr/bin/env wget -r --header "PRIVATE-TOKEN: xxxxxxxxxxxxxx" -O /home/.../build/downloads/my-firmware-file.bin.tmp -P /home/.../build/downloads 'https://git.mycompany.com/api/v4/projects/224/jobs/artifacts/master/raw/Production/firmware.bin?job=publish_executable'
DEBUG: Running export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1005/bus"; export PATH="..."; export HOME="/home/..."; /usr/bin/env wget -r --header "PRIVATE-TOKEN: xxxxxxxxxxxxxx" -O /home/.../build/downloads/my-firmware-file.bin.tmp -P /home/.../build/downloads 'https://git.mycompany.com/api/v4/projects/224/jobs/artifacts/master/raw/Production/firmware.bin?job=publish_executable' --progress=dot -v
WARNING: combining -O with -r or -p will mean that all downloaded content
will be placed in the single file you specified.
--2022-11-18 07:01:11-- https://git.mycompany.com/api/v4/projects/224/jobs/artifacts/master/raw/Production/firmware.bin?job=publish_executable
Resolving git.mycompany.com (git.mycompany.com)... <IP>
Connecting to git.mycompany.com (git.mycompany.com)|<IP>|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 613924 (600K) [application/octet-stream]
Saving to: ‘/home/.../build/downloads/my-firmware-file.bin.tmp’
2022-11-18 07:01:11 (70.4 MB/s) - ‘/home/.../build/downloads/my-firmware-file.bin.tmp’ saved [613924/613924]
FINISHED --2022-11-18 07:01:11--
Total wall clock time: 0.5s
Downloaded: 1 files, 600K in 0.008s (70.4 MB/s)
WARNING: Missing checksum for '/home/.../build/downloads/my-firmware-file.bin', consider adding at least one to the recipe:
SRC_URI[sha256sum] = "83aa3c373228b48eea58964b4ffec7ad42226014351d18bed12cb9b5eb3d261e"
DEBUG: Python function base_do_fetch finished
DEBUG: Python function do_fetch finished
当我再次运行do_fetch
时(即使在更改TAG
变量时,SRC_URI
也会发生变化),日志如下所示:
DEBUG: Executing python function extend_recipe_sysroot
NOTE: Direct dependencies are []
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: []
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing python function do_fetch
DEBUG: Executing python function base_do_fetch
WARNING: Missing checksum for '/home/.../build/downloads/my-firmware-file.bin', consider adding at least one to the recipe:
SRC_URI[sha256sum] = "83aa3c373228b48eea58964b4ffec7ad42226014351d18bed12cb9b5eb3d261e"
WARNING: Missing checksum for '/home/.../build/downloads/my-firmware-file.bin', consider adding at least one to the recipe:
SRC_URI[sha256sum] = "83aa3c373228b48eea58964b4ffec7ad42226014351d18bed12cb9b5eb3d261e"
DEBUG: Python function base_do_fetch finished
DEBUG: Python function do_fetch finished
注意第二个日志中重复丢失的校验和警告。我还尝试只删除./downloads/my-firmware-file.bin.done
文件,但它仍然没有重新下载,日志与第二个相同。
发布于 2022-11-17 05:08:20
尝试添加-r
标志以强制wget
重新下载,即使文件存在:
FETCHCMD_wget = "/usr/bin/env wget -r --header "PRIVATE-TOKEN: ${PRIVATE_TOKEN}""
https://stackoverflow.com/questions/74432650
复制相似问题