Generate includes for all schemas
Even for schemas we ignore, we should still generate the enums for them,
just to keep changes like [1] smaller.
Tested: Code compiles. No functional binary change.
[1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/55215
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I78adf1204a319bc14900152f94161afea21f2e07
diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py
index 0b66ac6..8021cbb 100755
--- a/scripts/update_schemas.py
+++ b/scripts/update_schemas.py
@@ -261,20 +261,21 @@
for filename in csdl_filenames:
# filename looks like Zone_v1.xml
- filenamesplit = filename.split("_")
- if filenamesplit[0] not in include_list:
- print("excluding schema: " + filename)
- continue
-
with open(os.path.join(schema_path, filename), "wb") as schema_out:
+ content = zip_ref.read(os.path.join("csdl", filename))
+ content = content.replace(b"\r\n", b"\n")
+
+ schema_out.write(content)
+
+ filenamesplit = filename.split("_")
+ if filenamesplit[0] not in include_list:
+ continue
metadata_index.write(
' <edmx:Reference Uri="/redfish/v1/schema/'
+ filename
+ '">\n'
)
- content = zip_ref.read(os.path.join("csdl", filename))
- content = content.replace(b"\r\n", b"\n")
xml_root = ET.fromstring(content)
edmx = "{http://docs.oasis-open.org/odata/ns/edmx}"
edm = "{http://docs.oasis-open.org/odata/ns/edm}"
@@ -296,7 +297,6 @@
+ namespace
+ '"/>\n'
)
- schema_out.write(content)
metadata_index.write(" </edmx:Reference>\n")
metadata_index.write(
@@ -391,3 +391,19 @@
zip_ref.close()
generate_schema_enums.main()
+
+# Now delete the xml schema files we aren't supporting
+if os.path.exists(schema_path):
+ files = [
+ os.path.join(schema_path, f)
+ for f in os.listdir(schema_path)
+ if not f.startswith(skip_prefixes)
+ ]
+ for filename in files:
+ # filename will include the absolute path
+ filenamesplit = filename.split("/")
+ name = filenamesplit.pop()
+ namesplit = name.split("_")
+ if namesplit[0] not in include_list:
+ print("excluding schema: " + filename)
+ os.remove(filename)