mirror of
https://git.yoctoproject.org/poky
synced 2026-06-17 18:29:57 +00:00
9501864db8
There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. (Bitbake rev: 5e43070e3087d09aea2f459b033d035c5ef747d0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
"""
|
|
BitBake 'Fetch' git annex implementation
|
|
"""
|
|
|
|
# Copyright (C) 2014 Otavio Salvador
|
|
# Copyright (C) 2014 O.S. Systems Software LTDA.
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
|
|
import os
|
|
import bb
|
|
from bb.fetch2.git import Git
|
|
from bb.fetch2 import runfetchcmd
|
|
from bb.fetch2 import logger
|
|
|
|
class GitANNEX(Git):
|
|
def supports(self, ud, d):
|
|
"""
|
|
Check to see if a given url can be fetched with 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:
|
|
runfetchcmd("%s rev-list git-annex" % (ud.basecmd), d, quiet=True, workdir=wd)
|
|
return True
|
|
except bb.fetch.FetchError:
|
|
pass
|
|
|
|
return False
|
|
|
|
def update_annex(self, ud, d, wd):
|
|
try:
|
|
runfetchcmd("%s annex get --all" % (ud.basecmd), d, quiet=True, workdir=wd)
|
|
except bb.fetch.FetchError:
|
|
return False
|
|
runfetchcmd("chmod u+w -R %s/annex" % (ud.clonedir), d, quiet=True, workdir=wd)
|
|
|
|
return True
|
|
|
|
def download(self, ud, d):
|
|
Git.download(self, ud, d)
|
|
|
|
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)
|
|
|
|
try:
|
|
runfetchcmd("%s annex init" % (ud.basecmd), d, workdir=ud.destdir)
|
|
except bb.fetch.FetchError:
|
|
pass
|
|
|
|
annex = self.uses_annex(ud, d, ud.destdir)
|
|
if annex:
|
|
runfetchcmd("%s annex get" % (ud.basecmd), d, workdir=ud.destdir)
|
|
runfetchcmd("chmod u+w -R %s/.git/annex" % (ud.destdir), d, quiet=True, workdir=ud.destdir)
|
|
|