Skip to content
Snippets Groups Projects
Commit fd5332ae authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

preparation of automatic update (2)

parent 0d6c5c82
No related branches found
No related tags found
No related merge requests found
#! /bin/bash
# Rolf Niepraschk, 2020-08-17
if [ "$#" -ne 2 ]; then
echo "Illegal number of parameters"
echo "Usage: $0 \"tag (version)\" \"tag message\""
exit 1
fi
git tag "$1" -am '$2'
git push --tags
exit 0
......@@ -2,6 +2,8 @@ from flask import Flask, request, jsonify, send_from_directory
from flask_cors import CORS
import utils as utils
from trans import Trans
from datetime import datetime
import subprocess
from pprint import pprint
config = utils.get_config_dict()
......@@ -23,7 +25,24 @@ def version():
def update():
app.logger.debug('hit update')
req = request.get_json()
pprint(req)
###pprint(req)
tarball_url = req['repository']['homepage'] + '/-/archive/master/' + \
req['repository']['name'] + '-master.tar'
version = utils.get_version()
print(tarball_url)
with open('./LOG', 'a') as f:
print(datetime.now().strftime("[%Y-%m-%d %H:%M:%S] " + version), file=f)
try:
ps = subprocess.Popen(('/usr/bin/curl', '--insecure', '--silent', \
'--output', '-', tarball_url), stdout=subprocess.PIPE)
output = subprocess.check_output(('/usr/bin/tar', '--extract', \
'-f', '-', '--strip-components=1'), stdin=ps.stdout)
ps.wait()
except Exception as error:
app.logger.debug(str(error))
return jsonify({'error':str(error)})
return jsonify({'OK':True})
@app.route('/validate', methods=['POST'])
def validate():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment