+def check_patchset():
+ """Compare the changes to API messages in this changeset.
+ Ignores API files with version < 1.0.0.
+ Only considers API files located under the src directory in the repo.
+ """
+ files = filelist_from_patchset("^src/")
+ revision = "HEAD~1"
+
+ oldcrcs = {}
+ newcrcs = {}
+ for filename in files:
+ # Ignore files that have version < 1.0.0
+ _ = crc_from_apigen(None, filename)
+ # Ignore removed files
+ if isinstance(_, set) == 0:
+ if isinstance(_, set) == 0 and _["_version"]["major"] == "0":
+ continue
+ newcrcs.update(_)
+
+ oldcrcs.update(crc_from_apigen(revision, filename))
+
+ backwards_incompatible = report(newcrcs, oldcrcs)
+ if backwards_incompatible:
+ # alert on changing production API
+ print(
+ "crcchecker: Changing production APIs in an incompatible way",
+ file=sys.stderr,
+ )
+ sys.exit(-1)
+ else:
+ print("*" * 67)
+ print("* VPP CHECKAPI SUCCESSFULLY COMPLETED")
+ print("*" * 67)
+
+