问题0001
Command ['/usr/bin/git', 'rev-parse', '--short=8', 'HEAD'] returned 128
//将来源代码中可能会有无数个位置使用git_head_hash函数调用或其变体之一。一次获得它们的任何简单方法(至少现在是这样)是编辑Tools/ardupilotwaf/git_submodule.py
def _git_head_hash(ctx, path, short=False):
cmd = [ctx.env.get_flat('GIT'), 'rev-parse']
if short:
cmd.append('--short=8')
cmd.append('HEAD')
out = ctx.cmd_and_log(cmd, quiet=Context.BOTH, cwd=path)
return out.strip()
//将其修改为立即返回一个假哈希字符串:
def _git_head_hash(ctx, path, short=False):
return "deadc0de"
//您可以根据需要编辑此函数,该函数应处理Command ['/usr/bin/git', 'rev-parse', '--short=8', 'HEAD'] returned 128构建过程中报告的所有错误。
问题0002
Build failed
Traceback (most recent call last):
File "/mnt/hgfs/002_Ardupilot-420/ardupilot/modules/waf/waflib/Runner.py", line 395, in task_status
return tsk.runnable_status()
File "Tools/ardupilotwaf/git_submodule.py", line 75, in runnable_status
out = self.generator.bld.cmd_and_log(cmd, quiet=Context.BOTH, cwd=self.cwd)
File "/mnt/hgfs/002_Ardupilot-420/ardupilot/modules/waf/waflib/Context.py", line 461, in cmd_and_log
raise e
WafError: Command ('/usr/bin/git', 'submodule', 'status', '--recursive', '--', '/mnt/hgfs/002_Ardupilot-420/ardupilot/modules/ChibiOS') returned 128
git config --global --add safe.directory /mnt/hgfs/002_Ardupilot-420/ardupilot
git submodule update --init --recursive --force
问题0003
ubuntu18.04提示:cannot create temp file for here-document, no space left on device
由于虚拟机分配的存储大小不足,可用df -h 查询当前设备空间分配
问题0004
submodule更新失败:
fatal: remote error: upload-pack: not our ref 53a161966d2f0c95c04c7262e71d319be2618505 fatal: The remote end hung up unexpectedly
cd {submodule path}
git reset --hard origin/master
cd -
git clean -n
git add {submodule path}
git commit
git submodule update --init --recursive
link:https://stackoverflow.com/questions/61163082/why-does-git-submodule-update-fail-with-fatal-remote-error-upload-pack-not-o