Skip to content

Add compatibility wrappers for pre-1.7 repositories.#1341

Merged
gouttegd merged 4 commits intomasterfrom
add-wrappers-for-pre17-scripts
May 5, 2026
Merged

Add compatibility wrappers for pre-1.7 repositories.#1341
gouttegd merged 4 commits intomasterfrom
add-wrappers-for-pre17-scripts

Conversation

@gouttegd
Copy link
Copy Markdown
Contributor

@gouttegd gouttegd commented May 2, 2026

ODK versions up to 1.6 had included two small helper scripts:

  • check-rdfxml, to check RDF/XML artefacts for correctness;
  • context2csv, to convert a JSON-based context file to a CSV file.

In ODK 1.7, as part of the migration to the ODK-Core system, those scripts were consolidated into a single odk-helper script. Makefiles generated with ODK 1.7 will automatically call this new odk-helper script.

But of course, Makefiles that were generated with a pre-1.7 ODK will still attempt to call the original individual scripts. To make sure that standard workflows from a pre-1.7 ODK instance can still be run with a ODK 1.7 image, we must provide wrapper scripts, which is what we do here.

Similarly, we must also provide symlinks linking the old locations of the ROBOT plugins and of the templates to their new respective locations.

closes #1339

ODK versions up to 1.6 had included two small helper scripts:

* check-rdfxml, to check RDF/XML artefacts for correctness;
* context2csv, to convert a JSON-based context file to a CSV file.

In ODK 1.7, as part of the migration to the ODK-Core system, those
scripts were consolidated into a single `odk-helper` script. Makefiles
generated with ODK 1.7 will automatically call this new `odk-helper`
script.

But of course, Makefiles that were generated with a pre-1.7 ODK will
still attempt to call the original individual scripts. To make sure that
standard workflows from a pre-1.7 ODK instance can still be run with a
ODK 1.7 image, we must provide wrapper scripts, which is what we do
here.

closes #1339
@gouttegd gouttegd self-assigned this May 2, 2026
@gouttegd gouttegd requested a review from matentzn May 2, 2026 23:06
gouttegd added 2 commits May 3, 2026 02:15
Another thing that has changed with the switch to ODK-Core is the
location of:

* the ROBOT plugins (from /tools/robot-plugins to
  /odk/resources/robot/plugins);
* the templates (from /tools/templates to within the ODK-Core Python
  package).

In 1.7-generated Makefiles, we have explicit variables to refer to these
locations, but in pre-1.7 Makefiles, they were hardcoded. So to allow
pre-1.7 repositories to keep working with a ODK 1.7 image prior to being
updated, we need symlinks linking the old locations to the new ones.
We do _not_ to `exec` the odk-helper script here, because we need the
final `rm` command to be executed once the script has finished.
Copy link
Copy Markdown
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, two minor considerations for yourself.

Comment thread docker/odklite/Dockerfile
Comment thread scripts/compat-context2csv.sh
The wrapper script for the `context2csv` command should return the same
error code as the command itself.

We can't do that by using `set -e`, because then any error in
`context2csv` would cause the wrapper to immediately exit without
removing the temporary file. And using `trap` to make sure the file is
always removed regardless of how the script terminates could make the
script less portable (I don't remember how well `trap` is supported in
the various shells out there, and I can't be bothered to check right
now). So we simply capture the return code of `context2csv`, remove the
intermediate file, and explicitly exits the wrapper with the captured
return code.
Copy link
Copy Markdown
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@gouttegd gouttegd merged commit 18931cb into master May 5, 2026
1 check passed
@gouttegd gouttegd deleted the add-wrappers-for-pre17-scripts branch May 5, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ODK 1.7 will need compatibility wrappers for pre-1.7 repositories

2 participants