diff --git a/builder/kojid b/builder/kojid index b79f1db6..0e5eb22c 100755 --- a/builder/kojid +++ b/builder/kojid @@ -62,6 +62,7 @@ except ImportError: import dnf import Cheetah.Template +import jinja2 import librepo import requests import rpm @@ -2104,6 +2105,7 @@ class WrapperRPMTask(BaseBuildTask): def handler(self, spec_url, build_target, build, task, opts=None): if not opts: opts = {} + self.opts = opts if not (build or task): raise koji.BuildError('build and/or task must be specified') @@ -2286,13 +2288,8 @@ class WrapperRPMTask(BaseBuildTask): # get the source before chown, git > 2.35.2 would refuse to that later source = scm.get_source() - spec_template = None - for path, dir, files in os.walk(specdir): - files.sort() - for filename in files: - if filename.endswith('.spec.tmpl'): - spec_template = os.path.join(path, filename) - break + + engine, spec_template = self.find_template(specdir) if not spec_template: raise koji.BuildError('no spec file template found at URL: %s' % spec_url) @@ -2313,13 +2310,12 @@ class WrapperRPMTask(BaseBuildTask): # change directory to the specdir to the template can reference files there os.chdir(specdir) - contents = Cheetah.Template.Template(file=spec_template, - searchList=[values]).respond() - contents = contents.encode('utf-8') - specfile = spec_template[:-5] - with open(specfile, 'wb') as specfd: - specfd.write(contents) + if engine == 'cheetah': + specfile = self.handle_cheetah(spec_template, values) + elif engine == 'jinja': + specfile = self.handle_jinja(spec_template, values) + uploadpath = self.getUploadDir() self.session.uploadWrapper(specfile, uploadpath) @@ -2475,6 +2471,51 @@ class WrapperRPMTask(BaseBuildTask): return results + def find_template(self, specdir): + # historically, spec templates were cheetah templates + # now we support jinja as well + spec_template = None + engine = None + for dirpath, dirnames, filenames in os.walk(specdir): + for filename in sorted(filenames): + if filename.endswith('.spec.tmpl'): + spec_template = os.path.join(dirpath, filename) + engine = 'cheetah' + break + if self.opts.get('jinja') and filename.endswith(('.spec.jinja', '.spec.j2')): + spec_template = os.path.join(dirpath, filename) + engine = 'jinja' + break + return engine, spec_template + + def handle_cheetah(self, spec_template, values): + """Generate specfile from cheetah template""" + contents = Cheetah.Template.Template(file=spec_template, + searchList=[values]).respond() + contents = contents.encode('utf-8') + + # strip .tmpl + specfile = spec_template[:-5] + with open(specfile, 'wb') as specfd: + specfd.write(contents) + return specfile + + def handle_jinja(self, spec_template, values): + """Generate specfile from jinja template""" + env = jinja2.Environment( + loader=jinja2.FileSystemLoader('.'), + autoescape=False # not html + ) + path = os.path.relpath(spec_template) + template = env.get_template(path) + contents = template.render(**values) + + # strip .j2 or .jinja ext + specfile = os.path.splitext(spec_template)[0] + with open(specfile, 'wt') as specfd: + specfd.write(contents) + return specfile + class ChainMavenTask(MultiPlatformTask): diff --git a/devtools/convert-cheetah b/devtools/convert-cheetah new file mode 100755 index 00000000..65e27e60 --- /dev/null +++ b/devtools/convert-cheetah @@ -0,0 +1,190 @@ +#!/usr/bin/python3 + +import os.path +import re +import sys +import tempfile +from optparse import OptionParser + + +""" +Poorly convert some cheetah template code to jinja + +This is NOT a full or accurate conversion, it is a set of simple +tranformations that reduce some of the manual work. + +Always review the changes. +Always review the changes. +""" + + +def main(): + global subs + global options + parser = OptionParser(usage="%prog ") + parser.add_option('-w', '--write', action='store_true', help='write changes to file') + options, args = parser.parse_args() + options.args = args + + if len(args) != 1: + error('Please specify one template') + fn = args[0] + handle_file(fn) + + +def handle_file(fn): + outp = None + if options.write: + dirname = os.path.dirname(fn) + basename = os.path.basename(fn) + outfile = tempfile.NamedTemporaryFile(dir=dirname, mode='wt', prefix=f'_{basename}', delete=False) + with outfile as outp: + _handle_file(fn, outp) + os.replace(outfile.name, fn) + print(f'Wrote {fn}') + else: + _handle_file(fn, outp) + + +def _handle_file(fn, outp): + with open(fn, 'rt') as fp: + for lineno, line in enumerate(fp): + line = handle_line(lineno, line, outp) + if line is not None and outp is not None: + outp.write(line) + + +def handle_line(lineno, line, outp): + orig = line + matches = 0 + skip = False + rules = list(SUBS) + while rules: + prog, repl = rules.pop(0) + last = line + if repl == SKIP: + m = prog.search(line) + if m: + print(f'{lineno}: Matched skip pattern {prog.pattern!r}') + print(line, end='') + skip = True + line = orig + break + continue + elif repl == DROP: + m = prog.search(line) + if m: + print(f'{lineno}: Matched DROP pattern {prog.pattern!r}') + print(line, end='') + return None + elif repl == BREAK: + m = prog.search(line) + if m: + print(f'{lineno}: Matched BREAK pattern {prog.pattern!r}') + print(line, end='') + break + elif isinstance(repl, Jump): + # forget remaing rules and use target rules from here + m = prog.search(line) + if m: + rules = list(repl.target) + else: + line, n = prog.subn(repl, line) + if n: + matches += n + print(f'{lineno}: Matched {prog.pattern!r} (count: {n})') + if matches: + print(f'Made {matches} substitutions for line {lineno}') + print(f'ORIG: {orig}', end='') + print(f' NEW: {line}') + return collapse(line) + + +def rules(subs): + # compile subs + return [(re.compile(pat, flags), repl) for pat, repl, flags in subs] + + +class Jump: + # jump to new set of substitutions + def __init__(self, target): + self.target = target + + +SKIP = ('skip subs for this line',) +DROP = ('drop line',) +BREAK = ('stop subs checks for this line',) +STATE = rules([ + # subrules for some line statements + [r'[$]', '', 0], + [r'len\(([\w.$]+)\)', r'(\1 |length)', 0 ], +]) +SUBS = rules([ + # [pattern, replacement, flags] + [r'util.(toggleOrder|rowToggle|sortImage|passthrough_except|passthrough|authToken)\b', r'util.\g<1>2', 0], + [r'(#include .*)header.chtml', r'\1header2.chtml', 0], + [r'(#include .*)footer.chtml', r'\1footer2.chtml', 0], + [r'^#import', DROP, 0], + [r'^#from .* import', DROP, 0], + [r'^\s*#(if|for|elif|set)', Jump(STATE), 0], + [r'#end if', r'#endif', 0], + [r'#end for', r'#endfor', 0], + [r'[(][$]self, ', r'(', 0 ], + [r'\([$]self\)', r'()', 0 ], + [r'len\(([\w.$]+)\)', r'(\1 |length)', 0 ], + [r'[$](([\w.]+)[(][^()]*[)])', r'{{ \1 }}', 0 ], + [r'${\s*([^{}]+)\s*}', r'{{ \1 }}', 0 ], + [r'#echo ([^#]+)#', r'{{ \1 }}', 0 ], + [r'#if ([^#]+) then ([^#]+) else ([^#]+)\s*#', r'{{ \2 if \1 else \3 }}', 0 ], + [r'''[$]([\w.]+)\['(\w+)'\]''', r'{{ \1.\2 }}', 0], + [r'''[$]([\w.]+)\["(\w+)"\]''', r'{{ \1.\2 }}', 0], + [r'[$]([\w.]+)[([]', SKIP, 0], + [r'^(\s*)#attr ', r'\1#set ', 0], + [r'^\s*#', BREAK, 0], + [r'[$]([\w.]+)', r'{{ \1 }}', 0], +]) + + +def error(msg): + print(msg) + sys.exit(1) + + +BRACES = re.compile(r'({{ | }})') + +def collapse(line): + """Collapse nested double braces""" + tokens = BRACES.split(line) + + depth = 0 + tokens2 = [] + for tok in tokens: + if tok == '{{ ': + # only keep braces at the outer layer + if depth == 0: + tokens2.append(tok) + depth += 1 + elif tok == ' }}': + depth -= 1 + if depth < 0: + warning("Brace mismatch. Can't collapse") + break + elif depth == 0: + # only keep braces at the outer layer + tokens2.append(tok) + else: + # keep everything else + tokens2.append(tok) + + if depth < 0: + warning('Unexpected }}') + return line + elif depth > 0: + warning('Missing }}') + return line + else: + return ''.join(tokens2) + + +if __name__ == '__main__': + main() diff --git a/devtools/fakeweb b/devtools/fakeweb index 9c595dff..b00ec5cd 100755 --- a/devtools/fakeweb +++ b/devtools/fakeweb @@ -2,9 +2,11 @@ from __future__ import absolute_import, print_function +import ast import mimetypes import os import os.path +import optparse import pprint import sys from urllib.parse import quote @@ -17,6 +19,7 @@ sys.path.insert(0, CWD) sys.path.insert(1, os.path.join(CWD, 'www/lib')) sys.path.insert(1, os.path.join(CWD, 'www/kojiweb')) import wsgi_publisher +import index as kojiweb_handlers def get_url(environ): @@ -122,11 +125,75 @@ def application(environ, start_response): return wsgi_publisher.application(environ, start_response) +def nice_literal(value): + try: + return ast.literal_eval(value) + except (ValueError, SyntaxError): + return value + + +def get_options(): + parser = optparse.OptionParser(usage='%prog [options]') + # parser.add_option('--pdb', action='store_true', + # help='drop into pdb on error') + parser.add_option('--user', '-u', help='fake login as user') + parser.add_option('-o', '--config-option', help='override config option', + action='append', metavar='NAME=VALUE') + opts, args = parser.parse_args() + + if args: + parser.error('This command takes no args, just options') + + if opts.config_option: + overrides = {} + for s in opts.config_option: + k, v = s.split('=', 1) + v = nice_literal(v) + overrides[k] = v + opts.config_option = overrides + + return opts + + +def override_load_config(opts): + original_load_config = wsgi_publisher.Dispatcher.load_config + + def my_load_config(_self, environ): + oldopts = original_load_config(_self, environ) + oldopts.update(opts) + _self.options = oldopts + return oldopts + + wsgi_publisher.Dispatcher.load_config = my_load_config + + +def fake_login(user): + original_assertLogin = kojiweb_handlers._assertLogin + original_getServer = kojiweb_handlers._getServer + + def my_assertLogin(environ): + pass + + def my_getServer(environ): + session = original_getServer(environ) + environ['koji.currentUser'] = session.getUser(user) + return session + + kojiweb_handlers._assertLogin = my_assertLogin + kojiweb_handlers._getServer = my_getServer + + def main(): + options = get_options() + if options.config_option: + override_load_config(options.config_option) + if options.user: + fake_login(options.user) # koji.add_file_logger('koji', 'fakeweb.log') httpd = make_server('', 8000, application) print("Serving kojiweb on http://localhost:8000 ...") httpd.serve_forever() + if __name__ == '__main__': main() diff --git a/tests/test_builder/test_wrapperRPM.py b/tests/test_builder/test_wrapperRPM.py new file mode 100644 index 00000000..d727e060 --- /dev/null +++ b/tests/test_builder/test_wrapperRPM.py @@ -0,0 +1,158 @@ +from __future__ import absolute_import +try: + from unittest import mock +except ImportError: + import mock +import os +import rpm +import shutil +import tempfile +import threading +import unittest +import koji +import koji.tasks +from .loadkojid import kojid +from six.moves import range +from functools import partial + + +mylock = threading.Lock() + + +class TestWrapperRPM(unittest.TestCase): + + def setUp(self): + self.tempdir = tempfile.mkdtemp() + self.session = mock.MagicMock() + self.options = mock.MagicMock() + self.options.copy_old_repodata = False + self.options.createrepo_update = True + self.topdir = self.tempdir + '/topdir' + self.options.topdir = self.topdir + self.pathinfo = koji.PathInfo(self.topdir) + mock.patch('koji.pathinfo', new=self.pathinfo).start() + + # set up task handler + task_id = 99 + method = 'wrapperRPM' + self.spec_url = 'SPEC_URL' + self.target = {'id': 123, 'name': 'TARGET', 'build_tag': 456} + self.build = {'id': 12345, 'state': 1, 'name': '_name', 'version': '_version', + 'release': '_release'} + self.task = None + self.opts = {} + params = [self.spec_url, self.target, self.build, self.task, self.opts] + self.handler = kojid.WrapperRPMTask(task_id, method, params, self.session, + self.options, self.tempdir + '/work') + + self.handler.find_arch = mock.MagicMock() + self.handler.chownTree = mock.MagicMock() + self.handler.localPath = self.my_localPath + + # mock some more things + self.wait = mock.MagicMock() + self.handler.wait = self.wait + self.session.getExternalRepoList.return_value = [] + self.SCM = mock.patch.object(kojid, 'SCM').start() + self.SCM.return_value.assert_allowed = mock.MagicMock() + self.SCM.return_value.checkout.side_effect = self.my_checkout + self.BuildRoot = mock.patch.object(kojid, 'BuildRoot').start() + self.BuildRoot().resultdir.return_value = self.tempdir + '/result' + mock.patch('pwd.getpwnam').start() + mock.patch('grp.getgrnam').start() + + # default to a maven build + self.session.getMavenBuild.return_value = {'build_id': 12345, 'artifact_id': 'ARTIFACT'} + self.session.getWinBuild.return_value = None + self.session.getImageBuild.return_value = None + + self.session.listArchives.return_value = [{'id': 999, 'filename': 'test.pom', + 'group_id': 'GROUP', 'artifact_id': 'ARTIFACT', + 'version': 'VERSION', 'name': 'NAME'}] + # This handler relies on chdir + mylock.acquire() + self.savecwd = os.getcwd() + + def tearDown(self): + # clean up the chdir + os.chdir(self.savecwd) + mylock.release() + mock.patch.stopall() + shutil.rmtree(self.tempdir) + + def my_checkout(self, *a, **kw): + return self.my_checkout2(['foo.spec.tmpl'], *a, **kw) + + def my_checkout2(self, relpaths, *a, **kw): + scmdir = self.tempdir + '/checkout' + koji.ensuredir(scmdir) + for relpath in relpaths: + fn = koji.util.joinpath(scmdir, relpath) + with open(fn, 'wt') as fp: + fp.write(f'Hello World\n{relpath}\n') + return scmdir + + def my_localPath(self, relpath): + path = koji.util.joinpath(self.tempdir, relpath) + koji.ensuredir(os.path.dirname(path)) + with open(path, 'wt') as fp: + fp.write('Hola Mundo\n') + return path + + def write_srpm(self): + fn = self.tempdir + '/result/foo.src.rpm' + koji.ensuredir(os.path.dirname(fn)) + with open(fn, 'wt') as fp: + fp.write('Bonjour le monde\n') + + def my_build(self, *a, **kw): + self.write_srpm() + fn = self.tempdir + '/result/foo.noarch.rpm' + koji.ensuredir(os.path.dirname(fn)) + with open(fn, 'wt') as fp: + fp.write('Ahoj světe\n') + + def test_basic(self): + # self.session.getTag.return_value = {'id': 'TAGID', 'name': 'TAG'} + self.write_srpm() + # rewrite the srpm when build is called + self.BuildRoot().build.side_effect = self.my_build + + # this handler relies on os.chdir + result = self.handler.run() + + self.assertEqual(result['srpm'], 'foo.src.rpm') + self.assertEqual(result['rpms'], ['foo.noarch.rpm']) + + + def test_basic_jinja(self): + # self.session.getTag.return_value = {'id': 'TAGID', 'name': 'TAG'} + self.write_srpm() + # rewrite the srpm when build is called + self.BuildRoot().build.side_effect = self.my_build + # use a jinja template + self.SCM.return_value.checkout.side_effect = partial(self.my_checkout2, ['foo.spec.j2']) + + # this handler relies on os.chdir + self.opts['jinja'] = True + result = self.handler.run() + + self.assertEqual(result['srpm'], 'foo.src.rpm') + self.assertEqual(result['rpms'], ['foo.noarch.rpm']) + + def test_jinja_requires_opt(self): + # self.session.getTag.return_value = {'id': 'TAGID', 'name': 'TAG'} + self.write_srpm() + # rewrite the srpm when build is called + self.BuildRoot().build.side_effect = self.my_build + # use a jinja template + self.SCM.return_value.checkout.side_effect = partial(self.my_checkout2, ['foo.spec.j2']) + + # this handler relies on os.chdir + with self.assertRaises(koji.BuildError) as ex: + result = self.handler.run() + + self.assertIn('no spec file template found', str(ex.exception)) + + +# the end diff --git a/tests/test_www/test_repoinfo.py b/tests/test_www/test_repoinfo.py index 2ab51ec5..81aafed1 100644 --- a/tests/test_www/test_repoinfo.py +++ b/tests/test_www/test_repoinfo.py @@ -1,6 +1,7 @@ from unittest import mock import unittest +import koji from .loadwebindex import webidx @@ -26,7 +27,8 @@ class TestRepoInfo(unittest.TestCase): self.get_server.return_value = self.server self.server.repoInfo.return_value = {'dist': True, 'id': int(self.repo_id), - 'tag_name': 'test-tag'} + 'tag_name': 'test-tag', 'state': koji.REPO_READY, + 'create_ts': 1735707600.0} self.server.listBuildroots.return_value = [] webidx.repoinfo(self.environ, self.repo_id) @@ -38,7 +40,8 @@ class TestRepoInfo(unittest.TestCase): self.get_server.return_value = self.server self.server.repoInfo.return_value = {'dist': False, 'id': int(self.repo_id), - 'tag_name': 'test-tag'} + 'tag_name': 'test-tag', 'state': koji.REPO_READY, + 'create_ts': 1735707600.0} self.server.listBuildroots.return_value = [{'id': 1, 'repo_id': int(self.repo_id)}] webidx.repoinfo(self.environ, self.repo_id) diff --git a/www/kojiweb/activesession.chtml b/www/kojiweb/activesession.chtml index eec433f2..9bf34476 100644 --- a/www/kojiweb/activesession.chtml +++ b/www/kojiweb/activesession.chtml @@ -1,28 +1,26 @@ -#include "includes/header.chtml" -#import koji -#from kojiweb import util +#include "includes/header2.chtml" -#attr _PASSTHROUGH = ['userID'] +#set _PASSTHROUGH = ['userID'] -

Active sessions for $loggedInUser.name user

+

Active sessions for {{ loggedInUser.name }} user


- - - - - - + + + + + + - #for $act in $activesess - - - - - - - + #for act in activesess + + + + + + + - #end for + #endfor
Session ID $util.sortImage($self, 'id')Client IP $util.sortImage($self, 'hostip')Auth type $util.sortImage($self, 'authtype')Session start time $util.sortImage($self, 'start_time')Length session $util.sortImage($self, 'start_time')Logout? $util.sortImage($self, 'id')Session ID {{ util.sortImage('id') }}Client IP {{ util.sortImage('hostip') }}Auth type {{ util.sortImage('authtype') }}Session start time {{ util.sortImage('start_time') }}Length session {{ util.sortImage('start_time') }}Logout? {{ util.sortImage('id') }}
$act.id$act.hostip$act.authtype$util.formatTimeLong($act.start_time)$act.lengthSession daysLogout
{{ act.id }}{{ act.hostip }}{{ act.authtype }}{{ util.formatTimeLong(act.start_time) }}{{ act.lengthSession }} daysLogout
diff --git a/www/kojiweb/api.chtml b/www/kojiweb/api.chtml index 6e871926..f6a15c15 100644 --- a/www/kojiweb/api.chtml +++ b/www/kojiweb/api.chtml @@ -1,7 +1,6 @@ -#include "includes/header.chtml" -#import koji +#include "includes/header2.chtml" -

