-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust Port: Part 1 #671
Rust Port: Part 1 #671
Conversation
By the way, why is this split up into so many different creates?
I do feel this is a bit unnecessary. You could easily have it all as one lib with different modules. Any reason you don't do this? |
Heh, yes. Well even in current Haskell-based Aura, those flags must occur after the capital letter command. Nobody has complained about it up to this point, which either means it hasn't been an issue, or nobody has told me ;) I think for the flag compat, as with the current implementation, I'm going with a best-effort approach. Will there likely remain some funky edge case that At the moment, this Rust port can already display usage info (i.e. In the specific case of
This is by design. Haskell Aura is one-lib-one-exec, and many things were added to it organically over the years. There are often cross-cutting concerns and organizational problems that make the library hard to use. The Rust crate layout is still preliminary, but this would allow us to streamline:
Then, if anyone ever needs a particular piece of Aura, they aren't bogged down by the concerns of the other pieces. Critically, |
I do -_- While I get the idea of splitting up into so many crates. It seems a bit over board don't you think? Too many crates also becomes a bit of a pain to develop and maintain. How about aura as the binary? This would contain everything aura specific. aur-lib as a general purpose aur lib? There's also alpm-utils which I maintain. And is basically what you expect. Helper functions to make doing alpm stuff easier. the general purpose aur-lib is also something I've wanted to do. The goal would be to split it out of paru and make depends on it. So if you wanna work together to make it a common dependency I'd be all for that. |
😅 By "edge case" I was imagining very strange arg orders + mixtures of long and short options + positional args. I'm confident we can arrive at something workable with
Yes this is definitely a concern. Of course this port is still in early days, so let me share with you my thought process. By the way, it's quite nice to be discussing these things with someone else who understands the whole scope of the problem 😄 My first step was to take Aura's current layout and ask how this could be better organized, so that logic could be better shared with other tools/frontends/libraries/etc. Here's the first pass: I elaborate below. The namings above mostly match Aura's current Haskell modules names, so don't worry if it's not clear what they do. Some probably aren't even needed anymore! A number of the points below are obvious when read, but they're that way because at some point they weren't (or still aren't!) obvious to Haskell Aura. So we have:
I'm sure this will evolve as the port continues. Either way, I would be thrilled to collaborate with you on some common components. The more eyes we have on these problems the better - which is one of the reasons I celebrate that there are so many AUR tools, even if they're all quite similar and written in the same languages. |
As far as a generic aur-lib goes. I can see maybe moving the split_ functions and the comments/news grabbing, |
Also worth noting the split functions need better names. |
So I made a repo libaur and added the mentioned functions to it. If you want work on it together and add stuff please do. |
Amazing, yes I will. So that repo is the place where we intend AUR-specific functionality (say, pulling a PKGBUILD) to live? It would contain things that any AUR tool would need? Or better yet: what shouldn't it contain? |
In theory, if I didn't already have https://github.com/Morganamilo/aur-fetch.rs :P
Anything to do with formatting, or forces formatting one way. If you look at the news code, I made a special effort to sill allow you to format it however you want. |
Heh, thank you, I may very well borrow that too. I wrote the Haskell variants long ago, but can't exactly use them here. |
Hmm, that lib seems to be for the aur-rpc. The rust lib for that is |
Ah, gotcha. In that case the PKGBUILD fetching/diffing has always lived directly in Aura, I suppose I didn't think it big enough to break out. |
The library handles downloading concurrently, /diffing/marking as seen. There's quite a bit to it. |
I'm still a fan of just using pacman. Alpm is useful for dealing with packages, what is installed, what's available etc. But Using pacman for actual install/removes means you don't have to do the output formatting or worry about error handling and so on. |
Me too, actually. This latest code is mostly practice, and there's a good chance I'll rip out the manual forming of a transaction and replace it with a call down to
Next I'm going to more forward on localizing the messages with |
In general I think we should be careful about "stealing |
Actually I'll keep |
Honestly I prefer to keep those issues just to be consistent with Pacman. |
Oh hah, I just noticed for the first time that Pacman freaks out when arrow keys are pressed too. I'm going to call that a bug on their end. |
I've achieved the combination of localization + colouring, so we're pretty much full steam ahead. I also got good news today regarding the double flags: clap-rs/clap#2192 (comment) |
@Morganamilo So Is there some Rusty solution that comes to mind? Otherwise, iterating through a raw |
What I do is define an array of pacman args. With clap you could then just iterate over them and call values_of on each flag. Also I've neverr actually used clap v3 my attempts were with v2 . |
Not sure if you have any use for this: https://github.com/Morganamilo/paru/blob/master/src/args.rs |
A thought just occurred to me. If the |
At the moment I don't plan to release Aura v4 until |
In paru at least there's a ton of extra flags. forr example |
All AUR-based functionality is put under an |
^ Works like a charm. |
So looking at the latest commits. Quick reminder I have libs for downloading aur packages and dep solving. They are async based but I did make versions that were optionally async. It looks like II may have never pushed the branches. Let me know if you're interested in the APIs. https://github.com/Morganamilo/aur-fetch.rs |
Thanks I'll take a look! Yes keeping |
@Morganamilo when you have a chance, also please let me know about Morganamilo/pacmanconf.rs#4. If that's merged, I can release |
`clap` behaviour must have changed such that setting `multiple_values` is now manual.
This speeds up the overall resolution by quite a bit.
By the way i don't get what r2d2-alpm is for. Alpm has parallel downloads itself. |
It's not for package downloads, it's for when you want multiple |
Hmm okay. Is that actually needed though? Pacman tends to cache everything, so multiple handles means more cache misses and more time spent loading from disk. Plus the synchronisation overhead and all that. Maybe you used to use this in aura which uses the pacman command? But when using alpm I don't see it making much sense. |
Perhaps the amount of concurrency I'm doing won't pay off in the end. I'm measuring overall resolution times, and will write a strictly serial version afterwards to see how it compares. If it's just as good, then I can run off a single |
This mega-PR ports Aura to Rust as per the discussion in #657 and the proof-of-concept in PR #662.
Growth of Stripped Release Binary
Notes:
clap
+alpm
ubyte
rustyline
termcolor
i18n-embed
-L
completesimplelog
rayon
pbr
panic = "abort"
open
completepacmanconf
deps
completeitertools
-Cc
,-Cy
andcurl
-C
completeOther notes:
versions
(pullingnom
) only adds ~30kb.opt-level = "s"
reduced final stripped size from1710 -> 1410
Tracked Issues
parallel_downloads
Morganamilo/pacmanconf.rs#2Tracked PRs
FluentLanguageLoader::current_languages
kellpossible/cargo-i18n#47str
as Path arguments Morganamilo/pacmanconf.rs#4Before Release
panic = abort