Struct makedeb_srcinfo::SrcInfo
source · [−]pub struct SrcInfo { /* private fields */ }
Implementations
sourceimpl SrcInfo
impl SrcInfo
sourcepub fn new(content: &str) -> Result<Self, ParserError>
pub fn new(content: &str) -> Result<Self, ParserError>
Parse the .SRCINFO
file, returning a ParserError
if there was an issue parsing the
file.
content
should be a string representing the content of the .SRCINFO
file.
sourcepub fn get_string(&self, key: &str) -> Option<&String>
pub fn get_string(&self, key: &str) -> Option<&String>
Get a value for anything that’s a string variable in a PKGBUILD.
Note that you’ll need to use SrcInfo::get_array
if you want to get the pkgname
variable, since that has the
ability to be more than one item.
This function also accepts extended variables (i.e. focal_postrm
), though only variables that can be
extended by makedeb are supported.
Returns the Some
variant if the variable can be found, otherwise the None
variant is returned.
sourcepub fn get_extended_values(&self, key: &str) -> Option<Vec<String>>
pub fn get_extended_values(&self, key: &str) -> Option<Vec<String>>
Get the extended names (as well as the key itself) for a variable. Use this if you need a variable as well as any same variable that contains distribution and architecture extensions.
If key
isn’t a key makedeb supports for variable name extensions, this will return the None
variant, regardless
of if the base key is in the .SRCINFO
file or not.
This returns a vector of strings that can be then passed into [SrcInfo.get_string
] and
[SrcInfo.get_array
].