Skip to content

Improve support for android#3

Open
richardmaw-codethink wants to merge 12 commits into
CodethinkLabs:masterfrom
richardmaw-codethink:main
Open

Improve support for android#3
richardmaw-codethink wants to merge 12 commits into
CodethinkLabs:masterfrom
richardmaw-codethink:main

Conversation

@richardmaw-codethink

Copy link
Copy Markdown

With these changes frepo can begin the process of synchronising up to android 17.

First, the XML parser is ported to use expat.
libxml2 currently has an uncertain future after it was abandoned by its maintainer and re-forked under a different license.
The XML specification is heavily based in unicode, the characters that may exist in a tag are defined in terms of unicode code points and after finding the set of characters accepted was missing - I didn't feel like playing whack-a-mole with XML syntax.

The linkfile element gets a lot of use. Since copyfile is implemented with cp and the glob semantics are compatible with shell.

The group filtering was changed to fix a bug where nonempty group lists were assumed to not be included by default, and -g default is now the default behaviour.
The logic was also brought closer in line to android's git-repo where all of the filters are processed in order selectively enabling or disabling. frepo previously handled all and default specially, so default changed whether the project was included by default, which is sane but different to git-repo.
Now "default"'s special handling is to implicitly treat a project's groups as containing it so long as "notdefault" isn't included, and the filters are processed in reverse order since the result of a match only depends on the last matching filter.

The platform groups platform-linux, platform-windows and platform-darwin are supported based on the -p option (which is overloaded with its use in the forall command as print, for compatibility with both git-repo and earlier frepo) so -p auto (the default) adds a platform- based on the OS you are running, -p all adds all three to the groups to match, and -p linux or -p windows or -p darwin add their respective group.

repo-hooks elements are ignored since they're only used for upload hooks, soon disappear from use, and while it's possible to run them in a subprocess doing so is finnicky and support was removed from git-repo upstream.

The bugurl element is ignored because we don't need to do anything with it and it disappears soon.
contactinfo remains but is similarly ignored because we don't need to use it.

The superproject element is supposed to support managing a repo tree using an existing git repository with submodules, but --no-use-superproject exists to disable this feature so we can behave as if it has been used.

clone-depth is not supported because I ran out of time, and warning about this is better than silently failing to do a shallow clone.

The handwritten parser didn't handle tags with - characters in them
and since the full set of accepted characters includes unicode and
full unicode support would be awkward since libc doesn't directly
expose utf-8/utf-16 encoding support it makes sense to let a
battle-tested implementation deal with it.
It is specified in
https://gerrit.googlesource.com/git-repo/+/refs/tags/v2.64/project.py#471
that if src is a glob then every matching file is symlinked into dest,
but if there is no glob then the destination is the target.

Since frepo already shells out to run commands instead of doing things
in-process it is convenient that the shell and the ln command already
implement the specified behaviour.
The previous logic had a bug where projects with non-empty lists were
considered to not be part of the default group, since the check was just
whether the project had no groups or the group contained default,
when the logic is that anything that doesn't have notdefault is
implicitly part of the default group.
We don't need to do anything with them.
Its use for sync is optional and can be opted out in android git-repo
with the --no-use-superproject option so we behave as if that's always
provided.
We don't need to do anything with them.
clone-depth=1 is an optimisation that should be implemented but isn't
and it's better to have a warning than it be silently ignored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant