Loading misc/example.conf +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ url = # Url request timeout in seconds #timeout = # Url retry count (default: 0) #retry = # Custom regular expression # Default is $regex_name[-_]v?($regex_version)$regex_ext #regex = Loading misc/example2.conf +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ compare = pacman eval_upstream = version.replace("-", ".") timeout = 30 retry = 2 [acpid] url = http://sourceforge.net/projects/acpid2/files/ Loading src/lib/archversion/version.py +23 −19 Original line number Diff line number Diff line Loading @@ -70,9 +70,12 @@ class VersionController(object): "\.(?:tar(?:\.gz|\.bz2|\.xz)?|tgz|tbz2|zip)"))) # retrieve config timeout timeout = float(value.get("timeout", None)) # do it retry time + 1 ntry = int(value.get("retry", 0)) + 1 # do the job for n in range(1, ntry + 1): try: logging.debug("Requesting url: %s" % url) logging.debug("Requesting url: %s (try %d/%d)" % (url, n, ntry)) logging.debug("Timeout is %f" % timeout) url_req = Request(url, headers={"User-Agent": USER_AGENT}) url_fd = urlopen(url_req, timeout=timeout) Loading @@ -89,6 +92,7 @@ class VersionController(object): logging.debug("Upstream version is : %s" % v) return v except Exception as exp: if n == ntry: raise VersionNotFound("Upstream check failed: %s" % exp) assert(False) Loading Loading
misc/example.conf +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ url = # Url request timeout in seconds #timeout = # Url retry count (default: 0) #retry = # Custom regular expression # Default is $regex_name[-_]v?($regex_version)$regex_ext #regex = Loading
misc/example2.conf +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ compare = pacman eval_upstream = version.replace("-", ".") timeout = 30 retry = 2 [acpid] url = http://sourceforge.net/projects/acpid2/files/ Loading
src/lib/archversion/version.py +23 −19 Original line number Diff line number Diff line Loading @@ -70,9 +70,12 @@ class VersionController(object): "\.(?:tar(?:\.gz|\.bz2|\.xz)?|tgz|tbz2|zip)"))) # retrieve config timeout timeout = float(value.get("timeout", None)) # do it retry time + 1 ntry = int(value.get("retry", 0)) + 1 # do the job for n in range(1, ntry + 1): try: logging.debug("Requesting url: %s" % url) logging.debug("Requesting url: %s (try %d/%d)" % (url, n, ntry)) logging.debug("Timeout is %f" % timeout) url_req = Request(url, headers={"User-Agent": USER_AGENT}) url_fd = urlopen(url_req, timeout=timeout) Loading @@ -89,6 +92,7 @@ class VersionController(object): logging.debug("Upstream version is : %s" % v) return v except Exception as exp: if n == ntry: raise VersionNotFound("Upstream check failed: %s" % exp) assert(False) Loading