-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e98f4c
commit af5d47b
Showing
9 changed files
with
50 additions
and
49 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
pub mod apt { | ||
use anyhow::Context; | ||
use apt_cmd::{lock::apt_lock_wait, request::Request as AptRequest, AptGet}; | ||
use std::collections::HashSet; | ||
|
||
pub async fn fetch_uris(packages: Option<&[&str]>) -> anyhow::Result<HashSet<AptRequest>> { | ||
apt_lock_wait().await; | ||
let mut uris = AptGet::new() | ||
.noninteractive() | ||
.fetch_uris(&["full-upgrade"]) | ||
.await | ||
.context("failed to exec `apt-get full-upgrade --print-uris`")? | ||
.context("failed to fetch package URIs from apt-get full-upgrade")?; | ||
|
||
if let Some(packages) = packages { | ||
apt_lock_wait().await; | ||
let install_uris = AptGet::new() | ||
.noninteractive() | ||
.fetch_uris(&{ | ||
let mut args = vec!["install"]; | ||
args.extend_from_slice(packages); | ||
args | ||
}) | ||
.await | ||
.context("failed to exec `apt-get install --print-uris`")? | ||
.context("failed to fetch package URIs from `apt-get install`")?; | ||
|
||
for uri in install_uris { | ||
uris.insert(uri); | ||
} | ||
} | ||
|
||
Ok(uris) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.