You are not logged in.

#1 2016-04-21 14:30:11

aoneill
Member
Registered: 2016-04-21
Posts: 2

PKGBUILD Dependent on "latest.json"

Hello!

Before I submit this to the AUR, I wanted someone to look over this to see if there is a better way to achieve this.

The issue is that for this package, the latest version information can be easily found via the contents of a remote file, namely "latest.json". Here is what I managed to do to take advantage of this:

pkgname=vmnetx
pkgver=0.5.1
pkgrel=1
pkgdesc="Virtual Machine Network Execution"
arch=('i686' 'x86_64')
url="https://olivearchive.org/"
license=('GPL')
depends=( 'qemu' 'gtk2' 'pygtk' 'python2' 'python2-requests' 'python2-dateutil'\
          'python2-msgpack' 'python2-yaml' 'python2-flask' 'spice-gtk2'\
          'libvirt-python' 'python2-dbus' 'glib2' 'curl' 'fuse' 'libxml2'\
          'python2-lxml' 'pkg-config' 'python2-argparse' )
makedepends=( 'git' 'autoconf' )
provides=("${pkgname}")
conflicts=("${pkgname}")
_latest=latest.json
source=( "https://olivearchive.org/vmnetx/source/$_latest" )
md5sums=('SKIP')

_version() {
  cd "$srcdir"
  grep ".version.[[:space:]]*:" $_latest \
    | sed -e "s/^\s*[\"']version[\"']\s*:\s*[\"']\([0-9\.]\+\)[\"']\s*$/\1/"
}

prepare() {
  file="vmnetx-$(_version).tar.xz"
  url="https://olivearchive.org/vmnetx/source/$file" 
  SRCDEST="$srcdir" download_file $url
  
  cd "$srcdir"
  tar xf $file
}

pkgver() {
  _version
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  ./configure --prefix=/usr --sbindir=/usr/bin
  make
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  make -k check
}

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

It would be great for someone to look this over before I submit. I'm mostly concerned about the prepare section, which uses makepkg's internals to actually download the real source.

Thanks!

Offline

#2 2016-04-21 14:40:46

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

Re: PKGBUILD Dependent on "latest.json"

I would skip that all together. This being a stable package, you (as maintainer) need to bump the pkgver and push an update whenever there's a new version anyway.

Online

#3 2016-04-21 14:44:14

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: PKGBUILD Dependent on "latest.json"

I suggest you do not allow automatic updates of the version number. If you really want to do that, call the package vmnetx-latest. Also, do not use prepare to select the package version, but simply set pkgver dynamically.

pkgver="$(curl 'https://olivearchive.org/vmnetx/source/latest.json' | sed -n 's/^.*"version".*"\(.*\)".*$/\1/p')"

Last edited by progandy (2016-04-21 14:50:32)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2016-04-21 16:28:03

aoneill
Member
Registered: 2016-04-21
Posts: 2

Re: PKGBUILD Dependent on "latest.json"

progandy wrote:

I suggest you do not allow automatic updates of the version number. If you really want to do that, call the package vmnetx-latest. Also, do not use prepare to select the package version, but simply set pkgver dynamically.

pkgver="$(curl 'https://olivearchive.org/vmnetx/source/latest.json' | sed -n 's/^.*"version".*"\(.*\)".*$/\1/p')"

Great advise, thanks!

Offline

Board footer

Powered by FluxBB