فهرست منبع

Allow arbitrary names for constraints

This allows us to reuse working constraint files even if the
underlying file is different.
nosoop 10 ماه پیش
والد
کامیت
d26f4c910c
1فایلهای تغییر یافته به همراه13 افزوده شده و 0 حذف شده
  1. 13 0
      src/smgdc/app.py

+ 13 - 0
src/smgdc/app.py

@@ -48,6 +48,13 @@ def main() -> None:
         action="append",
         help="Path to a code binary that may be used for validation",
     )
+    parser.add_argument(
+        "--add-constraint",
+        dest="bin_constraints",
+        type=BinaryMountSpec,
+        action="append",
+        help="Path to a constraint mapping to apply to a binary (Linux binaries only)",
+    )
     parser.add_argument(
         "-o",
         "--output-directory",
@@ -88,11 +95,17 @@ def main() -> None:
     else:
         validation_files.add(args.validation_path)
 
+    constraint_map = dict()
+    for mount in args.bin_constraints:
+        constraint_map[mount.visible_path] = mount.file_path
+
     candidate_targets: list[PlatformBinary] = []
     for mount in args.bin_mounts:
         loaded_bin: PlatformBinary
         if mount.file_path.suffix == ".so":
             loaded_bin = LinuxBinary(mount.file_path)
+            if mount.visible_path in constraint_map:
+                loaded_bin.constraints_file = constraint_map[mount.visible_path]
         elif mount.file_path.suffix == ".dll":
             loaded_bin = WindowsBinary(mount.file_path)
         else: