diff options
author | Ed Tanous <edtanous@google.com> | 2022-12-22 00:21:52 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-12-28 23:02:34 +0300 |
commit | 853c0dc5486bbab77b2d1f158152de93847c20d9 (patch) | |
tree | 686790cd60d628ea1719cc307ef1088f06e68019 /scripts | |
parent | ed194be4aff97177c6062bad9e2372099f07cd3e (diff) | |
download | bmcweb-853c0dc5486bbab77b2d1f158152de93847c20d9.tar.xz |
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
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/update_schemas.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py index 0b66ac6b3f..8021cbb5d5 100755 --- a/scripts/update_schemas.py +++ b/scripts/update_schemas.py @@ -261,20 +261,21 @@ with open(metadata_index_path, "w") as metadata_index: 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 @@ with open(metadata_index_path, "w") as metadata_index: + namespace + '"/>\n' ) - schema_out.write(content) metadata_index.write(" </edmx:Reference>\n") metadata_index.write( @@ -391,3 +391,19 @@ with open(os.path.join(cpp_path, "schemas.hpp"), "w") as hpp_file: 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) |