2008-11-04 19:19:36 +00:00
|
|
|
repo Manifest Format
|
|
|
|
====================
|
|
|
|
|
|
|
|
A repo manifest describes the structure of a repo client; that is
|
|
|
|
the directories that are visible and where they should be obtained
|
|
|
|
from with git.
|
|
|
|
|
|
|
|
The basic structure of a manifest is a bare Git repository holding
|
|
|
|
a single 'default.xml' XML file in the top level directory.
|
|
|
|
|
|
|
|
Manifests are inherently version controlled, since they are kept
|
|
|
|
within a Git repository. Updates to manifests are automatically
|
|
|
|
obtained by clients during `repo sync`.
|
|
|
|
|
|
|
|
|
|
|
|
XML File Format
|
|
|
|
---------------
|
|
|
|
|
|
|
|
A manifest XML file (e.g. 'default.xml') roughly conforms to the
|
|
|
|
following DTD:
|
|
|
|
|
2009-03-04 22:26:50 +00:00
|
|
|
<!DOCTYPE manifest [
|
2010-11-01 22:08:06 +00:00
|
|
|
<!ELEMENT manifest (notice?,
|
|
|
|
remote*,
|
2009-03-04 22:26:50 +00:00
|
|
|
default?,
|
2010-04-06 17:40:01 +00:00
|
|
|
manifest-server?,
|
2009-03-04 22:26:50 +00:00
|
|
|
remove-project*,
|
Support repo-level pre-upload hook and prep for future hooks.
All repo-level hooks are expected to live in a single project at the
top level of that project. The name of the hooks project is provided
in the manifest.xml. The manifest also lists which hooks are enabled
to make it obvious if a file somehow failed to sync down (or got
deleted).
Before running any hook, we will prompt the user to make sure that it
is OK. A user can deny running the hook, allow once, or allow
"forever" (until hooks change). This tries to keep with the git
spirit of not automatically running anything on the user's computer
that got synced down. Note that individual repo commands can add
always options to avoid these prompts as they see fit (see below for
the 'upload' options).
When hooks are run, they are loaded into the current interpreter (the
one running repo) and their main() function is run. This mechanism is
used (instead of using subprocess) to make it easier to expand to a
richer hook interface in the future. During loading, the
interpreter's sys.path is updated to contain the directory containing
the hooks so that hooks can be split into multiple files.
The upload command has two options that control hook behavior:
- no-verify=False, verify=False (DEFAULT):
If stdout is a tty, can prompt about running upload hooks if needed.
If user denies running hooks, the upload is cancelled. If stdout is
not a tty and we would need to prompt about upload hooks, upload is
cancelled.
- no-verify=False, verify=True:
Always run upload hooks with no prompt.
- no-verify=True, verify=False:
Never run upload hooks, but upload anyway (AKA bypass hooks).
- no-verify=True, verify=True:
Invalid
Sample bit of manifest.xml code for enabling hooks (assumes you have a
project named 'hooks' where hooks are stored):
<repo-hooks in-project="hooks" enabled-list="pre-upload" />
Sample main() function in pre-upload.py in hooks directory:
def main(project_list, **kwargs):
print ('These projects will be uploaded: %s' %
', '.join(project_list))
print ('I am being a good boy and ignoring anything in kwargs\n'
'that I don\'t understand.')
print 'I fail 50% of the time. How flaky.'
if random.random() <= .5:
raise Exception('Pre-upload hook failed. Have a nice day.')
Change-Id: I5cefa2cd5865c72589263cf8e2f152a43c122f70
2011-03-04 19:54:18 +00:00
|
|
|
project*,
|
|
|
|
repo-hooks?)>
|
2009-03-04 22:26:50 +00:00
|
|
|
|
2010-11-01 22:08:06 +00:00
|
|
|
<!ELEMENT notice (#PCDATA)>
|
|
|
|
|
2009-03-04 22:26:50 +00:00
|
|
|
<!ELEMENT remote (EMPTY)>
|
|
|
|
<!ATTLIST remote name ID #REQUIRED>
|
|
|
|
<!ATTLIST remote fetch CDATA #REQUIRED>
|
|
|
|
<!ATTLIST remote review CDATA #IMPLIED>
|
|
|
|
|
|
|
|
<!ELEMENT default (EMPTY)>
|
|
|
|
<!ATTLIST default remote IDREF #IMPLIED>
|
|
|
|
<!ATTLIST default revision CDATA #IMPLIED>
|
2011-09-23 00:44:31 +00:00
|
|
|
<!ATTLIST default sync-j CDATA #IMPLIED>
|
2010-04-06 17:40:01 +00:00
|
|
|
|
|
|
|
<!ELEMENT manifest-server (EMPTY)>
|
|
|
|
<!ATTLIST url CDATA #REQUIRED>
|
2009-03-04 22:26:50 +00:00
|
|
|
|
2012-04-12 20:04:13 +00:00
|
|
|
<!ELEMENT project (annotation?)>
|
2009-03-04 22:26:50 +00:00
|
|
|
<!ATTLIST project name CDATA #REQUIRED>
|
|
|
|
<!ATTLIST project path CDATA #IMPLIED>
|
|
|
|
<!ATTLIST project remote IDREF #IMPLIED>
|
|
|
|
<!ATTLIST project revision CDATA #IMPLIED>
|
2012-03-29 03:15:45 +00:00
|
|
|
<!ATTLIST project groups CDATA #IMPLIED>
|
2012-04-12 20:04:13 +00:00
|
|
|
|
|
|
|
<!ELEMENT annotation (EMPTY)>
|
|
|
|
<!ATTLIST annotation name CDATA #REQUIRED>
|
|
|
|
<!ATTLIST annotation value CDATA #REQUIRED>
|
|
|
|
<!ATTLIST annotation keep CDATA "true">
|
2009-03-04 22:26:50 +00:00
|
|
|
|
|
|
|
<!ELEMENT remove-project (EMPTY)>
|
|
|
|
<!ATTLIST remove-project name CDATA #REQUIRED>
|
Support repo-level pre-upload hook and prep for future hooks.
All repo-level hooks are expected to live in a single project at the
top level of that project. The name of the hooks project is provided
in the manifest.xml. The manifest also lists which hooks are enabled
to make it obvious if a file somehow failed to sync down (or got
deleted).
Before running any hook, we will prompt the user to make sure that it
is OK. A user can deny running the hook, allow once, or allow
"forever" (until hooks change). This tries to keep with the git
spirit of not automatically running anything on the user's computer
that got synced down. Note that individual repo commands can add
always options to avoid these prompts as they see fit (see below for
the 'upload' options).
When hooks are run, they are loaded into the current interpreter (the
one running repo) and their main() function is run. This mechanism is
used (instead of using subprocess) to make it easier to expand to a
richer hook interface in the future. During loading, the
interpreter's sys.path is updated to contain the directory containing
the hooks so that hooks can be split into multiple files.
The upload command has two options that control hook behavior:
- no-verify=False, verify=False (DEFAULT):
If stdout is a tty, can prompt about running upload hooks if needed.
If user denies running hooks, the upload is cancelled. If stdout is
not a tty and we would need to prompt about upload hooks, upload is
cancelled.
- no-verify=False, verify=True:
Always run upload hooks with no prompt.
- no-verify=True, verify=False:
Never run upload hooks, but upload anyway (AKA bypass hooks).
- no-verify=True, verify=True:
Invalid
Sample bit of manifest.xml code for enabling hooks (assumes you have a
project named 'hooks' where hooks are stored):
<repo-hooks in-project="hooks" enabled-list="pre-upload" />
Sample main() function in pre-upload.py in hooks directory:
def main(project_list, **kwargs):
print ('These projects will be uploaded: %s' %
', '.join(project_list))
print ('I am being a good boy and ignoring anything in kwargs\n'
'that I don\'t understand.')
print 'I fail 50% of the time. How flaky.'
if random.random() <= .5:
raise Exception('Pre-upload hook failed. Have a nice day.')
Change-Id: I5cefa2cd5865c72589263cf8e2f152a43c122f70
2011-03-04 19:54:18 +00:00
|
|
|
|
|
|
|
<!ELEMENT repo-hooks (EMPTY)>
|
|
|
|
<!ATTLIST repo-hooks in-project CDATA #REQUIRED>
|
|
|
|
<!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
|
2009-03-04 22:26:50 +00:00
|
|
|
]>
|
2008-11-04 19:19:36 +00:00
|
|
|
|
|
|
|
A description of the elements and their attributes follows.
|
|
|
|
|
|
|
|
|
|
|
|
Element manifest
|
|
|
|
----------------
|
|
|
|
|
|
|
|
The root element of the file.
|
|
|
|
|
|
|
|
|
|
|
|
Element remote
|
|
|
|
--------------
|
|
|
|
|
|
|
|
One or more remote elements may be specified. Each remote element
|
|
|
|
specifies a Git URL shared by one or more projects and (optionally)
|
|
|
|
the Gerrit review server those projects upload changes through.
|
|
|
|
|
|
|
|
Attribute `name`: A short name unique to this manifest file. The
|
|
|
|
name specified here is used as the remote name in each project's
|
|
|
|
.git/config, and is therefore automatically available to commands
|
|
|
|
like `git fetch`, `git remote`, `git pull` and `git push`.
|
|
|
|
|
|
|
|
Attribute `fetch`: The Git URL prefix for all projects which use
|
|
|
|
this remote. Each project's name is appended to this prefix to
|
|
|
|
form the actual URL used to clone the project.
|
|
|
|
|
|
|
|
Attribute `review`: Hostname of the Gerrit server where reviews
|
|
|
|
are uploaded to by `repo upload`. This attribute is optional;
|
|
|
|
if not specified then `repo upload` will not function.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Attribute `remote`: Name of a previously defined remote element.
|
|
|
|
Project elements lacking a remote attribute of their own will use
|
|
|
|
this remote.
|
|
|
|
|
|
|
|
Attribute `revision`: Name of a Git branch (e.g. `master` or
|
|
|
|
`refs/heads/master`). Project elements lacking their own
|
|
|
|
revision attribute will use this revision.
|
|
|
|
|
|
|
|
|
2010-04-06 17:40:01 +00:00
|
|
|
Element manifest-server
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
At most one manifest-server may be specified. The url attribute
|
|
|
|
is used to specify the URL of a manifest server, which is an
|
|
|
|
XML RPC service that will return a manifest in which each project
|
|
|
|
is pegged to a known good revision for the current branch and
|
|
|
|
target.
|
|
|
|
|
|
|
|
The manifest server should implement:
|
|
|
|
|
|
|
|
GetApprovedManifest(branch, target)
|
|
|
|
|
|
|
|
The target to use is defined by environment variables TARGET_PRODUCT
|
|
|
|
and TARGET_BUILD_VARIANT. These variables are used to create a string
|
|
|
|
of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
|
|
|
|
If one of those variables or both are not present, the program will call
|
|
|
|
GetApprovedManifest without the target paramater and the manifest server
|
|
|
|
should choose a reasonable default target.
|
|
|
|
|
|
|
|
|
2008-11-04 19:19:36 +00:00
|
|
|
Element project
|
|
|
|
---------------
|
|
|
|
|
|
|
|
One or more project elements may be specified. Each element
|
|
|
|
describes a single Git repository to be cloned into the repo
|
|
|
|
client workspace.
|
|
|
|
|
|
|
|
Attribute `name`: A unique name for this project. The project's
|
|
|
|
name is appended onto its remote's fetch URL to generate the actual
|
|
|
|
URL to configure the Git remote with. The URL gets formed as:
|
|
|
|
|
|
|
|
${remote_fetch}/${project_name}.git
|
|
|
|
|
|
|
|
where ${remote_fetch} is the remote's fetch attribute and
|
|
|
|
${project_name} is the project's name attribute. The suffix ".git"
|
|
|
|
is always appended as repo assumes the upstream is a forrest of
|
|
|
|
bare Git repositories.
|
|
|
|
|
|
|
|
The project name must match the name Gerrit knows, if Gerrit is
|
|
|
|
being used for code reviews.
|
|
|
|
|
|
|
|
Attribute `path`: An optional path relative to the top directory
|
|
|
|
of the repo client where the Git working directory for this project
|
|
|
|
should be placed. If not supplied the project name is used.
|
|
|
|
|
|
|
|
Attribute `remote`: Name of a previously defined remote element.
|
|
|
|
If not supplied the remote given by the default element is used.
|
|
|
|
|
|
|
|
Attribute `revision`: Name of the Git branch the manifest wants
|
|
|
|
to track for this project. Names can be relative to refs/heads
|
|
|
|
(e.g. just "master") or absolute (e.g. "refs/heads/master").
|
|
|
|
Tags and/or explicit SHA-1s should work in theory, but have not
|
|
|
|
been extensively tested. If not supplied the revision given by
|
|
|
|
the default element is used.
|
|
|
|
|
2012-03-29 03:15:45 +00:00
|
|
|
Attribute `groups`: List of groups to which this project belongs,
|
|
|
|
whitespace or comma separated. All projects are part of the group
|
|
|
|
"default" unless "-default" is specified in the list of groups.
|
|
|
|
|
2012-04-12 20:04:13 +00:00
|
|
|
Element annotation
|
|
|
|
------------------
|
|
|
|
|
|
|
|
Zero or more annotation elements may be specified as children of a
|
|
|
|
project element. Each element describes a name-value pair that will be
|
|
|
|
exported into each project's environment during a 'forall' command,
|
|
|
|
prefixed with REPO__. In addition, there is an optional attribute
|
|
|
|
"keep" which accepts the case insensitive values "true" (default) or
|
|
|
|
"false". This attribute determines whether or not the annotation will
|
|
|
|
be kept when exported with the manifest subcommand.
|
|
|
|
|
2008-11-20 19:42:22 +00:00
|
|
|
Element remove-project
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Deletes the named project from the internal manifest table, possibly
|
|
|
|
allowing a subsequent project element in the same manifest file to
|
|
|
|
replace the project with a different source.
|
|
|
|
|
|
|
|
This element is mostly useful in the local_manifest.xml, where
|
|
|
|
the user can remove a project, and possibly replace it with their
|
|
|
|
own definition.
|
|
|
|
|
|
|
|
|
2008-11-06 16:48:44 +00:00
|
|
|
Local Manifest
|
|
|
|
==============
|
|
|
|
|
|
|
|
Additional remotes and projects may be added through a local
|
|
|
|
manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
2009-03-04 22:26:50 +00:00
|
|
|
$ cat .repo/local_manifest.xml
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<manifest>
|
|
|
|
<project path="manifest"
|
|
|
|
name="tools/manifest" />
|
|
|
|
<project path="platform-manifest"
|
|
|
|
name="platform/manifest" />
|
|
|
|
</manifest>
|
2008-11-06 16:48:44 +00:00
|
|
|
|
|
|
|
Users may add projects to the local manifest prior to a `repo sync`
|
|
|
|
invocation, instructing repo to automatically download and manage
|
|
|
|
these extra projects.
|