API reference (hub version: $koji_version, web version: $koji.__version__)

+

API reference (hub version: {{ koji_version }}, web version: {{ web_version }})

Various constants used in API calls can be found in first part of koji module. @@ -15,7 +14,7 @@ Basic anonymous client in python would look like this: import koji mytag = "mytag" -session = koji.ClientSession("$koji_hub_url") +session = koji.ClientSession("{{ koji_hub_url }}") try: repo_info = session.getRepo(mytag, koji.REPO_STATES["READY"], dist=True) if not repo_info: @@ -26,13 +25,13 @@ except koji.GenericError:

List of API calls

-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/archiveinfo.chtml b/www/kojiweb/archiveinfo.chtml index ee503733..c7b073f6 100644 --- a/www/kojiweb/archiveinfo.chtml +++ b/www/kojiweb/archiveinfo.chtml @@ -1,163 +1,159 @@ -#import koji -#from kojiweb import util -#from pprint import pformat -#from urllib.parse import quote -#attr _PASSTHROUGH = ['archiveID', 'fileOrder', 'fileStart', 'buildrootOrder', 'buildrootStart'] +#set _PASSTHROUGH = ['archiveID', 'fileOrder', 'fileStart', 'buildrootOrder', 'buildrootStart'] -#include "includes/header.chtml" -

Information for archive $archive.filename

+#include "includes/header2.chtml" +

Information for archive {{ archive.filename }}

