summaryrefslogtreecommitdiffstats
path: root/src/shims
diff options
context:
space:
mode:
Diffstat (limited to 'src/shims')
-rw-r--r--src/shims/mod.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/shims/mod.rs b/src/shims/mod.rs
index 4b29466..a877739 100644
--- a/src/shims/mod.rs
+++ b/src/shims/mod.rs
@@ -109,7 +109,8 @@ fn manifest_impl() -> Manifest {
}
}
-pub fn record(tool: &str, args: &[String]) {
+/// Called by `run` to log the invocation; nothing outside `shims` records a shim call.
+pub(crate) fn record(tool: &str, args: &[String]) {
let dir = match std::env::var("AUR_SHIM_DIR") {
Ok(d) => d,
Err(_) => return,
@@ -206,7 +207,8 @@ pub fn run(tool: &str) -> i32 {
}
}
-pub fn mkarchroot(args: &[String]) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn mkarchroot(args: &[String]) -> Result<i32, String> {
let mut target = None;
let mut skip = false;
for a in args {
@@ -229,7 +231,8 @@ pub fn mkarchroot(args: &[String]) -> Result<i32, String> {
Ok(0)
}
-pub fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if !args.iter().any(|a| a == "-r") {
return Err("makechrootpkg: expected -r <chroot>".into());
}
@@ -407,7 +410,8 @@ fn fake_sig(bytes: &[u8]) -> Vec<u8> {
format!("-----BEGIN FAKE PGP SIGNATURE-----\n{}\n-----END FAKE PGP SIGNATURE-----\n", hash::hex(bytes)).into_bytes()
}
-pub fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if args.iter().any(|a| a == "--vercheck" || a == "-V-check") {
let v = m.vercheck.clone().unwrap_or_else(|| "1.0-1".into());
println!("{v}");
@@ -456,7 +460,8 @@ pub fn makepkg(args: &[String], m: &Manifest) -> Result<i32, String> {
}
}
-pub fn pacman(args: &[String]) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn pacman(args: &[String]) -> Result<i32, String> {
if args.iter().any(|a| a == "-U") {
for path in args.iter().filter(|a| !a.starts_with('-')) {
let p = std::path::Path::new(path);
@@ -624,7 +629,8 @@ fn pkginfo_fields(pkg_bytes: &[u8]) -> Result<(String, String, String, String),
Ok((info.name, info.version, info.arch, extra))
}
-pub fn gpg(args: &[String]) -> Result<i32, String> {
+/// Reached only through `run`, which matches the tool name to it. The tool name appears in test strings, which is not a caller.
+pub(crate) fn gpg(args: &[String]) -> Result<i32, String> {
let out = args
.iter()
.position(|a| a == "--output" || a == "-o")