summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXZS2016-03-23 17:36:28 +0100
committerXZS2016-03-23 17:55:58 +0100
commit82acec4e2ca2852d4ed2a6a8cfd18865d121ce14 (patch)
tree863856c32020e6399375a8a36a33c195610922d7
parent222e75fd00b9b33af92da134504c77703fe58e6c (diff)
downloadaur-82acec4e2ca2852d4ed2a6a8cfd18865d121ce14.tar.gz
externalize version extraction to download agent
Having the version readily available means that multiple functions in the PKGBUILD can use it without extracting it again every time. Unfortunately, makepkg escapes DLAGENTS in a way that makes adding a complex one quite ugly: It splits arguments on free spaces, so all spaces in the quote-enclosed argument to "bash -c" have to be escaped. On top of that, there are many sed expressions and even sed expressions in sed expressions containing escaped symbols which now have to be escaped again or even three times.
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD22
2 files changed, 20 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 66173bd9554c..6d651bbc089d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -6,9 +6,9 @@ pkgbase = aurora-themes
arch = any
license = GPL3
optdepends = gtk-engine-murrine: for GTK2 themes
- source = version.html::http://opendesktop.org/content/show.php?content=170523
+ source = version::version://opendesktop.org/content/show.php?content=170523
source = http://gnome-look.org/CONTENT/content-files/170523-Dark-Aurora.tar.gz
- sha256sums = 68991e89036a271fec7f8b6408416a6c2817f298ef326365117fe41b1b5222b5
+ sha256sums = 6f34484abaf76f7175264de32610a92447408d63c06a91dfb6e5744023e8d831
sha256sums = 506332ec0d86b90f0e41be79875fa7b40bb923caf01c1412cf02020a6d056f28
pkgname = aurora-themes
diff --git a/PKGBUILD b/PKGBUILD
index ae3b9c1cf78f..d971ea2a62ba 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,14 +9,28 @@ arch=('any')
url="http://opendesktop.org/content/show.php?content=170523"
license=('GPL3')
optdepends=("gtk-engine-murrine: for GTK2 themes")
-source=("version.html::$url"
+source=("version::version${url#http}"
"http://gnome-look.org/CONTENT/content-files/${url##*=}-Dark-Aurora.tar.gz")
-sha256sums=('68991e89036a271fec7f8b6408416a6c2817f298ef326365117fe41b1b5222b5'
+sha256sums=('6f34484abaf76f7175264de32610a92447408d63c06a91dfb6e5744023e8d831'
'506332ec0d86b90f0e41be79875fa7b40bb923caf01c1412cf02020a6d056f28')
+# The following is very convoluted script because of makepkg's DLAGENTS escaping logic.
+# An agent is added for the protocol "version". It is treated like http, which is done by processing
+# the input url %u with sed, replacing the protocol back to http. Everything downloaded is then not
+# immediatley saved to the output file name %o, but first piped through sed, which finds the
+# gnome-shell version string in the Dark Aurora page on GNOME-Look.org.
+# This makes a file containing the version readily available to both pkgver and package so that they
+# not both have to sed out the version from the webpage themselves.
+DLAGENTS=("version::/usr/bin/bash -c $(
+ printf '%s\n' "${DLAGENTS[@]}" | sed -n 's/http::\(.*\)/\1/p' \
+ | sed 's/-[^ ] %o //' | sed 's/ /\\ /g' | sed 's/%u/$(echo\\ %u\\ |\\ sed\\ "s\/^version\/http\/")/'
+)\ |\ sed\ -n\ 's/$(
+ ).*<h1.*>Dark\ Aurora<\\\\/h1>.*<span\ class=\"contentdata\">$(
+ )\\\\([^<]\\\\+\\\\)<\\\\/span>.*/\\\\1/p'\ >\ %o"
+"${DLAGENTS[@]}")
+
pkgver() {
- sed -n 's/.*<h1.*>Dark Aurora<\/h1>.*<span class="contentdata">\([^<]\+\)<\/span>.*/\1/p' \
- version.html | tr '\n' '.'
+ tr '\n' '.' < version
while read -rd $'\0'
do
if [[ "$REPLY" -gt "$max" ]]