summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-08 13:07:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-08 13:07:48 +0000
commit854daab404a23e4ebb6107d737d9cfd5a0e5548b (patch)
tree7d9ae36a02d56a82d51d46afc6cb55e5bef5ecd4 /bitbake
parenta2f5a614e2063c47fd2b51c87d982bd8a5a032a8 (diff)
downloadpoky-854daab404a23e4ebb6107d737d9cfd5a0e5548b.tar.gz
bitbake: gitannex: Add missing file from previous commit
(Bitbake rev: e14031fbe4924819ab4c9705eef2bedccae1506c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/gitannex.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/gitannex.py b/bitbake/lib/bb/fetch2/gitannex.py
new file mode 100644
index 0000000000..02711b0be6
--- /dev/null
+++ b/bitbake/lib/bb/fetch2/gitannex.py
@@ -0,0 +1,76 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3"""
4BitBake 'Fetch' git annex implementation
5"""
6
7# Copyright (C) 2014 Otavio Salvador
8# Copyright (C) 2014 O.S. Systems Software LTDA.
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License version 2 as
12# published by the Free Software Foundation.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License along
20# with this program; if not, write to the Free Software Foundation, Inc.,
21# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23import os
24import bb
25from bb import data
26from bb.fetch2.git import Git
27from bb.fetch2 import runfetchcmd
28from bb.fetch2 import logger
29
30class GitANNEX(Git):
31 def supports(self, url, ud, d):
32 """
33 Check to see if a given url can be fetched with git.
34 """
35 return ud.type in ['gitannex']
36
37 def uses_annex(self, ud, d):
38 for name in ud.names:
39 try:
40 runfetchcmd("%s rev-list git-annex" % (ud.basecmd), d, quiet=True)
41 return True
42 except bb.fetch.FetchError:
43 pass
44
45 return False
46
47 def update_annex(self, u, ud, d):
48 try:
49 runfetchcmd("%s annex get --all" % (ud.basecmd), d, quiet=True)
50 except bb.fetch.FetchError:
51 return False
52 runfetchcmd("chmod u+w -R %s/annex" % (ud.clonedir), d, quiet=True)
53
54 return True
55
56 def download(self, loc, ud, d):
57 Git.download(self, loc, ud, d)
58
59 os.chdir(ud.clonedir)
60 annex = self.uses_annex(ud, d)
61 if annex:
62 self.update_annex(loc, ud, d)
63
64 def unpack(self, ud, destdir, d):
65 Git.unpack(self, ud, destdir, d)
66
67 os.chdir(ud.destdir)
68 try:
69 runfetchcmd("%s annex sync" % (ud.basecmd), d)
70 except bb.fetch.FetchError:
71 pass
72
73 annex = self.uses_annex(ud, d)
74 if annex:
75 runfetchcmd("%s annex get" % (ud.basecmd), d)
76 runfetchcmd("chmod u+w -R %s/.git/annex" % (ud.destdir), d, quiet=True)