You are not logged in.

#1 2016-03-08 07:49:37

GosuSan
Member
Registered: 2014-08-19
Posts: 32

[solved ]How to install specific parts of a PKGBUILD?

Hey everyone,

I recently discovered that there are drivers and software for my roccat keyboard and mouse in the AUR: roccat-tools
I know that this is a package group, and wanted to only install parts of it: roccat-tools-common (base-package) roccat-tools-isku (my keyboard) and roccat-tools-koneplus (my mouse).

First thing I tried was with yaourt, but when I used "yaourt -S roccat-tools-common" it tried to install all 21 packages.
I cancelled and had a look into the PKGBUILD (yes, I know, I should do that anyway ... hmm ) and it seems to be the same PKGBUILD for all the packages in the group.


So I googled and found this:

https://www.archlinux.org/pacman/makepkg.8.html wrote:

--pkg <list>
Only build listed packages from a split package. Multiple packages should be comma separated in the list. This option can be specified multiple times.

So I tried: "makepkg --pkg roccat-tools-common,roccat-tools-isku,roccat-tools-koneplus -rsi"

Aaaand ... it got removed (the --pkg switch). Yay! However, this just would have prevented building all the packages, not installing them, right?


So I build all of the packages with "makepkg -rs" and installed the three packages that I wanted with pacman using
"pacman -U roccat-tools-common.pkg.tar.xz roccat-tools-isku.pkg.tar.xz roccat-tools-koneplus.pkg.tar.xz" and finally it worked!

Finally my question: Was this last try the correct way? I do not install many packages from Source or AUR and most of the time just use yaourt to do so.
That means I am not really sure that I ended up with the correct way to do this, and since I plan on keeping these packages up to date I might have to do this more than once.

Thanks in advance!

Last edited by GosuSan (2016-03-08 12:49:54)

Offline

#2 2016-03-08 07:59:20

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,463

Re: [solved ]How to install specific parts of a PKGBUILD?

Yes, you did things the correct way in the end. Keeping them up to date is a different matter, as yaourt's split package support isn't very good last I checked. A better AUR helper might be in order.

Last edited by Scimmia (2016-03-08 08:00:17)

Offline

#3 2016-03-08 08:01:14

metak
Member
Registered: 2009-09-27
Posts: 198

Re: [solved ]How to install specific parts of a PKGBUILD?

GosuSan wrote:

Finally my question: Was this last try the correct way? I do not install many packages from Source or AUR and most of the time just use yaourt to do so.
That means I am not really sure that I ended up with the correct way to do this, and since I plan on keeping these packages up to date I might have to do this more than once.

Thanks in advance!

Yes, that was the correct way. If the pkgbuild file contains multiple split packages you have to build them all and later install what you need.
You could modify the pkgbuild file according to your needs?

Last edited by metak (2016-03-08 08:01:59)

Offline

#4 2016-03-08 09:23:13

Awebb
Member
Registered: 2010-05-06
Posts: 6,272

Re: [solved ]How to install specific parts of a PKGBUILD?

I recommend you ditch AUR helpers for everything but searching the AUR and checking for new packages. I use cower, for example, because it can scan local non-repo packages for updates and list them.

The new AUR (there was a big version bump "recently") supports git. What you want is pulling the package with git from the AUR, copy the folder (so the git folder remains clean) and build the package. Then, if you want an update, git pull inside the package folder, copy the folder to /tmp and build the package. You could write a simple script, that lists all packages with updates (cower -u for example), go to your local AUR src repository, git pull, cp folder to /tmp and then... I don't know, ask you to edit the PKGBUILD or simply inform you about those new packages. You could also create some sort of auto builder, but chances are you stop reading the PKGBUILDs on every update and be in a world of pain some day.

Offline

#5 2016-03-08 09:52:39

GosuSan
Member
Registered: 2014-08-19
Posts: 32

Re: [solved ]How to install specific parts of a PKGBUILD?

Scimmia wrote:

... Keeping them up to date is a different matter, as yaourt's split package support isn't very good last I checked. A better AUR helper might be in order.

I think I'll stick with yaourt and just exclude my roccat-tools from there and update them manually.
But what is a better AUR helper in your opinion?

metak wrote:

If the pkgbuild file contains multiple split packages you have to build them all and later install what you need.
You could modify the pkgbuild file according to your needs?

I could, actually that was one of the things I tried before and it felt more like a workaround than a real solution.
PKGBUILD-files do get updated too, right? So I'd have to modify them each time I pull a snapshot from the AUR.

Awebb wrote:

I recommend you ditch AUR helpers for everything but searching the AUR and checking for new packages. I use cower, for example, because it can scan local non-repo packages for updates and list them.
The new AUR (there was a big version bump "recently") supports git. What you want is pulling the package with git from the AUR, copy the folder (so the git folder remains clean) and build the package. Then, if you want an update, git pull inside the package folder, copy the folder to /tmp and build the package. You could write a simple script, that lists all packages with updates (cower -u for example), go to your local AUR src repository, git pull, cp folder to /tmp and then... I don't know, ask you to edit the PKGBUILD or simply inform you about those new packages. You could also create some sort of auto builder, but chances are you stop reading the PKGBUILDs on every update and be in a world of pain some day.

Didn't really think of that. Sounds like a lot more to do, but in the end I'd get more used to building packages myself.
Your last sentence confuses me a bit, if I create my own auto-builder, why not just use yaourt? o.O


Thanks for all your Input guys, I really appreciate it!
I think my solution will be a mix of all your suggestions.

Offline

#6 2016-03-08 11:37:34

Awebb
Member
Registered: 2010-05-06
Posts: 6,272

Re: [solved ]How to install specific parts of a PKGBUILD?

GosuSan wrote:

if I create my own auto-builder, why not just use yaourt? o.O

1. Yaourt does not automatically edit PKGBUILD files for you. Your own script can.
2. If your own script craps out on you, you have to read a hundred lines of clean shell script and fix it. If yaourt fails, you'll be reading stupid message board posts asking the same question over and over again and endless debates about unrelated things. You will then read a couple hundred lines of bash code, a couple hundred lines of C code, realize you don't know what's going on, post a bug report on the yaourt tracker, be told it's a bug in package-query, post a bug there, be told it's a pacman bug the devs refuse to patch, which has been patched in some pacman fork of another distro.

Offline

#7 2016-03-08 12:37:48

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

Re: [solved ]How to install specific parts of a PKGBUILD?

Awebb wrote:

2. If your own script craps out on you, you have to read a hundred lines of clean shell script

I had one of these scripts for a while that I wrote.  100 lines seems like a drastic overestimate.  Mine was a function in my shellrc that was 10 lines tops.  A for loop, pushd/popd, git, and makepkg commands are about all that's needed.

But a bit more to the original question: GosuSan, you say you rarely use AUR packages so you weren't sure about the right way to deal with split packages (that's what this type of package is called).  But split packages in the AUR are pretty rare.

I am frequently critical of yaourt and/or the way it is used by people who don't know what it is doing: archers should know how to use the AUR with only the official tools first then if you want you can add on helper tools.  But in this case, I don't see the confusion as a concern: split packages are an exception to the rule, so if that's what got you tripped up, I wouldn't be worried.  And seeing the steps you were able to take to figure it out and get the results you wanted even with a split package suggests you have suitable knowledge of how the AUR works to use whatever helper you want.  So if you like yaourt, by all means keep using it, and just be ready to work around situations it can't handle.

That said, as a one-time-yaourt user, I can say I'm much happier without yaourt now (I do use cower for searching/downloading).


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

Offline

#8 2016-03-08 12:40:18

GosuSan
Member
Registered: 2014-08-19
Posts: 32

Re: [solved ]How to install specific parts of a PKGBUILD?

@Awebb: Thanks, those are some good points. I think about that but until I have a working alternative I'll stick with yaourt.

EDIT:
@Trilby: Thanks for those additional information. I by all means do not think that I know 100% how the AUR works. But you are right, I know enough to work around problems when they occur.
I did not know that split packages (thanks for the correct term btw, always good to know) are an exception, wich makes me more confident to stick with an helper.
That said, I just looked it up: I do have 9 packages installed from the AUR, 4 of those are the drivers mentioned above. So it won't be much of a difference anyway.

Thanks to all of you!
Marked thread as solved, but if anyone has additional info, let me know.

Last edited by GosuSan (2016-03-08 12:49:23)

Offline

#9 2016-03-08 13:37:31

Awebb
Member
Registered: 2010-05-06
Posts: 6,272

Re: [solved ]How to install specific parts of a PKGBUILD?

Trilby wrote:
Awebb wrote:

2. If your own script craps out on you, you have to read a hundred lines of clean shell script

I had one of these scripts for a while that I wrote.  100 lines seems like a drastic overestimate.  Mine was a function in my shellrc that was 10 lines tops.  A for loop, pushd/popd, git, and makepkg commands are about all that's needed.

I do a lot of checking. I use two functions, one that does the actual fetching (aurget) and one called "aurupdate", that uses cower to find new packages and hands the names to aurget. Then, aurget does all kinds of checks. Is the package available locally, so it decides whether to clone or pull. Is there an error message from git? Is there actually a PKGBUILD (the AUR will give you a "blank" git repo, if you clone into something that isn't there. In addition, aurupdate and aurget both have a switch, that decides whether the PKGBUILD should be opened with $EDITOR (emulating yaourt's interactive mode).

You're right. With all the fluff, it's still <50 lines. I'd say a non-intrusive but fully featured AUR helper could be made in less than 200 lines, including --help, search and an update check.

Offline

#10 2016-03-08 16:42:06

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

Re: [solved ]How to install specific parts of a PKGBUILD?

If your demands are simple (as in, 20-30 simple and well-written packages), then most automation is indeed questionable. Whatever you do add, could be done in a few dozen lines.

However, if you have more complex use-cases, things start to look grim fast. For example plasma-git-meta has a staggering 104 dependencies from the AUR, and you have to 1. build in them exact right order 2. deal with virtual dependencies from provides/replaces 3. handle stuff that's already in the repos.

Assuming you already have all AUR packages cloned (this is a big assumption, though cower -dd can do it), the first step could be done in 10 sloc (assuming no split packages: parse SRCINFO with awk, output to tsort). The second and third steps are not trivial. For example, even if you didn't mind running `pacman -Si` before every makepkg call, it only works with updated dependency names; e.g. pkgconfig, which is provided by pkg-config - note the dash - can't be queried via pacman.

Now about the build, you could do this in a simple while read loop, but what if you want a local repository? Or several of them, of which you can choose interactively? systemd-nspawn even? Or what if you want to check ABI automatically to avoid running into missing libraries later? You'll need a bit more than 50 lines there, though most AUR helpers only handle the most primitive case (makepkg -i respectively pacman -U).

Either way, I do agree most AUR helpers are monolothic monsters with nasty internals, but they have one goal in common: "Handle whatever PKGBUILDs the user can come up with". Sadly all but bauerbill and pacaur (see the "AUR helper" article in the wiki) fail completely at this goal. Some like yaourt and packer even source the PKGBUILD for mundane tasks such as displaying AUR information - with no prior warning.

Last edited by Alad (2016-03-08 16:55:55)


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