Commit 07abcdbf authored by Seblu's avatar Seblu
Browse files

Add regex_exclude

This option allow to use a regex to exclude upstream versions before trying to
find the last one. Useful to exclude rc* version from a list without building
a complex regex_version.
parent f08f650e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -37,6 +37,12 @@ url =
# Default is \.(?:tar(?:\.gz|\.bz2|\.xz)?|tgz|tbz2|zip)
#regex_ext =

# Exclude upstream versions matching this regex before looking for the last
# Useful to remove release candiates and beta versions
# Default is .*(rc|beta).*
# Set to empty string to not exclude
#regex_exclude =

# Custom upstream version modifier in python
# e.g: version.replace("-", "_")
#eval_upstream =
+8 −1
Original line number Diff line number Diff line
@@ -102,9 +102,16 @@ class VersionController(object):
                if v is None or len(v) == 0:
                    raise VersionNotFound("No regex match on upstream")
                # remove duplicity
                v = list(set(v))
                v = set(v)
                # list all found versions
                logging.debug("Found versions: %s" % v)
                # exclude versions
                regex_exclude = value.get("regex_exclude", ".*(rc|beta).*")
                if regex_exclude != "":
                    logging.debug("Exclusion regex: %s" % regex_exclude)
                    v -= set(filter(lambda x: "rc" in x, v))
                    logging.debug("Found versions after exclusion: %s" % v)
                # latest version is the highest
                v = max(v, key=VersionKey)
                # list selected version
                logging.debug("Upstream version is : %s" % v)