Expand description
Formatting-preserving parser and editor for Debian watch files
§Example
let wf = debian_watch::WatchFile::new(None);
assert_eq!(wf.version(), debian_watch::DEFAULT_VERSION);
assert_eq!("", wf.to_string());
let wf = debian_watch::WatchFile::new(Some(4));
assert_eq!(wf.version(), 4);
assert_eq!("version=4\n", wf.to_string());
let wf: debian_watch::WatchFile = r#"version=4
opts=foo=blah https://foo.com/bar .*/v?(\d\S+)\.tar\.gz
"#.parse().unwrap();
assert_eq!(wf.version(), 4);
assert_eq!(wf.entries().collect::<Vec<_>>().len(), 1);
let entry = wf.entries().next().unwrap();
assert_eq!(entry.opts(), maplit::hashmap! {
"foo".to_string() => "blah".to_string(),
});
assert_eq!(&entry.url(), "https://foo.com/bar");
assert_eq!(entry.matching_pattern().as_deref(), Some(".*/v?(\\d\\S+)\\.tar\\.gz"));Structs§
- Entry
- A node in the syntax tree for $ast
- EntryV5
- An entry in a format 5 watch file
- Parse
- Thread-safe parse result that can be stored in incremental computation systems like Salsa. The type parameter T represents the root AST node type (e.g., WatchFile).
- Parse
Error - Error type for parsing watch file types
- Watch
File - A node in the syntax tree for $ast
- Watch
File V5 - A watch file in format 5 (RFC822/deb822 style)
Enums§
- Component
Type - The type of the component
- Compression
- Compression type
- Conversion
Error - Error type for conversion failures
- GitExport
- Git export mode
- GitMode
- Git clone operation mode
- Mode
- Archive download mode
- PgpMode
- PGP verification mode
- Pretty
- How to generate upstream version string from git tags
- Search
Mode - How to search for the upstream tarball
- Version
Policy - The version policy to use when downloading upstream tarballs
Constants§
- DEFAULT_
VERSION - Any watch files without a version are assumed to be version 1.
Traits§
- Watch
Entry - Common trait for watch file entries across all formats
- Watch
File Format - Common trait for all watch file format versions
Functions§
- convert_
to_ v5 - Convert a watch file from formats 1-4 to format 5
- parse_
watch_ file - Parse a watch file and return a thread-safe parse result. This can be stored in incremental computation systems like Salsa.