| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding: utf-8 | 2 # coding: utf-8 |
| 3 | 3 |
| 4 # This Source Code Form is subject to the terms of the Mozilla Public | 4 # This Source Code Form is subject to the terms of the Mozilla Public |
| 5 # License, v. 2.0. If a copy of the MPL was not distributed with this | 5 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 | 7 |
| 8 import sys | 8 import sys |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 return | 219 return |
| 220 | 220 |
| 221 if type in revisions: | 221 if type in revisions: |
| 222 revision = revisions[type] | 222 revision = revisions[type] |
| 223 elif "*" in revisions: | 223 elif "*" in revisions: |
| 224 revision = revisions["*"] | 224 revision = revisions["*"] |
| 225 else: | 225 else: |
| 226 logging.warning("No revision specified for repository %s (type %s), skipping update" % (target, type)) | 226 logging.warning("No revision specified for repository %s (type %s), skipping update" % (target, type)) |
| 227 return | 227 return |
| 228 | 228 |
| 229 resolved_revision = repo_types[type].get_revision_id(target, revision) | 229 resolved_revision = repo_types[type].get_revision_id(target, revision) |
|
Wladimir Palant
2015/05/06 18:17:32
For reference, I think the check belongs here:
if
kzar
2015/05/07 13:02:38
OK I've done this, I have some reservations though
Sebastian Noack
2015/05/07 13:17:19
Yeah, I'm pretty sure Wladimir meant to return her
kzar
2015/05/07 13:44:29
Done.
| |
| 230 if not resolved_revision: | 230 if not resolved_revision: |
| 231 logging.info("Revision %s is unknown, downloading remote changes" % revision ) | 231 logging.info("Revision %s is unknown, downloading remote changes" % revision ) |
| 232 repo_types[type].pull(target) | 232 repo_types[type].pull(target) |
| 233 resolved_revision = repo_types[type].get_revision_id(target, revision) | 233 resolved_revision = repo_types[type].get_revision_id(target, revision) |
| 234 if not resolved_revision: | 234 if not resolved_revision: |
| 235 raise Exception("Failed to resolve revision %s" % revision) | 235 raise Exception("Failed to resolve revision %s" % revision) |
| 236 | 236 |
| 237 current_revision = repo_types[type].get_revision_id(target) | 237 current_revision = repo_types[type].get_revision_id(target) |
| 238 if resolved_revision != current_revision: | 238 if resolved_revision != current_revision: |
| 239 logging.info("Updating repository %s to revision %s" % (target, resolved_rev ision)) | 239 logging.info("Updating repository %s to revision %s" % (target, resolved_rev ision)) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 if not pattern in file_content: | 290 if not pattern in file_content: |
| 291 file_content.append(pattern) | 291 file_content.append(pattern) |
| 292 f.seek(0, os.SEEK_SET) | 292 f.seek(0, os.SEEK_SET) |
| 293 f.truncate() | 293 f.truncate() |
| 294 for l in file_content: | 294 for l in file_content: |
| 295 print >>f, l | 295 print >>f, l |
| 296 | 296 |
| 297 if __name__ == "__main__": | 297 if __name__ == "__main__": |
| 298 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) | 298 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) |
| 299 | 299 |
| 300 if os.environ.get("SKIP_ENSURE_DEPENDENCIES", "").lower() not in ("", "0", "fa lse"): | |
| 301 logging.warning("SKIP_ENSURE_DEPENDENCIES environment variable set, skipping .") | |
| 302 sys.exit() | |
| 303 | |
| 300 parser = argparse.ArgumentParser(description="Verify dependencies for a set of repositories, by default the repository of this script.") | 304 parser = argparse.ArgumentParser(description="Verify dependencies for a set of repositories, by default the repository of this script.") |
| 301 parser.add_argument("repos", metavar="repository", type=str, nargs="*", help=" Repository path") | 305 parser.add_argument("repos", metavar="repository", type=str, nargs="*", help=" Repository path") |
| 302 parser.add_argument("-q", "--quiet", action="store_true", help="Suppress infor mational output") | 306 parser.add_argument("-q", "--quiet", action="store_true", help="Suppress infor mational output") |
| 303 args = parser.parse_args() | 307 args = parser.parse_args() |
| 304 | 308 |
| 305 if args.quiet: | 309 if args.quiet: |
| 306 logging.disable(logging.INFO) | 310 logging.disable(logging.INFO) |
| 307 | 311 |
| 308 repos = args.repos | 312 repos = args.repos |
| 309 if not len(repos): | 313 if not len(repos): |
| 310 repos = [os.path.dirname(__file__)] | 314 repos = [os.path.dirname(__file__)] |
| 311 for repo in repos: | 315 for repo in repos: |
| 312 resolve_deps(repo) | 316 resolve_deps(repo) |
| OLD | NEW |