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: 181

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)


“Talent you can bloom. Instinct you can polish.”  — Haikyuu!! (adapted)
“If everybody thought alike, no one would be thinking very much.”  — Walter Lippmann (adapted)
“The important thing is to be able, at any moment, to sacrifice what we are for what we could become.”  — Charles Dubois

Offline

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

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

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
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
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: 181

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)


“Talent you can bloom. Instinct you can polish.”  — Haikyuu!! (adapted)
“If everybody thought alike, no one would be thinking very much.”  — Walter Lippmann (adapted)
“The important thing is to be able, at any moment, to sacrifice what we are for what we could become.”  — Charles Dubois

Offline

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

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

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: 181

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)


“Talent you can bloom. Instinct you can polish.”  — Haikyuu!! (adapted)
“If everybody thought alike, no one would be thinking very much.”  — Walter Lippmann (adapted)
“The important thing is to be able, at any moment, to sacrifice what we are for what we could become.”  — Charles Dubois

Offline

Board footer

Powered by FluxBB