crystal-linux/amethyst

[BUG]: Amethyst fails on updating mesa-git

orowith2os opened this issue · 11 comments

Describe the bug

When I update my packages (or install mesa-git from the AUR) it'll fail, and mention that it can't find llvm-libs=14.0.6

To reproduce the bug

ame ins mesa-git

This issue is not experienced if I clone the PKGBUILD from the AUR and run makepkg -si myself.

Expected behavior

Amethyst will check for dependencies properly, and build mesa-git

Screenshots

https://cdn.discordapp.com/attachments/843147448917950485/1013695329574600764/unknown.png

Additional context

I think it might be due to Amethyst taking the package dependency too literally, although I'm not sure. I'll take a look at the source code myself later.

It seems like this is a general problem with dependencies that specify a specific version

This certainly shouldn't happen anymore, what version of amethyst is this?

Nvm it has to be 3.6 because of the cached pkg src, but that's a really strange issue, I wonder why clean.rs isn't stripping it?

Ideally we'd extract the version information and compare it to the one found by pacman/found in the aur anyway.

@not-my-segfault any issue with implementing it like this for now instead of using a regex?

use regex::Regex;

/// Strips packages from versioning and other extraneous information.
pub fn clean(a: &[String]) -> Vec<String> {
    // Strip versioning from package names
    let cleaned = a.iter()
        .map(|name| 
            name
                .split_once("=")
                .map(|n| n.0.to_string())
                .unwrap_or(name.to_string()))
        .collect();

    tracing::debug!("Cleaned: {:?}\nInto: {:?}", a, cleaned);

    cleaned
}

@not-my-segfault any issue with implementing it like this for now instead of using a regex?

use regex::Regex;

/// Strips packages from versioning and other extraneous information.
pub fn clean(a: &[String]) -> Vec<String> {
    // Strip versioning from package names
    let cleaned = a.iter()
        .map(|name| 
            name
                .split_once("=")
                .map(|n| n.0.to_string())
                .unwrap_or(name.to_string()))
        .collect();

    tracing::debug!("Cleaned: {:?}\nInto: {:?}", a, cleaned);

    cleaned
}

The issue is that it has to handle all of the following:

  • =
  • >
  • <
  • <=
  • >=

So I assume that'd break packages

Oh well. I guess it has to be a regex then. We should make use of the lazy-regex crate that allows something like:

let (whole, name, version) = regex_captures!(
    r#"(\w+)-([0-9.]+)"#, // a literal regex
    "This is lazy_regex-2.0!", // any expression
).unwrap();

and extract all the information that way

Oh well. I guess it has to be a regex then. We should make use of the lazy-regex crate that allows something like:

let (whole, name, version) = regex_captures!(
    r#"(\w+)-([0-9.]+)"#, // a literal regex
    "This is lazy_regex-2.0!", // any expression
).unwrap();

and extract all the information that way

That would probably be more performant, I'm just confused as to why my regex didn't work

Did you check with regex101?

Just tested and I believe it's because of the hyphen in the name

this following regex should pick up just the package name as match 1, which is all we need:
^([a-zA-Z\-])*

@Trivernis is working on this for Amethyst v4.0.0