| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
The clone_into functions were deprecated from commit
014a029ade9a045a839ca86c35690b218098ea33, but
functions in baserock-import still depend on these functions.
Change-Id: I7362e1ae70bf86677b0019248ca8538912507b51
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems to be broken since d58d8e8f7a4ec03ff14021a4515c8283dad52573
and it's making `morph get-repo` fail with:
/src/definitions # morph get-repo ansible
2016-04-06 11:36:31 Loading in all morphologies
2016-04-06 11:36:32 Checking out ref 0a7124541247cc613352054f4bc0c3e116e0b657 of ansible in ansible stratum
Traceback (most recent call last):
File "cliapp/app.py", line 190, in _run
self.process_args(args)
File "/src/morph/morphlib/app.py", line 299, in process_args
cliapp.Application.process_args(self, args)
File "cliapp/app.py", line 539, in process_args
method(args[1:])
File "/src/morph/morphlib/plugins/get_repo_plugin.py", line 142, in get_repo
chunk_dirname = checkout_chunk(morph, chunk)
File "/src/morph/morphlib/plugins/get_repo_plugin.py", line 110, in checkout_chunk
ref or chunk_spec['ref'])
File "/src/morph/morphlib/plugins/get_repo_plugin.py", line 60, in _clone_repo
gd.update_submodules(self.app)
File "/src/morph/morphlib/gitdir.py", line 527, in update_submodules
morphlib.git.update_submodules(app, self.dirname)
File "/src/morph/morphlib/git.py", line 150, in update_submodules
submodules.load()
File "/src/morph/morphlib/git.py", line 69, in load
content = self._read_gitmodules_file()
File "/src/morph/morphlib/git.py", line 82, in _read_gitmodules_file
ignore_fail=True)
File "/src/morph/morphlib/git.py", line 306, in gitcmd
return runcmd(cmdline, **kwargs)
TypeError: 'str' object is not callable
Change-Id: I8d08eb71a2b0a773bc4322ed46222bea0adbbee1
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some repositories may have submodules listed in .gitmodules that
are not pointing to a commit object in the tree. This was causing
the following error:
ERROR: /srv/distbuild/gits/git___git_foo_bar_git:c36652c7dd9f1687c87ce04ad3d4af2beb52dc25:.gitmodules: No commit object found for submodule "codegen"
Instead of raising that error, capture it and ignore the submodule.
Change-Id: Iba0428feea7605f797dc78e3e250f3d66c003670
|
|
|
|
|
|
|
|
|
| |
This code is a rework from changes done by:
- Tiago Gomes <tiago.gomes@codethink.co.uk>
https://storyboard.baserock.org/#!/story/86
Change-Id: I3475c2bcb648a272fee33bc878a521f79d4e6581
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's not really any reason you'd want to use the RemoteRepoCache
class except as a workaround for the slow speed of some LocalRepoCache
operations, so I can't see this ruining anyone's day.
The main reason for doing this is so we can simply the sourceresolver
code. One reason that the sourceresolver class is so hopelessly
complicated is that it right now has to use two incompatible interfaces
for Git repo caches.
I've taken the opportunity to detangle the RepoCache class from the
App class. Now all of the configuration for the RepoCache class is
passed into the constructor explicitly. This makes the class usable from
outside Morph:
resolver = morphlib.repoaliasresolver.RepoAliasResolver(aliases=[])
repo_cache = morphlib.repocache.RepoCache('/src/cache/gits', resolver)
Change-Id: I596c81d7645b67504c88e555172a8c238f4f8a66
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For a long time the CachedRepo class has basically been a wrapper around
the GitDir class, but with a few extra methods that don't really even
belong there.
It is now a tiny class in the localrepocache module which just keeps
track of a few extra attributes. All other functionality is provided
by the gitdir module.
This commit also removes the `git clone` approach for copying repos out
of the cache. The alternative approach implemented by
git.copy_repository() was slightly faster when I tested, so for now we
should use that everywhere. Longer term we should find out why this is
quicker than `git clone`, and fix Git itself to be fast.
Change-Id: I1686ab43253d44c3903d9a0bad8bb75528e9cf75
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When preparing the build directory for a chunk, Morph clones the Git repo
being built (and any submodules) into the staging area.
Instead of using `git clone --no-hardlinks`, the
morphlib.git.copy_repository() function uses 'cp -a' plus some faffing
to achieve the same thing a bit faster.
The 'cp -a' command will preserve the ownership and permissions of the
cached copy. These may not match up with which user is doing the build.
I found that files in my Git cache were owned by UID 1002. This caused
chunks that needed to access the .git directory at build time to fail
with strange errors. Worse, it would trigger a bug in Git[1] that leads
to a fork bomb, which would cause Linux to freeze up completely. This
occured even though I was building as `root`, because of the way
`linux-user-chroot` drops certain privileges: presumably, setting
SECBIT_NOROOT leads to CAP_DAC_OVERRIDE being unset.
To avoid this bug, the code now ensures the copied .git repos are owned
by the user and group who ran `morph`.
Another way to fix this would be to change the
morphlib.gits.copy_repository() function to use `git clone
--no-hardlinks`. This is what YBD does. I found that there is a slight
speed benefit to using the current code ... these are results of cloning
repos from the cache with the 2 methods:
With 'cp -a' plus a chown:
upstream:bison: 4.54 seconds average (10 results)
upstream:ybd: 0.13 seconds average (10 results)
upstream:linux: 40.51 seconds average (10 results)
With 'git clone --hardlinks':
upstream:bison: 6.23 seconds average (10 results)
upstream:ybd: 0.11 seconds average (10 results)
upstream:linux: 43.36 seconds average (10 results)
Test code is: <https://gist.github.com/ssssam/833e0ef8d04fb1fb6ff3>.
Ideally we would fix `git clone --no-hardlinks` to be faster, but we
may as well keep the existing code for the time being.
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750687
Change-Id: Ieea87322ea7b7f62975b9480f877755665656217
|
|
|
|
| |
Change-Id: Ibda7a938cd16e35517a531140f39ef4664d85c72
|
|
|
|
| |
Change-Id: I992dc0c1d40f563ade56a833162d409b02be90a0
|
|
|
|
|
| |
There is still code here that duplicates stuff the GitDirectory class
should be doing, I think.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This consolidates a bunch of code paths that were previously duplicated.
This also changes the API for local cached repos to match the
function names GitDirectory uses. Note that the remote repo cache still
uses the old names, and should be fixed when time permits.
Some unit tests that use the CachedRepo module required a bit of
inelegant monkey-patching in order that they continue to work. A better
way to do this would be with the 'mock' library (which would need to be
added to Baserock 'build' and 'devel' systems before we could use it).
|
|
|
|
|
| |
Fix checking for commit object in submodules which their path and
name are not the same.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Morph can appear to hang in situations where it is actually waiting on a
slow network operation. This change gives users a way to see the output
of the subcommands that are doing the network IO (either 'wget', 'git
clone' or 'git remote update').
The status information goes onto stderr, because that is where the
subcommands write it. Morph tends to put its status output on stdout,
but (a) some commands are machine-parsed, such as `serialise-artifact`
and (b) it's tricky to get Git to put status output on stdout.
|
|
|
|
|
|
|
|
|
| |
The clone_into function is non-functional when you pass it a sha1 ref.
If you have a file:// URI then this doesn't get used, which is how it
slipped past the tests.
Reviewed-by: Lars Wirzenius +2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We assumed that the sha1 of the tree of the commit of the ref we care
about was sufficient to cache, but `git replace` means that you need to
know the state of other branches too, since anything in refs/replace can
completely change what the tree you check-out is.
This behaviour can be disabled globally by setting
GIT_NO_REPLACE_OBJECTS, so we're going to do that.
If we need to integrate a project that uses git-replace to change the
contents of their git trees then we could support that by:
if any(refs/replace/*):
potentially_replacable_objects = [
`git rev-parse HEAD`,
`git rev-parse HEAD^{commit}`,
`git rev-parse HEAD^{tree}`]
potentially_replacable_objects.extend(
`git ls-tree -r HEAD | awk '{print $3}'`)
# NOTE: doesn't handle submodules, and you'd need to expand this
# set whenever you process a replacement
for object in refs/replace/*:
if basename(object) not in potentially_replacable_objects: continue
cache_key['replacements'][basename(object)] = `git rev-parse $object`
If we were to support this would need to traverse the tree anyway, doing
replacements, so we may as well use libgit to do the checkout anyway,
and list which replacements were used.
However, since the expected use-case of `git replace` is as a better way
to do history grafting, we're unlikely to need it, as it would only have
any effect if it replaced the commit we were using with a different one.
Rubber-stamped-by: Daniel Silverstone
|
|
|
|
|
|
| |
When cloning a repository, the files stored using git-fat need to
be pulled. This situation occurs in `morph branch`, `morph edit`,
and `morph checkout`.
|
|
|
|
|
|
|
| |
It now uses a generator expression instead of a list, which makes the
operation lazy.
It also uses string.hexdigits instead of redefining it.
|
|
|
|
|
|
|
|
|
|
| |
Previously it would use `git config --get-regex`, which while more
terse, is a little arcane and the regular expression did not account
for slashes or dashes in the option names, and the names usually
correspond to a file path.
Now we use the Submodules class, which validates that the listed commit
is available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Cross-bootstrap is a way to build baserock on an architecture that
does not currently have Baserock. It can be used by `morph
cross-bootstrap <ARCH> <REPO> <REF> <MORPH>`, and will build an artifact
that can be used as a root filesystem with a basic build environment
with a script named `native-bootstrap` which will build and install
every chunk in the system.
If done with a devel system, this will give you a suitable environment
for building a proper Baserock system.
This does not currently provide a kernel for the target architecture.
Apart from adding the cross-bootstrap plugin, it also makes the
following changes:
* Moves the lit of valid_archs into morphlib (instead of locally-scoped
in MorphologyFactory)
* BuildCommand takes an extra argument, build_env
* split BuildCommand's get_artifact_object into create_source_pool and
resolve_artifacts (plus changes things that use get_artifact_object to
use the new way)
* setup_mounts finds out whether to do so by whether build_mode is
'staging', instead of by whether the setting 'staging-chroot' is true.
* Makes ChunkBuilder's get_sources use the
morphlib.builder2.extract_sources() method, and moved
set_mtime_recursively into morphlib.builder2, since it's not currently
used anywhere else.
* moved ChunkBuilder's get_commands into the Morphology class (plus
changes to anything that used get_commands)
|
| |
|
| |
|
|
|
|
| |
morph.log will now show an INFO message rther than a ERROR
|
|
|
|
|
|
|
| |
This makes the warning messages include how to fix the problem.
morphlib.git.check_config_set will return the values of the
keys which were set, so it can be used to get git config.
|
|
|
|
|
|
|
|
|
| |
Some subcommands use git to create commits, in which case user config
needs to be set.
Others imply commits may be created, e.g. by cloning a repository, at
which point it is useful to have a reminder that the configuration needs
to be set.
|
|
|
|
|
|
|
|
|
| |
Newer versions of git have changed the behaviour when cloning with
--branch=$sha1. It used to be nearly synonamous with clone then checkout.
The clone then checkout logic is different to the clone with branch
logic, since they have different behaviour with regard to the branches
that are checked out in the workspace.
|
|\
| |
| |
| | |
into baserock/merge-queue
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously some code used `git show-ref`, which is wrong -- given two
refs named 'alpha/master' and 'master', `git show-ref master` will
return both, sorted alphabetically. This can lead to build failures,
etc. due to refs resolving to the wrong SHAs.
We should also use `git rev-parse --verify` to verify SHA1s, which
we previously did with `git rev-list`.
Finally, `git rev-parse --verify` is more than twice as fast as
`git show-ref`.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to make releases and freeze system branches entirely, we
need to be able to 100% petrify a system branch (that is, resolve
ALL refs into SHA1s) and tag this state to be able to check it out
again later.
This is essentially what "morph tag" does. It takes a tag name
and an arbitrary amount of arguments to "git tag", petrifies all
morphologies of the current system branch behind the scenes, creates
a dangling commit and attaches an annotated tag to it.
Petrifying in this case means that all refs used for chunks are
resolved into commit SHA1s. For stratum and system morphologies,
the refs are replaced by the name of the tag that's being created.
The "tag" command also supports tagging when stratum morphologies
are spread across multiple repositories. In this case, it will
include all statum morphologies from other repos in the tag commi
in the branch root repo. The references to these morphologies are
updated so that they point to the branch root repo and the tag
being created.
This commit also adds a few tests for "morph tag" to verify that
all this works.
|
|
|
|
|
| |
Currently the message is still displayed "Updating xxx" but no
update is actually done.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We often have .gitmodules edited to contain a URI such as
upstream:gnulib, so that we can transparently mirror these in different
locations.
It would be nice to set up git url.insteadOf rules to expand these for
the submodules, but 'git submodule update' uses 'git clone' to fetch
them, which will not take into account the configuration of the
parent repository.
Instead, we set up the submodules automatically and rewrite the URLs
directly in the configuration. The user will need to recreate their
system branch checkouts if their URL configuration changes, or update
the URLs manually, but that should not happen often.
|
|
|
|
|
|
|
|
|
|
| |
The rationale here is that inside a checkout of a system branch, the
user should only be committing to the refs for that system branch,
because those are the only ones that 'morph merge' will look at.
This removes a problem where we could be confused by a ref with a
name that would be sorted before 'master' in the result of 'git
show-ref'.
|
| |
|
|
|
|
| |
'git commit' fails if there are no changes in any case.
|
|
|
|
|
|
|
|
| |
This reworks the code for managing and using the git caches in morph to treat
the caches as bare repositories which are mirrors of where we clone from. In
addition we correctly prune the branches during updates, so that we don't end
up accumulating pointless branches over and over. This is even more important
with branch-and-merge generating temporary build refs for things.
|
|
|
|
|
|
| |
Users in a VM may be running as 'root' so inferring from the username
is often useless. Since build branches are pushed to a server it is
useful to enforce useful onwership info.
|
| |
|
| |
|
|
|
|
|
|
| |
'merge' now traverses every system in the branch root (baserock:morphs)
and merges any chunk or stratum that was changed with 'morph edit'. It
also takes care of updating the refs in the target branch.
|
|
|
|
|
|
|
|
|
| |
This was done with the aid of the pep8 script, available by running
`easy_install pep8`.
It may be worth making this part of ./check, but that will require
putting pep8 into the development tools stratum.
This should be easy, given pep8 has no external dependencies.
|
|
|
|
|
| |
Nobody was using this, so it is obviously useless. Instead, log at the
warning level.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This makes it possible to use the Submodule and Submodules classes
in the refactored code that gets rid of Treeish completely.
|
|
|
|
| |
This helps refactoring morph to get rid of treeishes.
|
|
|
|
|
|
|
|
| |
When making a copy of the repository to build from, builder copies the
.git directory then checks out the ref it wants.
However sometimes this doesn't add the files to the working directory,
possibly because the files it is missing weren't changed in the difference
between what the .git thought HEAD was and what is now checked out.
|
|
|
|
|
|
|
|
| |
The helper class, Factory, has unit tests, which is why it's currently
separate. It may later get integrated with BlobBuilder, or the other
way around.
Classes that don't have unit tests are marked out of coverage.
|
|
|
|
|
|
|
|
|
| |
This is done to keep the git repository intact with history and all
that. cp + checkout turns out to be faster than a regular "git clone".
In order to avoid roundtrips to the internet whenever a chunk tries to
do something with submodules, we force the submodule URLs to point to
our locally cached repos.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is almost as good as --bare. But unlike --bare, it properly sets up
the 'origin' remote and creates the 'refs/remotes/origin/...' branches.
When cloning with --bare, and you end up with "refs/heads/master", not
"/refs/remotes/origin/master". You can re-add the remote 'origin', still
no "refs/remotes/origin/master". Only after you update the remote (after
re-adding it), the bare clone has "refs/remotes/origin/master"... and a
"refs/heads/master" that is out of sync. An ugly mix, basically.
So maybe this approach is better.
|