You are not logged in.

#1 2017-12-31 16:06:30

TheOdysseus
Member
Registered: 2017-12-31
Posts: 2

How to make split packages right?

I've created two versions of the same package:
https://aur.archlinux.org/packages/nginx-unit-php
https://aur.archlinux.org/packages/nginx-unit-python
Here is PKGBUILD.

Question 1: Where should I specify that first requires php-embed, but second requires python? Currently I placed both in optdepends (Yes, I know that's not correct).
Question 2: Why during installation via yay nginx-unit-python  BOTH packages are trying to be installed?! They are split, aren't they?

That's my first split package, so it's great chance of me doing something wrong.
Thanks!

Offline

#2 2017-12-31 16:36:39

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

Re: How to make split packages right?

You can specify depends, optdepends, pkgdesc, and several other variables, *inside* the package_*() functions. See the manpage for PKGBUILD(5) under the "PACKAGE SPLITTING" header. For example,

package_nginx-unit-python() {
    pkgdesc="Dynamic web application server, designed to run applications in multiple languages (python bindings),"
    depends=(python)
    ...
}

But, you should not be configuring and compiling in the package function. From my quick perusal of the source code documentation, you should be able to use something like:

build() {
  cd "$srcdir"/$_shortname-$pkgver
  ./configure --prefix=/usr
  ./configure php
  ./configure python
  make all
}

package_nginx-unit()
  cd "$srcdir"/$_shortname-$pkgver
  make DESTDIR="$pkgdir" unitd-install
}    

package_nginx-unit-python()
  depends=('nginx-unit' 'python')
  cd "$srcdir"/$_shortname-$pkgver
  make DESTDIR="$pkgdir" python-install
}    

package_nginx-unit-php()
  depends=('nginx-unit' 'php')
  cd "$srcdir"/$_shortname-$pkgver
  make DESTDIR="$pkgdir" php-install
}

Note that php and python must be makedepends as well, or they won't be installed by makepkg and the build step will fail. Note also that "$srcdir" and "$pkgdir" must always be quoted.
Note also that using `|| return 1` is completely unnecessary since several years ago, as makepkg sets the bash errexit option for the prepare, pkgver, build and package (or split packaging) functions, causing any command that exits with an error to abort makepkg. If you want errors to be ignored, you have to specifically use `|| true`.

Last edited by eschwartz (2017-12-31 16:38:34)


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

Offline

#3 2017-12-31 16:47:23

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: How to make split packages right?

Non-shared dependencies should be defined under the respective package_ function.

A few comments:

  • You shouldn't be building anything in package functions.

  • Don't use '|| return 1' at all.

  • Quote any and all instances of variables you have no control over, specifically "$srcdir" and $pkgdir" in this case, as they may have spaces in them.

  • Ideally use https sources if available, especially when upstream doesn't sign their sources.

  • When sources are simply tarballs with version numbers, rename them with sensible names, you can do this by specifying the source as $pkgbase-$pkgver.tar.gz::"https://mysource.com/$pkgver.tar.gz"

yay nginx-unit-python

No idea what 'yay' is, but if it's an AUR helper, then it's probably broken. Can you reproduce the problem with 'makepkg' and 'pacman -U'?

EDIT: wow, beaten by 10 minutes.

Last edited by WorMzy (2017-12-31 16:48:50)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#4 2017-12-31 17:08:35

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

Re: How to make split packages right?

WorMzy wrote:

No idea what 'yay' is, but if it's an AUR helper, then it's probably broken. Can you reproduce the problem with 'makepkg' and 'pacman -U'?

It does appear to be an AUR helper, and I suppose it doesn't implement split package support. Then again, few do -- I know pacaur does using a complex hack that breaks everything else, cf. "mismatched .SRCINFO", and aurutils avoids the fuss by not implementing package installation at all, and letting you use pacman with a local repo afterwards (it does -Syu your custom database only, though).

WorMzy wrote:

EDIT: wow, beaten by 10 minutes.

Keep in mind that I also had to clone the source and run configure a few times to look at it, since they use their own homegrown Makefile generator without proper documentation. Otherwise it wouldn't have taken me so long. big_smile


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

Offline

#5 2018-01-01 15:27:54

TheOdysseus
Member
Registered: 2017-12-31
Posts: 2

Re: How to make split packages right?

Thanks for comments, WorMzy & Eschwartz.
I will fix qoute issues and other.

Yes, yay is AUR helper (https://github.com/Jguer/yay). It's a pity that most helpers don't support split packages.

Offline

Board footer

Powered by FluxBB