-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
base: master
Are you sure you want to change the base?
Conversation
387e623
to
e6f8dd3
Compare
@@ -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" \ |
There was a problem hiding this comment.
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".
termux-packages/scripts/lint-packages.sh
Lines 73 to 120 in 89853e9
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 | |
} |
Making this a draft since apparently this has turned into "add array support to auto updates". |
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?