Commit 6da44cf0 authored by Seblu's avatar Seblu

Split version and release pattern matching

parent de6dd4a9
......@@ -227,10 +227,11 @@ class Archive(object):
debug("Remote and local indexes seems equal. No update.")
def search(self, name_pattern, version_pattern, arch_list=None):
def search(self, name_pattern, version_pattern, release_pattern, arch_list=None):
"""Search for a package """
name_regex = recompile(name_pattern)
version_regex = recompile(version_pattern) if version_pattern is not None else None
release_regex = recompile(release_pattern) if release_pattern is not None else None
res = list()
for pkg in self._index.values():
......@@ -240,7 +241,11 @@ class Archive(object):
# check against version
if version_regex is not None:
if not
if not
# check against release
if release_regex is not None:
if not
res += [pkg]
return res
......@@ -339,6 +344,8 @@ def parse_argv():
help="regex to match a package name")
p_main.add_argument("version", nargs="?",
help="regex to match a package version")
p_main.add_argument("release", nargs="?",
help="regex to match a package release")
return p_main.parse_args()
def main():
......@@ -352,7 +359,7 @@ def main():
# init archive interface
archive = Archive(args.url, args.timeout, args.update)
# select target pacakges
packages =, args.version, args.arch)
packages =, args.version, args.release, args.arch)
if len(packages) == 0:
print("No match found.")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment