diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-09-13 17:23:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-14 09:50:28 +0100 |
commit | 7ddf64d58de9ef9f281f6afadf3c82ac8634ef65 (patch) | |
tree | 64dbaa51d142491d3782ba9d9bec014fa7eb0fe1 | |
parent | 87ec7526ce661f97afa0e39654741b602a809c29 (diff) | |
download | poky-7ddf64d58de9ef9f281f6afadf3c82ac8634ef65.tar.gz |
scripts/combo-layer: use last_revision if specified in init
If last_revision is specified for a component when running combo-layer
init, then use that revision instead of the latest revision on the
branch. Also, remove unnecessary git checkout during init since we
specify the revision to all calls to git when dealing with the component
repositories.
Fixes [YOCTO #3040].
(From OE-Core rev: ff8277cd133e9a02b131977078cff61fa587a1af)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/combo-layer | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 330faca389..65435db8c0 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer | |||
@@ -174,25 +174,31 @@ def action_init(conf, args): | |||
174 | if not os.path.exists(ldir): | 174 | if not os.path.exists(ldir): |
175 | logger.info("cloning %s to %s" %(conf.repos[name]['src_uri'], ldir)) | 175 | logger.info("cloning %s to %s" %(conf.repos[name]['src_uri'], ldir)) |
176 | subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True) | 176 | subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True) |
177 | branch = conf.repos[name].get('branch', "master") | ||
178 | runcmd("git checkout %s" % branch, ldir) | ||
179 | if not os.path.exists(".git"): | 177 | if not os.path.exists(".git"): |
180 | runcmd("git init") | 178 | runcmd("git init") |
181 | for name in conf.repos: | 179 | for name in conf.repos: |
182 | repo = conf.repos[name] | 180 | repo = conf.repos[name] |
183 | ldir = repo['local_repo_dir'] | 181 | ldir = repo['local_repo_dir'] |
184 | logger.info("copying data from %s..." % name) | 182 | branch = repo.get('branch', "master") |
183 | lastrev = repo.get('last_revision', None) | ||
184 | if lastrev and lastrev != "HEAD": | ||
185 | initialrev = lastrev | ||
186 | logger.info("Copying data from %s at specified revision %s..." % (name, lastrev)) | ||
187 | else: | ||
188 | lastrev = None | ||
189 | initialrev = branch | ||
190 | logger.info("Copying data from %s..." % name) | ||
185 | dest_dir = repo['dest_dir'] | 191 | dest_dir = repo['dest_dir'] |
186 | if dest_dir and dest_dir != ".": | 192 | if dest_dir and dest_dir != ".": |
187 | extract_dir = os.path.join(os.getcwd(), dest_dir) | 193 | extract_dir = os.path.join(os.getcwd(), dest_dir) |
188 | os.makedirs(extract_dir) | 194 | os.makedirs(extract_dir) |
189 | else: | 195 | else: |
190 | extract_dir = os.getcwd() | 196 | extract_dir = os.getcwd() |
191 | branch = repo.get('branch', "master") | ||
192 | file_filter = repo.get('file_filter', "") | 197 | file_filter = repo.get('file_filter', "") |
193 | runcmd("git archive %s | tar -x -C %s %s" % (branch, extract_dir, file_filter), ldir) | 198 | runcmd("git archive %s | tar -x -C %s %s" % (initialrev, extract_dir, file_filter), ldir) |
194 | lastrev = runcmd("git rev-parse %s" % branch, ldir).strip() | 199 | if not lastrev: |
195 | conf.update(name, "last_revision", lastrev, initmode=True) | 200 | lastrev = runcmd("git rev-parse %s" % initialrev, ldir).strip() |
201 | conf.update(name, "last_revision", lastrev, initmode=True) | ||
196 | runcmd("git add .") | 202 | runcmd("git add .") |
197 | if conf.localconffile: | 203 | if conf.localconffile: |
198 | localadded = True | 204 | localadded = True |