Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
JimFuller-RedHat committed Feb 7, 2024
1 parent 74c09b3 commit 8cfafdb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 35 deletions.
23 changes: 10 additions & 13 deletions griffon/commands/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ def retrieve_component_summary(ctx, component_name, strict_name_search):
"search_latest",
is_flag=True,
default=False,
help=f"Search root Components {Style.BOLD}(enabled by default){Style.RESET}.",
help=f"Search latest root Components.",
)
@click.option(
"--search-provides",
"search_provides",
is_flag=True,
default=False,
help=(
f"Search root Components by provides children "
f"Search dependencies returning their latest root (RPM:src,OCI:noarch) Components "
f"{Style.BOLD}(enabled by default){Style.RESET}."
),
)
Expand All @@ -249,36 +249,33 @@ def retrieve_component_summary(ctx, component_name, strict_name_search):
"search_upstreams",
is_flag=True,
default=False,
help=(
f"Search root Components by upstreams children "
f"{Style.BOLD}(enabled by default){Style.RESET}."
),
help=(f"Search root (RPM:src,OCI:noarch) Components by upstreams children "),
)
@click.option(
"--search-related-url",
"search_related_url",
is_flag=True,
default=False,
help=f"Search related url {Style.BOLD}(enabled by default){Style.RESET}.",
help=f"Search by related url.",
)
@click.option(
"--filter-rh-naming/--no-filter-rh-naming",
default=get_config_option("default", "filter_rh_naming", True),
help="Do not filter RH naming.",
help=f"rh-filter-naming is {Style.BOLD}enabled by default{Style.RESET}. Use --no-filter-rh-naming to disable.",
)
@click.option(
"--search-all",
"search_all",
is_flag=True,
default=False,
help="Flat search for all Components.",
help="Flat search of all Components.",
)
@click.option(
"--search-all-roots",
"search_all_roots",
is_flag=True,
default=False,
help="Search all ROOT Components and dependencies.",
help="Search all root (RPM:src,OCI:noarch) Components.",
)
@click.option(
"--search-community",
Expand All @@ -292,7 +289,7 @@ def retrieve_component_summary(ctx, component_name, strict_name_search):
"search_all_upstreams",
is_flag=True,
default=False,
help="Flat search for all Components by upstream.",
help="Flat search for all upstream Components.",
)
@click.option(
"--no-community",
Expand Down Expand Up @@ -334,7 +331,7 @@ def retrieve_component_summary(ctx, component_name, strict_name_search):
"output_type_filter",
type=click.Choice(CorgiService.get_component_types()),
default=None,
help="Filter component type.",
help="Filter components by type from output.",
)
@click.option(
"-v",
Expand All @@ -357,7 +354,7 @@ def retrieve_component_summary(ctx, component_name, strict_name_search):
"include_container_roots",
is_flag=True,
default=get_config_option("default", "include_container_roots", False),
help="Include OCI root components in output.",
help="Include all root (RPM:src,OCI:noarch) components in output.",
)
@click.option(
"--exclude-unreleased",
Expand Down
27 changes: 5 additions & 22 deletions griffon/services/core_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

logger = logging.getLogger("griffon")

ITEM_BATCH = 50
ITEM_BATCH = 75


class product_stream_summary:
Expand Down Expand Up @@ -346,7 +346,10 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
params["released_components"] = "True"
if not (self.include_container_roots):
params["type"] = "RPM"
params["arch"] = "src"
if self.ns:
params["namespace"] = self.ns
if self.component_type:
params["type"] = self.component_type

component_name = self.component_name
if not self.strict_name_search and not self.regex_name_search:
Expand All @@ -358,8 +361,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_provides_params["re_provides_name"] = component_name
else:
search_provides_params["provides_name"] = component_name
if self.ns:
search_provides_params["namespace"] = self.ns
search_provides_params["latest_components_by_streams"] = "True"
status.update("searching latest provided child component(s).")
latest_components_cnt = self.corgi_session.components.count(**search_provides_params)
Expand Down Expand Up @@ -410,8 +411,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_latest_params["re_name"] = component_name
else:
search_latest_params["name"] = component_name
if self.ns:
search_latest_params["namespace"] = self.ns
search_latest_params["root_components"] = "True"
search_latest_params["latest_components_by_streams"] = "True"
status.update("searching latest root component(s).")
Expand Down Expand Up @@ -458,8 +457,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_upstreams_params["re_upstreams_name"] = component_name
else:
search_upstreams_params["upstreams_name"] = component_name
if self.ns:
search_upstreams_params["namespace"] = self.ns
search_upstreams_params["latest_components_by_streams"] = "True"
status.update("searching latest upstreams child component(s).")
latest_components_cnt = self.corgi_session.components.count(**search_upstreams_params)
Expand Down Expand Up @@ -503,10 +500,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_related_url_params = copy.deepcopy(params)
# Note: related_url filter has no concept of strict
search_related_url_params["related_url"] = component_name
if self.ns:
search_related_url_params["namespace"] = self.ns
if self.component_type:
search_related_url_params["type"] = self.component_type
related_url_components_cnt = self.corgi_session.components.count(
**search_related_url_params,
)
Expand Down Expand Up @@ -538,10 +531,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_all_params["re_name"] = component_name
else:
search_all_params["name"] = component_name
if self.component_type:
search_all_params["type"] = self.component_type
if self.ns:
search_all_params["namespace"] = self.ns
all_components_cnt = self.corgi_session.components.count(**search_all_params)
status.update(f"found {all_components_cnt} all component(s).")
# TODO: remove max_results
Expand Down Expand Up @@ -579,8 +568,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_all_roots_params["re_name"] = component_name
else:
search_all_roots_params["name"] = component_name
if self.ns:
search_all_roots_params["namespace"] = self.ns
all_src_components_cnt = self.corgi_session.components.count(**search_all_roots_params)
status.update(f"found {all_src_components_cnt} all root component(s).")
all_src_components = self.corgi_session.components.retrieve_list_iterator_async(
Expand Down Expand Up @@ -614,8 +601,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_all_upstreams_params["re_name"] = component_name
else:
search_all_upstreams_params["name"] = component_name
if self.component_type:
search_all_upstreams_params["type"] = self.component_type
upstream_components_cnt = self.corgi_session.components.count(
**search_all_upstreams_params
)
Expand Down Expand Up @@ -701,8 +686,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_community_params["re_name"] = component_name
else:
search_community_params["name"] = component_name
if self.ns:
search_community_params["namespace"] = self.ns
all_community_components_cnt = self.community_session.components.count(
**search_community_params
)
Expand Down

0 comments on commit 8cfafdb

Please sign in to comment.