From a9534762eadcb5f9d4773345f1dd7f0833a79a57 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 22 Feb 2018 21:44:38 +0100 Subject: maint: added script to download distfiles --- maint/download_release.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 maint/download_release.py (limited to 'maint') 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]) -- cgit v1.2.3-18-g5258