summaryrefslogtreecommitdiffstats
path: root/src/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipeline')
-rw-r--r--src/pipeline/publish.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs
index ab0cb87..40048c3 100644
--- a/src/pipeline/publish.rs
+++ b/src/pipeline/publish.rs
@@ -321,15 +321,21 @@ fn dedupe_by_name(paths: Vec<PathBuf>) -> Vec<PathBuf> {
out
}
+/// The package name a built artifact declares, read from its own `.PKGINFO`.
+///
+/// This is the real parser in `crate::pkginfo`, not the shim harness's: the
+/// name that goes into the index must come from the same read of the bytes that
+/// the pipeline signs, and a second parser in the test scaffolding is one
+/// refactor away from disagreeing about what a package calls itself (ยง6 M-4).
fn package_name(path: &Path) -> Option<String> {
let bytes = std::fs::read(path).ok()?;
- let info = crate::shims::read_pkginfo(&bytes).ok()?;
- for line in info.lines() {
- if let Some(v) = line.strip_prefix("pkgname =") {
- return Some(v.trim().to_string());
- }
+ let info = crate::pkginfo::pkginfo_text(&bytes).ok()?;
+ let name = crate::pkginfo::parse_pkginfo(&info).name;
+ if name.is_empty() {
+ None
+ } else {
+ Some(name)
}
- None
}
/// Re-materialize the served index from the DB. Run at startup: if a crash left