aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-02-22 21:44:38 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-02-22 21:44:38 +0100
commita9534762eadcb5f9d4773345f1dd7f0833a79a57 (patch)
tree086c71c5f4e59d6c975788417f10c0de7d15354b
parent3a39396dd011d2dc6b746efd2c4c8211f70d5dfb (diff)
downloadblogc-a9534762eadcb5f9d4773345f1dd7f0833a79a57.tar.gz
blogc-a9534762eadcb5f9d4773345f1dd7f0833a79a57.tar.bz2
blogc-a9534762eadcb5f9d4773345f1dd7f0833a79a57.zip
maint: added script to download distfiles
-rw-r--r--.gitignore2
-rw-r--r--maint/download_release.py30
2 files changed, 32 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 4c0dd28..4d18f25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,3 +103,5 @@ blogc-*.rpm
/build/
/root/
+
+/maint/releases/
diff --git a/maint/download_release.py b/maint/download_release.py
new file mode 100644
index 0000000..2d145b2
--- /dev/null
+++ b/maint/download_release.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python2
+# coding: utf-8
+
+import os
+import re
+import requests
+import subprocess
+import sys
+
+re_distfile = re.compile(r'(blogc[^\'"]+)\.sha512')
+base_url = 'https://distfiles.rgm.io/blogc'
+cwd = os.path.dirname(os.path.abspath(__file__))
+
+
+def download_release(version):
+ release_url = '%s/blogc-%s' % (base_url, version)
+ r = requests.get('%s/' % release_url)
+ r.raise_for_status()
+
+ for distfile in set(re_distfile.findall(r.content)):
+ file_url = '%s/%s' % (release_url, distfile)
+ dest_path = os.path.join(cwd, 'releases', version)
+ subprocess.check_call(['wget', '-c', '-P', dest_path, file_url,
+ '%s.sha512' % file_url])
+ subprocess.check_call(['sha512sum', '-c', '%s.sha512' % distfile],
+ cwd=dest_path)
+
+
+if __name__ == '__main__':
+ download_release(sys.argv[1])