summaryrefslogtreecommitdiff
path: root/kbas
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-02-07 14:15:53 +0000
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-02-07 14:15:53 +0000
commit4329de30b2437686edf51e2ec67ae4c842c6d993 (patch)
treef35e4ef2a63e5894cdde54fa7b6901bd423a1a3a /kbas
parentdb7bf5f8531b8232765000fcaf30f38f61da5e0b (diff)
downloadybd-4329de30b2437686edf51e2ec67ae4c842c6d993.tar.gz
Show md5 sums in kbas listings
Diffstat (limited to 'kbas')
-rwxr-xr-xkbas/__main__.py22
-rw-r--r--kbas/public/style.css2
2 files changed, 21 insertions, 3 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py
index e7f6c70..db727ac 100755
--- a/kbas/__main__.py
+++ b/kbas/__main__.py
@@ -66,11 +66,26 @@ class KeyedBinaryArtifactServer(object):
@bottle.get('/<name>')
@bottle.get('/artifacts/<name>')
def list(name=""):
+
+ def check(artifact):
+ try:
+ artifact = os.path.join(app.config['artifact-dir'], artifact,
+ artifact)
+ checkfile = artifact + '.md5'
+ if not os.path.exists(checkfile):
+ checksum = app.md5(artifact)
+ with open(checkfile, "a") as f:
+ f.write(checksum)
+
+ return(open(checkfile).read())
+ except:
+ return('================================')
+
current_dir = os.getcwd()
os.chdir(app.config['artifact-dir'])
names = glob.glob('*' + name + '*')
- content = [[strftime('%y-%m-%d', gmtime(os.path.getctime(x))), x]
- for x in names]
+ content = [[strftime('%y-%m-%d', gmtime(os.path.getctime(x))),
+ check(x), x] for x in names]
os.chdir(current_dir)
return template('kbas',
title='Available Artifacts:',
@@ -134,6 +149,9 @@ class KeyedBinaryArtifactServer(object):
shutil.rmtree(unpackdir)
os.rename(tmpdir, os.path.join(app.config['artifact-dir'],
cache_id))
+ checksum = app.md5(artifact)
+ with open(artifact + '.md5', "a") as f:
+ write(f, checksum)
response.status = 201 # success!
return
except:
diff --git a/kbas/public/style.css b/kbas/public/style.css
index f9a2b40..5dd869d 100644
--- a/kbas/public/style.css
+++ b/kbas/public/style.css
@@ -8,7 +8,7 @@ html,body {
body {
color: #bbb;
background: #444;
- font-family: verdana;
+ font-family: monospace;
font-size: 10pt;
}