You are not logged in.

#1 2013-01-26 13:43:35

phunni
Member
From: Bristol, UK
Registered: 2003-08-13
Posts: 672

[Solved] Problems writing my first PKGBUILD

I'm trying to write a PKGBUILD to create a package for a script I wrote.  I first realised there were problems when

makepkg -g

didn't download anything. So I ran

makepkg --check

and got the following result:

==> ERROR: pkgname is not allowed to be empty.
==> ERROR: pkgrel is not allowed to be empty.
==> ERROR: pkgver is not allowed to be empty.
==> ERROR:  is not available for the 'x86_64' architecture.
    Note that many packages may need a line added to their PKGBUILD
    such as arch=('x86_64').

I'm confused as the PKGBUILD contains all those variables:

# Maintainer: Paul Hunnisett <arch AT redfruit DOT co DOT uk>
pkgname=netcfg-manager
pkgver=1.0
pkgrel=1
pkgdesc="Manages netcfg profiles to allow netcfg to start user defined profiles and stop when one succeeds"
url="http://www.archlinux.org"
arch=('all')
license=('GPLv3')
depends=('netcfg')
makedepends=()
conflicts=()
replaces=()
backup=()
source=('https://www.dropbox.com/s/m3itcvgbf8bi8ct/$pkgname-$pkgver.tar')
md5sums=()

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
}

Obviously it's not finished yet - but it won't even download the existing source, or pass a --check and I can't understand why not.

Last edited by phunni (2013-01-30 15:00:53)

Offline

#2 2013-01-26 13:50:03

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 438

Re: [Solved] Problems writing my first PKGBUILD

The first problems are that "all" should be changed to "any"

arch=('any')

and in the source array, the single quotes need to be removed or changed to double quotes.

Last edited by tdy (2013-01-26 13:51:05)

Offline

#3 2013-01-26 13:50:36

Awebb
Member
Registered: 2010-05-06
Posts: 4,528

Re: [Solved] Problems writing my first PKGBUILD

I took your code and put it in a PKGBUILD. Only one error:

$ makepkg --check
==> ERROR: netcfg-manager is not available for the 'i686' architecture.
    Note that many packages may need a line added to their PKGBUILD
    such as arch=('i686').

After changing arch=('all') to arch=('any') as it should be, because all is wrong (:-P), it did not build like this:

makepkg --check
==> Making package: netcfg-manager 1.0-1 (Sa 26. Jan 14:52:15 CET 2013)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
  -> Downloading $pkgname-$pkgver.tar...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   390    0   390    0     0    316      0 --:--:--  0:00:01 --:--:--   558
100 10240  100 10240    0     0   4965      0  0:00:02  0:00:02 --:--:-- 27750
mv: cannot stat ‘/home/rage2people/$pkgname-$pkgver.tar.part’: No such file or directory
==> ERROR: Failure while downloading $pkgname-$pkgver.tar
    Aborting...

EDIT: The second error is your source line. Single quotes.:wq

Last edited by Awebb (2013-01-26 13:52:19)

Offline

#4 2013-01-26 19:42:25

phunni
Member
From: Bristol, UK
Registered: 2003-08-13
Posts: 672

Re: [Solved] Problems writing my first PKGBUILD

Thanks guys - I have it all working now.  This is my (hopefully final) PKGBUILD.  Any comments on it before I attempt to submit it to AUR?

# Maintainer: Paul Hunnisett <arch AT redfruit DOT co DOT uk>
pkgname=netcfg-manager
pkgver=1.0
pkgrel=1
pkgdesc="Manages netcfg profiles to allow netcfg to start user defined profiles and stop when one succeeds"
url="http://www.archlinux.org"
arch=('any')
license=('GPL3')
depends=('bash')
makedepends=()
conflicts=()
replaces=()
backup=('etc/netcfg-manager.conf')
source=("https://www.dropbox.com/s/m3itcvgbf8bi8ct/$pkgname-$pkgver.tar")
md5sums=('52d7d8993bd2cfd58def91b3eddb8169')

package() {
  cd "${srcdir}/${pkgname}"
  install -Dm755 netcfg-manager "$pkgdir/usr/bin/netcfg-manager"
  install -Dm755 netcfg-manager.service "$pkgdir/usr/lib/systemd/system/netcfg-manager.service"
  install -Dm755 netcfg-manager.conf "$pkgdir/etc/netcfg-manager.conf"
}

Offline

#5 2013-01-26 19:57:26

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 438

Re: [Solved] Problems writing my first PKGBUILD

For minor changes, I would remove the empty fields and change the service+conf perms from 755 to 644.

For me, the md5 was wrong and needed to be this:
md5sums=('7e174bd00e76fc41384edb130ccb2e95')

Offline

#6 2013-01-26 19:59:43

phunni
Member
From: Bristol, UK
Registered: 2003-08-13
Posts: 672

Re: [Solved] Problems writing my first PKGBUILD

thanks, yes - the md5sum had changed due to some tweaking - apologies. Latest is:

# Maintainer: Paul Hunnisett <arch AT redfruit DOT co DOT uk>
pkgname=netcfg-manager
pkgver=1.0
pkgrel=1
pkgdesc="Manages netcfg profiles to allow netcfg to start user defined profiles and stop when one succeeds"
url="http://www.archlinux.org"
arch=('any')
license=('GPL3')
depends=('bash')
makedepends=()
backup=('etc/netcfg-manager.conf')
source=("https://www.dropbox.com/s/m3itcvgbf8bi8ct/$pkgname-$pkgver.tar")
md5sums=('7e174bd00e76fc41384edb130ccb2e95')

package() {
  cd "${srcdir}/${pkgname}"
  install -Dm755 netcfg-manager "$pkgdir/usr/bin/netcfg-manager"
  install -Dm644 netcfg-manager.service "$pkgdir/usr/lib/systemd/system/netcfg-manager.service"
  install -Dm644 netcfg-manager.conf "$pkgdir/etc/netcfg-manager.conf"
}

Offline

#7 2013-01-26 20:36:32

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,522
Website

Re: [Solved] Problems writing my first PKGBUILD

Awebb wrote:

The second error is your source line. Single quotes.:wq

Dude... Did you just use a Vi command to post your reply?

Offline

Board footer

Powered by FluxBB