Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: appengine/swarming/cipd.py

Issue 1910713002: swarming: add support for cipd on the server side (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: swarming: add cipd packages on the server side Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
M-A Ruel 2016/04/25 19:09:45 THis file is not executable.
nodir 2016/04/25 20:27:15 Done.
2 # Copyright 2016 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed by the Apache v2.0 license that can be
4 # found in the LICENSE file.
5
6 """CIPD-specific code is concentrated here."""
7
8 import re
9
10 # Regular expressions below are copied from
11 # https://chromium.googlesource.com/infra/infra/+/468bb43/appengine/chrome_infra _packages/cipd/impl.py
12 # https://chromium.googlesource.com/infra/infra/+/468bb43/appengine/chrome_infra _packages/cas/impl.py
13
14 PACKAGE_NAME_RE = re.compile(r'^([a-z0-9_\-]+/)*[a-z0-9_\-]+$')
15 INSTANCE_ID_RE = re.compile(r'^[0-9a-f]{40}$')
16 TAG_KEY_RE = re.compile(r'^[a-z0-9_\-]{1,400}$')
17 REF_RE = re.compile(r'^[a-z0-9_\-]{1,100}$')
18
19
20 def is_valid_package_name(package_name):
21 """Returns True if |package_name| is a valid CIPD package name."""
22 return bool(PACKAGE_NAME_RE.match(package_name))
23
24
25 def is_valid_version(version):
26 """Returns True if |version| is a valid CIPD package version."""
27 return bool(
28 INSTANCE_ID_RE.match(version) or
29 TAG_KEY_RE.match(version) or
30 REF_RE.match(version)
31 )
32
33
34 def is_pinned_version(version):
35 """Returns True if |version| is pinned"""
36 return bool(INSTANCE_ID_RE.match(version) or TAG_KEY_RE.match(version))
OLDNEW
« no previous file with comments | « no previous file | appengine/swarming/handlers_bot.py » ('j') | appengine/swarming/server/task_request.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698