You are not logged in.

#1 2010-06-28 13:33:36

algorythm
Member
From: /usr/share/zoneinfo/Europe/FIN
Registered: 2009-07-17
Posts: 178

The Pacman package() function

This "package()" function thingy hasn't quite 'opened' to me. What exactly is it for and how can I use it? I checked the /usr/share/pacman/PKGBUILD.proto example and red the PKGBUIL(5) man page that says:

An optional package() function can be specified in addition to the build() function. This function is run immediately after the build() function. When specified in combination with the fakeroot BUILDENV option in makepkg.conf(5), fakeroot usage will be limited to running the packaging stage. The build() function will be run as the user calling makepkg.

But I still don't get it.. hmm. Is it just so that fakeroot will be restricted to run only inside that function? And the build() function is for the patching, editing source files, etc.?

Also shouldn't this be mentioned in the Arch Packaing Standrads Wiki page?

Last edited by algorythm (2010-06-28 13:55:42)


PC: ASUS Maximus VIII Hero, Intel i7-6700K (4.6 GHz OC), NZXT Kraken X61, 16GB G.Skill DDR4-3200, MSI GTX 1080 Gaming X, Samsung 850 Pro 512GB, WD Black 6TB, Corsair Graphite 780T (Full Tower), be quiet! Dark Power Pro 11 650W (Platinum)
OS: Arch 64-bit / Windows 10 Pro 64-bit
Other: Dell UltraSharp 2560x1440 27", KB: Logitech G910, M: Logitech G502, HS: HyperX Cloud II, I: 100/10M

Offline

#2 2010-06-28 13:42:41

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

Re: The Pacman package() function

algorythm wrote:

But I still don't get it.. hmm. Is it just so that fakeroot will only be restricted to run only inside that function? And the build function is for the patching, editing source files, etc.?

Sounds to me like you DO get it smile - well, the biggest part of it. Split packages is the other main benefit of the package() function - that is also covered in the man page.

algorythm wrote:

Also shouldn't this be mentioned in the Arch Packaging Standards Wiki page?

Well, yeah sure - the difference is that the man pages are official, while that wiki page, like most wiki pages, is not. Feel free to update it as required.

Offline

#3 2010-06-28 13:47:02

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,416
Website

Re: The Pacman package() function

In the past we had bugs where packages could not be built using fakeroot. So it is best to use it for a small amount of time as possible and it is only really needed during the install stage.

Offline

#4 2010-06-28 15:16:23

algorythm
Member
From: /usr/share/zoneinfo/Europe/FIN
Registered: 2009-07-17
Posts: 178

Re: The Pacman package() function

So then iceman81 in AUR with his kernel26-ice package did it a little wrong when he defined the function like the package would create multiple ones, when in fact it creates just the one, kernel26-ice?:

pkgdesc="The Linux Kernel and modules with gentoo-sources patchset and tuxonice support"
depends=('coreutils' 'module-init-tools' 'mkinitcpio>=0.5.15' 'kernel26-firmware')
pkgext=-ice
pkgname=kernel26$pkgext
pkgver=2.6.34
_minor_patch=1
icever=$pkgver$pkgext
pkgrel=1
makedepends=('xmlto' 'docbook-xsl')
...
package_kernel26-ice() {
  pkgdesc="The Linux Kernel and modules"
  groups=('base')
  backup=(etc/mkinitcpio.d/$pkgname.preset)
  depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio>=0.5.20')
  replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
            'alsa-driver' 'ieee80211' 'hostap-driver26'
            'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
            'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
            'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
  install=$pkgname.install
  optdepends=('crda: to set the correct wireless channels of your country')
...

I take it he used the kernel26's ([core]) PKGBUILD but somehow wasn't pedantic enough and didn't notice that his package isn't splitted and that's not how the function should be used?

Last edited by algorythm (2010-06-28 15:31:56)


PC: ASUS Maximus VIII Hero, Intel i7-6700K (4.6 GHz OC), NZXT Kraken X61, 16GB G.Skill DDR4-3200, MSI GTX 1080 Gaming X, Samsung 850 Pro 512GB, WD Black 6TB, Corsair Graphite 780T (Full Tower), be quiet! Dark Power Pro 11 650W (Platinum)
OS: Arch 64-bit / Windows 10 Pro 64-bit
Other: Dell UltraSharp 2560x1440 27", KB: Logitech G910, M: Logitech G502, HS: HyperX Cloud II, I: 100/10M

Offline

#5 2010-06-28 21:07:59

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

Re: The Pacman package() function

I'll let iceman answer for himself, but I'll just add that it's quite clear what his PKGBUILD is doing - there is just one pkgname, therefore there will be just one package.

And I really don't think it's possible that he "didn't notice that his package isn't splitted". yikes

Offline

#6 2010-06-28 23:45:29

iceman81
Member
From: Cambridge
Registered: 2007-07-25
Posts: 59
Website

Re: The Pacman package() function

tomk wrote:

I'll let iceman answer for himself

Here i am! smile

the build function does what it says; builds
the function for "packages" are useful in case you want to create several packages starting from the same built objects. If you look in the kernel26 PKGBUILD you'll have a very good example. they create several packages (kernel, headers, firmware) building once and creating all the packages they need.
kernel26-ice at the moment does need just one package (the kernel itself), so you have just one package function and it behaves in the same way as it did with the old PKGBUILD.
but (yes... there's a "but") we now have much more flexibility (and flexibility is cool)
e.g. the "source code" option could be implemented as a separate package now (maybe i'll do this change in the future).
That's all folks wink

Offline

#7 2010-06-29 11:01:40

algorythm
Member
From: /usr/share/zoneinfo/Europe/FIN
Registered: 2009-07-17
Posts: 178

Re: The Pacman package() function

Yeah, sure, but I thought with a single package it should be defined just as simply as "package() {" and not mention all the dependencies and other info that has already been mentioned on the top of the PKGBUILD.

That's what confused me a bit.

Last edited by algorythm (2010-06-29 11:01:58)


PC: ASUS Maximus VIII Hero, Intel i7-6700K (4.6 GHz OC), NZXT Kraken X61, 16GB G.Skill DDR4-3200, MSI GTX 1080 Gaming X, Samsung 850 Pro 512GB, WD Black 6TB, Corsair Graphite 780T (Full Tower), be quiet! Dark Power Pro 11 650W (Platinum)
OS: Arch 64-bit / Windows 10 Pro 64-bit
Other: Dell UltraSharp 2560x1440 27", KB: Logitech G910, M: Logitech G502, HS: HyperX Cloud II, I: 100/10M

Offline

Board footer

Powered by FluxBB