def build_package(builder_image, package_type, version, out_dir, dependencies):
"""
Build a deb or RPM package using a fpm-within-docker Docker image.
:param package_type str: "rpm" or "deb".
:param version str: The package version.
:param out_dir Path: Directory where package will be output.
:param dependencies list: package names the resulting package should depend
on.
"""
run([
"docker", "run", "--rm", "-e", "PACKAGE_VERSION=" + version,
"-e", "PACKAGE_TYPE=" + package_type,
"-v", "{}:/build-inside:rw".format(THIS_DIRECTORY),
"-v", "{}:/source:rw".format(THIS_DIRECTORY.parent),
"-v", str(out_dir) + ":/out", "-w", "/build-inside", builder_image,
"/build-inside/build-package.sh", *dependencies
],
check=True)
评论列表
文章目录