Skip to content

Commit e78b0de

Browse files
committed
Allow specifying the path to odk at configure time.
The name and location of the main `odk` script will change in ODK 1.7: currently (up to ODK 1.6), the script is in `/tools/odk.py`; starting from ODK 1.7, it will be in `/usr/local/bin/odk`. Docker images for ODK 1.7 will include symlinks so that invoking `/tools/odk.py` will still work, but the recommended way to invoke the script will be to simply call `odk` (no `.py` extension, and fully relying on the shell to find the executable in the PATH). This commit adds a configure-time option to the ODK Runner to specify how the ODK script should be invoked. The default is `/tools/odk.py`, for compatibility with both pre- and post-1.7 images. Run the configure script with `--with-odk-executable=odk` to build a runner that will work only on post-1.7 images. At some point after the publication of ODK 1.7, the default value will change to `odk`, so that it would be required to use `--with-odk-executable=/tools/odk.py` to build a runner that will keep working with pre-1.7 images.
1 parent 61ed082 commit e78b0de

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ AC_ARG_WITH([min-osx-version],
3535
[MACOS_EXTRA_CFLAGS="$MACOS_EXTRA_CFLAGS -mmacosx-version-min=$withval"],
3636
[MACOS_EXTRA_CFLAGS="$MACOS_EXTRA_CFLAGS"])
3737

38+
dnl Support for pre-1.7 ODK images
39+
AC_ARG_WITH([odk-executable],
40+
[AS_HELP_STRING([--with-odk-executable],
41+
[Name of (of full path to) the odk script.])],
42+
[],
43+
[with_odk_executable="/tools/odk.py"])
44+
AC_DEFINE_UNQUOTED([ODK_EXECUTABLE], ["$with_odk_executable"], [Name or path of the odk script])
45+
3846
dnl Host-based tweaks
3947
AC_CANONICAL_HOST
4048
AS_CASE([$host],

src/backend-docker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ run(odk_backend_t *backend, odk_run_config_t *cfg, char **command)
129129
argv[i++] = "### DEBUG STATS ###\nElapsed time: %E\nPeak memory: %M kb";
130130
}
131131
if ( cfg->flags & ODK_FLAG_SEEDMODE ) {
132-
argv[i++] = "/tools/odk.py";
132+
argv[i++] = ODK_EXECUTABLE;
133133
argv[i++] = "seed";
134134
}
135135
for ( cursor = &command[0]; *cursor; cursor++ )

src/backend-native.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ run(odk_backend_t *backend, odk_run_config_t *cfg, char **command)
9999
argv[i++] = "### DEBUG STATS ###\nElapsed time: %E\nPeak memory: %M kb";
100100
}
101101
if ( cfg->flags & ODK_FLAG_SEEDMODE ) {
102-
argv[i++] = "odk"; /* We assume the odk script is in PATH */
102+
argv[i++] = "odk"; /* In native environments the odk script
103+
should always be in the PATH. */
103104
argv[i++] = "seed";
104105
}
105106
for ( cursor = &command[0]; *cursor; cursor++ )

src/backend-singularity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ run(odk_backend_t *backend, odk_run_config_t *cfg, char **command)
138138
argv[i++] = "### DEBUG STATS ###\nElapsed time: %E\nPeak memory: %M kb";
139139
}
140140
if ( cfg->flags & ODK_FLAG_SEEDMODE ) {
141-
argv[i++] = "/tools/odk.py";
141+
argv[i++] = ODK_EXECUTABLE;
142142
argv[i++] = "seed";
143143
}
144144
for ( cursor = &command[0]; *cursor; cursor++ )

0 commit comments

Comments
 (0)