[aur-general] RFC: PKGBUILD for nixnote2-git
Tom Hale
tom at hale.ee
Sat Oct 6 16:09:57 UTC 2018
I want avoid the latest commit for greater stability.
Updated attachment: I've dropped the "-git" from the pkgname as I build
from the latest annotated tag.
On 6/10/18 10:48 pm, Doug Newgard via aur-general wrote:
> -git PKGBUILDS need to build from the latest commit on master or the default
> branch, not from a tag. I didn't review the whole thing because the entire
> concept is invalid.
-------------- next part --------------
# Maintainer: Tom Hale <tom[noodle]hale[point]ee>
# Contributor: twa022 <twa022 at gmail dot com>
# Build the highest versioned tag of nixnote2.
# For versioning, see https://github.com/robert7/nixnote2/issues/28
_pkgname=nixnote2
_repo_url="https://github.com/robert7/${_pkgname}.git"
pkgname=$_pkgname
pkgver=2.1.0.beta4g
pkgrel=1
pkgdesc="Evernote clone (formerly Nevernote) - latest tagged version"
url="https://github.com/robert7/nixnote2"
arch=(x86_64)
license=('GPL3')
depends=(tidy java-runtime hicolor-icon-theme poppler-qt5 qt5-webkit)
makedepends=(git)
provides=("nixnote=${pkgver%.r*}" "nixnote2=${pkgver%.r*}")
replaces=(nevernote nixnote nixnote-beta)
source=("${_pkgname}"::git+$_repo_url)
sha256sums=('SKIP')
set -o pipefail
# Get the tag of the commit to use
# Separated out to allow for `makepkg -e` not running prepare()
_get_tag() {
_tag=$(git -c 'versionsort.suffix=-' ls-remote -t --exit-code --refs --sort=-v:refname \
"$_repo_url" 'v*' \
| sed -E 's/^[[:xdigit:]]+[[:space:]]+refs\/tags\/(.+)/\1/g' | head -n1)
echo "Selected git tag: $_tag" >&2 # To STDERR as called from pkgver()
}
prepare() {
_get_tag
cd "$srcdir/$_pkgname"
git reset --hard "$_tag"
}
pkgver() {
cd "$srcdir/$_pkgname"
[[ -z ${_tag-} ]] && _get_tag
# Example: v2.1.0-beta3 -> 2.1.0.beta3
echo "$_tag" | sed -E 's/^v//;s/-/./'
}
build() {
echo "Building package: $_pkgname-$pkgver" >&2
cd "$srcdir/$_pkgname"
/usr/bin/qmake PREFIX=/usr
make
# Strip the binary to save 160MB of disk
strip qmake-build-release/"$_pkgname"
}
package() {
cd "$_pkgname"
make INSTALL_ROOT="${pkgdir}" install
install -Dm644 shortcuts.txt "${pkgdir}/usr/share/doc/$_pkgdir/shortcuts_sample.txt"
install -Dm644 docs/{shortcuts-howto,CHANGELOG}.md "${pkgdir}/usr/share/doc/$_pkgdir/"
}
More information about the aur-general
mailing list