diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 811acbf6c6..82721c6cfa 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -57,6 +57,11 @@ class Git(FetchMethod): | |||
57 | if 'nocheckout' in ud.parm: | 57 | if 'nocheckout' in ud.parm: |
58 | ud.nocheckout = True | 58 | ud.nocheckout = True |
59 | 59 | ||
60 | # rebaseable means the upstream git repo may rebase in the future, | ||
61 | # and current revision may disappear from upstream repo | ||
62 | # rebaseable is false by default. set rebaseable=1 in SRC_URI if rebaseable. | ||
63 | ud.rebaseable = ud.parm.get("rebaseable","0") == "1" | ||
64 | |||
60 | branches = ud.parm.get("branch", "master").split(',') | 65 | branches = ud.parm.get("branch", "master").split(',') |
61 | if len(branches) != len(ud.names): | 66 | if len(branches) != len(ud.names): |
62 | raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url) | 67 | raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url) |
@@ -65,16 +70,9 @@ class Git(FetchMethod): | |||
65 | branch = branches[ud.names.index(name)] | 70 | branch = branches[ud.names.index(name)] |
66 | ud.branches[name] = branch | 71 | ud.branches[name] = branch |
67 | 72 | ||
68 | gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) | ||
69 | ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname) | ||
70 | ud.fullmirror = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball) | ||
71 | ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) | ||
72 | |||
73 | ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" | 73 | ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" |
74 | 74 | ||
75 | ud.write_tarballs = (data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0" | 75 | ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0") or ud.rebaseable |
76 | |||
77 | ud.localfile = ud.clonedir | ||
78 | 76 | ||
79 | ud.setup_revisons(d) | 77 | ud.setup_revisons(d) |
80 | 78 | ||
@@ -84,6 +82,20 @@ class Git(FetchMethod): | |||
84 | ud.branches[name] = ud.revisions[name] | 82 | ud.branches[name] = ud.revisions[name] |
85 | ud.revisions[name] = self.latest_revision(ud.url, ud, d, name) | 83 | ud.revisions[name] = self.latest_revision(ud.url, ud, d, name) |
86 | 84 | ||
85 | gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) | ||
86 | # for rebaseable git repo, it is necessary to keep mirror tar ball | ||
87 | # per revision, so that even the revision disappears from the | ||
88 | # upstream repo in the future, the mirror will remain intact and still | ||
89 | # contains the revision | ||
90 | if ud.rebaseable: | ||
91 | for name in ud.names: | ||
92 | gitsrcname = gitsrcname + '_' + ud.revisions[name] | ||
93 | ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname) | ||
94 | ud.fullmirror = os.path.join(data.getVar("DL_DIR", d, True), ud.mirrortarball) | ||
95 | ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) | ||
96 | |||
97 | ud.localfile = ud.clonedir | ||
98 | |||
87 | def localpath(self, url, ud, d): | 99 | def localpath(self, url, ud, d): |
88 | return ud.clonedir | 100 | return ud.clonedir |
89 | 101 | ||