ScanIndex

Struct ScanIndex 

Source
pub struct ScanIndex {
Show 15 fields pub pkgname: PkgName, pub pkg_location: Option<PkgPath>, pub all_depends: Option<Vec<Depend>>, pub pkg_skip_reason: Option<String>, pub pkg_fail_reason: Option<String>, pub no_bin_on_ftp: Option<String>, pub restricted: Option<String>, pub categories: Option<String>, pub maintainer: Option<String>, pub use_destdir: Option<String>, pub bootstrap_pkg: Option<String>, pub usergroup_phase: Option<String>, pub scan_depends: Option<Vec<PathBuf>>, pub pbulk_weight: Option<String>, pub multi_version: Option<Vec<String>>,
}
Expand description

Parse the output of make pbulk-index into individual records.

See pbulk-index.mk and pbulk-build(1).

While the majority of these fields will always be set even if left empty, they are wrapped in Option to simplify tests as well as handle cases in the future should they be removed from the default output.

§Example

use pkgsrc::{PkgName, ScanIndex};
use std::io::BufReader;
use std::process::{Command, Stdio};

let cmd = Command::new("make")
    .current_dir("/usr/pkgsrc/databases/php-mysql")
    .arg("pbulk-index")
    .stdout(Stdio::piped())
    .spawn()
    .expect("Unable to execute make");
let stdout = cmd.stdout.unwrap();
let reader = BufReader::new(stdout);
let index: Vec<_> = ScanIndex::from_reader(reader)
    .collect::<Result<_, _>>()
    .unwrap();

// Should return 5 results due to MULTI_VERSION
assert_eq!(index.len(), 5);
assert_eq!(index[0].pkgname, PkgName::new("php56-mysql-5.6.40nb1"));

Fields§

§pkgname: PkgName

Name of the package including the version number.

§pkg_location: Option<PkgPath>

Path to the package inside pkgsrc. Should really be PKGPATH.

§all_depends: Option<Vec<Depend>>

All dependencies of the package as DEPENDS matches.

§pkg_skip_reason: Option<String>

A string containing the reason if the package should be skipped.

§pkg_fail_reason: Option<String>

A string containing the reason if the package failed or is broken.

§no_bin_on_ftp: Option<String>

A string containing the reason why its binary package may not be uploaded.

§restricted: Option<String>

A string containing the reason why its binary package may not be distributed.

§categories: Option<String>

Categories to which the package belongs.

§maintainer: Option<String>

Maintainer of the package.

§use_destdir: Option<String>

DESTDIR method this package supports (almost always user-destdir).

§bootstrap_pkg: Option<String>

If this package is used during pkgsrc bootstrap.

§usergroup_phase: Option<String>

The phase of the build process during which the user and/or group needed by this package need to be available.

§scan_depends: Option<Vec<PathBuf>>

List of files read during the dependency scanning step.

§pbulk_weight: Option<String>

Numeric build priority of the package. If not set, a value of 100 is assumed.

§multi_version: Option<Vec<String>>

List of variables to be set when building this specific PKGNAME from a common PKGPATH.

Implementations§

Source§

impl ScanIndex

Source

pub fn parse(input: &str) -> Result<Self, Error>

Parses from KEY=VALUE formatted input.

§Errors

Returns an error if:

  • A line doesn’t contain =
  • A required field is missing
  • A value fails to parse into its target type
  • An unknown key is encountered (unless allow_unknown is set)
Source§

impl ScanIndex

Source

pub fn from_reader<R: BufRead>(reader: R) -> ScanIndexIter<R>

Create an iterator that parses ScanIndex entries from a reader.

Records are delimited by lines starting with PKGNAME=.

Trait Implementations§

Source§

impl Clone for ScanIndex

Source§

fn clone(&self) -> ScanIndex

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScanIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ScanIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for ScanIndex

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for ScanIndex

Source§

fn eq(&self, other: &ScanIndex) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ScanIndex

Source§

impl StructuralPartialEq for ScanIndex

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.