You are not logged in.

#1 2015-01-24 19:02:12

ayekat
Member
Registered: 2011-01-17
Posts: 1,614

pkgbuilddep - list and install package build dependencies

UPDATE: the problem this script tries to solve has never really existed (see comments below). I'll just keep the original post for... let's say "historic reasons"

The last few months I had to repeatedly install some build dependencies for various packages (but without building/installing the packages themselves via PKGBUILD). For that, I would have loved something like Debian's `apt-get build-dep`.

As `makepkg` lacks that functionality As I was not aware of the flag combination `-seo`, it required me to either manually copy/type the content of `makedepends`, or source the corresponding PKGBUILD into the shell in order to have the array available. That became a little tedious after a while, so I decided to wrap it in a script.

Enter

pkgbuilddep

It's a little POSIX shell script¹ that sources /etc/abs.conf to determine the ABS root, searches the corresponding PKGBUILD file therein, and sources it to access the `makedepends` array that determines the build dependencies.

Depending on the passed options, it will then do one of the following 3 things:

  • list: List missing build dependencies for a package:

    $ pkgbuilddep list linux
    xmlto
    docbook-xsl
  • listall: List all build dependencies for a package (also the ones that are already installed):

    $ pkgbuilddep listall linux
    xmlto
    docbook-xsl
    kmod
    inetutils
    bc
  • install: Install missing build dependencies for a package (with `--asdeps`, don't worry):

    $ sudo pkgbuilddep install linux
    resolving dependencies...
    looking for conflicting packages...
    
    Packages (3) docbook-xml-4.5-6  docbook-xsl-1.78.1-1  xmlto-0.0.26-1
    
    Total Download Size:    0.02 MiB
    Total Installed Size:  14.93 MiB
    
    :: Proceed with installation? [Y/n] 

If the command line is invalid, it will simply print this help message (so if you occasionally forget how it works, just type pkgbuilddep):

$ pkgbuilddep
pkgbuilddep: list and install build dependencies for Arch Linux packages

Usage: pkgbuilddep {install,list,listall} PACKAGE

Source is available on Github.

Disclaimer: It's very likely that there is already a pacman wrapper out there that provides this functionality; however, I prefer simple scripts that do one thing well, instead of a full blown pacman wrapper, so I'll provide this here and hope someone might find this useful.
If, however, there really is a script like this, I'd be happy to hear about it, and remove this duplication of effort.


______
¹ It is mostly POSIX, with the exception of when it sources the PKGBUILD, hence the `#!/usr/bin/env bash` shebang.

Last edited by ayekat (2017-04-28 04:34:35)


pkgshackscfgblag

Offline

#2 2015-01-24 19:16:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: pkgbuilddep - list and install package build dependencies

'makepkg -so'?
This grabs the source but won't build anything.

Offline

#3 2015-01-24 19:28:28

ayekat
Member
Registered: 2011-01-17
Posts: 1,614

Re: pkgbuilddep - list and install package build dependencies

Thanks for a feedback!

karol wrote:

'makepkg -so'?

This solves it only partly:

  • It runs prepare() and applies patches, while I would like to have the upstream, vanilla sources.

  • Usually I've got the source already on my machine, so downloading them another time is not even necessary.

While the second point is rather a matter of taste, the goal was to have something akin to Debian's `apt-get build-dep PACKAGE`.

EDIT: I've renamed it to pkgbuilddep to be more clear that this is about resolving build time dependencies, as opposed to regular dependencies.

Last edited by ayekat (2015-01-24 20:02:29)


pkgshackscfgblag

Offline

#4 2015-01-24 21:34:44

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: pkgbuilddep - list and install package build dependencies

ayekat wrote:

I had to repeatedly install some build dependencies for various packages (but without building/installing the packages themselves via PKGBUILD).

I'm curious - why do you want to install the build deps if you're not building the packages?

Offline

#5 2015-01-24 21:55:09

ayekat
Member
Registered: 2011-01-17
Posts: 1,614

Re: pkgbuilddep - list and install package build dependencies

For my semester project, I had to write an LLVM Pass to do program instrumentation. So I took the upstream source to extend LLVM. In order to build it, I still needed to install the build-time dependencies, and I thought "well, why not simply use the package manager to fulfil that task?", as Debian people kept telling me that they would use `apt-get build-dep`, which seemed straightforward enough.

For the rest of the programs (coreutils, firefox, ...) I needed to compile them using the aforementioned, added LLVM Pass, with clang. I could've modified the PKGBUILD, e.g. alter the options for the configure script - but I was about to work with other distributions, too (Debian, Ubuntu), so I prefered to do it manually in order to keep the compilation process distribution-agnostic.

Initially, I also tried to compile S²E, a symbolic execution platform that builds on qemu, LLVM, KLEE and other stuff, so I needed to get the build dependencies for each of them.

On a different note, on the matter of installing build dependencies without all the rest, from the feedback I've got so far (IRC, this forum), I get the impression of being the only Arch user who's ever needed that sort of thing... so am I missing something?


pkgshackscfgblag

Offline

#6 2015-01-24 23:59:02

progandy
Member
Registered: 2012-05-17
Posts: 5,279

Re: pkgbuilddep - list and install package build dependencies

ayekat wrote:

On a different note, on the matter of installing build dependencies without all the rest, from the feedback I've got so far (IRC, this forum), I get the impression of being the only Arch user who's ever needed that sort of thing... so am I missing something?

I believe "makepkg -seo" should do what you want or am I wrong?
-s / --syncdeps to install dependencies
-e / --noextract to stop makepkg from downloading and extracting files.
-o / --nobuild to stop makepkg from building anything.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2015-01-25 00:11:21

ayekat
Member
Registered: 2011-01-17
Posts: 1,614

Re: pkgbuilddep - list and install package build dependencies

progandy wrote:

I believe "makepkg -seo" should do what you want or am I wrong?

Oh, that's... Yes.
Well, I'm sorry for having initiated this rather pointless discussion, then.

(I'll still keep the script, though, as it's a handy way to do it fast - but you won't hear from me on that matter again smile)


pkgshackscfgblag

Offline

#8 2015-01-25 00:18:06

progandy
Member
Registered: 2012-05-17
Posts: 5,279

Re: pkgbuilddep - list and install package build dependencies

ayekat wrote:

Oh, that's... Yes.
Well, I'm sorry for having initiated this rather pointless discussion, then.

It wasn't pointless. You learned something new, and you gained experience with shell scripting.
Edit: By the way, the makedepends alone aren't always sufficient, in most cases you'll need the normal dependencies as well. Then there is also the new syntax with architecture suffix you might want to support. (e.g. makedepends_x86_64)

Last edited by progandy (2015-01-25 00:22:17)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#9 2015-01-25 00:20:33

ayekat
Member
Registered: 2011-01-17
Posts: 1,614

Re: pkgbuilddep - list and install package build dependencies

progandy wrote:

You learned something new.

Mostly that reading manpages carefully can save a lot of time.

EDIT

progandy wrote:

in most cases you'll need the normal dependencies as well

Yes, I thought about it, too. Maybe I'll add an additional command.

progandy wrote:

Then there is also the new syntax with architecture suffix you might want to support. (e.g. makedepends_x86_64)

Thanks for pointing it out! That's worth a fix.

Last edited by ayekat (2015-01-25 01:51:14)


pkgshackscfgblag

Offline

Board footer

Powered by FluxBB