package_info: fix check_launchpad_repo needing web requests (use git)
Some checks failed
CI / build (push) Failing after 20m1s
CI / snap (push) Has been skipped

This commit is contained in:
2026-02-16 18:44:46 +01:00
parent 7c53b268dd
commit eb3e71a938

View File

@@ -20,15 +20,15 @@ pub fn ppa_to_base_url(user: &str, name: &str) -> String {
async fn check_launchpad_repo(package: &str) -> Result<Option<String>, Box<dyn Error>> {
let url = format!("https://git.launchpad.net/ubuntu/+source/{}", package);
let client = reqwest::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.build()?;
let response = client.head(&url).send().await?;
if response.status().is_success() {
Ok(Some(url))
} else {
Ok(None)
// Use libgit2 to check if the remote repository exists
// This is more reliable than HTTP HEAD requests when CGIt is disabled
match git2::Remote::create_detached(url.clone()) {
Ok(mut remote) => match remote.connect(git2::Direction::Fetch) {
Ok(_) => Ok(Some(url)),
Err(_) => Ok(None),
},
Err(_) => Ok(None),
}
}