summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXZS2015-10-15 01:25:12 +0200
committerXZS2015-10-15 01:25:12 +0200
commit7ef29f2970f4be84091813d4b8c048767451d19b (patch)
tree390879997ea7442de3cec7c54c0a64176df6ae4b
parent7e6f64f9a142705e1542c7e61fd5255f06480503 (diff)
downloadaur-7ef29f2970f4be84091813d4b8c048767451d19b.tar.gz
externalize compatible version query
This makes it easier to switch out the location this information is retrieved from, should there be a more current source to query than the install.rdf file included in the Add-On itself.
-rw-r--r--PKGBUILD23
1 files changed, 13 insertions, 10 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 162128b7c3dc..a4e0a3a53114 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -25,6 +25,18 @@ prepare() {
find -name '.git*' -exec rm -rf '{}' +
}
+makedepends+=(rasqal)
+
+sparql() {
+ roqet -e "PREFIX em: <http://www.mozilla.org/2004/em-rdf#> SELECT ?x WHERE { $1 }" \
+ -D "${2:-install.rdf}" -r csv 2>/dev/null | tr -d '\r' | tail -n 1 | head -c -1
+}
+
+# Retrieve current compatibility information from install.rdf.
+query-version() {
+ sparql "[] em:id '$2' ; em:${1}Version ?x" install.rdf
+}
+
pkgver() {
cd "$_gitname"
sed -n 's/.*"version"\s*:\s*"\([[:digit:].]*\)"\s*,.*/\1/p' \
@@ -54,13 +66,6 @@ for target in "${optdepends[@]}"; do
done
optdepends=()
-makedepends+=(rasqal)
-
-sparql() {
- roqet -e "PREFIX em: <http://www.mozilla.org/2004/em-rdf#> SELECT ?x WHERE { $1 }" \
- -D "${2:-install.rdf}" -r csv 2>/dev/null | tr -d '\r' | tail -n 1 | head -c -1
-}
-
version-range() {
local emid=$(emid $1)
echo "$1>$(version min $emid)" "$1<$(version max $emid)"
@@ -75,9 +80,7 @@ emid() {
}
version() {
- local version;
- version=$(sparql "[] em:id '$2' ; em:${1}Version ?x" \
- "$srcdir/install.rdf" )
+ local version="$(query-version $1 $2)"
if [[ $version =~ ([[:digit:]]+).\* ]]; then
if [[ $1 = max ]]; then
echo $(( ${BASH_REMATCH[1]} + 1 ))