Commit c2d94a5b authored by Tomas Krizek's avatar Tomas Krizek
Browse files

Merge branch 'fixes' into 'master'

small fixes found during BIRD packaging

See merge request !34
parents e630752e 153ca8a4
Pipeline #79170 passed with stages
in 2 minutes and 28 seconds
......@@ -43,6 +43,8 @@ def build_package(
# make source package
infiles = _srcpkg.make_srcpkg(
archive=archive,
input_files=input_files,
input_file_lists=input_file_lists,
version=version,
release=release,
distro=distro,
......
......@@ -57,6 +57,11 @@ def parse_input_files(files, file_lists):
utility to parse apkg input files and input file lists
into a single list of input files
"""
if not files:
files = []
if not file_lists:
file_lists = []
all_files = [Path(f) for f in files]
if len([fl for fl in file_lists if fl == '-']) > 1:
......
......@@ -12,6 +12,12 @@ import apkg.util.shutil35 as shutil
log = getLogger(__name__)
def default_render_filter(path):
if str(path).endswith('.patch'):
return False
return True
class PackageTemplate:
def __init__(self, path, style=None):
self.path = Path(path)
......@@ -23,7 +29,8 @@ class PackageTemplate:
self.style = _pkgstyle.get_pkgstyle_for_template(self.path)
return self.style
def render(self, out_path, env):
def render(self, out_path, env,
render_filter=default_render_filter):
"""
render package template into specified output directory
"""
......@@ -42,9 +49,15 @@ class PackageTemplate:
for fn in files:
dst = out_path / rel_dir / fn
src = Path(d) / fn
log.verbose("rendering file: %s -> %s", src, dst)
t = None
with src.open('r') as srcf:
t = jinja2.Template(srcf.read())
with dst.open('w') as dstf:
dstf.write(t.render(**env) + '\n')
# TODO: filtering should be exposed through config files
if render_filter(src):
log.verbose("rendering file: %s -> %s", src, dst)
t = None
with src.open('r') as srcf:
t = jinja2.Template(srcf.read())
with dst.open('w') as dstf:
dstf.write(t.render(**env) + '\n')
else:
log.verbose(
"copying file without render: %s -> %s", src, dst)
shutil.copyfile(src, dst)
......@@ -18,6 +18,6 @@ RUN apt-get install -y -qqq python3-pbr python3-jinja2 python3-docopt python3-bl
# non-python deps
RUN apt-get install -y -qqq git atool
# deps not available in distro
RUN pip3 install htmllistparse
RUN pip3 install distro htmllistparse
# testing deps
RUN apt-get install -y -qqq tox python3-pytest python3-pytest-cov python3-pytest-catchlog
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment