summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/gitannex.py
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2016-08-10 10:08:16 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-20 16:08:59 +0100
commitab09541d5517da9b1a23923ea8f5c26ddf745084 (patch)
treeb0b81a809ec783b7481c012b430b9f6618e87a73 /bitbake/lib/bb/fetch2/gitannex.py
parenteefb4b66c8628fbf366ebc5c23cfe013c8fa3756 (diff)
downloadpoky-ab09541d5517da9b1a23923ea8f5c26ddf745084.tar.gz
bitbake: fetch2: preserve current working directory
Fix the methods in all fetchers so they don't change the current working directory of the calling process, which could lead to "changed cwd" warnings from bitbake. (Bitbake rev: 6aa78bf3bd1f75728209e2d01faef31cb8887333) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/gitannex.py')
-rw-r--r--bitbake/lib/bb/fetch2/gitannex.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/bitbake/lib/bb/fetch2/gitannex.py b/bitbake/lib/bb/fetch2/gitannex.py
index e4527f1c75..4937a10891 100644
--- a/bitbake/lib/bb/fetch2/gitannex.py
+++ b/bitbake/lib/bb/fetch2/gitannex.py
@@ -34,43 +34,42 @@ class GitANNEX(Git):
34 """ 34 """
35 return ud.type in ['gitannex'] 35 return ud.type in ['gitannex']
36 36
37 def uses_annex(self, ud, d): 37 def uses_annex(self, ud, d, wd):
38 for name in ud.names: 38 for name in ud.names:
39 try: 39 try:
40 runfetchcmd("%s rev-list git-annex" % (ud.basecmd), d, quiet=True) 40 runfetchcmd("%s rev-list git-annex" % (ud.basecmd), d, quiet=True, workdir=wd)
41 return True 41 return True
42 except bb.fetch.FetchError: 42 except bb.fetch.FetchError:
43 pass 43 pass
44 44
45 return False 45 return False
46 46
47 def update_annex(self, ud, d): 47 def update_annex(self, ud, d, wd):
48 try: 48 try:
49 runfetchcmd("%s annex get --all" % (ud.basecmd), d, quiet=True) 49 runfetchcmd("%s annex get --all" % (ud.basecmd), d, quiet=True, workdir=wd)
50 except bb.fetch.FetchError: 50 except bb.fetch.FetchError:
51 return False 51 return False
52 runfetchcmd("chmod u+w -R %s/annex" % (ud.clonedir), d, quiet=True) 52 runfetchcmd("chmod u+w -R %s/annex" % (ud.clonedir), d, quiet=True, workdir=wd)
53 53
54 return True 54 return True
55 55
56 def download(self, ud, d): 56 def download(self, ud, d):
57 Git.download(self, ud, d) 57 Git.download(self, ud, d)
58 58
59 os.chdir(ud.clonedir) 59 annex = self.uses_annex(ud, d, ud.clonedir)
60 annex = self.uses_annex(ud, d)
61 if annex: 60 if annex:
62 self.update_annex(ud, d) 61 self.update_annex(ud, d, ud.clonedir)
63 62
64 def unpack(self, ud, destdir, d): 63 def unpack(self, ud, destdir, d):
65 Git.unpack(self, ud, destdir, d) 64 Git.unpack(self, ud, destdir, d)
66 65
67 os.chdir(ud.destdir)
68 try: 66 try:
69 runfetchcmd("%s annex init" % (ud.basecmd), d) 67 runfetchcmd("%s annex init" % (ud.basecmd), d, workdir=ud.destdir)
70 except bb.fetch.FetchError: 68 except bb.fetch.FetchError:
71 pass 69 pass
72 70
73 annex = self.uses_annex(ud, d) 71 annex = self.uses_annex(ud, d, ud.destdir)
74 if annex: 72 if annex:
75 runfetchcmd("%s annex get" % (ud.basecmd), d) 73 runfetchcmd("%s annex get" % (ud.basecmd), d, workdir=ud.destdir)
76 runfetchcmd("chmod u+w -R %s/.git/annex" % (ud.destdir), d, quiet=True) 74 runfetchcmd("chmod u+w -R %s/.git/annex" % (ud.destdir), d, quiet=True, workdir=ud.destdir)
75