unknown-cli 0.9.14__tar.gz → 0.9.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/PKG-INFO +1 -1
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknown_cli.egg-info/PKG-INFO +1 -1
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknown_cli.egg-info/SOURCES.txt +1 -0
- unknown-cli-0.9.16/unknowncli/VERSION +1 -0
- unknown-cli-0.9.16/unknowncli/commands/xbox.py +496 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/utils.py +18 -4
- unknown-cli-0.9.14/unknowncli/VERSION +0 -1
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/README.md +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/setup.cfg +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/setup.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknown_cli.egg-info/dependency_links.txt +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknown_cli.egg-info/entry_points.txt +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknown_cli.egg-info/requires.txt +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknown_cli.egg-info/top_level.txt +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/__init__.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/__main__.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/commands/__init__.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/commands/preflight.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/commands/project.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/commands/task.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/commands/unreal.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/data/.p4ignore.txt +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/set_registry_keys.py +0 -0
- {unknown-cli-0.9.14 → unknown-cli-0.9.16}/unknowncli/set_url_handler.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.9.16
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import shutil
|
|
3
|
+
import time
|
|
4
|
+
import os
|
|
5
|
+
import socket
|
|
6
|
+
import getpass
|
|
7
|
+
from datetime import datetime, timedelta
|
|
8
|
+
from tabulate import tabulate
|
|
9
|
+
import click
|
|
10
|
+
from click import echo, secho
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from subprocess import call, Popen, PIPE
|
|
13
|
+
from pprint import pprint
|
|
14
|
+
import json
|
|
15
|
+
from collections import defaultdict
|
|
16
|
+
from dateutil.parser import parse
|
|
17
|
+
|
|
18
|
+
my_path = Path(__file__).parent
|
|
19
|
+
builds_file = my_path / "builds.json"
|
|
20
|
+
cached_builds = {}
|
|
21
|
+
xbapps_ensured = False
|
|
22
|
+
console_ip = None
|
|
23
|
+
temp_path = Path("c:/temp/xboxbuilds/")
|
|
24
|
+
temp_path.mkdir(parents=True, exist_ok=True)
|
|
25
|
+
|
|
26
|
+
def abort(msg):
|
|
27
|
+
secho(msg, fg="red")
|
|
28
|
+
sys.exit(1)
|
|
29
|
+
|
|
30
|
+
def get_timestamp_from_logline(l):
|
|
31
|
+
timestamp_string = l.split("]")[0][1:].split(":")[0]
|
|
32
|
+
try:
|
|
33
|
+
timestamp = datetime.strptime(timestamp_string, "%Y.%m.%d-%H.%M.%S")
|
|
34
|
+
except Exception as e:
|
|
35
|
+
return datetime.now()
|
|
36
|
+
return timestamp
|
|
37
|
+
|
|
38
|
+
def parse_changelists(changelists_string, config):
|
|
39
|
+
all_builds = collect_builds()
|
|
40
|
+
changelists = []
|
|
41
|
+
if "," in changelists_string:
|
|
42
|
+
changelists = changelists_string.split(",")
|
|
43
|
+
elif "-" in changelists_string:
|
|
44
|
+
lst = changelists_string.split("-")
|
|
45
|
+
lst.sort()
|
|
46
|
+
|
|
47
|
+
if len(lst) != 2:
|
|
48
|
+
abort("Changelist range must be in the form [from]-[to]")
|
|
49
|
+
first_changelist = int(lst[0])
|
|
50
|
+
last_changelist = int(lst[1] or "999999999")
|
|
51
|
+
for changelist, builds in all_builds.items():
|
|
52
|
+
found_build = None
|
|
53
|
+
if changelist >= first_changelist and changelist <= last_changelist:
|
|
54
|
+
for b in builds:
|
|
55
|
+
if b['configuration'].lower() == config.lower():
|
|
56
|
+
found_build = b
|
|
57
|
+
if found_build:
|
|
58
|
+
changelists.append(changelist)
|
|
59
|
+
else:
|
|
60
|
+
changelists = [int(changelists_string)]
|
|
61
|
+
for cl in changelists:
|
|
62
|
+
if cl not in all_builds:
|
|
63
|
+
abort(f"Changelist {cl} not found")
|
|
64
|
+
if not changelists:
|
|
65
|
+
abort(f"Did not find valid changeslists in '{changelists_string}' for config '{config}'")
|
|
66
|
+
return changelists
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def collect_builds():
|
|
70
|
+
global cached_builds
|
|
71
|
+
if cached_builds:
|
|
72
|
+
return cached_builds
|
|
73
|
+
builds_path = Path("U:/SN2")
|
|
74
|
+
builds_by_changelist = defaultdict(list)
|
|
75
|
+
for f in builds_path.iterdir():
|
|
76
|
+
if "_MAIN_" not in str(f):
|
|
77
|
+
continue
|
|
78
|
+
n = f.name
|
|
79
|
+
lst = n.replace("CL-", "").split("_")
|
|
80
|
+
build_number = int(lst[0])
|
|
81
|
+
branch = lst[-2]
|
|
82
|
+
configuration = "Test" if "test" in n.lower() else "Development"
|
|
83
|
+
changelist = int(lst[-1])
|
|
84
|
+
builds_by_changelist[changelist].append((f.name, branch, configuration))
|
|
85
|
+
builds_by_changelist = dict(sorted(builds_by_changelist.items()))
|
|
86
|
+
#pprint(builds_by_changelist)
|
|
87
|
+
builds = get_builds()
|
|
88
|
+
if not builds:
|
|
89
|
+
secho("Running initial scan. This will take a while...", fg="yellow")
|
|
90
|
+
n = 0
|
|
91
|
+
for changelist, folders in builds_by_changelist.items():
|
|
92
|
+
if changelist in builds:
|
|
93
|
+
builds_by_changelist[changelist] = builds[changelist]
|
|
94
|
+
continue
|
|
95
|
+
if changelist not in builds:
|
|
96
|
+
builds[changelist] = []
|
|
97
|
+
|
|
98
|
+
for folder, branch, configuration in folders:
|
|
99
|
+
path = builds_path / folder
|
|
100
|
+
# U:\SN2\10147_TEST_MAIN_CL-53357\Publish\++project+sn2-main-ue\Subnautica2-CL-53353\XSX\Packages\Test
|
|
101
|
+
package_path = path / "Publish" / "++project+sn2-main-ue"
|
|
102
|
+
#print(package_path)
|
|
103
|
+
# / f"Subnautica2-CL-{changelist}" / "XSX\Packages" / "Test"
|
|
104
|
+
for f in package_path.glob("*/XSX/Packages/*/*.xvc"):
|
|
105
|
+
if f.is_file():
|
|
106
|
+
print(f"Found XBox build for {folder}")
|
|
107
|
+
build = {
|
|
108
|
+
"filename": f.name,
|
|
109
|
+
"path": f.as_posix(),
|
|
110
|
+
"configuration": configuration,
|
|
111
|
+
"branch": branch,
|
|
112
|
+
"size_mb": f.stat().st_size // 1024 // 1024,
|
|
113
|
+
"timestamp": datetime.fromtimestamp(f.stat().st_mtime).isoformat(),
|
|
114
|
+
}
|
|
115
|
+
builds[changelist].append(build)
|
|
116
|
+
n += 1
|
|
117
|
+
|
|
118
|
+
save_builds(builds)
|
|
119
|
+
cached_builds = builds
|
|
120
|
+
return builds
|
|
121
|
+
|
|
122
|
+
def get_loglines(num=None):
|
|
123
|
+
ensure_xbapps()
|
|
124
|
+
path = Path(f"//{console_ip}/SystemScratch/Logs/Subnautica2.log")
|
|
125
|
+
if not path.is_file():
|
|
126
|
+
abort(f"Path {path} not found")
|
|
127
|
+
with path.open() as f:
|
|
128
|
+
lines = f.readlines()
|
|
129
|
+
ret = []
|
|
130
|
+
if num:
|
|
131
|
+
lines = lines[-num:]
|
|
132
|
+
for l in lines:
|
|
133
|
+
ret.append(l.strip())
|
|
134
|
+
return ret
|
|
135
|
+
|
|
136
|
+
def ensure_xbapps():
|
|
137
|
+
global console_ip
|
|
138
|
+
if console_ip:
|
|
139
|
+
return
|
|
140
|
+
game_dk = os.environ.get("GAMEDK")
|
|
141
|
+
if not game_dk:
|
|
142
|
+
abort("XBox GDK Manager is not installed")
|
|
143
|
+
game_bin_path = Path(game_dk) / "bin"
|
|
144
|
+
xbapp = game_bin_path / "xbapp.exe"
|
|
145
|
+
xbconnect = game_bin_path / "xbconnect.exe"
|
|
146
|
+
if not xbapp.is_file() or not xbconnect.is_file():
|
|
147
|
+
abort("XBox GDK Manager is not installed")
|
|
148
|
+
p = Popen(f"{xbconnect} /q /b", stdout=PIPE, stderr=PIPE)
|
|
149
|
+
out, err = p.communicate()
|
|
150
|
+
if not not p.returncode:
|
|
151
|
+
abort("No XBox console found (1)")
|
|
152
|
+
|
|
153
|
+
console_ip = out.strip().decode()
|
|
154
|
+
if not console_ip.startswith("192."):
|
|
155
|
+
abort("No XBox console found (2)")
|
|
156
|
+
|
|
157
|
+
def xb(appname):
|
|
158
|
+
ensure_xbapps()
|
|
159
|
+
return Path(os.environ.get("GAMEDK")) / "bin" / appname
|
|
160
|
+
|
|
161
|
+
def get_builds():
|
|
162
|
+
try:
|
|
163
|
+
with open(builds_file) as f:
|
|
164
|
+
return {int(k): v for k, v in json.load(f).items()}
|
|
165
|
+
except Exception as e:
|
|
166
|
+
return {}
|
|
167
|
+
|
|
168
|
+
def save_builds(data):
|
|
169
|
+
with open(builds_file, "w") as f:
|
|
170
|
+
json.dump(data, f, indent=4)
|
|
171
|
+
|
|
172
|
+
def mount():
|
|
173
|
+
p = Path("U:")
|
|
174
|
+
if p.is_dir():
|
|
175
|
+
return
|
|
176
|
+
mountbat_filename = my_path.parent / "BatchFiles" / "MountBuildsFolder.bat"
|
|
177
|
+
cmd = ["net", "use", "U:", r"\\sn2-storage-int.metal.subnautica.net\storage /persistent:yes /user:install belabour-hull-calcutta"]
|
|
178
|
+
p = Popen(cmd, shell=True)
|
|
179
|
+
stdout, stderr = p.communicate()
|
|
180
|
+
|
|
181
|
+
@click.group()
|
|
182
|
+
@click.option('--debug/--no-debug', default=False)
|
|
183
|
+
@click.pass_context
|
|
184
|
+
def cli(ctx, debug):
|
|
185
|
+
"""
|
|
186
|
+
Manage xbox builds and run xbox phototours
|
|
187
|
+
"""
|
|
188
|
+
ctx.ensure_object(dict)
|
|
189
|
+
ctx.obj['DEBUG'] = debug
|
|
190
|
+
|
|
191
|
+
@cli.command("list")
|
|
192
|
+
@click.option("-t", "--type", "config", default="None", help="Test or Development configuration (default is both)")
|
|
193
|
+
@click.option("-n", "--num", default=10, show_default=True, help="Maximum number of builds to show")
|
|
194
|
+
@click.option("-d", "--days", default=7, show_default=True, help="Show builds from the last few days")
|
|
195
|
+
@click.pass_context
|
|
196
|
+
def list_builds(ctx, config, num, days):
|
|
197
|
+
"""
|
|
198
|
+
List out the builds in the build folder on teamcity.
|
|
199
|
+
This might take a while to collect the builds
|
|
200
|
+
"""
|
|
201
|
+
mount()
|
|
202
|
+
builds = collect_builds()
|
|
203
|
+
hdr = ["CL", "timestamp", "config", "GB"]
|
|
204
|
+
lst = []
|
|
205
|
+
for changelist, builds in builds.items():
|
|
206
|
+
for build in builds:
|
|
207
|
+
dt = parse(build["timestamp"])
|
|
208
|
+
if dt < datetime.now() - timedelta(days=days):
|
|
209
|
+
continue
|
|
210
|
+
if config and build['configuration'].lower() != config.lower():
|
|
211
|
+
continue
|
|
212
|
+
lst.append([changelist, dt.strftime("%Y-%m-%d %H:%M"), build['configuration'], round(build['size_mb']/1024, 1)])
|
|
213
|
+
lst.reverse()
|
|
214
|
+
lst = lst[:num]
|
|
215
|
+
echo(tabulate(lst, hdr))
|
|
216
|
+
|
|
217
|
+
@cli.command()
|
|
218
|
+
@click.option("-n", "--num")
|
|
219
|
+
@click.option("-f", "--filter")
|
|
220
|
+
@click.pass_context
|
|
221
|
+
def tail(ctx, num, filter):
|
|
222
|
+
num = int(num) if num else 100
|
|
223
|
+
lines = get_loglines(num)
|
|
224
|
+
for l in lines:
|
|
225
|
+
if not filter or filter.lower() in l.lower():
|
|
226
|
+
print(l)
|
|
227
|
+
|
|
228
|
+
@cli.command()
|
|
229
|
+
@click.pass_context
|
|
230
|
+
def kill(ctx):
|
|
231
|
+
"""
|
|
232
|
+
Terminate the currently running executable on your xbox
|
|
233
|
+
"""
|
|
234
|
+
ensure_xbapps()
|
|
235
|
+
xbapp = xb("xbapp.exe")
|
|
236
|
+
cmd = [xbapp, "terminate"]
|
|
237
|
+
call(cmd)
|
|
238
|
+
|
|
239
|
+
@cli.command()
|
|
240
|
+
@click.option("-m", "--mode", "kit_mode", help="Set mode to xss or xsx")
|
|
241
|
+
@click.pass_context
|
|
242
|
+
def mode(ctx, kit_mode):
|
|
243
|
+
"""
|
|
244
|
+
Switch the xbox console between Lockhart (series S) and Anaconda (series X) modes.
|
|
245
|
+
This will restart the console.
|
|
246
|
+
"""
|
|
247
|
+
ensure_xbapps()
|
|
248
|
+
app = xb("xbconfig.exe")
|
|
249
|
+
cmd = [app, "/D"]
|
|
250
|
+
p = Popen(cmd, stdout=PIPE)
|
|
251
|
+
out, err = p.communicate()
|
|
252
|
+
curr_settings = {}
|
|
253
|
+
for l in out.splitlines():
|
|
254
|
+
kv = [k.strip() for k in l.strip().decode().split(":")]
|
|
255
|
+
try:
|
|
256
|
+
curr_settings[kv[0]] = kv[1]
|
|
257
|
+
except Exception as e:
|
|
258
|
+
pass
|
|
259
|
+
console_mode = curr_settings["consolemode"]
|
|
260
|
+
extra_title_memory = curr_settings["extratitlememory"]
|
|
261
|
+
profiling_mode = curr_settings["profilingmode"] == "on"
|
|
262
|
+
secho(f"Console is in mode: {console_mode}", bold=True)
|
|
263
|
+
modes = {
|
|
264
|
+
"xss": {
|
|
265
|
+
"ConsoleMode": "LockhartProfiling",
|
|
266
|
+
"ProfilingMode": "On",
|
|
267
|
+
"ExtraTitleMemory": "6048",
|
|
268
|
+
},
|
|
269
|
+
"xsx": {
|
|
270
|
+
"ConsoleMode": "AnacondaProfiling",
|
|
271
|
+
"ProfilingMode": "On"
|
|
272
|
+
},
|
|
273
|
+
}
|
|
274
|
+
if kit_mode:
|
|
275
|
+
settings = modes.get(kit_mode)
|
|
276
|
+
if not settings:
|
|
277
|
+
abort(f"Mode {kit_mode} not Found. Please select one of: {','.join(modes.keys())}")
|
|
278
|
+
if settings["ConsoleMode"] == console_mode:
|
|
279
|
+
echo(f"Console is already in mode {kit_mode}")
|
|
280
|
+
else:
|
|
281
|
+
echo(f"Setting console to mode {kit_mode} ({settings['ConsoleMode']})")
|
|
282
|
+
cmd = [app]
|
|
283
|
+
for k, v in settings.items():
|
|
284
|
+
cmd.append(f"{k}={v}")
|
|
285
|
+
p = Popen(cmd, stdout=PIPE)
|
|
286
|
+
out, err = p.communicate()
|
|
287
|
+
secho("Rebooting console. Please wait...")
|
|
288
|
+
call(xb("xbreboot.exe"))
|
|
289
|
+
|
|
290
|
+
while 1:
|
|
291
|
+
sys.stdout.write(".")
|
|
292
|
+
sys.stdout.flush()
|
|
293
|
+
cmd = [xb("xbconnect.exe"), "/q"]
|
|
294
|
+
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
|
295
|
+
p.communicate()
|
|
296
|
+
if p.returncode:
|
|
297
|
+
time.sleep(1.0)
|
|
298
|
+
else:
|
|
299
|
+
break
|
|
300
|
+
secho(f"\nConsole mode has been set to {kit_mode}", fg="green")
|
|
301
|
+
ctx.invoke(mode)
|
|
302
|
+
else:
|
|
303
|
+
echo("Use '-m xss' or '-m xsx' to switch modes")
|
|
304
|
+
|
|
305
|
+
def find_package(package):
|
|
306
|
+
p = Path(package)
|
|
307
|
+
if p.is_file():
|
|
308
|
+
return p.as_posix()
|
|
309
|
+
elif p.is_dir():
|
|
310
|
+
files = []
|
|
311
|
+
for f in p.glob("**/*.xvc"):
|
|
312
|
+
if f.is_file():
|
|
313
|
+
files.append(f.as_posix())
|
|
314
|
+
if len(files) > 1:
|
|
315
|
+
abort(f"Too many packages found: {files}")
|
|
316
|
+
elif files:
|
|
317
|
+
return files[0]
|
|
318
|
+
abort(f"Package {package} not found")
|
|
319
|
+
|
|
320
|
+
def find_build(cl, config):
|
|
321
|
+
all_builds = collect_builds()
|
|
322
|
+
cl = int(cl)
|
|
323
|
+
for b in all_builds[cl]:
|
|
324
|
+
if b['configuration'].lower() == (config or "").lower() or len(all_builds[cl]) == 1:
|
|
325
|
+
build = b
|
|
326
|
+
if not build:
|
|
327
|
+
abort(f"Multiple builds for {cl} found. Please specify --type=development|test")
|
|
328
|
+
return build
|
|
329
|
+
|
|
330
|
+
@cli.command()
|
|
331
|
+
@click.option("-c", "--cl", "changelists_string", help="Comma separated list of changelists or a range [from]-[to]")
|
|
332
|
+
@click.option("-t", "--type", "config", default=None, help="Build configuration, select either Development or Test")
|
|
333
|
+
@click.pass_context
|
|
334
|
+
def fetch(ctx, changelists_string, config):
|
|
335
|
+
"""
|
|
336
|
+
Fetch a build from teamcity storage to the local machine
|
|
337
|
+
"""
|
|
338
|
+
all_builds = collect_builds()
|
|
339
|
+
if not changelists_string:
|
|
340
|
+
ctx.invoke(list_builds, config=config)
|
|
341
|
+
changelists_string = input("Select a changelist to deploy: ")
|
|
342
|
+
|
|
343
|
+
changelists = parse_changelists(changelists_string, config)
|
|
344
|
+
secho(f"Downloading the following builds: {', '.join([str(c) for c in changelists])} in {config} configuration", bold=True)
|
|
345
|
+
if (len(changelists) > 1):
|
|
346
|
+
secho(f"This will require approximately {len(changelists)*20} GB space on your c:/ drive", fg="yellow")
|
|
347
|
+
|
|
348
|
+
for i, cl in enumerate(changelists):
|
|
349
|
+
build = find_build(cl, config)
|
|
350
|
+
|
|
351
|
+
full_path = Path(build["path"])
|
|
352
|
+
#echo(f"[{i+1}/{len(changelists)}] Downloading CL {cl} from {full_path}")
|
|
353
|
+
|
|
354
|
+
target_file = temp_path / build['filename']
|
|
355
|
+
if target_file.is_file():
|
|
356
|
+
tz = datetime.fromtimestamp(target_file.stat().st_mtime).isoformat()
|
|
357
|
+
if tz == build['timestamp']:
|
|
358
|
+
secho(f"[{i+1}/{len(changelists)}] Build {target_file.name} is already in {temp_path}", fg="green")
|
|
359
|
+
continue
|
|
360
|
+
else:
|
|
361
|
+
secho(f"[{i+1}/{len(changelists)}] Build {target_file.name} was found in {temp_path} but has the wrong timestamp. Will re-download", fg="yellow")
|
|
362
|
+
secho(f"[{i+1}/{len(changelists)}] Copying file {full_path} to {temp_path}...", fg="green")
|
|
363
|
+
path_to_copy = full_path.parent.as_posix()
|
|
364
|
+
cmd = ["robocopy.exe", path_to_copy, temp_path, "*.xvc", "/mt:10"]
|
|
365
|
+
p = call(cmd)
|
|
366
|
+
|
|
367
|
+
@cli.command()
|
|
368
|
+
@click.option("-c", "--cl", help="Changelist number to deploy")
|
|
369
|
+
@click.option("-p", "--package", help=".xvc Package name or folder containing package, alternative to --cl")
|
|
370
|
+
@click.option("-t", "--type", "config", default=None, help="Build configuration, select wither Development or Test")
|
|
371
|
+
@click.pass_context
|
|
372
|
+
def deploy(ctx, cl, package, config):
|
|
373
|
+
"""
|
|
374
|
+
Deploy a build that has already been downloaded to c:/temp/xboxbuilds
|
|
375
|
+
to your xbox console
|
|
376
|
+
"""
|
|
377
|
+
ensure_xbapps()
|
|
378
|
+
xbapp = xb("xbapp.exe")
|
|
379
|
+
xbconnect = xb("xbconnect.exe")
|
|
380
|
+
|
|
381
|
+
if cl:
|
|
382
|
+
echo(f"XBox found at IP {console_ip}. Deploying CL {cl}")
|
|
383
|
+
else:
|
|
384
|
+
echo(f"XBox found at IP {console_ip}. Deploying package {cl}")
|
|
385
|
+
|
|
386
|
+
cmd = [xbapp, "list"]
|
|
387
|
+
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
|
388
|
+
out, err = p.communicate()
|
|
389
|
+
if not not p.returncode:
|
|
390
|
+
abort("No XBox console found")
|
|
391
|
+
app_id = ""
|
|
392
|
+
for l in out.split():
|
|
393
|
+
l = l.decode()
|
|
394
|
+
# try to find the build number
|
|
395
|
+
if "UnknownWorldsEnter" in l and "!" not in l:
|
|
396
|
+
installed_cl = l.strip().split(".")[-1].split("_")[0]
|
|
397
|
+
if installed_cl:
|
|
398
|
+
try:
|
|
399
|
+
installed_cl = int(installed_cl)
|
|
400
|
+
except Exception as e:
|
|
401
|
+
installed_cl = 0
|
|
402
|
+
if installed_cl == cl:
|
|
403
|
+
secho(f"Changelist {cl} is already installed on xbox")
|
|
404
|
+
return
|
|
405
|
+
if package:
|
|
406
|
+
file_path_string = find_package(package)
|
|
407
|
+
else:
|
|
408
|
+
file_path_string = temp_path / find_build(cl, config)['filename']
|
|
409
|
+
secho(f"Installing build {file_path_string} on xbox", fg="green")
|
|
410
|
+
cmd = [xbapp, "install", file_path_string]
|
|
411
|
+
p = call(cmd)
|
|
412
|
+
|
|
413
|
+
@cli.command()
|
|
414
|
+
@click.option("-c", "--cl", "changelists_string", help="Comma separated or [from]-[to] list of changelists")
|
|
415
|
+
@click.option("-p", "--package", help=".xvc Package name or folder containing package, alternative to --cl")
|
|
416
|
+
@click.option("-t", "--type", "config", default=None, help="Development or Test configuration (required)")
|
|
417
|
+
@click.option("-m", "--mode", "kit_mode", default="xss", show_default=True, help="Run as xss or xsx")
|
|
418
|
+
@click.option("--teamcity/--no-teamcity", default=False, help="Run as teamcity build (sets group)")
|
|
419
|
+
@click.option("--cameras", default="xss", help="Comma separated list of camera filters")
|
|
420
|
+
@click.pass_context
|
|
421
|
+
def phototour(ctx, changelists_string, package, config, kit_mode, teamcity, cameras):
|
|
422
|
+
"""
|
|
423
|
+
Run a phototour from the selected changelists on the xbox console.
|
|
424
|
+
Downloads the required builds to your local machine before running.
|
|
425
|
+
Before running this use 'list' to see available builds
|
|
426
|
+
"""
|
|
427
|
+
ensure_xbapps()
|
|
428
|
+
ctx.invoke(mode, kit_mode=kit_mode)
|
|
429
|
+
if not package:
|
|
430
|
+
changelists = parse_changelists(changelists_string, config)
|
|
431
|
+
secho(f"Running phototours on the following changelists: {','.join([str(c) for c in changelists])}")
|
|
432
|
+
ctx.invoke(fetch, changelists_string=changelists_string, config=config)
|
|
433
|
+
for cl in changelists:
|
|
434
|
+
run_phototour(ctx, cl, None, config, teamcity, cameras, kit_mode)
|
|
435
|
+
else:
|
|
436
|
+
run_phototour(ctx, None, package, config, teamcity, cameras, kit_mode)
|
|
437
|
+
|
|
438
|
+
def run_phototour(ctx, cl, package, config, teamcity, cameras, kit_mode):
|
|
439
|
+
if cl:
|
|
440
|
+
secho(f"Deploying and running changelist {cl}", fg="green")
|
|
441
|
+
else:
|
|
442
|
+
secho(f"Deploying and running package {package}", fg="green")
|
|
443
|
+
ctx.invoke(deploy, cl=cl, package=package, config=config)
|
|
444
|
+
xbapp = xb("xbapp.exe")
|
|
445
|
+
# get the build ID
|
|
446
|
+
cmd = [xbapp, "list"]
|
|
447
|
+
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
|
448
|
+
out, err = p.communicate()
|
|
449
|
+
if not not p.returncode:
|
|
450
|
+
abort("No XBox console found")
|
|
451
|
+
app_id = ""
|
|
452
|
+
for l in out.split():
|
|
453
|
+
l = l.decode()
|
|
454
|
+
if "UnknownWorldsEnter" in l and "!" in l:
|
|
455
|
+
app_id = l.strip()
|
|
456
|
+
if not app_id:
|
|
457
|
+
abort("App not found on console")
|
|
458
|
+
|
|
459
|
+
computer_name = socket.gethostname()
|
|
460
|
+
current_user = getpass.getuser()
|
|
461
|
+
cmd = [xbapp, "launch", app_id, "-phototour",
|
|
462
|
+
f'-perftour_runner="{computer_name}/{current_user}"',
|
|
463
|
+
'-perftour_tags="personal"']
|
|
464
|
+
if cameras:
|
|
465
|
+
cmd.append(f'-perftour_cameras="{cameras}"')
|
|
466
|
+
if teamcity:
|
|
467
|
+
cmd.append(f'-perftour_group="{kit_mode.lower()}"')
|
|
468
|
+
secho(f"Launching phototour with app {app_id}", fg="green")
|
|
469
|
+
p = Popen(cmd, shell=True)
|
|
470
|
+
out, err = p.communicate()
|
|
471
|
+
done = False
|
|
472
|
+
start_time = datetime.now()
|
|
473
|
+
while 1:
|
|
474
|
+
time.sleep(10)
|
|
475
|
+
lines = get_loglines()
|
|
476
|
+
lines.reverse()
|
|
477
|
+
latest_timestamp = None
|
|
478
|
+
for l in lines:
|
|
479
|
+
if not latest_timestamp:
|
|
480
|
+
latest_timestamp = get_timestamp_from_logline(l)
|
|
481
|
+
if "phototour" in l.lower():
|
|
482
|
+
echo(l)
|
|
483
|
+
break
|
|
484
|
+
if "RequestExit" in l:
|
|
485
|
+
echo(l)
|
|
486
|
+
done = True
|
|
487
|
+
if latest_timestamp < datetime.now() - timedelta(minutes=2):
|
|
488
|
+
secho(f"No loglines since {latest_timestamp.isoformat()}. Quitting", fg="yellow")
|
|
489
|
+
done = True
|
|
490
|
+
if done:
|
|
491
|
+
break
|
|
492
|
+
durr = (datetime.now() - start_time).total_seconds()
|
|
493
|
+
secho(f"Phototour has finished running in {durr} sec", fg="green")
|
|
494
|
+
|
|
495
|
+
if __name__ == "__main__":
|
|
496
|
+
cli()
|
|
@@ -45,7 +45,20 @@ PERFORCE_SERVERS = {
|
|
|
45
45
|
"asia-edge": "ssl:perforce-asia.reginald.cloud:1666"
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
P4_TRUST = "
|
|
48
|
+
P4_TRUST = "D2:CA:D9:C9:67:64:CF:21:3C:32:ED:61:3F:93:DC:64:D5:7A:AA:C7"
|
|
49
|
+
|
|
50
|
+
import socket
|
|
51
|
+
|
|
52
|
+
def get_ip_from_url(url):
|
|
53
|
+
timeout = 0.1
|
|
54
|
+
try:
|
|
55
|
+
# Set the default timeout for the socket
|
|
56
|
+
socket.setdefaulttimeout(timeout)
|
|
57
|
+
# Resolve the domain to an IP
|
|
58
|
+
ip = socket.gethostbyname(url)
|
|
59
|
+
return ip
|
|
60
|
+
except Exception as e:
|
|
61
|
+
return None
|
|
49
62
|
|
|
50
63
|
def print_error(*txt):
|
|
51
64
|
color_print(*txt, color="red")
|
|
@@ -318,13 +331,14 @@ def check_p4trust():
|
|
|
318
331
|
|
|
319
332
|
for ssl_connection in ssl_connection_list:
|
|
320
333
|
p4_port = ssl_connection.replace("ssl:", "")
|
|
334
|
+
ip = get_ip_from_url(p4_port.split(":")[0])
|
|
321
335
|
matching_trust_line = next(
|
|
322
|
-
(t for t in trust_line_list if t.startswith(p4_port) and t.endswith(P4_TRUST)),
|
|
336
|
+
(t for t in trust_line_list if (t.startswith(p4_port) or t.startswith(ip)) and t.endswith(P4_TRUST)),
|
|
323
337
|
None
|
|
324
338
|
)
|
|
325
339
|
if matching_trust_line:
|
|
326
|
-
# Connection fingerprint is up to date; no action needed.
|
|
327
|
-
|
|
340
|
+
# Connection fingerprint is up to date; no action needed. Assume other servers are also good
|
|
341
|
+
return
|
|
328
342
|
|
|
329
343
|
secho(f"Updating trust: {ssl_connection}", fg="green")
|
|
330
344
|
p4 = P4()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.9.14
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|