fosskers / aura

A multilingual package manager for Arch Linux and the AUR.
https://fosskers.github.io/aura/
GNU General Public License v3.0
1.73k stars 112 forks source link

Automatic AUR Voting for Installed Packages #863

Open RubenKelevra opened 1 month ago

RubenKelevra commented 1 month ago

Hey everyone,

I’m a big fan of aura, but it really bugs me that I have to visit the AUR page every time I want to vote for a new program I’ve installed.

There's a tool called aurvote-utils that used to automate this, but it’s no longer functional. (see https://github.com/jadenPete/aurvote-utils/issues/1)

It would be fantastic if aura could automatically log into the AUR and vote for programs as they are installed. This would highlight the most popular tools better, improving search results in the AUR for everyone.

Here’s the tricky part: the Chaotic-AUR repo is becoming more popular, as well as distributions like CachyOS, which ship binary packages for AUR packages. It would be great if aura could check Faur for the exact package name during installation and vote for packages that match the installed version and name, even if they’re not directly installed from the AUR.

This way, prebuilt Chaotic-AUR/CachyOS packages would get voted for automatically as well, giving the AUR maintainers the credit they deserve.

It may be a good idea to also check if a package has been voted for when it gets updated, to ensure all already installed tools get a vote once this feature is live.

Lastly, if a user removes a package, aura should unvote it on the AUR, as they’ve likely switched to an alternative.

Thanks for considering this feature!

fosskers commented 1 month ago

Thanks for the suggestion and thanks for using Aura.

automatically log into the AUR

This would be the tricky bit. It would be great if the AUR RPC supported remote voting via some auth token, but I doubt it does.

P.S. I also just noticed you flagged the AUR packages. The aura-git package is already ready, and I plan to update the others when I get home in a few hours.

RubenKelevra commented 1 month ago

@fosskers wrote:

This would be the tricky bit. It would be great if the AUR RPC supported remote voting via some auth token, but I doubt it does.

Actually, it does support using an auth token! This is how aurvote-utils worked:

If necessary, aur-vote will prompt for authentication. Cookies are saved in $XDG_DATA_HOME/aurvote->utils/cookie and are renewed automatically. Alternatively, you may regenerate the cookie manually:

@fosskers wrote:

P.S. I also just noticed you flagged the AUR packages. The aura-git package is already ready, and I plan to update the others when I get home in a few hours.

Yeah, I installed the git package. I only saw that you maintain the aur packages yourself after I switched. I guess no need to flag these then ;)

I'm currently switching over from paru, as the development seems to have ceased and the bugs are piling up. Heard about Aura and thought that the rewrite is the perfect opportunity to switch over :)

fosskers commented 1 month ago

Note to self: auto-voting would need to be opt-in through config.

RubenKelevra commented 1 month ago

Note to self: auto-voting would need to be opt-in through config.

Agreed, it should be optional. However, I think it would be beneficial to make it a mandatory configuration. So either aurvote: true or false.

If nothing is set, aura could prompt the user to configure it, avoiding the need to manually edit the config after an update.

aura supports automatic voting for installed AUR packages. Do you want to enable it? (yN)

If yes:

Enter AUR Username:
Enter AUR Password:
fosskers commented 1 month ago

If nothing is set, aura could prompt the user to configure it

This I don't think I will do, as it would interfere with normal offline usage.

RubenKelevra commented 1 month ago

I mean the user can just hit enter to say "no", no internet connectivity required 🤔

fosskers commented 1 month ago

I know, I meant that it would make a prompt appear at a time they may not have been expecting one. This could negatively affect people who use aura in scripts.

RubenKelevra commented 1 month ago

Yeah, that's true. But you could just ask the user if aura is not run in a script.

In bash you do this by checking $- for i like this

case "$-" in
    *i*) echo "Interactive Shell" ;;
    *) echo "Script" ;;
esac

I think you can do the same with atty in Rust:

extern crate atty;

fn main() {
    if atty::is(atty::Stream::Stdin) {
        println!("Interactive Shell");
    } else {
        println!("Script");
    }
}

But it may be broken atm for cron jobs:

https://github.com/softprops/atty/issues/52