Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto updates: add support for source arrays. #23678

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TomJo2000
Copy link
Member

@TomJo2000 TomJo2000 commented Mar 8, 2025

I'd also like to try and make an auto-update function for this.
But I'll need to think of a good way to query the latest major version of the Kernel for that.
Maybe git ls-remote on Linus' tree?

@TomJo2000 TomJo2000 requested a review from Grimler91 as a code owner March 8, 2025 16:09
@TomJo2000 TomJo2000 force-pushed the mp613 branch 2 times, most recently from 387e623 to e6f8dd3 Compare March 8, 2025 19:08
@@ -69,7 +69,7 @@ termux_pkg_upgrade_version() {
echo "INFO: package being updated to ${LATEST_VERSION}."

sed \
-e "s/^\(TERMUX_PKG_VERSION=\)\(.*\)\$/\1\"${EPOCH}${LATEST_VERSION}\"/g" \
-e "s/^\(TERMUX_PKG_VERSION=\(?\)\(.*\)\$/\1\"${EPOCH}${LATEST_VERSION}\"/g" \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts/updates/utils/termux_pkg_upgrade_version.sh doesn't currently "support" version arrays.
So this works by adding a stupid little work around to make it work with the first line of an array.
I'll borrow some code from lint-packages when I add array support "properly".

check_indentation() {
local pkg_script="$1"
local line='' heredoc_terminator='' in_array=0 i=0
local -a issues=('' '') bad_lines=('FAILED')
# parse leading whitespace
while IFS=$'\n' read -r line; do
((i++))
# make sure it's a heredoc, not a herestring
if ! [[ "$line" == *'<<<'* ]]; then
# Skip this check in entirely within heredocs
# (see packages/ghc-libs for an example of why)
[[ "$line" =~ [^\(]\<{2}-?[\'\"]?([^\'\"]+) ]] && {
heredoc_terminator="${BASH_REMATCH[1]}"
}
(( ${#heredoc_terminator} )) && \
grep -qP "^\s*${heredoc_terminator}" <<< "$line" && {
heredoc_terminator=''
}
(( ${#heredoc_terminator} )) && continue
fi
# check for mixed indentation
grep -qP '^(\t+ +| +\t+)' <<< "$line" && {
issues[0]='Mixed indentation'
bad_lines[$i]="${pkg_script}:${i}:$line"
}
[[ "$line" == *'=('* ]] && in_array=1
if (( ! in_array )); then # spaces for indentation are okay for aligning arrays
grep -qP '^ +' <<< "$line" && { # check for spaces as indentation
issues[1]='Use tabs for indentation'
bad_lines[$i]="${pkg_script}:${i}:$line"
}
fi
[[ "$line" == *')' ]] && in_array=0
done < "$pkg_script"
# if we found problems print them out and throw an error
(( ${#issues[0]} || ${#issues[1]} )) && {
printf '%s\n' "${bad_lines[@]}"
printf '%s\n' "${issues[@]}"
return 1
}
return 0
}

@TomJo2000 TomJo2000 marked this pull request as draft March 8, 2025 19:18
@TomJo2000
Copy link
Member Author

Making this a draft since apparently this has turned into "add array support to auto updates".

@TomJo2000 TomJo2000 changed the title bump(main/manpages): 6.13 Auto updates: add support for source arrays. Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant