|
@@ -2,16 +2,34 @@
|
|
|
|
|
|
import argparse
|
|
import argparse
|
|
import configparser
|
|
import configparser
|
|
|
|
+import dataclasses
|
|
|
|
+import os
|
|
import pathlib
|
|
import pathlib
|
|
|
|
|
|
from . import validate
|
|
from . import validate
|
|
from .validate import LinuxBinary, PlatformBinary, WindowsBinary
|
|
from .validate import LinuxBinary, PlatformBinary, WindowsBinary
|
|
|
|
|
|
|
|
|
|
|
|
+@dataclasses.dataclass
|
|
|
|
+class BinaryMountSpec:
|
|
|
|
+ # a "mount" specification, described as a pathsep-separated pair of paths
|
|
|
|
+ # (we can't use colons across all platforms because Windows)
|
|
|
|
+ file_path: pathlib.Path
|
|
|
|
+ visible_path: pathlib.Path
|
|
|
|
+
|
|
|
|
+ def __init__(self, arg: str):
|
|
|
|
+ (self.file_path, self.visible_path) = map(
|
|
|
|
+ pathlib.Path, arg.split(os.pathsep) if os.pathsep in arg else (arg, arg)
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
def main() -> None:
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser()
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
|
parser.add_argument("validation_path", metavar="config", type=pathlib.Path)
|
|
parser.add_argument("validation_path", metavar="config", type=pathlib.Path)
|
|
|
|
+ parser.add_argument(
|
|
|
|
+ "--add-binary", dest="bin_mounts", type=BinaryMountSpec, action="append"
|
|
|
|
+ )
|
|
|
|
|
|
args = parser.parse_args()
|
|
args = parser.parse_args()
|
|
|
|
|
|
@@ -21,22 +39,16 @@ def main() -> None:
|
|
else:
|
|
else:
|
|
validation_files.add(args.validation_path)
|
|
validation_files.add(args.validation_path)
|
|
|
|
|
|
- bin_mounts = {
|
|
|
|
- "232250/tf/bin/server.dll": "server.dll",
|
|
|
|
- "232250/tf/bin/server_srv.so": "server_srv.so",
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
candidate_targets: list[PlatformBinary] = []
|
|
candidate_targets: list[PlatformBinary] = []
|
|
- for mount, bin in bin_mounts.items():
|
|
|
|
- bin_path = pathlib.Path(bin)
|
|
|
|
|
|
+ for mount in args.bin_mounts:
|
|
loaded_bin: PlatformBinary
|
|
loaded_bin: PlatformBinary
|
|
- if bin_path.suffix == ".so":
|
|
|
|
- loaded_bin = LinuxBinary(bin_path)
|
|
|
|
- elif bin_path.suffix == ".dll":
|
|
|
|
- loaded_bin = WindowsBinary(bin_path)
|
|
|
|
|
|
+ if mount.file_path.suffix == ".so":
|
|
|
|
+ loaded_bin = LinuxBinary(mount.file_path)
|
|
|
|
+ elif mount.file_path.suffix == ".dll":
|
|
|
|
+ loaded_bin = WindowsBinary(mount.file_path)
|
|
else:
|
|
else:
|
|
- raise ValueError(f"Unknown bin suffix {bin_path.suffix}")
|
|
|
|
- loaded_bin.path = pathlib.Path(mount)
|
|
|
|
|
|
+ raise ValueError(f"Unknown bin suffix {mount.file_path.suffix}")
|
|
|
|
+ loaded_bin.path = mount.visible_path
|
|
candidate_targets.append(loaded_bin)
|
|
candidate_targets.append(loaded_bin)
|
|
|
|
|
|
for validation_file in sorted(validation_files):
|
|
for validation_file in sorted(validation_files):
|