summaryrefslogtreecommitdiffstats
path: root/src/shims
diff options
context:
space:
mode:
authordev <dev@example.com>2026-11-21 19:29:41 +0000
committerdev <dev@example.com>2026-11-21 19:29:41 +0000
commitbb1d533515c8f63faacb00b3ef59232cf2d4a1c5 (patch)
tree94da9ecc261f28f12ac6e74b29b27f3aef4b1e77 /src/shims
parent0f18ebddc1c138c531e3e331786c7fa917d9186f (diff)
downloadaur-build-bb1d533515c8f63faacb00b3ef59232cf2d4a1c5.tar.gz
aur-build-bb1d533515c8f63faacb00b3ef59232cf2d4a1c5.zip
pipeline,sandbox,shims: thirty-two more markers the compiler was willing to take
The whole `shims` module is behind `test-support`, so its thirteen `pub(crate)` items were invisible to a release build already — but `pub(crate)` still made each of them part of the crate's interface to every other module, and none of them had a reader outside the file that declares it. `manifest`, `record`, `split_version`, `valid_db_arg`, `DB_SUFFIXES` and the nine tool entry points are now private to `src/shims/mod.rs`, which is where the shim binaries reach them through the module's own `pub` surface. `pipeline` went 16 -> 4 and `sandbox` 16 -> 9. Two refusals are worth the sentence: `SourceIdentity` is the type of the `pub(crate)` field `Ctx::src`, and a field may not be more reachable than its type, so making it private is the `private_interfaces` warning rather than a legal narrowing. `provision_request` is declared inside the private `kata_backend` module and called from the sibling `#[cfg(test)] mod tests`, and privacy does not cross to a sibling — E0624. Both are argued in `over_visibility.allowlist` now instead of sitting unexplained. `LOW` in `review` is the same sibling case one level up: it lives in the `pub mod level` nested in risk.rs and the scorer in the parent module reads `level::LOW`, so `pub(crate)` is the narrowest thing that reaches, given that this crate does not admit `pub(super)`. priv 149 -> 117, overwide 21 -> 0 unargued. `cargo check` clean under both profiles with no new warnings; tests/pipeline.rs, remote_agent.rs, kata.rs, approve.rs, shims.rs and world.rs pass (62 tests), and `cargo test --test architecture` is 16 passed.
Diffstat (limited to 'src/shims')
-rw-r--r--src/shims/mod.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/shims/mod.rs b/src/shims/mod.rs
index 8e6e231..a918515 100644
--- a/src/shims/mod.rs
+++ b/src/shims/mod.rs
@@ -42,7 +42,7 @@ impl Default for FakePackage {
}
impl FakePackage {
- pub(crate) fn split_version(&self) -> (String, String) {
+ fn split_version(&self) -> (String, String) {
match self.version.rsplit_once('-') {
Some((v, r)) => (v.to_string(), r.to_string()),
None => (self.version.clone(), "1".into()),
@@ -98,7 +98,7 @@ pub fn manifest() -> Manifest {
}
#[cfg(not(feature = "test-support"))]
-pub(crate) fn manifest() -> Manifest {
+fn manifest() -> Manifest {
manifest_impl()
}
@@ -113,7 +113,7 @@ fn manifest_impl() -> Manifest {
}
/// Called by `run` to log the invocation; nothing outside `shims` records a shim call.
-pub(crate) fn record(tool: &str, args: &[String]) {
+fn record(tool: &str, args: &[String]) {
let dir = match std::env::var("AUR_SHIM_DIR") {
Ok(d) => d,
Err(_) => return,
@@ -211,7 +211,7 @@ pub fn run(tool: &str) -> i32 {
}
/// 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> {
+fn mkarchroot(args: &[String]) -> Result<i32, String> {
let mut target = None;
let mut skip = false;
for a in args {
@@ -235,7 +235,7 @@ pub(crate) 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 makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
+fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> {
if !args.iter().any(|a| a == "-r") {
return Err("makechrootpkg: expected -r <chroot>".into());
}
@@ -243,7 +243,7 @@ pub(crate) fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String
emit_packages(m, "makechrootpkg", wants_sig)
}
-pub(crate) fn emit_packages(m: &Manifest, tool: &str, wants_sig: bool) -> Result<i32, String> {
+fn emit_packages(m: &Manifest, tool: &str, wants_sig: bool) -> Result<i32, String> {
for l in &m.log_lines {
println!("{l}");
}
@@ -323,7 +323,7 @@ fn packages_to_emit(m: &Manifest, startdir: &Path) -> Vec<FakePackage> {
}
}
-pub(crate) fn write_package(dir: &Path, p: &FakePackage, m: &Manifest) -> Result<PathBuf, String> {
+fn write_package(dir: &Path, p: &FakePackage, m: &Manifest) -> Result<PathBuf, String> {
let (pkgver, pkgrel) = p.split_version();
let filename = format!("{}-{}-{}.pkg.tar.zst", p.name, p.version, p.arch);
let path = dir.join(&filename);
@@ -414,7 +414,7 @@ fn fake_sig(bytes: &[u8]) -> Vec<u8> {
}
/// 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> {
+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}");
@@ -464,7 +464,7 @@ pub(crate) 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 pacman(args: &[String]) -> Result<i32, String> {
+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);
@@ -505,7 +505,7 @@ fn installed_db() -> Option<std::path::PathBuf> {
std::env::var("AUR_SHIM_DIR").ok().map(|d| std::path::Path::new(&d).join("installed.txt"))
}
-pub(crate) const DB_SUFFIXES: [&str; 5] = [
+const DB_SUFFIXES: [&str; 5] = [
".db.tar",
".db.tar.gz",
".db.tar.zst",
@@ -523,7 +523,7 @@ pub fn valid_db_arg(p: &Path) -> bool {
}
#[cfg(not(feature = "test-support"))]
-pub(crate) fn valid_db_arg(p: &Path) -> bool {
+fn valid_db_arg(p: &Path) -> bool {
valid_db_arg_impl(p)
}
@@ -538,7 +538,7 @@ fn valid_db_arg_impl(p: &Path) -> bool {
.any(|sfx| name.ends_with(sfx))
}
-pub(crate) fn repo_add(args: &[String], _m: &Manifest) -> Result<i32, String> {
+fn repo_add(args: &[String], _m: &Manifest) -> Result<i32, String> {
let mut positional: Vec<&String> = Vec::new();
let mut skip = false;
for a in args {
@@ -633,7 +633,7 @@ fn pkginfo_fields(pkg_bytes: &[u8]) -> Result<(String, String, String, 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> {
+fn gpg(args: &[String]) -> Result<i32, String> {
let out = args
.iter()
.position(|a| a == "--output" || a == "-o")