diff --git a/CHANGELOG.md b/CHANGELOG.md index 5058615a8fc8c6ef750f178a18df4267882c4522..90216055d4c9ef81c7e4de4f635af94a7e7399d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ * Fixed issue with module name checking which caused modules to fail to build on certain linux distributions * Exact module version is fetched correctly at build-time to ensure that new releases do not affect upstream dependencies * Issue involving priority between some test versions fixed +* `make patch` when there are no patch files will no longer return an error code. ## Other changes * Removed `require` as a submodule and merged it into `e3-require`. diff --git a/require-ess/src/require.c b/require-ess/src/require.c index 6bd8866148d750aa21c5faeb188a48ca20367000..bda302bc48d8a0a32679ccd2254c209bda9877b9 100644 --- a/require-ess/src/require.c +++ b/require-ess/src/require.c @@ -823,18 +823,25 @@ static int compareDigit(int found, int requested, const char *name) return MATCH; } -static int compareNumericVersion(semver_t *sv_found, semver_t *sv_request, int already_matched) { +static int compareNumericVersion(semver_t *sv_found, semver_t *sv_request, int already_matched) +{ int match; match = compareDigit(sv_found->major, sv_request->major, "major"); if (match != MATCH) + { return match; + } match = compareDigit(sv_found->minor, sv_request->minor, "minor"); if (match != MATCH) + { return match; + } match = compareDigit(sv_found->patch, sv_request->patch, "patch"); if (match != MATCH) + { return match; + } if (sv_request->build == -1) { diff --git a/require-ess/src/version.c b/require-ess/src/version.c index 0d960d01dcb23a38291544b08cd385075044edf9..9d716c535f995af0671ff53b804421c39570850a 100644 --- a/require-ess/src/version.c +++ b/require-ess/src/version.c @@ -4,12 +4,14 @@ #include <stdio.h> #include "version.h" -void cleanup_semver(semver_t *s) { +void cleanup_semver(semver_t *s) +{ free(s->version_str); free(s); } -static void init_semver(const char *version, semver_t *s) { +static void init_semver(const char *version, semver_t *s) +{ s->version_str = calloc(strlen(version) + 1, sizeof(char)); strcpy(s->version_str, version); s->test_str = ""; @@ -20,7 +22,8 @@ static void init_semver(const char *version, semver_t *s) { s->build = -1; } -static void fetch_part(char *version_str, regmatch_t *groups, unsigned int ix, int *part) { +static void fetch_part(char *version_str, const regmatch_t *groups, unsigned int ix, int *part) +{ char tmp; tmp = version_str[groups[ix].rm_eo]; @@ -29,7 +32,8 @@ static void fetch_part(char *version_str, regmatch_t *groups, unsigned int ix, i version_str[groups[ix].rm_eo] = tmp; } -int parse_semver(const char *version, semver_t *s) { +int parse_semver(const char *version, semver_t *s) +{ static const char* version_regex = "^(([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\+([0-9]+))?)?(.*)$"; static const unsigned int max_regex_groups = 7 + 1; static const unsigned int major_ix = 2; @@ -43,19 +47,23 @@ int parse_semver(const char *version, semver_t *s) { init_semver(version, s); - if (s->version_str == NULL || s->version_str[0] == 0) { + if (s->version_str == NULL || s->version_str[0] == 0) + { return 1; } - if (regcomp(&compiled, version_regex, REG_EXTENDED)) { + if (regcomp(&compiled, version_regex, REG_EXTENDED)) + { return 1; } - if (regexec(&compiled, s->version_str, max_regex_groups, groups, 0) == 0) { + if (regexec(&compiled, s->version_str, max_regex_groups, groups, 0) == 0) + { fetch_part(s->version_str, groups, major_ix, &s->major); fetch_part(s->version_str, groups, minor_ix, &s->minor); fetch_part(s->version_str, groups, patch_ix, &s->patch); - if (groups[build_ix].rm_so != (size_t)-1) { + if (groups[build_ix].rm_so != (regoff_t)-1) + { fetch_part(s->version_str, groups, build_ix, &s->build); } s->test_str = s->version_str + groups[test_ix].rm_so;