summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/classes/gitpkgv.bbclass25
1 files changed, 20 insertions, 5 deletions
diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
index eb4b1eae9a..c3d98cb2e1 100644
--- a/meta-oe/classes/gitpkgv.bbclass
+++ b/meta-oe/classes/gitpkgv.bbclass
@@ -21,6 +21,11 @@
21# v1.2, xtest, v2.0" will force you to increment PE to get upgradeable 21# v1.2, xtest, v2.0" will force you to increment PE to get upgradeable
22# path to v2.0 revisions 22# path to v2.0 revisions
23# 23#
24# Another WARNING: Since Walnascar release BB_SHALLOW_GIT will actually
25# perform a shallow initial checkout, which makes it impossible to determine
26# the correct number of commits in the repository - thus using this class
27# is not recommended when shallow cloning is enabled.
28#
24# use example: 29# use example:
25# 30#
26# inherit gitpkgv 31# inherit gitpkgv
@@ -59,6 +64,9 @@ def get_git_pkgv(d, use_tags):
59 from shlex import quote 64 from shlex import quote
60 65
61 src_uri = d.getVar('SRC_URI').split() 66 src_uri = d.getVar('SRC_URI').split()
67 unpackdir = d.getVar('UNPACKDIR')
68 def_destsuffix = (d.getVar("BB_GIT_DEFAULT_DESTSUFFIX") or "git") + "/"
69
62 fetcher = bb.fetch2.Fetch(src_uri, d) 70 fetcher = bb.fetch2.Fetch(src_uri, d)
63 ud = fetcher.ud 71 ud = fetcher.ud
64 72
@@ -78,20 +86,27 @@ def get_git_pkgv(d, use_tags):
78 found = False 86 found = False
79 for url in ud.values(): 87 for url in ud.values():
80 if url.type == 'git' or url.type == 'gitsm': 88 if url.type == 'git' or url.type == 'gitsm':
81 if not os.path.exists(url.localpath): 89 destsuffix = url.parm.get("destsuffix", def_destsuffix)
90 subdir = url.parm.get('subdir', '')
91 destdir = os.path.join(unpackdir, destsuffix, subdir)
92
93 if not os.path.exists(destdir):
82 return None 94 return None
83 95
96 if d.getVar('BB_GIT_SHALLOW') == '1':
97 bb.warnonce('%s: Shallow cloning enabled - gitpkgv.bbclass will not generate sortable versions' % d.getVar('PN'))
98
84 found = True 99 found = True
85 100
86 vars = { 'repodir' : quote(url.localpath), 101 vars = { 'repodir' : quote(destdir),
87 'rev' : quote(url.revision) } 102 'rev' : quote(url.revision) }
88 103
89 rev = bb.fetch2.get_srcrev(d).split('+')[1] 104 rev = bb.fetch2.get_srcrev(d).split('+')[1]
90 rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + url.revision) 105 rev_file = os.path.join(destdir, "oe-gitpkgv_" + url.revision)
91 106
92 if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0: 107 if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0:
93 commits = bb.fetch2.runfetchcmd( 108 commits = bb.fetch2.runfetchcmd(
94 "git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l" 109 "git -C %(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l"
95 % vars, d, quiet=True).strip().lstrip('0') 110 % vars, d, quiet=True).strip().lstrip('0')
96 111
97 if commits != "": 112 if commits != "":
@@ -107,7 +122,7 @@ def get_git_pkgv(d, use_tags):
107 if use_tags: 122 if use_tags:
108 try: 123 try:
109 output = bb.fetch2.runfetchcmd( 124 output = bb.fetch2.runfetchcmd(
110 "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null" 125 "git -C %(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
111 % vars, d, quiet=True).strip() 126 % vars, d, quiet=True).strip()
112 ver = gitpkgv_drop_tag_prefix(d, output) 127 ver = gitpkgv_drop_tag_prefix(d, output)
113 except Exception: 128 except Exception: