From 6ee88156aed8b182a8a4795e009b0d415d59cae5 Mon Sep 17 00:00:00 2001 From: oklopfer <104327997+oklopfer@users.noreply.github.com> Date: Tue, 7 May 2024 18:30:13 -0400 Subject: [PATCH] fix({build,package}.sh): log previously installed pacdeps as such (#1108) Co-authored-by: ook37 Co-authored-by: Elsie --- misc/scripts/build.sh | 13 ++++++++++++- misc/scripts/package.sh | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/misc/scripts/build.sh b/misc/scripts/build.sh index 5b72208ba..fe6830466 100755 --- a/misc/scripts/build.sh +++ b/misc/scripts/build.sh @@ -677,6 +677,17 @@ function repacstall() { install_deb } +function check_if_pacdep() { + local package="${1}" finddir="${2}" found + found="$(find "${finddir}" -type f -exec awk -v pkg="${package}" ' + $0 ~ "_pacdeps=\\(\\[" "[0-9]+" "\\]=\"" pkg "\"" { + found = 1 + } END { + if (!found) {exit 1} + }' {} \; -print)" + [[ ${found} ]] && return 0 || return 1 +} + function write_meta() { echo "_name=\"$pkgname\"" echo "_version=\"${full_version}\"" @@ -697,7 +708,7 @@ function write_meta() { if [[ -n $gives ]]; then echo "_gives=\"$gives\"" fi - if [[ -f /tmp/pacstall-pacdeps-"$pkgname" ]]; then + if [[ -f /tmp/pacstall-pacdeps-"$pkgname" ]] || check_if_pacdep "${pkgname}" "${METADIR}"; then echo '_pacstall_depends="true"' fi if [[ $local == 'no' ]]; then diff --git a/misc/scripts/package.sh b/misc/scripts/package.sh index c25ac2a56..72f4787d0 100755 --- a/misc/scripts/package.sh +++ b/misc/scripts/package.sh @@ -222,6 +222,9 @@ if [[ -n $pacdeps ]]; then fi else fancy_message info "The pacstall dependency ${i} is already installed and at latest version" + if ! awk '/_pacstall_depends="true"/ {found=1; exit} END {if (found != 1) exit 1}' "${METADIR}/${i}"; then + echo '_pacstall_depends="true"' | sudo tee -a "${METADIR}/${i}" > /dev/null + fi fi elif fancy_message info "Installing dependency ${PURPLE}${i}${NC}" && ! pacstall "$cmd" "${i}${repo}"; then fancy_message error "Failed to install dependency (${i} from ${PACKAGE})"