You are not logged in.

#1 2013-12-22 02:23:35

Kremlin
Member
Registered: 2013-10-22
Posts: 10

My first PKGBUILD, is this OK to submit to the aur?

hi all, i'm trying to get into writing/maintaining aur packages and was wondering if y'all might check this pretty simple one I wrote for a popular command-line json parser.

here's the PKGBUILD:

# Maintainer: ian <ian at kremlin dot cc>

pkgname=json-sh
pkgver=r71.19aa1be
pkgrel=1
pkgdesc="command line json tool written in bash"
arch=('any')
url="https://github.com/dominictarr/JSON.sh"
license=('MIT' 'APACHE')
makedepends=('git')
source=('git://github.com/dominictarr/JSON.sh.git')
md5sums=('SKIP')
depends=('bash')

pkgver() {
	cd "$srcdir/JSON.sh"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

check() {
	cd "$srcdir/JSON.sh"
	sh "all-tests.sh"
}

package() {
	cd $pkgdir
	mkdir -p usr/bin
	mkdir -p usr/share/licenses/$pkgname/
	mv $srcdir/JSON.sh/JSON.sh usr/bin/json
	install -D -m644 $srcdir/JSON.sh/LICENSE.MIT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

any direction would be appreciated. thanks!

Offline

#2 2013-12-22 02:39:09

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: My first PKGBUILD, is this OK to submit to the aur?

diff -uprN a/PKGBUILD b/PKGBUILD
--- a/PKGBUILD  2013-12-21 21:39:55.685038483 -0500
+++ b/PKGBUILD  2013-12-21 21:39:44.015307280 -0500
@@ -13,7 +13,7 @@ md5sums=('SKIP')
 depends=('bash')

 pkgver() {
- cd "$srcdir/JSON.sh"
+ cd "JSON.sh"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
 }

@@ -23,9 +23,7 @@ check() {
 }

 package() {
- cd $pkgdir
- mkdir -p usr/bin
- mkdir -p usr/share/licenses/$pkgname/
- mv $srcdir/JSON.sh/JSON.sh usr/bin/json
- install -D -m644 $srcdir/JSON.sh/LICENSE.MIT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ cd "JSON.sh"
+ install -Dm755 "$srcdir/JSON.sh/JSON.sh" "$pkgdir/usr/bin/JSON.sh"
+ install -Dm644 "$srcdir/JSON.sh/LICENSE.MIT" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 }

Looks fine to me but stylistically, people tend to write PKGBUILD with install statements and not moving from $srcdir.  Also, always quote your variables.  For example:

First and third changes - makepkg always goes into "$srcdir" so no need to repeat it.
Forth and fifth changes - no need for mkdir stuff and either always use {} variables or not, although that is not a deal breaker.

Last edited by graysky (2013-12-22 02:42:48)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2013-12-22 03:00:55

Kremlin
Member
Registered: 2013-10-22
Posts: 10

Re: My first PKGBUILD, is this OK to submit to the aur?

graysky wrote:
diff -uprN a/PKGBUILD b/PKGBUILD
--- a/PKGBUILD  2013-12-21 21:39:55.685038483 -0500
+++ b/PKGBUILD  2013-12-21 21:39:44.015307280 -0500
@@ -13,7 +13,7 @@ md5sums=('SKIP')
 depends=('bash')

 pkgver() {
- cd "$srcdir/JSON.sh"
+ cd "JSON.sh"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
 }

@@ -23,9 +23,7 @@ check() {
 }

 package() {
- cd $pkgdir
- mkdir -p usr/bin
- mkdir -p usr/share/licenses/$pkgname/
- mv $srcdir/JSON.sh/JSON.sh usr/bin/json
- install -D -m644 $srcdir/JSON.sh/LICENSE.MIT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ cd "JSON.sh"
+ install -Dm755 "$srcdir/JSON.sh/JSON.sh" "$pkgdir/usr/bin/JSON.sh"
+ install -Dm644 "$srcdir/JSON.sh/LICENSE.MIT" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 }

Looks fine to me but stylistically, people tend to write PKGBUILD with install statements and not moving from $srcdir.  Also, always quote your variables.  For example:

First and third changes - makepkg always goes into "$srcdir" so no need to repeat it.
Forth and fifth changes - no need for mkdir stuff and either always use {} variables or not, although that is not a deal breaker.

noted. thanks!

Offline

#4 2013-12-22 03:04:20

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: My first PKGBUILD, is this OK to submit to the aur?

First and second, not first and third but you get it. Welcome to Arch.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2013-12-22 16:12:59

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: My first PKGBUILD, is this OK to submit to the aur?

You're also pulling from git master, the pkgname should be appended with "-git"

I'll disagree with graysky and say there's nothing wrong with cd'ing to $srcdir/whatever. Using an absolute path is fine.

Last edited by Scimmia (2013-12-22 16:16:35)

Offline

#6 2013-12-22 20:12:19

Kremlin
Member
Registered: 2013-10-22
Posts: 10

Re: My first PKGBUILD, is this OK to submit to the aur?

Scimmia wrote:

You're also pulling from git master, the pkgname should be appended with "-git"

I'll disagree with graysky and say there's nothing wrong with cd'ing to $srcdir/whatever. Using an absolute path is fine.

d'oh! i meant to append that but i was so anxious to submit i forgot, haha.

Offline

Board footer

Powered by FluxBB