Downloads pkgbase.gz from aurweb and extracts the package names.
()
| 160 | |
| 161 | /// Downloads pkgbase.gz from aurweb and extracts the package names. |
| 162 | fn get_packages_list() -> Result<Vec<String>, Error> { |
| 163 | let resp = get(AUR_PKGBASE_URL) |
| 164 | .map_err(|source| Error::HttpQueryFailed { |
| 165 | context: "retrieving the list of AUR packages".to_string(), |
| 166 | source, |
| 167 | })? |
| 168 | .error_for_status() |
| 169 | .map_err(|source| Error::HttpQueryFailed { |
| 170 | context: "retrieving the list of AUR packages".to_string(), |
| 171 | source, |
| 172 | })?; |
| 173 | let bytes = resp.bytes().map_err(|source| Error::HttpQueryFailed { |
| 174 | context: "retrieving the response body as bytes for the list of AUR packages".to_string(), |
| 175 | source, |
| 176 | })?; |
| 177 | let mut decoder = GzDecoder::new(&bytes[..]); |
| 178 | let mut aur_packages_raw = String::new(); |
| 179 | decoder |
| 180 | .read_to_string(&mut aur_packages_raw) |
| 181 | .map_err(|source| Error::Io { |
| 182 | context: |
| 183 | "reading the gzip decoded response body for the list of AUR packages as string" |
| 184 | .to_string(), |
| 185 | source, |
| 186 | })?; |
| 187 | Ok(aur_packages_raw.lines().map(|s| s.to_string()).collect()) |
| 188 | } |
no outgoing calls
no test coverage detected