Closed JeanChristopheMorinPerso closed 16 hours ago
Yes! That seems like a bug.
Could the problem be that https://github.com/mamba-org/rattler/blob/1630c43f89496bb46cf876e76932ee08b47fbd30/crates/rattler_repodata_gateway/src/gateway/query.rs#L223-L253 doesn't filter fetched records based on the input spec?
yeah indeed! it seems to only be used to filter fetching dependencies.
I'm currently learning rust (I'm very early in the process) and tried something. This patch seems to work, though it doesn't feel "right" to me.
diff --git a/crates/rattler_repodata_gateway/src/gateway/query.rs b/crates/rattler_repodata_gateway/src/gateway/query.rs
index 2a0847e..5d37e91 100644
--- a/crates/rattler_repodata_gateway/src/gateway/query.rs
+++ b/crates/rattler_repodata_gateway/src/gateway/query.rs
@@ -247,8 +247,15 @@ impl GatewayQuery {
// Add the records to the result
if records.len() > 0 {
let result = &mut result[result_idx];
- result.len += records.len();
- result.shards.push(records);
+
+ for record in records.iter() {
+ if !request_specs.iter().any(|spec| spec.matches(record)) {
+ // Do not recurse into records that do not match to root spec.
+ continue;
+ }
+ result.len += 1;
+ result.shards.push(Arc::new([record.clone()]));
+ }
}
}
Hello, I was trying out the
Gateway.query
method and I noticed that it seems to return all versions of a package even if I use a spec like_go_select[md5=73a9dbf6acbed92b5e45e336f0372bcf]
.Example:
Shouldn't it return a single record in this case or at best 2 (the .tar.bz2 and the .conda)?
I also tried with a matchspec like
_go_select=2.3.0=cgo
and I get the same result.