diff options
author | Christopher Larson <kergoth@gmail.com> | 2017-05-13 02:46:32 +0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-26 21:59:26 +0100 |
commit | ca0dd3c95502b22c369fbf37f915f45e02c06887 (patch) | |
tree | 8f43400b2f3eeb05af60cd2e520e49e6f8ba672b /lib/bb/fetch2 | |
parent | 6c0613f1f2f9d4f009545f82a9173e80396f9d34 (diff) | |
download | bitbake-contrib-ca0dd3c95502b22c369fbf37f915f45e02c06887.tar.gz |
fetch/gitannex: add support for shallow mirror tarballs
When we're building from a shallow mirror tarball, we don't want to do
anything with ud.clonedir, as it's not being used when we unpack. As such,
disable updating annex in that case. Also include annex files in the shallow
tarball.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2')
-rw-r--r-- | lib/bb/fetch2/gitannex.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/bb/fetch2/gitannex.py b/lib/bb/fetch2/gitannex.py index c66c21142..a9b69caab 100644 --- a/lib/bb/fetch2/gitannex.py +++ b/lib/bb/fetch2/gitannex.py @@ -33,6 +33,11 @@ class GitANNEX(Git): """ return ud.type in ['gitannex'] + def urldata_init(self, ud, d): + super(GitANNEX, self).urldata_init(ud, d) + if ud.shallow: + ud.shallow_extra_refs += ['refs/heads/git-annex', 'refs/heads/synced/*'] + def uses_annex(self, ud, d, wd): for name in ud.names: try: @@ -55,9 +60,21 @@ class GitANNEX(Git): def download(self, ud, d): Git.download(self, ud, d) - annex = self.uses_annex(ud, d, ud.clonedir) - if annex: - self.update_annex(ud, d, ud.clonedir) + if not ud.shallow or ud.localpath != ud.fullshallow: + if self.uses_annex(ud, d, ud.clonedir): + self.update_annex(ud, d, ud.clonedir) + + def clone_shallow_local(self, ud, dest, d): + super(GitANNEX, self).clone_shallow_local(ud, dest, d) + + try: + runfetchcmd("%s annex init" % ud.basecmd, d, workdir=dest) + except bb.fetch.FetchError: + pass + + if self.uses_annex(ud, d, dest): + runfetchcmd("%s annex get" % ud.basecmd, d, workdir=dest) + runfetchcmd("chmod u+w -R %s/.git/annex" % (dest), d, quiet=True, workdir=dest) def unpack(self, ud, destdir, d): Git.unpack(self, ud, destdir, d) |