Skip to content

Commit

Permalink
make downloading and installing quiet (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptarjan authored Apr 1, 2021
1 parent 08cddcc commit 6c3c59b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
11 changes: 4 additions & 7 deletions docker/package_managers/download_pkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,29 @@ def _generate_add_additional_repo_commands(ctx, additional_repos):

def _generate_download_commands(ctx, packages, additional_repos):
return """#!/usr/bin/env bash
set -ex
set -e
{add_additional_repo_commands}
# Remove /var/lib/apt/lists/* in the base image. apt-get update -y command will create them.
rm -rf /var/lib/apt/lists/*
# Fetch Index
apt-get update -y
apt-get update -y -qq
# Make partial dir
mkdir -p /tmp/install/./partial
# Install command
apt-get install --no-install-recommends -y -q -o Dir::Cache="/tmp/install" -o Dir::Cache::archives="." {packages} --download-only
apt-get install --no-install-recommends -y -qq -o Dir::Cache="/tmp/install" -o Dir::Cache::archives="." {packages} --download-only
items=$(ls /tmp/install/*.deb)
if [ $items = "" ]; then
if [ -z "$items" ]; then
echo "Did not find the .deb files for debian packages {packages} in /tmp/install. Did apt-get actually succeed?" && false
fi
# Generate csv listing the name & versions of the debian packages.
# Example contents of a metadata CSV with debian packages gcc 8.1 & clang 9.1:
# Name,Version
# gcc,7.1
# clang,9.1
echo "Generating metadata CSV file {installables}_metadata.csv"
echo Name,Version > {installables}_metadata.csv
dpkg_deb_path=$(which dpkg-deb)
for item in $items; do
echo "Adding information about $item to metadata CSV"
pkg_name=$($dpkg_deb_path -f $item Package)
if [ $pkg_name = "" ]; then
echo "Failed to get name of the package for $item" && false
Expand All @@ -60,7 +58,6 @@ for item in $items; do
if [ $pkg_version = "" ]; then
echo "Failed to get the version of the package for $item" && false
fi
echo "Package $pkg_name, Version $pkg_version"
echo -n "$pkg_name," >> {installables}_metadata.csv
echo $pkg_version >> {installables}_metadata.csv
done;
Expand Down
2 changes: 1 addition & 1 deletion docker/package_managers/installer.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This script installs debs in installables.tar through dpkg and apt-get.
# It expects to be volume-mounted inside a docker image, in /tmp/pkginstall
# along with the installables.tar.
set -ex
set -e
pushd /tmp/pkginstall
%{install_commands}
popd
Expand Down
2 changes: 1 addition & 1 deletion docker/package_managers/run_download.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -ex
set -e

function guess_runfiles() {
if [ -d ${BASH_SOURCE[0]}.runfiles ]; then
Expand Down
2 changes: 1 addition & 1 deletion docker/package_managers/run_install.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -ex
set -e

# Resolve the docker tool path
DOCKER="%{docker_tool_path}"
Expand Down
2 changes: 1 addition & 1 deletion docker/util/commit_layer.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -e

# Load utils
source %{util_script}
Expand Down
2 changes: 1 addition & 1 deletion docker/util/extract.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -e

# Resolve the docker tool path
DOCKER="%{docker_tool_path}"
Expand Down

0 comments on commit 6c3c59b

Please sign in to comment.