summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorheinrich59912015-12-22 06:14:16 +0000
committerheinrich59912015-12-22 06:14:16 +0000
commit5af1d35d3eb1c6b186871ba0a95290f205f380cf (patch)
tree96274628c1f7062eae96aab09254efd3e566fbbf
parent9a29fc2429748581412089bc01f5c083b218c284 (diff)
downloadaur-5af1d35d3eb1c6b186871ba0a95290f205f380cf.tar.gz
Add update script
-rw-r--r--update.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/update.py b/update.py
new file mode 100644
index 000000000000..66186aa09fe5
--- /dev/null
+++ b/update.py
@@ -0,0 +1,58 @@
+from bs4 import BeautifulSoup
+from robobrowser import RoboBrowser
+import re
+import subprocess
+import warnings
+
+URL1="http://www.siedler25.org/"
+URL2="http://www.siedler25.org/index.php?com=dynamic&mod=2&type=nightly"
+LINK_URL_RE=re.compile('http://www.siedler25.org/uploads/nightly/s25rttr_([0-9]{8})-[0-9a-f]{40}_linux.x86_64.tar.bz2')
+TEMPLATE="""
+# Maintainer: heinrich5991 <heinrich5991@gmail.com>
+pkgname=s25rttr-nightly-bin
+pkgver={date}
+pkgrel=1
+pkgdesc="Settlers II remake (Needs a copy of the original game!)"
+arch=('x86_64')
+url="http://www.siedler25.org/"
+license=('GPL3')
+depends=(sdl sdl_mixer)
+install="s25rttr-nightly-bin.install"
+source=("{url}"
+ "rttr"
+ "s25rttr-nightly-bin.install")
+sha256sums=('0000000000000000000000000000000000000000000000000000000000000000'
+ '985b0e88823e3b7d525cedfb602bb249217dc0e5271223b2a810ef37c1908fdb'
+ '774aaaafc556ccd3334ee0129267382117ec5e178095377a4676cbcf00845489')
+
+build() {{
+ cd "$srcdir"/s25rttr_"$pkgver"
+ rm lib/libminiupnpc.so
+}}
+
+package() {{
+ cd "$srcdir"/s25rttr_"$pkgver"
+ install -d "$pkgdir"/usr
+ cp -r lib/ share/ "$pkgdir"/usr/
+ install -d "$pkgdir"/usr/bin
+ install -d "$pkgdir"/usr/lib/s25rttr
+ install -m755 bin/s25client "$pkgdir"/usr/lib/s25rttr/
+ install -m755 ../rttr "$pkgdir"/usr/bin/
+}}
+
+# vim:set ts=2 sw=2 et:
+"""[1:]
+
+browser = RoboBrowser()
+browser.open(URL1)
+browser.open(URL2)
+
+with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ hrefs = (a.get("href") for a in browser.parsed("a"))
+ matching_hrefs = (LINK_URL_RE.match(href) for href in hrefs if href is not None)
+ result = [(m.group(0), m.group(1)) for m in matching_hrefs if m is not None]
+ if len(result) != 1:
+ raise ValueError
+ url, date = result[0]
+ print(TEMPLATE.format(date=date, url=url), end="")