| OLD | NEW |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """CIPD-specific code is concentrated here.""" | 5 """CIPD-specific code is concentrated here.""" |
| 6 | 6 |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 # Regular expressions below are copied from | 9 # Regular expressions below are copied from |
| 10 # https://chromium.googlesource.com/infra/infra/+/468bb43/appengine/chrome_infra
_packages/cipd/impl.py | 10 # https://chromium.googlesource.com/infra/infra/+/468bb43/appengine/chrome_infra
_packages/cipd/impl.py |
| 11 # https://chromium.googlesource.com/infra/infra/+/468bb43/appengine/chrome_infra
_packages/cas/impl.py | 11 # https://chromium.googlesource.com/infra/infra/+/468bb43/appengine/chrome_infra
_packages/cas/impl.py |
| 12 | 12 |
| 13 PACKAGE_NAME_RE = re.compile(r'^([a-z0-9_\-]+/)*[a-z0-9_\-]+$') | 13 PACKAGE_NAME_RE = re.compile(r'^([a-z0-9_\-]+/)*[a-z0-9_\-]+$') |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 """True if string looks like a valid package instance tag.""" | 58 """True if string looks like a valid package instance tag.""" |
| 59 if not tag or ':' not in tag or len(tag) > TAG_MAX_LEN: | 59 if not tag or ':' not in tag or len(tag) > TAG_MAX_LEN: |
| 60 return False | 60 return False |
| 61 # Care only about the key. Value can be anything (including empty string). | 61 # Care only about the key. Value can be anything (including empty string). |
| 62 return bool(TAG_KEY_RE.match(tag.split(':', 1)[0])) | 62 return bool(TAG_KEY_RE.match(tag.split(':', 1)[0])) |
| 63 | 63 |
| 64 | 64 |
| 65 def is_pinned_version(version): | 65 def is_pinned_version(version): |
| 66 """Returns True if |version| is pinned.""" | 66 """Returns True if |version| is pinned.""" |
| 67 return bool(INSTANCE_ID_RE.match(version)) or is_valid_tag(version) | 67 return bool(INSTANCE_ID_RE.match(version)) or is_valid_tag(version) |
| OLD | NEW |