You are not logged in.

#1 2016-06-09 17:38:44

cmdd
Member
Registered: 2016-06-09
Posts: 2

PKGBUILD review request: timew-git

Hi! This is my first PKGBUILD, and I want to make sure that it doesn't have any glaring flaws before submitting.
Feedback would be much appreciated!

# Maintainer: David Cao <dcao@protonmail.com>
pkgname=timew-git
pkgver=r1688.61c0cb3
pkgrel=1
pkgdesc="A command-line time tracker"
arch=('i686' 'x86_64')
url="https://taskwarrior.org/docs/timewarrior/index.html"
license=('MIT')
depends=('gcc-libs')
makedepends=('cmake' 'git')
source=('git+https://git.tasktools.org/scm/tm/timew.git'
        'git+https://git.tasktools.org/scm/tm/libshared.git')
md5sums=('SKIP' 'SKIP')

pkgver() {
  cd "${pkgname%-git}"
  ( set -o pipefail
    git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

prepare() {
  cd "${pkgname%-git}"
  git submodule init
  git config submodule.src/libshared.url $srcdir/libshared
  git submodule update src/libshared
}

build() {
  cd "${pkgname%-git}"
  cmake . -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd "${pkgname%-git}"
  make DESTDIR="${pkgdir}/" install

  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname%-git}/LICENSE
}

Offline

#2 2016-06-09 17:53:50

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

Re: PKGBUILD review request: timew-git

Very good; only two suggestions, and both are minor.

You should quote any paths containing variables you don't control, such as $srcdir and $pkgdir. You don't know if they contain spaces or not.
License should be installed to /usr/share/licenses/${pkgname}/, not /usr/share/licenses/${pkgname%-git}/

Last edited by Scimmia (2016-06-09 17:54:22)

Offline

#3 2016-06-09 17:57:17

mis
Member
Registered: 2016-03-16
Posts: 234

Re: PKGBUILD review request: timew-git

The subshell in the pkgver() function is not needed. (edit: not sure about that with set -o pipefail ...)

Otherwise it looks good to me.

...maybe the gcc-libs dependency could be removed since gcc-libs is part of the base group.

Last edited by mis (2016-06-09 18:03:40)

Offline

#4 2016-06-09 18:39:03

cmdd
Member
Registered: 2016-06-09
Posts: 2

Re: PKGBUILD review request: timew-git

Thanks for the feedback so far!
When I didn't have the gcc-libs dependency included before, namcap complained that it was missing. Lots of packages on the AUR include gcc-libs as a dependency, so I think it should be okay.

Updated PKGBUILD:

# Maintainer: David Cao <dcao@protonmail.com>
pkgname=timew-git
pkgver=r1688.61c0cb3
pkgrel=2
pkgdesc="A command-line time tracker"
arch=('i686' 'x86_64')
url="https://taskwarrior.org/docs/timewarrior/index.html"
license=('MIT')
depends=('gcc-libs')
makedepends=('cmake' 'git')
source=('git+https://git.tasktools.org/scm/tm/timew.git'
        'git+https://git.tasktools.org/scm/tm/libshared.git')
md5sums=('SKIP' 'SKIP')

pkgver() {
  cd "${pkgname%-git}"
  ( set -o pipefail
    git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

prepare() {
  cd "${pkgname%-git}"
  git submodule init
  git config submodule.src/libshared.url "${srcdir}/libshared"
  git submodule update src/libshared
}

build() {
  cd "${pkgname%-git}"
  cmake . -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd "${pkgname%-git}"
  make DESTDIR="${pkgdir}/" install

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

Offline

Board footer

Powered by FluxBB