diff options
author | Constantin Musca <constantinx.musca@intel.com> | 2012-12-05 10:58:26 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-12-17 17:42:19 +0000 |
commit | d0f35207f9e19b440393a79ebf621649c495738d (patch) | |
tree | 7906465c9116719628dc96114fd1f9617a864a96 /bitbake/lib/bb/fetch2/git.py | |
parent | f39e75ddefe783ffc226d916d6617c794fd1e738 (diff) | |
download | poky-d0f35207f9e19b440393a79ebf621649c495738d.tar.gz |
bitbake: fetch2: remove localcount and use AUTOINC instead
- do not use the BB_URI_LOCALCOUNT database for computing revision
incremental numbers anymore
- sortable_revision now generates "AUTOINC+${latest_rev}"
- use one incrementing value rather than several
- PV becomes 0.1+gitAUTOINC+deadbeefdecafbad_decafbaddeadbeef
- remove all localcount code and simplify the fetcher
- this patch addresses the following proposal:
http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-November/003878.html
(Bitbake rev: 61cf01c5c236b4218f40cfae7c059c2b86765dbd)
Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index ba9f5fb9ab..63ff00b165 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -71,11 +71,8 @@ from bb.fetch2 import logger | |||
71 | class Git(FetchMethod): | 71 | class Git(FetchMethod): |
72 | """Class to fetch a module or modules from git repositories""" | 72 | """Class to fetch a module or modules from git repositories""" |
73 | def init(self, d): | 73 | def init(self, d): |
74 | # | 74 | pass |
75 | # Only enable _sortable revision if the key is set | 75 | |
76 | # | ||
77 | if d.getVar("BB_GIT_CLONE_FOR_SRCREV", True): | ||
78 | self._sortable_buildindex = self._sortable_buildindex_disabled | ||
79 | def supports(self, url, ud, d): | 76 | def supports(self, url, ud, d): |
80 | """ | 77 | """ |
81 | Check to see if a given url can be fetched with git. | 78 | Check to see if a given url can be fetched with git. |
@@ -316,38 +313,6 @@ class Git(FetchMethod): | |||
316 | def _build_revision(self, url, ud, d, name): | 313 | def _build_revision(self, url, ud, d, name): |
317 | return ud.revisions[name] | 314 | return ud.revisions[name] |
318 | 315 | ||
319 | def _sortable_buildindex_disabled(self, url, ud, d, rev): | ||
320 | """ | ||
321 | Return a suitable buildindex for the revision specified. This is done by counting revisions | ||
322 | using "git rev-list" which may or may not work in different circumstances. | ||
323 | """ | ||
324 | |||
325 | cwd = os.getcwd() | ||
326 | |||
327 | # Check if we have the rev already | ||
328 | |||
329 | if not os.path.exists(ud.clonedir): | ||
330 | logger.debug(1, "GIT repository for %s does not exist in %s. \ | ||
331 | Downloading.", url, ud.clonedir) | ||
332 | self.download(None, ud, d) | ||
333 | if not os.path.exists(ud.clonedir): | ||
334 | logger.error("GIT repository for %s does not exist in %s after \ | ||
335 | download. Cannot get sortable buildnumber, using \ | ||
336 | old value", url, ud.clonedir) | ||
337 | return None | ||
338 | |||
339 | |||
340 | os.chdir(ud.clonedir) | ||
341 | if not self._contains_ref(rev, d): | ||
342 | self.download(None, ud, d) | ||
343 | |||
344 | output = runfetchcmd("%s rev-list %s -- 2> /dev/null | wc -l" % (ud.basecmd, rev), d, quiet=True) | ||
345 | os.chdir(cwd) | ||
346 | |||
347 | buildindex = "%s" % output.split()[0] | ||
348 | logger.debug(1, "GIT repository for %s in %s is returning %s revisions in rev-list before %s", url, ud.clonedir, buildindex, rev) | ||
349 | return buildindex | ||
350 | |||
351 | def checkstatus(self, uri, ud, d): | 316 | def checkstatus(self, uri, ud, d): |
352 | fetchcmd = "%s ls-remote %s" % (ud.basecmd, uri) | 317 | fetchcmd = "%s ls-remote %s" % (ud.basecmd, uri) |
353 | try: | 318 | try: |