Skip to content

Commit

Permalink
fix({build,package}.sh): log previously installed pacdeps as such (pa…
Browse files Browse the repository at this point in the history
…cstall#1108)

Co-authored-by: ook37 <[email protected]>
Co-authored-by: Elsie <[email protected]>
  • Loading branch information
3 people authored May 7, 2024
1 parent 92273a1 commit 6ee8815
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion misc/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}\""
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions misc/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down

0 comments on commit 6ee8815

Please sign in to comment.