[Qa-jenkins-scm] [jenkins.debian.net] 08/08: reproducible debian: add common function for creating temporary files
Holger Levsen
holger at layer-acht.org
Tue Jul 5 15:25:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit b4ea329bf29b4e4d101d85a68dcc04305d8cb97e
Author: Valerie R Young <spectranaut at riseup.net>
Date: Fri Jul 1 10:41:02 2016 -0400
reproducible debian: add common function for creating temporary files
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/reproducible_common.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 2340644..f7a2a7d 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -26,8 +26,10 @@ import html as HTML
from string import Template
from subprocess import call
from traceback import print_exception
+from tempfile import NamedTemporaryFile
from datetime import datetime, timedelta
+
DEBUG = False
QUIET = False
@@ -47,6 +49,7 @@ BIN_PATH = '/srv/jenkins/bin'
BASE = '/var/lib/jenkins/userContent/reproducible'
DEBIAN_BASE = '/var/lib/jenkins/userContent/reproducible/debian'
TEMPLATE_PATH = BIN_PATH + '/templates'
+TEMP_PATH="/tmp/reproducible"
REPRODUCIBLE_JSON = BASE + '/reproducible.json'
REPRODUCIBLE_TRACKER_JSON = BASE + '/reproducible-tracker.json'
@@ -166,6 +169,8 @@ html_header = Template("""<!DOCTYPE html>
try:
JOB_URL = os.environ['JOB_URL']
except KeyError:
+ JOB_URL = ''
+ JOB_NAME = ''
JOB_FOOTER = ''
else:
JOB_NAME = os.path.basename(JOB_URL[:-1])
@@ -218,6 +223,11 @@ def percent(part, whole):
return round(100 * float(part)/float(whole), 1)
+def create_temp_file(mode='w+b'):
+ os.makedirs(TEMP_PATH, exist_ok=True)
+ return NamedTemporaryFile(suffix=JOB_NAME, dir=TEMP_PATH, mode=mode)
+
+
class bcolors:
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list