summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXZS2015-10-15 01:26:34 +0200
committerXZS2015-10-15 01:26:34 +0200
commita32051175f0afb1964cc0048487ff261fa0fb42d (patch)
tree8b1aeaacc81c25b351c5b2c9285843c9b96b489f
parent2ab7815d6f6a6832e7ab0dcb0997c63b3e33d0c3 (diff)
downloadaur-a32051175f0afb1964cc0048487ff261fa0fb42d.tar.gz
ask addons.mozilla.org for updated information
The addons.mozilla.org API provides updated information about Add-On compatibility more recent than the install.rdf file included in the extension. Restricting package relations according to it yields a wider version range, especially with newer versions.
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD15
2 files changed, 13 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 89cc57937b6c..97a999bca565 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -8,7 +8,9 @@ pkgbase = firefox-extension-flash-video-downloader
makedepends = rasqal
depends = firefox
source = firefox-extension-flash-video-downloader.zip::https://addons.mozilla.org/firefox/downloads/latest/flash-video-downloader/platform:2/
+ source = version::https://services.addons.mozilla.org/en-US/firefox/api/1.5/addon/flash-video-downloader
md5sums = 1617f371ee8a38ac75ac2fe8bfabde8a
+ md5sums = SKIP
pkgname = firefox-extension-flash-video-downloader
diff --git a/PKGBUILD b/PKGBUILD
index 31eba82568c7..6866bf7f1b06 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,7 +12,11 @@ md5sums=('1617f371ee8a38ac75ac2fe8bfabde8a')
[ "$arch" ] || arch=('any')
-source+=("${pkgname}.zip::https://addons.mozilla.org/firefox/downloads/latest/${pkgname#*-*-}/platform:2/")
+source+=(
+ "${pkgname}.zip::https://addons.mozilla.org/firefox/downloads/latest/${pkgname#*-*-}/platform:2/"
+ "version::https://services.addons.mozilla.org/en-US/firefox/api/1.5/addon/${pkgname#*-*-}"
+)
+md5sums+=('SKIP')
prepare() {
rm ${pkgname}.zip
@@ -29,6 +33,11 @@ pkgver() {
sparql '<urn:mozilla:install-manifest> em:version ?x' | tr - .
}
+# Retrieve current compatibility information from addons.mozilla.org API.
+query-version() {
+ xmllint version --xpath \
+ "//application[appID='$2']/$1_version/text()"
+}
version-range() {
local emid=$(emid $1)
echo "$1>$(version min $emid)" "$1<$(version max $emid)"
@@ -43,9 +52,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 ))