mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 17:39:31 +00:00
bitbake: Add PN to SRCREV keyhash in the persistent database to avoid conflicts between pacckages (from upstream bitbake)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
@@ -508,7 +508,7 @@ class Fetch(object):
|
|||||||
raise ParameterError
|
raise ParameterError
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.PersistData(d)
|
||||||
key = self._revision_key(url, ud, d)
|
key = self.generate_revision_key(url, ud, d)
|
||||||
rev = pd.getValue("BB_URI_HEADREVS", key)
|
rev = pd.getValue("BB_URI_HEADREVS", key)
|
||||||
if rev != None:
|
if rev != None:
|
||||||
return str(rev)
|
return str(rev)
|
||||||
@@ -521,11 +521,13 @@ class Fetch(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if hasattr(self, "_sortable_revision"):
|
has_sortable = hasattr(self, "_sortable_revision")
|
||||||
|
if has_sortable:
|
||||||
return self._sortable_revision(url, ud, d)
|
return self._sortable_revision(url, ud, d)
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.PersistData(d)
|
||||||
key = self._revision_key(url, ud, d)
|
key = self.generate_revision_key(url, ud, d)
|
||||||
|
|
||||||
latest_rev = self._build_revision(url, ud, d)
|
latest_rev = self._build_revision(url, ud, d)
|
||||||
last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
|
last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
|
||||||
count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
|
count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
|
||||||
@@ -543,6 +545,9 @@ class Fetch(object):
|
|||||||
|
|
||||||
return str(count + "+" + latest_rev)
|
return str(count + "+" + latest_rev)
|
||||||
|
|
||||||
|
def generate_revision_key(self, url, ud, d):
|
||||||
|
key = self._revision_key(url, ud, d)
|
||||||
|
return "%s-%s" % (key, bb.data.getVar("PN", d, True) or "")
|
||||||
|
|
||||||
import cvs
|
import cvs
|
||||||
import git
|
import git
|
||||||
|
|||||||
@@ -145,3 +145,44 @@ class Git(Fetch):
|
|||||||
def _build_revision(self, url, ud, d):
|
def _build_revision(self, url, ud, d):
|
||||||
return ud.tag
|
return ud.tag
|
||||||
|
|
||||||
|
def _want_sortable_revision(self, url, ud, d):
|
||||||
|
return bb.data.getVar("BB_GIT_CLONE_FOR_SRCREV", d, True) or False
|
||||||
|
|
||||||
|
def _sortable_revision(self, url, ud, d):
|
||||||
|
"""
|
||||||
|
This is only called when _want_sortable_revision called true
|
||||||
|
|
||||||
|
We will have to get the updated revision.
|
||||||
|
"""
|
||||||
|
gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
|
||||||
|
repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
|
||||||
|
|
||||||
|
key = "GIT_CACHED_REVISION-%s-%s" % (gitsrcname, ud.tag)
|
||||||
|
if bb.data.getVar(key, d):
|
||||||
|
return bb.data.getVar(key, d)
|
||||||
|
|
||||||
|
|
||||||
|
# Runtime warning on wrongly configured sources
|
||||||
|
if ud.tag == "1":
|
||||||
|
bb.msg.error(1, bb.msg.domain.Fetcher, "SRCREV is '1'. This indicates a configuration error of %s" % url)
|
||||||
|
return "0+1"
|
||||||
|
|
||||||
|
cwd = os.getcwd()
|
||||||
|
|
||||||
|
# Check if we have the rev already
|
||||||
|
if not os.path.exists(repodir):
|
||||||
|
print "no repo"
|
||||||
|
self.go(None, ud, d)
|
||||||
|
|
||||||
|
os.chdir(repodir)
|
||||||
|
if not self._contains_ref(ud.tag, d):
|
||||||
|
self.go(None, ud, d)
|
||||||
|
|
||||||
|
output = runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % ud.tag, d, quiet=True)
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
sortable_revision = "%s+%s" % (output.split()[0], ud.tag)
|
||||||
|
bb.data.setVar(key, sortable_revision, d)
|
||||||
|
return sortable_revision
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ class Fetch(object):
|
|||||||
raise ParameterError
|
raise ParameterError
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.PersistData(d)
|
||||||
key = self._revision_key(url, ud, d)
|
key = self.generate_revision_key(url, ud, d)
|
||||||
rev = pd.getValue("BB_URI_HEADREVS", key)
|
rev = pd.getValue("BB_URI_HEADREVS", key)
|
||||||
if rev != None:
|
if rev != None:
|
||||||
return str(rev)
|
return str(rev)
|
||||||
@@ -527,11 +527,13 @@ class Fetch(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if hasattr(self, "_sortable_revision"):
|
has_sortable = hasattr(self, "_sortable_revision")
|
||||||
|
if has_sortable:
|
||||||
return self._sortable_revision(url, ud, d)
|
return self._sortable_revision(url, ud, d)
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.PersistData(d)
|
||||||
key = self._revision_key(url, ud, d)
|
key = self.generate_revision_key(url, ud, d)
|
||||||
|
|
||||||
latest_rev = self._build_revision(url, ud, d)
|
latest_rev = self._build_revision(url, ud, d)
|
||||||
last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
|
last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
|
||||||
count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
|
count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
|
||||||
@@ -549,6 +551,9 @@ class Fetch(object):
|
|||||||
|
|
||||||
return str(count + "+" + latest_rev)
|
return str(count + "+" + latest_rev)
|
||||||
|
|
||||||
|
def generate_revision_key(self, url, ud, d):
|
||||||
|
key = self._revision_key(url, ud, d)
|
||||||
|
return "%s-%s" % (key, bb.data.getVar("PN", d, True) or "")
|
||||||
|
|
||||||
import cvs
|
import cvs
|
||||||
import git
|
import git
|
||||||
|
|||||||
@@ -146,3 +146,44 @@ class Git(Fetch):
|
|||||||
def _build_revision(self, url, ud, d):
|
def _build_revision(self, url, ud, d):
|
||||||
return ud.tag
|
return ud.tag
|
||||||
|
|
||||||
|
def _want_sortable_revision(self, url, ud, d):
|
||||||
|
return bb.data.getVar("BB_GIT_CLONE_FOR_SRCREV", d, True) or False
|
||||||
|
|
||||||
|
def _sortable_revision(self, url, ud, d):
|
||||||
|
"""
|
||||||
|
This is only called when _want_sortable_revision called true
|
||||||
|
|
||||||
|
We will have to get the updated revision.
|
||||||
|
"""
|
||||||
|
gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
|
||||||
|
repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
|
||||||
|
|
||||||
|
key = "GIT_CACHED_REVISION-%s-%s" % (gitsrcname, ud.tag)
|
||||||
|
if bb.data.getVar(key, d):
|
||||||
|
return bb.data.getVar(key, d)
|
||||||
|
|
||||||
|
|
||||||
|
# Runtime warning on wrongly configured sources
|
||||||
|
if ud.tag == "1":
|
||||||
|
bb.msg.error(1, bb.msg.domain.Fetcher, "SRCREV is '1'. This indicates a configuration error of %s" % url)
|
||||||
|
return "0+1"
|
||||||
|
|
||||||
|
cwd = os.getcwd()
|
||||||
|
|
||||||
|
# Check if we have the rev already
|
||||||
|
if not os.path.exists(repodir):
|
||||||
|
print "no repo"
|
||||||
|
self.go(None, ud, d)
|
||||||
|
|
||||||
|
os.chdir(repodir)
|
||||||
|
if not self._contains_ref(ud.tag, d):
|
||||||
|
self.go(None, ud, d)
|
||||||
|
|
||||||
|
output = runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % ud.tag, d, quiet=True)
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
sortable_revision = "%s+%s" % (output.split()[0], ud.tag)
|
||||||
|
bb.data.setVar(key, sortable_revision, d)
|
||||||
|
return sortable_revision
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user