You are not logged in.

#1 2018-03-03 22:26:13

faviouz
Member
Registered: 2011-09-15
Posts: 10

AUR one-line helper

pacaur has been deprecated and I don't really like any other alternatives, so I tried to keep it simple

function aur() { cd ~/aur && git clone "https://aur.archlinux.org/$1.git" && cd "$1" && vim PKGBUILD && makepkg -si; }

Then I install the package with

aur google-chrome

vim PKGBUILD is there just for the sake of reviewing the PKGBUILD. I can quit vim with :cq to exit with an error code and short-circuit the one-liner there to prevent it from installing.

I have been using it for a while now and I didn't have any problems yet. But to be fair I don't have many things from the AUR installed so I could be missing something.

Are there any potential flaws or issues with this that I should be aware of? How might I fix them while still keeping it simple?

Offline

#2 2018-03-03 22:51:43

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: AUR one-line helper

The line above just combines manual steps in a single function. It doesn't "help" by, for example, looking what AUR dependencies a package may have. It also only works to install new packages - git clone bails on existing directories (you'd need git pull).


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#3 2018-03-05 12:42:58

faviouz
Member
Registered: 2011-09-15
Posts: 10

Re: AUR one-line helper

Thanks for your feedback!

Alad wrote:

The line above just combines manual steps in a single function.

Yes.

Alad wrote:

It doesn't "help" by, for example, looking what AUR dependencies a package may have.

Do packages in the AUR frequently depend on other AUR dependencies? Recently I have seen that GNS3 has some AUR dependencies, but per the Wiki it is expected that you install them yourself.

Alad wrote:

It also only works to install new packages - git clone bails on existing directories (you'd need git pull).

I forgot about updating packages. Does it suffice to git pull && makepkg? If so I just need to automate that somehow for all installed packages.

Offline

#4 2018-03-05 13:53:09

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: AUR one-line helper

Do packages in the AUR frequently depend on other AUR dependencies? Recently I have seen that GNS3 has some AUR dependencies, but per the Wiki it is expected that you install them yourself.

Yes, they often do. An extreme example is the ROS packages (robotics toolchain) which have 200+ AUR dependencies. It doesn't suffice to just get all the dependencies, you want them in the right order too.

I forgot about updating packages. Does it suffice to git pull && makepkg? If so I just need to automate that somehow for all installed packages.

git pull / git fetch always return 0 even if the AUR repository was not updated. Accordingly you'll get makepkg errors from already built packages, even with pkgver that increases monotically on every commit (generally not the case).

You can either not care, use git rev-parse, or only run your function after receiving an email notification.

Last edited by Alad (2018-03-05 13:54:51)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#5 2018-03-05 15:07:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: AUR one-line helper

Alad wrote:

...even with pkgver that increases monotically on every commit (generally not the case)

Can you explain the "generally not the case" here?  This is required for AUR packages.  Certainly some bad packagers break the rules, but that is a packaging bug and should certainly not be expected.

Last edited by Trilby (2018-03-05 18:35:08)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#6 2018-03-05 15:24:46

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: AUR one-line helper

A PKGBUILD may be changed without it affecting the resulting package, e.g. when simplifying logic to achieve the same final package contents. In that case, it's not dicated that pkgrel should be increased by the maintainer.

https://wiki.archlinux.org/index.php/PKGBUILD#pkgrel wrote:

As fixes and additional features are added to the PKGBUILD that influence the resulting package, the pkgrel should be incremented by 1

Note there's also the case where pkgver may change (increase) after makepkg is run, which is not reflected in the AUR repository. Even with git rev-parse, you can only tell if a package should be updated after running makepkg.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#7 2018-03-05 18:33:13

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: AUR one-line helper

Alad wrote:

even with pkgver that increases monotically on every commit (generally not the case).

Alad wrote:

not dicated that pkgrel should be increased

So, uh, which one are we talking about? Or are we actually talking about a third concept, the `${epoch:+$epoch:}$pkgver-$pkgrel`

On a completely separate note, regardless of whether pkgrel is increased on each commit... I'm pretty sure that a pkgver which does not get modified at all, is still monotonically increasing by 0.

Last edited by eschwartz (2018-03-05 18:36:24)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2018-03-05 18:37:10

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: AUR one-line helper

Fine. strictly monotonically...

Here I meant the general pkgver-pkgrel string.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#9 2018-03-05 18:38:59

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: AUR one-line helper

Anyways, none of your points matter as soon as makepkg 5.1 is released, then (if the OP really wants to and decided he cares about detecting this programmatically rather than sticking with makepkg -si and reinstalling it anyway) one can check if makepkg exited with error code 13 for "A package has already been built."

Last edited by eschwartz (2018-03-05 19:00:20)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2018-03-05 18:41:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: AUR one-line helper

This is all a bit confusing to me.  The original point seems to be that the one-liner wouldn't work once the aur files had been retrieved once.  A related onliner for updating a package would need to use `git pull` instead.  This is true.  I can't see the relevance of the rest though.  All the additional points seem only to be related to detecting whether or not an update is available: this is not what is under discussion.  As for makepkg failing if one used the related one-line for updating a package, it would only fail if the user tried to update a package that didn't need upgrading, and even this could be avoided with the -f flag.

If you are trying to highlight that the OPs one-liner doesn't do all the things your set of tools with a dozen different executables and countless lines of code does: contrats, now go steal candy from babies.  If, in contrast, you are trying to say that the OPs one-liner doesn't do what the OP intends, that is not coming across: I think the onliner does do what the OP intends and covers most simple cases.

Last edited by Trilby (2018-03-05 18:43:52)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#11 2018-03-05 19:11:58

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: AUR one-line helper

Trilby wrote:

If you are trying to highlight that the OPs one-liner doesn't do all the things your set of tools with a dozen different executables and countless lines of code does: contrats, now go steal candy from babies.

I'm not even going to bother responding to pure ill will like that. Make whatever conclusions you want.

eschwartz wrote:

Anyways, none of your points matter as soon as makepkg 5.1 is released, then (if the OP really wants to and decided he cares about detecting this programmatically rather than sticking with makepkg -si and reinstalling it anyway) one can check if makepkg exited with error code 13 for "A package has already been built."

Yes, this is a good point I forgot about.

Last edited by Alad (2018-03-05 19:14:50)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

Board footer

Powered by FluxBB