You are not logged in.

#1 2010-01-29 00:06:27

Grazz256
Member
Registered: 2009-06-28
Posts: 69

Critique my PKGBUILD

Hey this is my first shot at a pkgbuild, it works fine just wondering if theres anything I should have done differently.

I should note that even the pkgbuild works fine unfortunately the app doesn't play nice with arch as it needs a python compiled with 4byte unicode characters...


pkgname=graphiteonecad
pkgver=3.1
pkgrel=1
pkgdesc=""
arch=('i686' 'x86_64')
url="http://www.graphiteone-cad.com"
license=('unknown')
groups=()
depends=(python qt3 libstdc++5)
makedepends=()
provides=()
conflicts=()
replaces=()
backup=()
install=
source=()
noextract=()
md5sums=() #generate with 'makepkg -g'
options=(!strip)

build() {
  cd $srcdir

  echo "Downloading files..."
  wget -c http://www.graphiteone-cad.com/download/graphiteone-3d-design-$pkgver-1.rpm
  wget -c http://www.graphiteone-cad.com/download/graphiteone-io-$pkgver-1.rpm
  
  if [ "$CARCH" = 'x86_64' ]; then
    wget -c http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse102_x86-64.rpm
  else
    wget -c http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse103.rpm
  fi

  echo "Extracting..."
  cd $pkgdir
  rpmextract.sh $srcdir/graphiteone-3d-design-$pkgver-1.rpm
  rpmextract.sh $srcdir/graphiteone-io-$pkgver-1.rpm
  
  if [ "$CARCH" = 'x86_64' ]; then
    rpmextract.sh $srcdir/graphiteone-libs-$pkgver-1-suse102_x86-64.rpm
  else
    rpmextract.sh $srcdir/graphiteone-libs-$pkgver-1-suse103.rpm
  fi
}

Cheers

Offline

#2 2010-01-29 00:25:57

res
Member
Registered: 2010-01-14
Posts: 55

Re: Critique my PKGBUILD

Add  http://www.graphiteone-cad.com/download … gver-1.rpm and http://www.graphiteone-cad.com/download … gver-1.rpm to source array. makepkg does this for you; no need for manually using wget.

Erase fields that aren't populated.

cd $srcdir is redundant since makepkg does this on its own, much like Crux's tool.

e:

Missing a makedepends on rpmextract.sh

Last edited by res (2010-01-29 00:27:31)

Offline

#3 2010-01-29 00:25:59

PirateJonno
Forum Fellow
From: New Zealand
Registered: 2009-04-13
Posts: 372

Re: Critique my PKGBUILD

rather than using wget you should put your sources in the source=() array, which you can define conditionally based on $CARCH if you want. there may also be a way of extracting rpm's automatically, although I'm not sure. since you're using rpmextract though, you should put it in makedepends. also consider removing !strip from options, unless you really intend to debug the program. if you're going to put it on the AUR a description would be nice as well. hope this helps

Edit: was a bit late posting but i'll leave it as is anyway

Last edited by PirateJonno (2010-01-29 00:26:48)


"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page

Offline

#4 2010-01-29 13:36:08

Grazz256
Member
Registered: 2009-06-28
Posts: 69

Re: Critique my PKGBUILD

I used the wgets because I wasn't sure how makepkg would deal with different compressed formats.
Will it just download the files? and if so what folder will they go in?

Would it be better form to put

if [ "$CARCH" = 'x86_64' ]; then
  source=(http://www.graphiteone-cad.com/download/graphiteone-3d-design-$pkgver-1.rpm
               http://www.graphiteone-cad.com/download/graphiteone-io-$pkgver-1.rpm
               http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse102_x86-64.rpm
               )
else
  source=(http://www.graphiteone-cad.com/download/graphiteone-3d-design-$pkgver-1.rpm
               http://www.graphiteone-cad.com/download/graphiteone-io-$pkgver-1.rpm
               http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse103.rpm
               )
fi

or

source=(http://www.graphiteone-cad.com/download/graphiteone-3d-design-$pkgver-1.rpm
             http://www.graphiteone-cad.com/download/graphiteone-io-$pkgver-1.rpm)
~~~~~~~~
build
{
  if [ "$CARCH" = 'x86_64' ]; then
    wget -c http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse102_x86-64.rpm
  else
    wget -c http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse103.rpm
  fi
~~~~~~~~~~~~~~~~~~~

The !strip is there because when the rpms are extracted they are owned by the superuser which causes the strip to fail and therefore the makepkg
!strip was an easy way to work around this (plus I couldn't think of any other way to do it at the time)

Thanks for the critques!

Offline

#5 2010-01-29 13:42:36

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,402
Website

Re: Critique my PKGBUILD

source=(http://www.graphiteone-cad.com/download/graphiteone-3d-design-$pkgver-1.rpm
             http://www.graphiteone-cad.com/download/graphiteone-io-$pkgver-1.rpm)
[ "$CARCH" = 'x86_64' ] && source=(${source[@]} http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse102_x86-64.rpm)
[ "$CARCH" = 'i686' ] && source=(${source[@]} http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse103.rpm)

Offline

#6 2010-01-31 04:19:27

res
Member
Registered: 2010-01-14
Posts: 55

Re: Critique my PKGBUILD

Instead of expanding the source array:

source=(${source[@]} http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse103.rpm)

you can just do:

source+=(http://www.graphiteone-cad.com/download/graphiteone-libs-$pkgver-1-suse103.rpm)

Offline

Board footer

Powered by FluxBB