forked from gentoo-utils/gentoo-utils
version wildcard comes after the version expression
This commit is contained in:
@@ -66,6 +66,9 @@ pub struct Version {
|
||||
rev: Option<VersionNumber>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct Wildcard;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum SlotOperator {
|
||||
Eq,
|
||||
@@ -127,7 +130,7 @@ pub struct Atom {
|
||||
blocker: Option<Blocker>,
|
||||
category: Category,
|
||||
name: Name,
|
||||
version: Option<(VersionOperator, Version)>,
|
||||
version: Option<(VersionOperator, Version, Option<Wildcard>)>,
|
||||
slot: Option<Slot>,
|
||||
#[get(kind = "deref")]
|
||||
usedeps: Vec<UseDep>,
|
||||
@@ -146,7 +149,7 @@ impl Cpv {
|
||||
impl Atom {
|
||||
#[must_use]
|
||||
pub fn version_operator(&self) -> Option<VersionOperator> {
|
||||
self.version.clone().map(|(oper, _)| oper)
|
||||
self.version.clone().map(|(oper, _, _)| oper)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@@ -160,7 +163,7 @@ impl Atom {
|
||||
#[must_use]
|
||||
pub fn into_cpv(self) -> Option<Cpv> {
|
||||
match self.version {
|
||||
Some((_, version)) => Some(Cpv {
|
||||
Some((_, version, _)) => Some(Cpv {
|
||||
category: self.category,
|
||||
name: self.name,
|
||||
version,
|
||||
@@ -639,8 +642,10 @@ impl fmt::Display for Atom {
|
||||
write!(f, "/")?;
|
||||
write!(f, "{}", self.name)?;
|
||||
|
||||
if let Some((_, version)) = self.version.as_ref() {
|
||||
if let Some((_, version, None)) = self.version() {
|
||||
write!(f, "-{version}")?;
|
||||
} else if let Some((_, version, Some(_))) = self.version() {
|
||||
write!(f, "-{version}*")?;
|
||||
}
|
||||
|
||||
if let Some(slot) = self.slot.as_ref() {
|
||||
|
||||
Reference in New Issue
Block a user