diff options
| -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 |
