diff options
Diffstat (limited to 'src/db/model.rs')
| -rw-r--r-- | src/db/model.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/db/model.rs b/src/db/model.rs index 263db4e..3fa2840 100644 --- a/src/db/model.rs +++ b/src/db/model.rs @@ -55,10 +55,25 @@ pub struct SourceDigest { /// sha256, or the resolved VCS commit for vcs sources. pub digest: String, pub size: u64, - /// True when the PKGBUILD declared `SKIP` (or nothing) for this source. + /// True when the PKGBUILD gave us no checksum to trust for this source — + /// `SKIP`, a malformed digest, or nothing at all. + /// + /// It means that and nothing else (m-19). It used to be hardcoded `true` for + /// VCS entries, where it reads as a warning the recipe never earned: a + /// `-git` source has no checksum by design because the *pin* is the + /// integrity. Ask [`SourceDigest::is_vcs`] when you need to know which of + /// the two mechanisms protects an entry. pub skip_declared: bool, } +impl SourceDigest { + /// True when this entry's integrity comes from a resolved commit rather than + /// a content hash. + pub fn is_vcs(&self) -> bool { + matches!(self.kind.as_str(), "vcs" | "git" | "svn" | "hg" | "bzr") + } +} + /// A member of a world snapshot: one of *our* packages the build ran against. #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] pub struct WorldMember { |
