Android 当使用 <include ... /> 语句时,回购工具无法初始化 default.xml
Android Repo tool fails to init default.xml when <include ... /> statement is used
使用 repo 工具包含其他清单文件时失败。
不幸的是,从日志来看,解析文件似乎有问题。
如有任何想法,我们将不胜感激。
我尝试过分别初始化每个 manifest.xml 并成功,但是一旦我使用 include 语句合并它们就失败了。
我曾尝试明确指向清单文件,但结果相同。
repo init -u https://github.com/example/Manifest -b master
repo init -u https://github.com/example/Manifest -b master -m default.xml
文件结构为:
- default.xml
- /scripts/filea.xml
- /scripts/fileb.xml
default.xml
<?xml version="1.0" encoding="UTF-8" ?>
<manifest>
<remote fetch="https://github.com/example" name="origin"/>
<default sync-j="4" revision="refs/heads/master" remote="origin"/>
<remote fetch="https://git.yoctoproject.org/git" name="yocto"/>
<remote fetch="https://github.com/mendersoftware" name="mender"/>
<remote fetch="https://github.com/openembedded" name="oe"/>
<project remote="yocto" revision="thud" name="poky" path="sources/poky"/>
<!-- <project remote="oe" revision="thud" name="meta-openembedded" path="sources/meta-openembedded"/> -->
<include name="scripts/filea.xml"/>
<include name="scripts/fileb.xml"/>
</manifest>
filea.xml
<?xml version="1.0" encoding="UTF-8" ?>
<manifest>
<default sync-j="4" revision="refs/heads/master"/>
<remote fetch="https://github.com/example" name="origin"/>
<project name="meta-kernel" remote="origin" revision="master" path="sources/meta-kernel"/>
</manifest>
fileb.xml
<?xml version="1.0" encoding="UTF-8" ?>
<manifest>
<default sync-j="4" revision="refs/heads/master"/>
<remote fetch="https://github.com/mendersoftware" name="mender"/>
<remote fetch="https://github.com/example" name="origin"/>
<project name="meta-mender" remote="mender" revision="thud" path="sources/meta-mender"/>
<project name="meta-mender-community" remote="mender" revision="thud" path="sources/meta-mender-community"/>
<project name="meta-mender-production" remote="origin" revision="master" path="sources/meta-mender-production"/>
</manifest>
下面是错误输出的片段。从它的外观来看,解析 default.xml 时出现了问题,但我正在努力找出原因。
From https://github.com/example/Manifest
* [new branch] master -> origin/master
Traceback (most recent call last):
File "/home/yocto/build/.repo/repo/main.py", line 572, in <module>
_Main(sys.argv[1:])
File "/home/yocto/build/.repo/repo/main.py", line 547, in _Main
result = run()
File "/home/yocto/build/.repo/repo/main.py", line 540, in <lambda>
run = lambda: repo._Run(name, gopts, argv) or 0
File "/home/yocto/build/.repo/repo/main.py", line 201, in _Run
result = cmd.Execute(copts, cargs)
File "/home/yocto/build/.repo/repo/subcmds/init.py", line 452, in Execute
self._LinkManifest(opt.manifest_name)
File "/home/yocto/build/.repo/repo/subcmds/init.py", line 309, in _LinkManifest
self.manifest.Link(name)
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 180, in Link
self.Override(name)
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 173, in Override
self._Load()
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 479, in _Load
self._ParseManifest(nodes)
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 546, in _ParseManifest
elif new_default != self._default:
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 74, in __ne__
return self.__dict__ != other.__dict__
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 95, in __eq__
return self.__dict__ == other.__dict__
AttributeError: 'NoneType' object has no attribute '__dict__'
从包含的文件(filea.xml 和 fileb.xml)中删除 <default ... />
。最多可以指定一个默认元素。
来自回购文档
$ repo help manifest
[...]
Element default
At most one default element may be specified. Its remote and revision
attributes are used when a project element does not specify its own
remote or revision attribute.
使用 repo 工具包含其他清单文件时失败。
不幸的是,从日志来看,解析文件似乎有问题。
如有任何想法,我们将不胜感激。
我尝试过分别初始化每个 manifest.xml 并成功,但是一旦我使用 include 语句合并它们就失败了。
我曾尝试明确指向清单文件,但结果相同。
repo init -u https://github.com/example/Manifest -b master
repo init -u https://github.com/example/Manifest -b master -m default.xml
文件结构为:
- default.xml
- /scripts/filea.xml
- /scripts/fileb.xml
default.xml
<?xml version="1.0" encoding="UTF-8" ?>
<manifest>
<remote fetch="https://github.com/example" name="origin"/>
<default sync-j="4" revision="refs/heads/master" remote="origin"/>
<remote fetch="https://git.yoctoproject.org/git" name="yocto"/>
<remote fetch="https://github.com/mendersoftware" name="mender"/>
<remote fetch="https://github.com/openembedded" name="oe"/>
<project remote="yocto" revision="thud" name="poky" path="sources/poky"/>
<!-- <project remote="oe" revision="thud" name="meta-openembedded" path="sources/meta-openembedded"/> -->
<include name="scripts/filea.xml"/>
<include name="scripts/fileb.xml"/>
</manifest>
filea.xml
<?xml version="1.0" encoding="UTF-8" ?>
<manifest>
<default sync-j="4" revision="refs/heads/master"/>
<remote fetch="https://github.com/example" name="origin"/>
<project name="meta-kernel" remote="origin" revision="master" path="sources/meta-kernel"/>
</manifest>
fileb.xml
<?xml version="1.0" encoding="UTF-8" ?>
<manifest>
<default sync-j="4" revision="refs/heads/master"/>
<remote fetch="https://github.com/mendersoftware" name="mender"/>
<remote fetch="https://github.com/example" name="origin"/>
<project name="meta-mender" remote="mender" revision="thud" path="sources/meta-mender"/>
<project name="meta-mender-community" remote="mender" revision="thud" path="sources/meta-mender-community"/>
<project name="meta-mender-production" remote="origin" revision="master" path="sources/meta-mender-production"/>
</manifest>
下面是错误输出的片段。从它的外观来看,解析 default.xml 时出现了问题,但我正在努力找出原因。
From https://github.com/example/Manifest
* [new branch] master -> origin/master
Traceback (most recent call last):
File "/home/yocto/build/.repo/repo/main.py", line 572, in <module>
_Main(sys.argv[1:])
File "/home/yocto/build/.repo/repo/main.py", line 547, in _Main
result = run()
File "/home/yocto/build/.repo/repo/main.py", line 540, in <lambda>
run = lambda: repo._Run(name, gopts, argv) or 0
File "/home/yocto/build/.repo/repo/main.py", line 201, in _Run
result = cmd.Execute(copts, cargs)
File "/home/yocto/build/.repo/repo/subcmds/init.py", line 452, in Execute
self._LinkManifest(opt.manifest_name)
File "/home/yocto/build/.repo/repo/subcmds/init.py", line 309, in _LinkManifest
self.manifest.Link(name)
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 180, in Link
self.Override(name)
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 173, in Override
self._Load()
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 479, in _Load
self._ParseManifest(nodes)
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 546, in _ParseManifest
elif new_default != self._default:
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 74, in __ne__
return self.__dict__ != other.__dict__
File "/home/yocto/build/.repo/repo/manifest_xml.py", line 95, in __eq__
return self.__dict__ == other.__dict__
AttributeError: 'NoneType' object has no attribute '__dict__'
从包含的文件(filea.xml 和 fileb.xml)中删除 <default ... />
。最多可以指定一个默认元素。
来自回购文档
$ repo help manifest
[...]
Element default
At most one default element may be specified. Its remote and revision
attributes are used when a project element does not specify its own
remote or revision attribute.