From a85a2de3b3bdb8a2ab3bcc5a3dbe297f9b22dd7c Mon Sep 17 00:00:00 2001 From: Andrew Walsh Date: Thu, 14 Jul 2022 21:23:42 -0700 Subject: [PATCH] Update installation to consider symlinks as well. Addresses problem raised in #25 --- action.yml | 5 +++-- install_and_cache_pkgs.sh | 13 ++----------- lib.sh | 9 ++++++++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/action.yml b/action.yml index 9cd2164..ee46a33 100644 --- a/action.yml +++ b/action.yml @@ -57,6 +57,7 @@ runs: / \ "${{ steps.load-cache.outputs.cache-hit }}" \ ${{ inputs.packages }} - echo "::set-output name=package-version-list::$(cat ~/cache-apt-pkgs/manifest_main.log)" - echo "::set-output name=all-package-version-list::$(cat ~/cache-apt-pkgs/manifest_all.log)" + function create_list { local list=$(cat ~/cache-apt-pkgs/manifest_${1}.log | tr '\n' ','); echo ${list:0:-1}; }; + echo "::set-output name=package-version-list::$(create_list main)" + echo "::set-output name=all-package-version-list::$(create_list all)" shell: bash diff --git a/install_and_cache_pkgs.sh b/install_and_cache_pkgs.sh index 1d420b2..1049d9b 100755 --- a/install_and_cache_pkgs.sh +++ b/install_and_cache_pkgs.sh @@ -75,14 +75,5 @@ for package in ${normalized_packages}; do done log "done." -manifest_all_filepath="${cache_dir}/manifest_all.log" -log "Writing all packages manifest to ${manifest_all_filepath}..." -# Remove trailing comma and write to manifest_all file. -echo "${manifest_all:0:-1}" > "${manifest_all_filepath}" -log "done." - -manifest_main_filepath="${cache_dir}/manifest_main.log" -log "Writing main requested packages manifest to ${manifest_main_filepath}..." -# Remove trailing comma and write to manifest_main file. -echo "${manifest_main:0:-1}" > "${manifest_main_filepath}" -log "done." +write_manifest "all" "${manifest_all}" "${cache_dir}/manifest_all.log" +write_manifest "main" "${manifest_main}" "${cache_dir}/manifest_main.log" diff --git a/lib.sh b/lib.sh index fc8eb1e..74255ca 100755 --- a/lib.sh +++ b/lib.sh @@ -27,4 +27,11 @@ function get_package_name_ver { echo "${name}" "${ver}" } -function log { echo "$(date +%H:%M:%S)" "${@}"; } \ No newline at end of file +function log { echo "$(date +%H:%M:%S)" "${@}"; } + +function write_manifest { + log "Writing ${1} packages manifest to ${3}..." + # 0:-1 to remove trailing comma, delimit by newline and sort + echo "${2:0:-1}" | tr ',' '\n' | sort > ${3} + log "done." +} \ No newline at end of file