Skip to content

Updating the CPACS schema to a new release

svengoldberg edited this page Sep 6, 2024 · 1 revision

When a new CPACS is available, it is necessary to also update the cpacs_gen_input/cpacs_schema.xsd in TiGL. Since there are often patches and changes in the TiGL version of this file which are not covered in the wanted CPACS version (yet), a simple copy and paste (or overwrite) is not enough.

Here, some steps are listed to merge those two versions. The existing cpacs_schema.xsd in this repository and the newer one from the CPACS repository, on the other hand. The commands diff and patch are used to achieve this.

  1. At first, download the cpacs_schema.xsd in its wanted version from the CPACS release page. Download the respective compressed repository and find the file in the schema directory. Move back to your local used TiGL repository and store the file as <ROOT>/cpacs_gen_input/cpacs_schema_update.xsd.
  2. Execute a diff between the old original file and the new one. It is important to use cpacs_schema.xsd.orig as a basis for comparison to not overwrite possible patches in the TiGL version:
diff -u cpacs_schema.xsd.orig cpacs_schema_update.xsd > cpacs_schema.diff
  1. Furthermore, a 'dummy-diff' between the TiGL version and the update file is needed. This is done to change the file name and time stemp in the cpacs_schema.diff since it will be used for the patch but was created from the cpacs_schema.xsd.orig:
diff -u cpacs_schema.xsd cpacs_schema_update.xsd  > cpacs_schema_DUMMY.diff
  1. Open both *.diff files in an editor and replace the first line (starting with ---) of cpacs_schema.diff by the first line of cpacs_schema_DUMMY.diff.
  2. cpacs_schema_DUMMY.diff can now be deleted. After that, everything is ready to start the patch itself. In fact, the cpacs_schema.diff compares two pure versions from the CPACS repository. However by changing the name and time stemp in the file, the patched version is the basis. So, for patch it looks like, cpacs_schema.xsd and cpacs_schema_updated.xsd have both diverged from the same state. Now, apply the patch and merge the changes to update the TiGL version:
patch < cpacs_schema.diff
  1. Potentially, there are some changes in both files that cannot be automatically put together (similiar to a merge conflict). For that reason, the patch tools creates cpacs_schema.xsd.rej that stores the conflicts. Now, open this file and the patched cpacs_schema.xsd to manually resolve the rejections.
  2. After that, follow these instructions to apply the changes from the CPACS schema to the TiGL source code.