Skip to main content

Crate debian_watch

Crate debian_watch 

Source
Expand description

Formatting-preserving parser and editor for Debian watch files

§Example

// For line-based formats (v1-4):
// Note: This example requires the "linebased" feature (enabled by default)
let wf = debian_watch::linebased::WatchFile::new(None);
assert_eq!(wf.version(), debian_watch::DEFAULT_VERSION);
assert_eq!("", wf.to_string());

let wf = debian_watch::linebased::WatchFile::new(Some(4));
assert_eq!(wf.version(), 4);
assert_eq!("version=4\n", wf.to_string());

let wf: debian_watch::linebased::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"));

Re-exports§

pub use release::Release;

Modules§

deb822
Watch file implementation for format 5 (RFC822/deb822 style)
linebased
Line-based watch file format parser (versions 1-4)
mangle
Functions for parsing and applying version and URL mangling expressions.
parse
Format detection and parsing for watch files
release
Types for representing discovered releases.
search
Functions for searching web pages for upstream releases.

Structs§

ParseError
Error type for parsing watch file types

Enums§

ComponentType
The type of the component
Compression
Compression type
ConversionError
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
SearchMode
How to search for the upstream tarball
VersionPolicy
The version policy to use when downloading upstream tarballs

Constants§

DEFAULT_USER_AGENT
Default user agent string used for HTTP requests
DEFAULT_VERSION
Any watch files without a version are assumed to be version 1.

Functions§

convert_to_v5
Convert a watch file from formats 1-4 to format 5