diff --git a/README.md b/README.md new file mode 100644 index 00000000000..df9f3dff1b4 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +BitBake +======= + +BitBake is a simple tool for the execution of tasks. It is derived from Portage, which is the package management system used by the Gentoo Linux distribution. It is most commonly used to build packages, and is used as the basis of the OpenEmbedded project. + +BitBake is now managed using the Git source control system which can be obtained from git://git.openembedded.org/bitbake.git. Releases can be downloaded from http://downloads.yoctoproject.org/releases/bitbake/ and the developer mailing list, bitbake-devel can be found at http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel. + +The user manual is found in the docmentation directory within the source code. + +Karfield's addition +=================== + +1. add gclient fetcher. So the bitbake can support to sync chromium-based project such as chromium, libjingle etc. + To use this, the SRC_URI for example, could write like this + + SRC_URI = "gclient://libjingle.googlecode.com/svn/trunk;name=libjingle;jobs=8". diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 6211cd7f5dc..c16e07bb038 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -1521,6 +1521,7 @@ def clean(self, urls = []): from . import hg from . import osc from . import repo +from . import gclient methods.append(local.Local()) methods.append(wget.Wget()) @@ -1536,3 +1537,4 @@ def clean(self, urls = []): methods.append(hg.Hg()) methods.append(osc.Osc()) methods.append(repo.Repo()) +methods.append(gclient.Gclient()) diff --git a/lib/bb/fetch2/gclient.py b/lib/bb/fetch2/gclient.py new file mode 100644 index 00000000000..e969d48035b --- /dev/null +++ b/lib/bb/fetch2/gclient.py @@ -0,0 +1,78 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +""" +BitBake 'Fetch' gclient implementation + +Copyright (C) 2013, Karfield Chen. All rights reserved. + +""" + +import os +import bb +from bb import data +from bb.fetch2 import FetchMethod +from bb.fetch2 import runfetchcmd +from bb.fetch2 import logger + +class Gclient(FetchMethod): + """Class for sync code from depot-based repositories""" + def init(self, d): + pass + + def supports(self, url, ud, d): + """ + Check to see if a given url starts with "depot" or "gclient". + """ + return ud.type in ["depot", "gclient"] + + def supports_checksum(self, urldata): + """ + checksum? needn't. + """ + return False + + def urldata_init(self, ud, d): + """ + supported options: + name: package name + """ + ud.name = ud.parm.get('name', '') + ud.njobs = ud.parm.get('jobs', '1') + ud.packname = "gclient_%s%s_%s" % (ud.host, ud.path.replace("/", "."), ud.name) + ud.localfile = data.expand("%s.tar.gz" % ud.packname, d) + + def download(self, loc, ud, d): + """ + do fetch + """ + # if the package has been downloaded, just return + if os.access(os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), os.R_OK): + logger.debug(1, "%s already exists (or was stashed). Skipping gclient sync.", ud.localpath) + return + + depot_dir = data.getVar("DEPOTDIR", d, True) or os.path.join(data.getVar("DL_DIR", d, True), "depot") + sync_dir = os.path.join(depot_dir, ud.packname) + + bb.utils.mkdirhier(sync_dir) + os.chdir(sync_dir) + + if not os.path.exists(os.path.join(sync_dir, ".gclient")): + logger.info('This is the first time to sync this depot, config it as htttp://%s%s' + % (ud.host, ud.path)) + runfetchcmd('gclient config http://%s%s' % (ud.host, ud.path), d) + + logger.info('Start to sync source code..') + runfetchcmd('gclient fetch --jobs %s' % ud.njobs, d) + + logger.info('Creating tarball %s.' % ud.localfile) + runfetchcmd('tar --exclude .svn --exclude .git -czf %s ./' % + os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), d) + + def supports_srcrev(self): + return False + + def _build_revision(self, url, ud, d): + return None + + def _want_sortable_revision(self, url, ud, d): + return False diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py index 7d4a5b14a71..3692f4202b1 100644 --- a/lib/bb/parse/parse_py/ConfHandler.py +++ b/lib/bb/parse/parse_py/ConfHandler.py @@ -128,6 +128,21 @@ def handle(fn, data, include): if not w: continue s = s.rstrip() + if s[0] == '#': continue # skip comments + def strip_comments(_s): + c1 = re.findall('\".*\"', _s) # used for check + v = _s.split('#') + if len(v) > 1: # we found some comments + _v = v[-1] + del v[-1] + _s = '#'.join(v).rstrip('#') + if re.findall('\".*\"', _s) != c1: + # we remove the expr, roll back + return '%s#%s' % (_s, _v.rstrip()) + return strip_comments(_s) + else: + return '#'.join(v).rstrip('[# ]') + s = strip_comments(s) while s[-1] == '\\': s2 = f.readline().strip() lineno = lineno + 1