'installables_tar' in toolchain_container overriders all other debs. (#34)
diff --git a/WORKSPACE b/WORKSPACE
index 6aa52f8..7a8a7cb 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -92,9 +92,9 @@
http_archive(
name = "debian_docker",
- sha256 = "44ad4c5f21771926350f1976d0e4300d9149622c6d4484378a3d00d232c0eb8f",
- strip_prefix = "base-images-docker-d5313e6a3f6d277490148df35c6716e65af5aa57",
- urls = ["https://github.com/GoogleCloudPlatform/base-images-docker/archive/d5313e6a3f6d277490148df35c6716e65af5aa57.tar.gz"],
+ sha256 = "d17612c25ee9e5985641beb2a1cb56f9d4332d69b22ca27f3c95a456b5e4ab6c",
+ strip_prefix = "base-images-docker-6360d9a3f781a0fa2cd7f7a91d3dcd7941b74026",
+ urls = ["https://github.com/GoogleCloudPlatform/base-images-docker/archive/6360d9a3f781a0fa2cd7f7a91d3dcd7941b74026.tar.gz"],
)
http_file(
diff --git a/container/rules/docker_toolchains.bzl b/container/rules/docker_toolchains.bzl
index ce74833..9c468be 100644
--- a/container/rules/docker_toolchains.bzl
+++ b/container/rules/docker_toolchains.bzl
@@ -66,12 +66,14 @@
packages = packages or ctx.attr.packages
additional_repos = additional_repos or ctx.attr.additional_repos
installables_tars = installables_tars or []
- if installables_tars == [] and ctx.file.installables_tar:
- installables_tars = [ctx.file.installables_tar]
installation_cleanup_commands = installation_cleanup_commands or ctx.attr.installation_cleanup_commands
- # Download packages if packages list is not empty.
- if packages != []:
+ # If ctx.file.installables_tar is specified, ignore 'packages' and other tars in installables_tars.
+ if ctx.file.installables_tar:
+ installables_tars = [ctx.file.installables_tar]
+ # Otherwise, download packages if packages list is not empty, and add the tar of downloaded
+ # debs to installables_tars.
+ elif packages != []:
# Declare intermediate output file generated by download_pkgs rule.
download_pkgs_output_executable = ctx.actions.declare_file(ctx.attr.name + "-download_pkgs_output_executable.sh")
download_pkgs_output_tar = ctx.actions.declare_file(ctx.attr.name + "-download_pkgs_output_tar.tar")
@@ -100,27 +102,27 @@
if tar:
installables_tars_paths.append(tar.path)
- # Declare intermediate output file generated by install_pkgs rule.
- combined_installables_tar = ctx.actions.declare_file(ctx.attr.name + "-packages.tar")
+ # Declare file for final tarball of debian packages to install.
+ final_installables_tar = ctx.actions.declare_file(ctx.attr.name + "-packages.tar")
# Combine all installables_tars into one tar. install_pkgs only takes a
# single installables_tar as input.
ctx.actions.run_shell(
inputs=installables_tars,
- outputs=[combined_installables_tar],
+ outputs=[final_installables_tar],
command="tar cvf {output_tar} --files-from /dev/null && tar --concatenate -v --file={output_tar} {input_tars}".format(
- output_tar=combined_installables_tar.path,
+ output_tar=final_installables_tar.path,
input_tars=' '.join(installables_tars_paths)
),
)
# Declare intermediate output file generated by install_pkgs rule.
install_pkgs_out = ctx.actions.declare_file(ctx.attr.name + "-with-packages.tar")
- # install_pkgs rule consumes 'combined_installables_tar' and 'installation_cleanup_commands'.
+ # install_pkgs rule consumes 'final_installables_tar' and 'installation_cleanup_commands'.
_install.implementation(
ctx,
image_tar=ctx.files.base[0],
- installables_tar= combined_installables_tar,
+ installables_tar= final_installables_tar,
installation_cleanup_commands = installation_cleanup_commands,
output_image_name = ctx.attr.name + "-with-packages",
output_tar=install_pkgs_out
@@ -235,8 +237,6 @@
symlinks.update(ctx.attr.symlinks)
packages.extend(ctx.attr.packages)
additional_repos.extend(ctx.attr.additional_repos)
- if ctx.file.installables_tar:
- installables_tars.append(ctx.file.installables_tar)
if ctx.attr.installation_cleanup_commands:
installation_cleanup_commands += (" && " + ctx.attr.installation_cleanup_commands)
@@ -282,6 +282,10 @@
installation_cleanup_commands: cleanup commands to run after package
installation.
+ If 'installables_tar' is specified in the 'toolchain_container' rule, then
+ 'packages' or 'installables_tar' specified in any of the 'language_layers'
+ passed to this 'toolchain_container' rule will be ignored.
+
Experimental rule.
"""