- + - #if $wininfo - + #if wininfo + #else - - #end if + + #endif - #if $archive.metadata_only + #if archive.metadata_only - #end if + #endif - + - + - #if $maveninfo + #if maveninfo - + - + - + - #end if + #endif - + - + - #if $wininfo + #if wininfo - + - + - #end if - #if $builtInRoot + #endif + #if builtInRoot - + - #end if - #if $archive.get('extra') + #endif + #if archive.get('extra') - + - #end if - #if $files + #endif + #if files - #end if + #endif - #if $show_rpm_components + #if show_rpm_components - + - #end if - #if $show_archive_components + #endif + #if show_archive_components - + - #end if + #endif
ID$archive.idID{{ archive.id }}
File Name$koji.pathinfo.winfile($archive)File Name{{ koji.pathinfo.winfile(archive) }}File Name$archive.filenameFile Name{{ archive.filename }}
Metadata onlyTrue (file not imported)
File Type$archive_type.descriptionFile Type{{ archive_type.description }}
Build$koji.buildLabel($build)Build{{ koji.buildLabel(build) }}
Maven groupId$archive.group_idMaven groupId{{ archive.group_id }}
Maven artifactId$archive.artifact_idMaven artifactId{{ archive.artifact_id }}
Maven version$archive.versionMaven version{{ archive.version }}
Size$util.formatNatural($archive.size)Size{{ util.formatNatural(archive.size) }}
Checksum$archive.checksumChecksum{{ archive.checksum }}
Platforms$archive.platformsPlatforms{{ archive.platforms }}
Flags$archive.flagsFlags{{ archive.flags }}
Buildroot$util.brLabel($builtInRoot)Buildroot{{ util.brLabel(builtInRoot) }}
Extra$pformat($archive.extra)Extra{{ archive.extra|pprint }}
Files - - + + - #for $file in $files - - + #for file in files + + - #end for + #endfor
- #if $len($filePages) > 1 + #if (filePages |length) > 1
Page: - + #for pageNum in filePages + + #endfor
- #end if - #if $fileStart > 0 - <<< - #end if - #echo $fileStart + 1 # through #echo $fileStart + $fileCount # of $totalFiles - #if $fileStart + $fileCount < $totalFiles - >>> - #end if + #endif + #if fileStart > 0 + <<< + #endif + {{ fileStart + 1 }} through {{ fileStart + fileCount }} of {{ totalFiles }} + #if fileStart + fileCount < totalFiles + >>> + #endif
Name $util.sortImage($self, 'name', 'fileOrder')Size $util.sortImage($self, 'size', 'fileOrder')Name {{ util.sortImage('name', 'fileOrder') }}Size {{ util.sortImage('size', 'fileOrder') }}
$file.name$util.formatNatural($file.size)
{{ file.name }}{{ util.formatNatural(file.size) }}
Component of - #if $len($buildroots) > 0 + #if (buildroots |length) > 0 - - - + + + - #for $buildroot in $buildroots - - - - + #for buildroot in buildroots + + + + - #end for + #endfor
- #if $len($buildrootPages) > 1 + #if (buildrootPages |length) > 1
Page: - + #for pageNum in buildrootPages + + #endfor
- #end if - #if $buildrootStart > 0 - <<< - #end if - #echo $buildrootStart + 1 # through #echo $buildrootStart + $buildrootCount # of $totalBuildroots - #if $buildrootStart + $buildrootCount < $totalBuildroots - >>> - #end if + #endif + #if buildrootStart > 0 + <<< + #endif + {{ buildrootStart + 1 }} through {{ buildrootStart + buildrootCount }} of {{ totalBuildroots }} + #if buildrootStart + buildrootCount < totalBuildroots + >>> + #endif
Buildroot $util.sortImage($self, 'id', 'buildrootOrder')Created $util.sortImage($self, 'create_event_time', 'buildrootOrder')State $util.sortImage($self, 'state', 'buildrootOrder')Buildroot {{ util.sortImage('id', 'buildrootOrder') }}Created {{ util.sortImage('create_event_time', 'buildrootOrder') }}State {{ util.sortImage('state', 'buildrootOrder') }}
$util.brLabel($buildroot)$util.formatTime($buildroot.create_event_time)$util.imageTag($util.brStateName($buildroot.state))
{{ util.brLabel(buildroot) }}{{ util.formatTime(buildroot.create_event_time) }}{{ util.imageTag(util.brStateName(buildroot.state)) }}
#else No buildroots - #end if + #endif
RPM componentsRPM components
Archive componentsArchive components
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/archivelist.chtml b/www/kojiweb/archivelist.chtml index 846f7b27..d7411d05 100644 --- a/www/kojiweb/archivelist.chtml +++ b/www/kojiweb/archivelist.chtml @@ -1,94 +1,92 @@ -#from kojiweb import util -#include "includes/header.chtml" +#include "includes/header2.chtml" -#@util.safe_return -#def getID() - #if $type == 'image' -imageID=$image.id #slurp +#macro getID() + #if type == 'image' +imageID={{ image.id }} #else -buildrootID=$buildroot.id #slurp - #end if -#end def +buildrootID={{ buildroot.id }} + #endif +#endmacro - #if $type == 'component' -

Component Archives of buildroot $util.brLabel($buildroot)

- #elif $type == 'image' -

Archives installed in $image.filename

+ #if type == 'component' +

Component Archives of buildroot {{ util.brLabel(buildroot) }}

+ #elif type == 'image' +

Archives installed in {{ image.filename }}

#else -

Archives built in buildroot $util.brLabel($buildroot)

- #end if +

Archives built in buildroot {{ util.brLabel(buildroot) }}

+ #endif - - - - #if $type == 'component' - - #end if + + + #if type == 'component' + + #endif - #if $len($archives) > 0 - #for $archive in $archives - - - - #if $type == 'component' - #set $project = $archive.project and 'yes' or 'no' - - #end if + #if (archives |length) > 0 + #for archive in archives + + + + #if type == 'component' + #set project = archive.project and 'yes' or 'no' + + #endif - #end for + #endfor #else - + - #end if + #endif -
- #if $len($archivePages) > 1 + + #if (archivePages |length) > 1
Page: - + #for pageNum in archivePages + + #endfor
- #end if - #if $archiveStart > 0 - <<< - #end if - #if $totalArchives != 0 - Archives #echo $archiveStart + 1 # through #echo $archiveStart + $archiveCount # of $totalArchives - #end if - #if $archiveStart + $archiveCount < $totalArchives - >>> - #end if + #endif + #if archiveStart > 0 + <<< + #endif + #if totalArchives != 0 + Archives {{ archiveStart + 1 }} through {{ archiveStart + archiveCount }} of {{ totalArchives }} + #endif + #if archiveStart + archiveCount < totalArchives + >>> + #endif
Filename $util.sortImage($self, 'filename')Type $util.sortImage($self, 'type_name')Build Dependency? $util.sortImage($self, 'project')Filename {{ util.sortImage('filename') }}Type {{ util.sortImage('type_name') }}Build Dependency? {{ util.sortImage('project') }}
$archive.filename$archive.type_name$util.imageTag($project)
{{ archive.filename }}{{ archive.type_name }}{{ util.imageTag(project) }}
No ArchivesNo Archives
- #if $len($archivePages) > 1 + + #if (archivePages |length) > 1
Page: - + #for pageNum in archivePages + + #endfor
- #end if - #if $archiveStart > 0 - <<< - #end if - #if $totalArchives != 0 - Archives #echo $archiveStart + 1 # through #echo $archiveStart + $archiveCount # of $totalArchives - #end if - #if $archiveStart + $archiveCount < $totalArchives - >>> - #end if + #endif + #if archiveStart > 0 + <<< + #endif + #if totalArchives != 0 + Archives {{ archiveStart + 1 }} through {{ archiveStart + archiveCount }} of {{ totalArchives }} + #endif + #if archiveStart + archiveCount < totalArchives + >>> + #endif
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildinfo.chtml b/www/kojiweb/buildinfo.chtml index aee3fb2c..43ea37a4 100644 --- a/www/kojiweb/buildinfo.chtml +++ b/www/kojiweb/buildinfo.chtml @@ -1,269 +1,261 @@ -#import koji -#import koji.util -#from pprint import pformat -#from kojiweb import util -#include "includes/header.chtml" -#set $nvrpath = $pathinfo.build($build) +#include "includes/header2.chtml" +#set nvrpath = pathinfo.build(build) -

Information for build $koji.buildLabel($build)

+

Information for build {{ koji.buildLabel(build) }}

- + - + - + - + - + - #if $build.draft + + #if build.draft #else - #end if - #if $build.get('source') - - + #endif - #end if - #if 'maven' in $typeinfo + #if build.get('source') - + + + #endif + #if 'maven' in typeinfo + + - + - + - #end if - #if 'module' in $typeinfo - #if $module_id + #endif + #if 'module' in typeinfo + #if module_id - #if $mbs_web_url - + #if mbs_web_url + #else - - #end if + + #endif - #end if - #if $module_tag + #endif + #if module_tag - + - #end if - #end if - #if $summary + #endif + #endif + #if summary - + - #end if - #if $description + #endif + #if description - + - #end if - #if $vcs + #endif + #if vcs - + - #end if - #if $disturl + #endif + #if disturl - + - #end if + #endif - + - #set $stateName = $util.stateName($build.state) + #set stateName = util.stateName(build.state) - - + - + - #if $build.state == $koji.BUILD_STATES.BUILDING - #if $estCompletion + #if build.state == koji.BUILD_STATES.BUILDING + #if estCompletion - + - #end if + #endif #else - + - #end if - #if $build.promotion_ts + #endif + #if build.promotion_ts - + - + - #end if - #if $build.cg_id + #endif + #if build.cg_id - + - #end if - #if $task + #endif + #if task - + - #end if - #if $build.get('extra') + #endif + #if build.get('extra') - + - #end if + #endif - #for btype in $archiveIndex - #set $archivesByExt = $archiveIndex[btype] - #if not $archivesByExt - #continue - #end if + #for btype in archiveIndex if archiveIndex[btype] + #set archivesByExt = archiveIndex[btype] - + - #end for - #if $logs_by_dir + #endfor + #if logs_by_dir - #end if - #if $changelog + #endif + #if changelog - + - #end if + #endif
ID$build.idID{{ build.id }}
Package Name$build.package_namePackage Name{{ build.package_name }}
Version$build.versionVersion{{ build.version }}
Release$build.releaseRelease{{ build.release }}
Epoch$build.epochEpoch{{ build.epoch }}
DraftTrueDraftFalse
Source$build['source']
Maven groupId$typeinfo.maven.group_idSource{{ build.source }}
Maven groupId{{ typeinfo.maven.group_id }}
Maven artifactId$typeinfo.maven.artifact_idMaven artifactId{{ typeinfo.maven.artifact_id }}
Maven version$typeinfo.maven.versionMaven version{{ typeinfo.maven.version }}
Module ID$module_id{{ module_id }}$module_id{{ module_id }}
Module Tag$module_tag.nameModule Tag{{ module_tag.name }}
Summary$summarySummary{{ summary }}
Description$descriptionDescription{{ description }}
$util.formatLink($vcs){{ util.formatLink(vcs) }}
DistURL$util.formatLink($disturl)DistURL{{ util.formatLink(disturl) }}
Built by$build.owner_nameBuilt by{{ build.owner_name }}
State$stateName - #if $build.state == $koji.BUILD_STATES.BUILDING - #if $currentUser and ('admin' in $perms or $build.owner_id == $currentUser.id) - (cancel) - #end if - #end if + {{ stateName }} + #if build.state == koji.BUILD_STATES.BUILDING + #if currentUser and ('admin' in perms or build.owner_id == currentUser.id) + (cancel) + #endif + #endif
Volume$build.volume_name{{ build.volume_name }}
Started$util.formatTimeLong($start_ts)Started{{ util.formatTimeLong(start_ts) }}
Est. Completion$util.formatTimeLong($estCompletion)Est. Completion{{ util.formatTimeLong(estCompletion) }}
Completed$util.formatTimeLong($build.completion_ts)Completed{{ util.formatTimeLong(build.completion_ts) }}
Promoted$util.formatTimeLong($build.promotion_ts)Promoted{{ util.formatTimeLong(build.promotion_ts) }}
Promoted by$build.promoter_namePromoted by{{ build.promoter_name }}
Content generator$build.cg_nameContent generator{{ build.cg_name }}
Task$koji.taskLabel($task)Task{{ koji.taskLabel(task) }}
Extra$pformat($build.extra)Extra{{ build.extra|pprint }}
Tags - #if $len($tags) > 0 + #if (tags |length) > 0 - #for $tag in $tags + #for tag in tags - + - #end for + #endfor
$tag.name{{ tag.name }}
#else No tags - #end if + #endif
RPMs - #if $len($rpmsByArch) > 0 + #if (rpmsByArch |length) > 0 - #if 'src' in $rpmsByArch + #if 'src' in rpmsByArch - #for $rpm in $rpmsByArch['src'] - #set $rpmfile = '%(name)s-%(version)s-%(release)s.%(arch)s.rpm' % $rpm - #set $rpmpath = $pathinfo.rpm($rpm) + #for rpm in rpmsByArch['src'] + #set rpmfile = '%(name)s-%(version)s-%(release)s.%(arch)s.rpm' % rpm + #set rpmpath = pathinfo.rpm(rpm) - #if $rpm.metadata_only - - #elif $build.state == $koji.BUILD_STATES.DELETED - + #elif build.state == koji.BUILD_STATES.DELETED + - #end if + + #endif - #end for - #end if - #set $arches = $rpmsByArch.keys() - #for $arch in sorted($arches) - #if $arch == 'src' - #silent continue - #end if + #endfor + #endif + #set arches = rpmsByArch.keys() + #for arch in arches|sort if arch != 'src' - + - #for $rpm in $rpmsByArch[$arch] + #for rpm in rpmsByArch[arch] - #set $rpmfile = '%(name)s-%(version)s-%(release)s.%(arch)s.rpm' % $rpm - #set $rpmpath = $pathinfo.rpm($rpm) + #set rpmfile = '%(name)s-%(version)s-%(release)s.%(arch)s.rpm' % rpm + #set rpmpath = pathinfo.rpm(rpm) - #end for - #end for + #endfor + #endfor
src
$rpmfile (info) (metadata only)$rpmfile (info) + #if rpm.metadata_only + {{ rpmfile }} (info) (metadata only){{ rpmfile }} (info) #else - $rpmfile (info) (download){{ rpmfile }} (info) (download)
$arch{{ arch }}
- #if $build.state != $koji.BUILD_STATES.DELETED - $rpmfile (info) (download) + #if build.state != koji.BUILD_STATES.DELETED + {{ rpmfile }} (info) (download) #else - $rpmfile (info) - #end if + {{ rpmfile }} (info) + #endif
#else No RPMs - #end if + #endif
$btype.capitalize() Archives{{ btype.capitalize() }} Archives - #set $exts = $archivesByExt.keys() - #for ext in $exts + #set exts = archivesByExt.keys() + #for ext in exts - + - #for $archive in $archivesByExt[$ext] + #for archive in archivesByExt[ext] - #end for - #end for + #endfor + #endfor
$ext{{ ext }}
- #if $archive.metadata_only or $build.state == $koji.BUILD_STATES.DELETED - $archive.display (info) + #if archive.metadata_only or build.state == koji.BUILD_STATES.DELETED + {{ archive.display }} (info) #else - $archive.display (info) (download) - #end if + {{ archive.display }} (info) (download) + #endif
Logs - #set $logdirs = $logs_by_dir.keys() - #for logdir in $logdirs + #set logdirs = logs_by_dir.keys() + #for logdir in logdirs - + - #for loginfo in $logs_by_dir[$logdir] + #for loginfo in logs_by_dir[logdir] - #end for - #end for + #endfor + #endfor
$logdir{{ logdir }}
- $loginfo.name + {{ loginfo.name }}
Changelog$koji.util.formatChangelog($changelog){{ koji.util.formatChangelog(changelog) }}
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildrootinfo.chtml b/www/kojiweb/buildrootinfo.chtml index 7f64ee1f..9af6bc31 100644 --- a/www/kojiweb/buildrootinfo.chtml +++ b/www/kojiweb/buildrootinfo.chtml @@ -1,62 +1,59 @@ -#import koji -#from kojiweb import util -#from pprint import pformat -#include "includes/header.chtml" +#include "includes/header2.chtml" -

Information for buildroot $util.brLabel($buildroot)

+

Information for buildroot {{ util.brLabel(buildroot) }}

- + - + - + - + - + - + - + - + - + - + - + - #if $buildroot.get('extra') + #if buildroot.get('extra') - + - #end if + #endif - + - + - + - +
Host$buildroot.host_nameHost{{ buildroot.host_name }}
Arch$buildroot.archArch{{ buildroot.arch }}
ID$buildroot.idID{{ buildroot.id }}
Task$koji.taskLabel($task)Task{{ koji.taskLabel(task) }}
State$util.imageTag($util.brStateName($buildroot.state))State{{ util.imageTag(util.brStateName(buildroot.state)) }}
Created$util.formatTimeLong($buildroot.create_event_time)Created{{ util.formatTimeLong(buildroot.create_event_time) }}
Retired$util.formatTimeLong($buildroot.retire_event_time)Retired{{ util.formatTimeLong(buildroot.retire_event_time) }}
Repo ID$buildroot.repo_idRepo ID{{ buildroot.repo_id }}
Repo Tag$buildroot.tag_nameRepo Tag{{ buildroot.tag_name }}
Repo State$util.imageTag($util.repoStateName($buildroot.repo_state))Repo State{{ util.imageTag(util.repoStateName(buildroot.repo_state)) }}
Repo Created$util.formatTimeLong($buildroot.repo_create_event_time)Repo Created{{ util.formatTimeLong(buildroot.repo_create_event_time) }}
Extra$pformat($buildroot.extra)Extra{{ buildroot.extra| pprint }}
Component RPMsComponent RPMs
Built RPMsBuilt RPMs
Component ArchivesComponent Archives
Built ArchivesBuilt Archives
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildrootinfo_cg.chtml b/www/kojiweb/buildrootinfo_cg.chtml index 25edb6a5..7af9aeef 100644 --- a/www/kojiweb/buildrootinfo_cg.chtml +++ b/www/kojiweb/buildrootinfo_cg.chtml @@ -1,47 +1,44 @@ -#import koji -#from kojiweb import util -#from pprint import pformat -#include "includes/header.chtml" +#include "includes/header2.chtml" -

Information for external buildroot $util.brLabel($buildroot)

+

Information for external buildroot {{ util.brLabel(buildroot) }}

- + - + - + - + - + - + - #if $buildroot.get('extra') + #if buildroot.get('extra') - + - #end if + #endif - + - + - + - +
ID$buildroot.idID{{ buildroot.id }}
Host OS$buildroot.host_osHost OS{{ buildroot.host_os }}
Host Arch$buildroot.host_archHost Arch{{ buildroot.host_arch }}
Content Generator$buildroot.cg_name ($buildroot.cg_version)Content Generator{{ buildroot.cg_name }} ({{ buildroot.cg_version }})
Container Type$buildroot.container_typeContainer Type{{ buildroot.container_type }}
Container Arch$buildroot.container_archContainer Arch{{ buildroot.container_arch }}
Extra$pformat($buildroot.extra)Extra{{ buildroot.extra |pprint }}
Component RPMsComponent RPMs
Built RPMsBuilt RPMs
Component ArchivesComponent Archives
Built ArchivesBuilt Archives
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildroots.chtml b/www/kojiweb/buildroots.chtml index 54f3ec7d..f2ffd9be 100644 --- a/www/kojiweb/buildroots.chtml +++ b/www/kojiweb/buildroots.chtml @@ -1,11 +1,9 @@ -#import koji -#from kojiweb import util -#attr _PASSTHROUGH = ['repoID', 'order', 'state'] +#set _PASSTHROUGH = ['repoID', 'order', 'state'] -#include "includes/header.chtml" +#include "includes/header2.chtml" -

Buildroots in repo $repoID

+

Buildroots in repo {{ repoID }}

@@ -14,84 +12,84 @@
State: - - #for $stateOpt in ['INIT', 'WAITING', 'BUILDING', 'EXPIRED'] - - #end for + #for stateOpt in ['INIT', 'WAITING', 'BUILDING', 'EXPIRED'] + + #endfor
- #if $len($buildrootPages) > 1 + #if (buildrootPages |length) > 1
Page: - + #for pageNum in buildrootPages + + #endfor
- #end if - #if $buildrootStart > 0 - <<< - #end if - #if $totalBuildroots != 0 - Buildroots #echo $buildrootStart + 1 # through #echo $buildrootStart + $buildrootCount # of $totalBuildroots - #end if - #if $buildrootStart + $buildrootCount < $totalBuildroots - >>> - #end if + #endif + #if buildrootStart > 0 + <<< + #endif + #if totalBuildroots != 0 + Buildroots {{ buildrootStart + 1 }} through {{ buildrootStart + buildrootCount }} of {{ totalBuildroots }} + #endif + #if buildrootStart + buildrootCount < totalBuildroots + >>> + #endif - BuildrootID $util.sortImage($self, 'id') - Repo ID $util.sortImage($self, 'repo_id') - Task ID $util.sortImage($self, 'task_id') - Tag name $util.sortImage($self, 'tag_name') - State $util.sortImage($self, 'state') + BuildrootID {{ util.sortImage('id') }} + Repo ID {{ util.sortImage('repo_id') }} + Task ID {{ util.sortImage('task_id') }} + Tag name {{ util.sortImage('tag_name') }} + State {{ util.sortImage('state') }} - #if $len($buildroots) > 0 - #for $buildroot in $buildroots - - $buildroot.id - $buildroot.repo_id - $buildroot.task_id - $buildroot.tag_name - #set $stateName = $util.brStateName($buildroot.state) - $util.brStateImage($buildroot.state) + #if (buildroots |length) > 0 + #for buildroot in buildroots + + {{ buildroot.id }} + {{ buildroot.repo_id }} + {{ buildroot.task_id }} + {{ buildroot.tag_name }} + #set stateName = util.brStateName(buildroot.state) + {{ util.brStateImage(buildroot.state) }} - #end for + #endfor #else No buildroots - #end if + #endif - #if $len($buildrootPages) > 1 + #if (buildrootPages |length) > 1
Page: - + #for pageNum in buildrootPages + + #endfor
- #end if - #if $buildrootStart > 0 - <<< - #end if - #if $totalBuildroots != 0 - Buildroots #echo $buildrootStart + 1 # through #echo $buildrootStart + $buildrootCount # of $totalBuildroots - #end if - #if $buildrootStart + $buildrootCount < $totalBuildroots - >>> - #end if + #endif + #if buildrootStart > 0 + <<< + #endif + #if totalBuildroots != 0 + Buildroots {{ buildrootStart + 1 }} through {{ buildrootStart + buildrootCount }} of {{ totalBuildroots }} + #endif + #if buildrootStart + buildrootCount < totalBuildroots + >>> + #endif -#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/builds.chtml b/www/kojiweb/builds.chtml index 15ecd85d..f5ca0732 100644 --- a/www/kojiweb/builds.chtml +++ b/www/kojiweb/builds.chtml @@ -1,70 +1,67 @@ -#import koji -#from kojiweb import util -#attr _PASSTHROUGH = ['userID', 'tagID', 'packageID', 'order', 'prefix', 'state', 'inherited', 'latest', 'type'] +#set _PASSTHROUGH = ['userID', 'tagID', 'packageID', 'order', 'prefix', 'state', 'inherited', 'latest', 'type'] -#include "includes/header.chtml" +#include "includes/header2.chtml" -#@util.safe_return -#def getDescription() -#if $latest +#macro getDescription() +#if latest Latest -#elif $state != None -$util.stateName($state).capitalize() -#end if -#if $type -$type.capitalize() -#end if +#elif state != None +{{ util.stateName(state)|capitalize }} +#endif +#if type +{{ type|capitalize }} +#endif Builds -#if $package -of $package.name -#end if -#if $user -by $user.name -#end if -#if $prefix -starting with "$prefix" -#end if -#if $tag -in tag $tag.name -#end if -#end def +#if package +of {{ package.name }} +#endif +#if user +by {{ user.name }} +#endif +#if prefix +starting with "{{ prefix }}" +#endif +#if tag +in tag {{ tag.name }} +#endif +#endmacro -

$getDescription()

+

{{ getDescription() }}

- - - - - - #if $tag - - #end if - - - + + + #if tag + + #endif + + + - #if $len($builds) > 0 - #for $build in $builds - - - - #if $tag - - #end if - - - #set $stateName = $util.stateName($build.state) - + #if (builds |length) > 0 + #for build in builds + + + + #if tag + + #endif + + + #set stateName = util.stateName(build.state) + - #end for + #endfor #else - + - #end if + #endif -
+ @@ -72,119 +69,119 @@ in tag $tag.nameType: - #if $tag + #if tag - #end if + #endif
- #if $tag + #if tag Latest: - + + #else State: - - #for $stateOpt in ['BUILDING', 'COMPLETE', 'FAILED', 'CANCELED'] - - #end for + #for stateOpt in ['BUILDING', 'COMPLETE', 'FAILED', 'CANCELED'] + + #endfor - #end if + #endif Built by: - + + #if loggedInUser + + #endif + #for userOption in users + + #endfor
- + + #for btype in btypes + + #endfor Inherited: - + +
- #for $char in $chars - #if $prefix == $char - $char + + #for char in chars + #if prefix == char + {{ char }} #else - $char - #end if + {{ char }} + #endif | - #end for - #if $prefix - all + #endfor + #if prefix + all #else all - #end if + #endif
- #if $len($buildPages) > 1 + + #if (buildPages |length) > 1
Page: - + #for pageNum in buildPages + + #endfor
- #end if - #if $buildStart > 0 - <<< - #end if - #if $totalBuilds != 0 - Builds #echo $buildStart + 1 # through #echo $buildStart + $buildCount # of $totalBuilds - #end if - #if $buildStart + $buildCount < $totalBuilds - >>> - #end if + #endif + #if buildStart > 0 + <<< + #endif + #if totalBuilds != 0 + Builds {{ buildStart + 1 }} through {{ buildStart + buildCount }} of {{ totalBuilds }} + #endif + #if buildStart + buildCount < totalBuilds + >>> + #endif
ID $util.sortImage($self, 'build_id')NVR $util.sortImage($self, 'nvr')Tag $util.sortImage($self, 'tag_name')Built by $util.sortImage($self, 'owner_name')Finished $util.sortImage($self, 'completion_time')State $util.sortImage($self, 'state')ID {{ util.sortImage('build_id') }}NVR {{ util.sortImage('nvr') }}Tag {{ util.sortImage('tag_name') }}Built by {{ util.sortImage('owner_name') }}Finished {{ util.sortImage('completion_time') }}State {{ util.sortImage('state') }}
$build.build_id$koji.buildLabel($build)$build.tag_name$build.owner_name$util.formatTime($build.completion_time)$util.stateImage($build.state)
{{ build.build_id }}{{ koji.buildLabel(build) }}{{ build.tag_name }}{{ build.owner_name }}{{ util.formatTime(build.completion_time) }}{{ util.stateImage(build.state) }}
No buildsNo builds
- #if $len($buildPages) > 1 + + #if (buildPages |length) > 1
Page: - + #for pageNum in buildPages + + #endfor
- #end if - #if $buildStart > 0 - <<< - #end if - #if $totalBuilds != 0 - Builds #echo $buildStart + 1 # through #echo $buildStart + $buildCount # of $totalBuilds - #end if - #if $buildStart + $buildCount < $totalBuilds - >>> - #end if + #endif + #if buildStart > 0 + <<< + #endif + #if totalBuilds != 0 + Builds {{ buildStart + 1 }} through {{ buildStart + buildCount }} of {{ totalBuilds }} + #endif + #if buildStart + buildCount < totalBuilds + >>> + #endif
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildsbystatus.chtml b/www/kojiweb/buildsbystatus.chtml index e416f795..ccf112ed 100644 --- a/www/kojiweb/buildsbystatus.chtml +++ b/www/kojiweb/buildsbystatus.chtml @@ -1,36 +1,34 @@ -#from kojiweb import util -#@util.safe_return -#def printOption(value, label=None) -#if not $label -#set $label = $value -#end if - -#end def +#macro printOption(value, label=None) +#if not label +#set label = value +#endif + +#endmacro -#set $numTotal = $numSucceeded + $numFailed + $numCanceled +#set numTotal = numSucceeded + numFailed + numCanceled -#include "includes/header.chtml" +#include "includes/header2.chtml" -

Succeeded/Failed/Canceled Builds#if $days != -1 then ' in the last %i days' % $days else ''#

+

Succeeded/Failed/Canceled Builds{{ ' in the last %i days' % days if days != -1 else '' }}

@@ -42,24 +40,24 @@ - - + + - - + + - - + + - +
Show last days
Succeededgraph row$numSucceededgraph row{{ numSucceeded }}
Failedgraph row$numFailedgraph row{{ numFailed }}
Canceledgraph row$numCanceledgraph row{{ numCanceled }}
Total $numTotal{{ numTotal }}
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildsbytarget.chtml b/www/kojiweb/buildsbytarget.chtml index 44db702b..30335017 100644 --- a/www/kojiweb/buildsbytarget.chtml +++ b/www/kojiweb/buildsbytarget.chtml @@ -1,101 +1,98 @@ -#from kojiweb import util -#from urllib.parse import quote -#@util.safe_return -#def printOption(value, label=None) -#if not $label -#set $label = $value -#end if - -#end def +#macro printOption(value, label=None) +#if not label +#set label = value +#endif + +#endmacro -#include "includes/header.chtml" +#include "includes/header2.chtml" -

Builds by Target#if $days != -1 then ' in the last %i days' % $days else ''#

+

Builds by Target{{ ' in the last %i days' % days if days != -1 else '' }}

- - + + - #if $len($targets) > 0 - #for $target in $targets - - - - + #if (targets |length) > 0 + #for target in targets + + + + - #end for + #endfor #else - #end if + #endif
Show last - + {{ printOption(1) }} + {{ printOption(3) }} + {{ printOption(5) }} + {{ printOption(7) }} + {{ printOption(14) }} + {{ printOption(30) }} + {{ printOption(60) }} + {{ printOption(90) }} + {{ printOption(120) }} + {{ printOption(-1, 'all') }} days
- #if $len($targetPages) > 1 + #if (targetPages |length) > 1
Page: - + #for pageNum in targetPages + + #endfor
- #end if - #if $targetStart > 0 - <<< - #end if - #if $totalTargets != 0 - Build Targets #echo $targetStart + 1 # through #echo $targetStart + $targetCount # of $totalTargets - #end if - #if $targetStart + $targetCount < $totalTargets - >>> - #end if + #endif + #if targetStart > 0 + <<< + #endif + #if totalTargets != 0 + Build Targets {{ targetStart + 1 }} through {{ targetStart + targetCount }} of {{ totalTargets }} + #endif + #if targetStart + targetCount < totalTargets + >>> + #endif
Name $util.sortImage($self, 'name')Builds $util.sortImage($self, 'builds')Name {{ util.sortImage('name') }}Builds {{ util.sortImage('builds') }}  
$target.namegraph row$target.builds
{{ target.name }}graph row{{ target.builds }}
No builds
- #if $len($targetPages) > 1 + #if (targetPages |length) > 1
Page: - + #for pageNum in targetPages + + #endfor
- #end if - #if $targetStart > 0 - <<< - #end if - #if $totalTargets != 0 - Build Targets #echo $targetStart + 1 # through #echo $targetStart + $targetCount # of $totalTargets - #end if - #if $targetStart + $targetCount < $totalTargets - >>> - #end if + #endif + #if targetStart > 0 + <<< + #endif + #if totalTargets != 0 + Build Targets {{ targetStart + 1 }} through {{ targetStart + targetCount }} of {{ totalTargets }} + #endif + #if targetStart + targetCount < totalTargets + >>> + #endif
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildsbyuser.chtml b/www/kojiweb/buildsbyuser.chtml index 708c666e..000afd0c 100644 --- a/www/kojiweb/buildsbyuser.chtml +++ b/www/kojiweb/buildsbyuser.chtml @@ -1,73 +1,72 @@ -#from kojiweb import util -#include "includes/header.chtml" +#include "includes/header2.chtml"

Builds by User

- - + + - #if $len($userBuilds) > 0 - #for $userBuild in $userBuilds - - - - + #if (userBuilds |length) > 0 + #for userBuild in userBuilds + + + + - #end for + #endfor #else - #end if + #endif
- #if $len($userBuildPages) > 1 + #if (userBuildPages |length) > 1
Page: - + #for pageNum in userBuildPages + + #endfor
- #end if - #if $userBuildStart > 0 - <<< - #end if - #if $totalUserBuilds != 0 - Users #echo $userBuildStart + 1 # through #echo $userBuildStart + $userBuildCount # of $totalUserBuilds - #end if - #if $userBuildStart + $userBuildCount < $totalUserBuilds - >>> - #end if + #endif + #if userBuildStart > 0 + <<< + #endif + #if totalUserBuilds != 0 + Users {{ userBuildStart + 1 }} through {{ userBuildStart + userBuildCount }} of {{ totalUserBuilds }} + #endif + #if userBuildStart + userBuildCount < totalUserBuilds + >>> + #endif
Name $util.sortImage($self, 'name')Builds $util.sortImage($self, 'builds')Name {{ util.sortImage('name') }}Builds {{ util.sortImage('builds') }}  
$userBuild.namegraph row$userBuild.builds
{{ userBuild.name }}graph row{{ userBuild.builds }}
No users
- #if $len($userBuildPages) > 1 + #if (userBuildPages |length) > 1
Page: - + #for pageNum in userBuildPages + + #endfor
- #end if - #if $userBuildStart > 0 - <<< - #end if - #if $totalUserBuilds != 0 - Users #echo $userBuildStart + 1 # through #echo $userBuildStart + $userBuildCount # of $totalUserBuilds - #end if - #if $userBuildStart + $userBuildCount < $totalUserBuilds - >>> - #end if + #endif + #if userBuildStart > 0 + <<< + #endif + #if totalUserBuilds != 0 + Users {{ userBuildStart + 1 }} through {{ userBuildStart + userBuildCount }} of {{ totalUserBuilds }} + #endif + #if userBuildStart + userBuildCount < totalUserBuilds + >>> + #endif
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildtargetedit.chtml b/www/kojiweb/buildtargetedit.chtml index 493fe889..0b1b855a 100644 --- a/www/kojiweb/buildtargetedit.chtml +++ b/www/kojiweb/buildtargetedit.chtml @@ -1,38 +1,37 @@ -#from kojiweb import util -#include "includes/header.chtml" +#include "includes/header2.chtml" - #if $target -

Edit target $target.name

+ #if target +

Edit target {{ target.name }}

#else

Create build target

- #end if + #endif -
- $util.authToken($self, form=True) - #if $target - - #end if + + {{ util.authToken(form=True) }} + #if target + + #endif - #if $target + #if target - + - #end if + #endif @@ -41,23 +40,23 @@
Name - +
ID$target.idID{{ target.id }}
Build Tag
- #if $target + #if target #else - #end if + #endif
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildtargetinfo.chtml b/www/kojiweb/buildtargetinfo.chtml index 42a51f63..ebe00e1a 100644 --- a/www/kojiweb/buildtargetinfo.chtml +++ b/www/kojiweb/buildtargetinfo.chtml @@ -1,30 +1,28 @@ -#from kojiweb import util +#include "includes/header2.chtml" -#include "includes/header.chtml" - -

Information for target $target.name

+

Information for target {{ target.name }}

- + - + - + - + - #if 'admin' in $perms + #if "admin" in perms - + - + - #end if + #endif
Name$target.nameName{{ target.name }}
ID$target.idID{{ target.id }}
Build Tag$buildTag.nameBuild Tag{{ buildTag.name }}
Destination Tag$destTag.nameDestination Tag{{ destTag.name }}
EditEdit
DeleteDelete
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/buildtargets.chtml b/www/kojiweb/buildtargets.chtml index 775a8561..3dfa6e94 100644 --- a/www/kojiweb/buildtargets.chtml +++ b/www/kojiweb/buildtargets.chtml @@ -1,76 +1,75 @@ -#from kojiweb import util -#include "includes/header.chtml" +#include "includes/header2.chtml"

Build Targets

- - + + - #if $len($targets) > 0 - #for $target in $targets - - - + #if (targets |length) > 0 + #for target in targets + + + - #end for + #endfor #else - #end if + #endif
- #if $len($targetPages) > 1 + #if (targetPages |length) > 1
Page: - + #for pageNum in targetPages + + #endfor
- #end if - #if $targetStart > 0 - <<< - #end if - #if $totalTargets != 0 - Targets #echo $targetStart + 1 # through #echo $targetStart + $targetCount # of $totalTargets - #end if - #if $targetStart + $targetCount < $totalTargets - >>> - #end if + #endif + #if targetStart > 0 + <<< + #endif + #if totalTargets != 0 + Targets {{ targetStart + 1 }} through {{ targetStart + targetCount }} of {{ totalTargets }} + #endif + #if targetStart + targetCount < totalTargets + >>> + #endif
ID $util.sortImage($self, 'id')Name $util.sortImage($self, 'name')ID {{ util.sortImage('id') }}Name {{ util.sortImage('name') }}
$target.id$target.name
{{ target.id }}{{ target.name }}
No build targets
- #if $len($targetPages) > 1 + #if (targetPages |length) > 1
Page: - + #for pageNum in targetPages + + #endfor
- #end if - #if $targetStart > 0 - <<< - #end if - #if $totalTargets != 0 - Targets #echo $targetStart + 1 # through #echo $targetStart + $targetCount # of $totalTargets - #end if - #if $targetStart + $targetCount < $totalTargets - >>> - #end if + #endif + #if targetStart > 0 + <<< + #endif + #if totalTargets != 0 + Targets {{ targetStart + 1 }} through {{ targetStart + targetCount }} of {{ totalTargets }} + #endif + #if targetStart + targetCount < totalTargets + >>> + #endif
- #if 'admin' in $perms + #if 'admin' in perms
- Create new Build Target - #end if + Create new Build Target + #endif -#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/channelinfo.chtml b/www/kojiweb/channelinfo.chtml index 15c5d33b..173e3b34 100644 --- a/www/kojiweb/channelinfo.chtml +++ b/www/kojiweb/channelinfo.chtml @@ -1,60 +1,59 @@ -#from kojiweb import util -#include "includes/header.chtml" +#include "includes/header2.chtml" -

Information for channel $channel.name

+

Information for channel {{ channel.name }}

- + - + - + - #set $enabled = $channel.enabled and 'yes' or 'no' + #set enabled = channel.enabled and 'yes' or 'no' - - + - +
Name$channel.nameName{{ channel.name }}
ID$channel.idID{{ channel.id }}
Description$channel.descriptionDescription{{ channel.description }}
Enabled? - $util.imageTag($enabled) + + {{ util.imageTag(enabled) }}
Comment$channel.commentComment{{ channel.comment }}
Active Tasks$taskCountActive Tasks{{ taskCount }}
Hosts - #if $len($hosts) > 0 + #if hosts | length > 0 - #for $host in $hosts - - - - + #for host in hosts + + + + - #end for + #endfor - - + +
Hostname Enabled Ready
$host.name#if $host.enabled then $util.imageTag('yes') else $util.imageTag('no')##if $host.ready then $util.imageTag('yes') else $util.imageTag('no')#
{{ host.name }}{{ util.imageTag('yes') if host.enabled else util.imageTag('no') }}{{ util.imageTag('yes') if host.ready else util.imageTag('no') }}
Total$enabled_hosts$ready_hosts{{ enabled_hosts }}{{ ready_hosts }}
#else No hosts - #end if + #endif
-#include "includes/footer.chtml" +#include "includes/footer2.chtml" diff --git a/www/kojiweb/clusterhealth.chtml b/www/kojiweb/clusterhealth.chtml index b83ba104..e4f92b80 100644 --- a/www/kojiweb/clusterhealth.chtml +++ b/www/kojiweb/clusterhealth.chtml @@ -1,14 +1,12 @@ -#from kojiweb import util -#@util.safe_return -#def printOption(value, label=None) -#if not $label -#set $label = $value -#end if - -#end def +#macro printOption(value, label=None) +#if not label +#set label = value +#endif + +#endmacro -#include "includes/header.chtml" +#include "includes/header2.chtml"