Repo copyfile and manifest.xml execution sequence issue

3,170 views
Skip to first unread message

Anthony Ginger

unread,
Jul 10, 2009, 5:01:04 AM7/10/09
to Repo and Gerrit Discussion
Here is part of my manifest.xml:
<project path="kernel/linux-2.6"
name="kernel/git/torvalds/linux-2.6"
revision="refs/heads/master" />

<project path="build" name="system/build">
<copyfile src="core/root.mk" dest="Makefile" />
<copyfile src="core/root.cfg" dest="AmbaConfig" />
<copyfile src="kernel/kernel.mk" dest="kernel/Makefile" />
<copyfile src="kernel/kernel.cfg" dest="kernel/AmbaConfig" />
</project>

What I want is copy $(PROJECT_TOP_DIR)/build/core/core.mk to $
(PROJECT_TOP_DIR) (it works), and $(PROJECT_TOP_DIR)/build/kernel/
kernel.mk to $(PROJECT_TOP_DIR) /kernel (which doesn't work).

I found "build" section will executed before "kernel" section, which
causes copyfile fail because kernel dir doesn’t exist at that time.
So I want to know:
1. Is there a way to make manifest.xml executed in its own sequence?
Not alphabet sequence.
2. Is there a way to mkdir in manifest.xml or make copyfile create
the dir automatically?
3. Is there a way to create symbol link in manifest.xml, not just
copyfile?

Shawn Pearce

unread,
Jul 10, 2009, 10:30:34 AM7/10/09
to repo-d...@googlegroups.com
On Fri, Jul 10, 2009 at 02:01, Anthony Ginger<Map...@gmail.com> wrote:
>
> Here is part of my manifest.xml:
>        <project path="kernel/linux-2.6"
>                name="kernel/git/torvalds/linux-2.6"
>                revision="refs/heads/master" />
>
>        <project path="build" name="system/build">
>                <copyfile src="core/root.mk" dest="Makefile" />
>                <copyfile src="core/root.cfg" dest="AmbaConfig" />
>                <copyfile src="kernel/kernel.mk" dest="kernel/Makefile" />
>                <copyfile src="kernel/kernel.cfg" dest="kernel/AmbaConfig" />
>        </project>
>
> What I want is copy $(PROJECT_TOP_DIR)/build/core/core.mk to $
> (PROJECT_TOP_DIR) (it works), and $(PROJECT_TOP_DIR)/build/kernel/
> kernel.mk to $(PROJECT_TOP_DIR) /kernel (which doesn't work).
>
> I found "build" section will executed before "kernel" section, which
> causes copyfile  fail because kernel dir doesn’t exist at that time.
> So I want to know:
> 1.  Is there a way to make manifest.xml executed in its own sequence?
> Not alphabet sequence.

No.

> 2.  Is there a way to mkdir in manifest.xml or make copyfile create
> the dir automatically?

No.

> 3.  Is there a way to create symbol link in manifest.xml, not just
> copyfile?

No.

And worse... the development version of repo contains a new manifest
format based on git submodule, not an XML file format. There is no
equivalent of copyfile there, instead we put the file directly in the
submodule working directory. Which can't be done on this case because
you cannot add a file to a directory which is mounted as a submodule
(aka project in the XML format). So we're actually heading in a
direction *away* from what you are trying to use it for.

<copyfile> was built as a kludge to ensure we had a Makefile at the
top level in the Android build tree, because we couldn't support any
other files there. Originally I had just proposed that people create
this file by hand; if you look at any Android tree its literally just
3 lines, 2 of which are pointless noise:

$ cat Makefile
### DO NOT EDIT THIS FILE ###
include build/core/main.mk
### DO NOT EDIT THIS FILE ###

Given that I wanted to have people either create this file by hand, or
symlink to it, e.g.:

$ ln -s build/core/main.mk Makefile
(or)
$ echo include build/core/main.mk >Makefile

But some peer pressure applied by fellow engineers lead to copyfile
being introduced instead.

Anthony Ginger

unread,
Jul 10, 2009, 10:33:22 PM7/10/09
to Repo and Gerrit Discussion
I agree. copyfile isn't necessary.

The problem is current repo can't support putting one git into another
git dir(correct me if I am wrong), and it make integrating projects a
little difficult. Will your development version of repo support "git-
submodule" or something like that?
I check the repo FAQ, it is empty. Could you provide some information
on your road map and some example on how to use the repo later?

I like repo!

Thanks a lot.

Shawn Pearce

unread,
Jul 10, 2009, 10:46:25 PM7/10/09
to repo-d...@googlegroups.com
On Fri, Jul 10, 2009 at 19:33, Anthony Ginger<Map...@gmail.com> wrote:
>
> I agree. copyfile isn't necessary.
>
> The problem is current repo can't support putting one git into another
> git dir(correct me if I am wrong), and it make integrating projects a
> little difficult. Will your development version of repo support "git-
> submodule" or something like that?

Yea, its actually supporting a more git submodule like structure. See

http://android.git.kernel.org/?p=tools/repo.git;a=blob;f=docs/manifest_submodule.txt;hb=HEAD

for more details on what's coming.

Anthony Ginger

unread,
Jul 13, 2009, 12:17:33 AM7/13/09
to Repo and Gerrit Discussion

Here is my .gitmodules:
[submodule "kernel/git/torvalds/linux-2.6"]
path = kernel/linux-2.6
url = git://test.com/kernel/git/torvalds/linux-2.6.git
revision = refs/heads/master

1. repo init -u git://test.com/manifest.git -b kernels (it will fail
because repo isn't based on the latest master)
...
* [new branch] kernels -> origin/kernels
* [new branch] master -> origin/master
* [new branch] test -> origin/test
fatal: manifest 'default.xml' not available
fatal: manifest default.xml not found

2. So I switch to the master by hand,
cd .repo/repo/ && git-reset --hard refs/remotes/origin/master
repo init -u git://test.com/manifest.git -b kernels

repo init did success, and I get ".git .gitmodules .repo .review"
in my project dir.

3. When I use repo sync, it fail agian,
Traceback (most recent call last):
File "/lhome/hfjiang/project/kernels/.repo/repo/main.py", line 231,
in <module>
_Main(sys.argv[1:])
File "/lhome/hfjiang/project/kernels/.repo/repo/main.py", line 213,
in _Main
repo._Run(argv)
File "/lhome/hfjiang/project/kernels/.repo/repo/main.py", line 119,
in _Run
cmd.Execute(copts, cargs)
File "/lhome/hfjiang/project/kernels/.repo/repo/subcmds/sync.py",
line 197, in Execute
all = self.GetProjects(args, missing_ok=True)
File "/lhome/hfjiang/project/kernels/.repo/repo/command.py", line
73, in GetProjects
all = self.manifest.projects
File "/lhome/hfjiang/project/kernels/.repo/repo/
manifest_submodule.py", line 102, in projects
self._Load()
File "/lhome/hfjiang/project/kernels/.repo/repo/
manifest_submodule.py", line 325, in _Load
self._ParseModules()
File "/lhome/hfjiang/project/kernels/.repo/repo/
manifest_submodule.py", line 336, in _ParseModules
p = self._ParseProject(name)
File "/lhome/hfjiang/project/kernels/.repo/repo/
manifest_submodule.py", line 405, in _ParseProject
% (name, path))
error.ManifestParseError: submodule "kernel/git/torvalds/linux-2.6"
has no revision at "kernel/linux-2.6"

What's wrong? And could your provide a sample .gitmodules based on
android project, so I can test and know what's wrong.

Thanks.

On 7月11日, 上午10时46分, Shawn Pearce <s...@google.com> wrote:
> On Fri, Jul 10, 2009 at 19:33, Anthony Ginger<Map...@gmail.com> wrote:
>
> > I agree. copyfile isn't necessary.
>
> > The problem is current repo can't support putting one git into another
> > git dir(correct me if I am wrong), and it make integrating projects a
> > little difficult. Will your development version of repo support "git-
> > submodule" or something like that?
>
> Yea, its actually supporting a more git submodule like structure.  See
>
>  http://android.git.kernel.org/?p=tools/repo.git;a=blob;f=docs/manifes...

Shawn Pearce

unread,
Jul 13, 2009, 10:19:36 AM7/13/09
to repo-d...@googlegroups.com
On Sun, Jul 12, 2009 at 21:17, Anthony Ginger<Map...@gmail.com> wrote:
> 1. repo init -u git://test.com/manifest.git -b kernels (it will fail
> because repo isn't based on the latest master)

Use instead:

repo init -u git://test.com/manifest.git -b kernels

--repo-branch=master --no-repo-verify

> 3. When I use repo sync, it fail agian,
> Traceback (most recent call last):

...


> error.ManifestParseError: submodule "kernel/git/torvalds/linux-2.6"
> has no revision at "kernel/linux-2.6"
>
> What's wrong? And could your provide a sample .gitmodules based on
> android project, so I can test and know what's wrong.

Read that final error. You don't have a submodule gitlink in your
manifest repository. To put that there, you need to do something
like:

mkdir kernel
git clone git://test.com/kernel/git/torvalds/linux-2.6.git kernel/linux-2.6
git add kernel/linux-2.6
git commit -m "Initial revision of kernel/linux-2.6"

Reply all
Reply to author
Forward
0 new messages