Skip to content
Snippets Groups Projects
Commit cab588d5 authored by Simon Rose's avatar Simon Rose
Browse files

Remove versionstr

This was only used for some older location to look for libraries and other
files. We do not use that in our packaging system.
parent 18dafed2
No related branches found
No related tags found
1 merge request!132E3-1066: Refactor require.c
...@@ -724,11 +724,10 @@ it calls epicsExit to abort the application. ...@@ -724,11 +724,10 @@ it calls epicsExit to abort the application.
/* wrapper to abort statup script */ /* wrapper to abort statup script */
static int require_priv(const char *module, const char *version, static int require_priv(const char *module, const char *version,
const char *args, const char *versionstr); const char *args);
int require(const char *module, const char *version, const char *args) { int require(const char *module, const char *version, const char *args) {
int status; int status;
char *versionstr;
static int firstTime = 1; static int firstTime = 1;
if (firstTime) { if (firstTime) {
...@@ -772,27 +771,7 @@ int require(const char *module, const char *version, const char *args) { ...@@ -772,27 +771,7 @@ int require(const char *module, const char *version, const char *args) {
return 0; return 0;
} }
if (version) { status = require_priv(module, version, args);
/* needed for old style only: */
if (asprintf(&versionstr, "-%s", version) < 0) return errno;
if (isdigit((unsigned char)version[0]) &&
version[strlen(version) - 1] == '+') {
/*
user may give a minimal version (e.g. "1.2.4+")
load highest matching version (here "1.2") and check later
*/
char *p = strrchr(versionstr, '.');
if (p == NULL) p = versionstr;
*p = 0;
}
} else {
versionstr = "";
}
if (requireDebug) printf("require: versionstr = \"%s\"\n", versionstr);
status = require_priv(module, version, args, versionstr);
if (version) free(versionstr);
if (status == 0) return 0; if (status == 0) return 0;
if (status != -1) perror("require"); if (status != -1) perror("require");
...@@ -891,10 +870,8 @@ static int handleDependencies(const char *module, char *depfilename) { ...@@ -891,10 +870,8 @@ static int handleDependencies(const char *module, char *depfilename) {
return 0; return 0;
} }
static int require_priv( static int require_priv(const char *module, const char *version,
const char *module, const char *version, const char *args, const char *args) {
const char *versionstr /* "-<version>" or "" (for old style only */
) {
int status; int status;
int returnvalue = 0; int returnvalue = 0;
const char *loaded = NULL; const char *loaded = NULL;
...@@ -951,7 +928,6 @@ static int require_priv( ...@@ -951,7 +928,6 @@ static int require_priv(
if (version && strcmp(version, "ifexists") == 0) { if (version && strcmp(version, "ifexists") == 0) {
ifexists = 1; ifexists = 1;
version = NULL; version = NULL;
versionstr = "";
} }
/* check already loaded verion */ /* check already loaded verion */
...@@ -1111,8 +1087,6 @@ static int require_priv( ...@@ -1111,8 +1087,6 @@ static int require_priv(
return ifexists ? 0 : -1; return ifexists ? 0 : -1;
} }
versionstr = "";
/* founddir = "<dirname>/[dirlen]<module>/<version>" */ /* founddir = "<dirname>/[dirlen]<module>/<version>" */
printf("Module %s version %s found in %s" OSI_PATH_SEPARATOR "\n", module, printf("Module %s version %s found in %s" OSI_PATH_SEPARATOR "\n", module,
found, founddir); found, founddir);
...@@ -1132,30 +1106,20 @@ static int require_priv( ...@@ -1132,30 +1106,20 @@ static int require_priv(
/* filename = /* filename =
* "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/module.dep" * "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/module.dep"
*/ */
/* or (old)
* "<dirname>/[dirlen]][releasediroffs][libdiroffs]<module>(-<version>)?.dep"
*/
if (handleDependencies(module, filename) == -1) return -1; if (handleDependencies(module, filename) == -1) return -1;
} }
if (requireDebug) printf("require: looking for library file\n"); if (requireDebug) printf("require: looking for library file\n");
if (!(TRY_FILE(libdiroffs, PREFIX "%s" INFIX "%s%n" EXT, module, versionstr, if (!(TRY_FILE(libdiroffs, PREFIX "%s" INFIX "%n" EXT, module, &extoffs))) {
&extoffs))) {
/* filename = /* filename =
"<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/PREFIX<module>INFIX[extoffs](EXT)?" "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/PREFIX<module>INFIX[extoffs](EXT)?"
*/ */
/* or (old)
"<dirname>/[dirlen][releasediroffs][libdiroffs]PREFIX<module>INFIX(-<version>)?[extoffs](EXT)?"
*/
printf("Module %s has no library\n", module); printf("Module %s has no library\n", module);
} else { } else {
/* filename = /* filename =
* "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/PREFIX<module>INFIX[extoffs]EXT" * "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/PREFIX<module>INFIX[extoffs]EXT"
*/ */
/* or (old)
* "<dirname>/[dirlen][releasediroffs][libdiroffs]PREFIX<module>INFIX(-<version>)?[extoffs]EXT"
*/
printf("Loading library %s\n", filename); printf("Loading library %s\n", filename);
if ((libhandle = loadlib(filename)) == NULL) return -1; if ((libhandle = loadlib(filename)) == NULL) return -1;
...@@ -1180,15 +1144,15 @@ static int require_priv( ...@@ -1180,15 +1144,15 @@ static int require_priv(
} }
/* load dbd file */ /* load dbd file */
if (TRY_NONEMPTY_FILE(releasediroffs, "dbd" OSI_PATH_SEPARATOR "%s%s.dbd", if (TRY_NONEMPTY_FILE(releasediroffs, "dbd" OSI_PATH_SEPARATOR "%s.dbd",
module, versionstr) || module) ||
TRY_NONEMPTY_FILE(releasediroffs, "%s%s.dbd", module, versionstr) || TRY_NONEMPTY_FILE(releasediroffs, "%s.dbd", module) ||
TRY_NONEMPTY_FILE(releasediroffs, TRY_NONEMPTY_FILE(releasediroffs,
".." OSI_PATH_SEPARATOR "dbd" OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR "dbd" OSI_PATH_SEPARATOR
"%s%s.dbd", "%s.dbd",
module, versionstr) || module) ||
TRY_NONEMPTY_FILE(releasediroffs, ".." OSI_PATH_SEPARATOR "%s%s.dbd", TRY_NONEMPTY_FILE(releasediroffs, ".." OSI_PATH_SEPARATOR "%s.dbd",
module, versionstr) || module) ||
TRY_NONEMPTY_FILE(releasediroffs, TRY_NONEMPTY_FILE(releasediroffs,
".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR
"dbd" OSI_PATH_SEPARATOR "%s.dbd", "dbd" OSI_PATH_SEPARATOR "%s.dbd",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment