Skip to content

Commit

Permalink
Make terminating build if version format is wrong configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubos Kardos committed Oct 23, 2015
1 parent f5bab7c commit 5e94633
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 9 additions & 5 deletions build/parseReqs.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static rpmRC checkSep(const char *s, char c, char **emsg)
const char *sep = strchr(s, c);
if (sep && strchr(sep + 1, c)) {
rasprintf(emsg, "Invalid version (double separator '%c'): %s", c, s);
return RPMRC_FAIL;
}
return RPMRC_OK;
}
Expand All @@ -35,7 +36,7 @@ static rpmRC checkEpoch(const char *s, char **emsg)
for (si = s; si != sep; si++) {
if (!risdigit(*si)) {
rasprintf(emsg, "Invalid version (epoch must be unsigned integer): %s", s);
break;
return RPMRC_FAIL;
}
}
return RPMRC_OK;
Expand All @@ -58,10 +59,13 @@ static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
}
if (rpmCharCheck(spec, EVR, ".-_+:%{}~"))
return RPMRC_FAIL;
if (checkSep(EVR, '-', emsg) != RPMRC_OK || checkSep(EVR, ':', emsg) != RPMRC_OK)
return RPMRC_FAIL;
if (checkEpoch(EVR, emsg) != RPMRC_OK)
return RPMRC_FAIL;
if (checkSep(EVR, '-', emsg) != RPMRC_OK ||
checkSep(EVR, ':', emsg) != RPMRC_OK ||
checkEpoch(EVR, emsg) != RPMRC_OK) {

if (rpmExpandNumeric("%{?_wrong_version_format_terminate_build}"))
return RPMRC_FAIL;
}
}
return RPMRC_OK;
}
Expand Down
3 changes: 3 additions & 0 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@ package or when debugging this package.\
# Should invalid utf8 encoding in package metadata terminate a build?
%_invalid_encoding_terminates_build 0

# Should invalid version format in requires, provides, ... terminate a build?
%_wrong_version_format_terminate_build 1

#
# Should rpm try to download missing sources at build-time?
# Enabling this is dangerous as long as rpm has no means to validate
Expand Down

0 comments on commit 5e94633

Please sign in to comment.