-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Auto updates: add support for source arrays. #23678
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
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 | |
} |
ebe8798
to
0d59482
Compare
Making this a draft since apparently this has turned into "add array support to auto updates". |
local latest_kernel_major | ||
latest_kernel_major="$(git ls-remote --tags https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git \ | ||
| grep -oP "refs/tags/v\K${TERMUX_PKG_UPDATE_VERSION_REGEXP}$" \ | ||
| sort -V \ | ||
| tail -n1)" | ||
|
||
# No new major release. | ||
if [[ "${latest_kernel_major}" == "${TERMUX_PKG_VERSION[0]}" ]]; then | ||
echo "INFO: No update needed. Already at version '${TERMUX_PKG_VERSION[0]}'." | ||
return | ||
fi | ||
|
||
# Verify that this major updated the man pages | ||
curl -fsSL "https://www.kernel.org/pub/linux/docs/man-pages/man-pages-${latest_kernel_major}.tar.sign" &> /dev/null || { | ||
echo "Info: Not updating. Linux ${latest_kernel_major} doesn't seem to have updates the man pages." | ||
} | ||
|
||
termux_pkg_upgrade_version "${latest_kernel_major}" |
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.
local latest_kernel_major | |
latest_kernel_major="$(git ls-remote --tags https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git \ | |
| grep -oP "refs/tags/v\K${TERMUX_PKG_UPDATE_VERSION_REGEXP}$" \ | |
| sort -V \ | |
| tail -n1)" | |
# No new major release. | |
if [[ "${latest_kernel_major}" == "${TERMUX_PKG_VERSION[0]}" ]]; then | |
echo "INFO: No update needed. Already at version '${TERMUX_PKG_VERSION[0]}'." | |
return | |
fi | |
# Verify that this major updated the man pages | |
curl -fsSL "https://www.kernel.org/pub/linux/docs/man-pages/man-pages-${latest_kernel_major}.tar.sign" &> /dev/null || { | |
echo "Info: Not updating. Linux ${latest_kernel_major} doesn't seem to have updates the man pages." | |
} | |
termux_pkg_upgrade_version "${latest_kernel_major}" | |
# get the page, find all filenames, sort by version and get the last line | |
local latest="$(curl -s https://www.kernel.org/pub/linux/docs/man-pages/ \ | |
| grep -oP 'man-pages-\K[0-9]+(\.[0-9]+)*' \ | |
| sort -V -u \ | |
| tail -n1)" | |
termux_pkg_upgrade_version "${latest}" |
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.
Heh.
local latest_kernel_major | |
latest_kernel_major="$(git ls-remote --tags https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git \ | |
| grep -oP "refs/tags/v\K${TERMUX_PKG_UPDATE_VERSION_REGEXP}$" \ | |
| sort -V \ | |
| tail -n1)" | |
# No new major release. | |
if [[ "${latest_kernel_major}" == "${TERMUX_PKG_VERSION[0]}" ]]; then | |
echo "INFO: No update needed. Already at version '${TERMUX_PKG_VERSION[0]}'." | |
return | |
fi | |
# Verify that this major updated the man pages | |
curl -fsSL "https://www.kernel.org/pub/linux/docs/man-pages/man-pages-${latest_kernel_major}.tar.sign" &> /dev/null || { | |
echo "Info: Not updating. Linux ${latest_kernel_major} doesn't seem to have updates the man pages." | |
} | |
termux_pkg_upgrade_version "${latest_kernel_major}" | |
read -r latest < <(curl -fsSL https://www.kernel.org/pub/linux/docs/man-pages/ | sed -rn 's/.*man-pages-([0-9]+(\.[0-9]+)*).*/\1/p' | sort -Vr); | |
termux_pkg_upgrade_version "${latest}" |
sed -r \ | ||
-e "s/^(TERMUX_PKG_VERSION=\(?)(.*)\$/\1\"${EPOCH}${LATEST_VERSION}\"/g" \ | ||
-e "/TERMUX_PKG_REVISION=/d" \ | ||
-i "${TERMUX_PKG_BUILDER_DIR}/build.sh" |
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.
Probably I found it out, but it is a literal nightmare.
sed -r \ | |
-e "s/^(TERMUX_PKG_VERSION=\(?)(.*)\$/\1\"${EPOCH}${LATEST_VERSION}\"/g" \ | |
-e "/TERMUX_PKG_REVISION=/d" \ | |
-i "${TERMUX_PKG_BUILDER_DIR}/build.sh" | |
sed -z -r \ | |
-e "s/(TERMUX_PKG_VERSION=\(?[[:space:]]*)[^[:space:]\)]+/\1\"${EPOCH}${LATEST_VERSION}\"/" \ | |
-e "s/(^|\n)TERMUX_PKG_REVISION=[^\n]*(\n|$)/\1/" \ | |
-i "${TERMUX_PKG_BUILDER_DIR}/build.sh" |
Or it you think perl is better
perl -0777 -i -pe '
s/^TERMUX_PKG_REVISION=.*\n//mg;
s{(TERMUX_PKG_VERSION=\(?\s*)[^)\s]+}{
qq{$1"'"${EPOCH}${LATEST_VERSION}"'"}
}em
' "${TERMUX_PKG_BUILDER_DIR}/build.sh"
tests.sh
Not my best work but it did the job.
#!/bin/bash
temp_dir=$(mktemp -d) || { echo failed to create temp directory; exit 1; }
cd "${temp_dir}"
LATEST_VERSION=6.18
EPOCH01=
cat << EOF > build.sh.01
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(6.13
2017)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.01
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=("6.18"
2017)
TERMUX_PKG_SHA256=(
EOF
EPOCH02=
cat << EOF > build.sh.02
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(6.13 2017)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.02
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=("6.18" 2017)
TERMUX_PKG_SHA256=(
EOF
EPOCH03=
cat << EOF > build.sh.03
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
6.13
2017
)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.03
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"6.18"
2017
)
TERMUX_PKG_SHA256=(
EOF
EPOCH04=
cat << EOF > build.sh.04
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
6.13
2017
)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.04
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"6.18"
2017
)
TERMUX_PKG_SHA256=(
EOF
EPOCH05=
cat << EOF > build.sh.05
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
6.13 2017
)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.05
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"6.18" 2017
)
TERMUX_PKG_SHA256=(
EOF
EPOCH06=
cat << EOF > build.sh.06
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
6.13 2017)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.06
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"6.18" 2017)
TERMUX_PKG_SHA256=(
EOF
EPOCH07=
cat << EOF > build.sh.07
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"6.13" 2017)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.07
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"6.18" 2017)
TERMUX_PKG_SHA256=(
EOF
EPOCH08=3:
cat << EOF > build.sh.08
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
3:6.13 2017)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.08
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"3:6.18" 2017)
TERMUX_PKG_SHA256=(
EOF
EPOCH09=3:
cat << EOF > build.sh.09
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
3:6.13 2017)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.09
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"3:6.18" 2017)
TERMUX_PKG_SHA256=(
EOF
EPOCH10=3:
cat << EOF > build.sh.10
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
3:6.13 2017
)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.10
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"3:6.18" 2017
)
TERMUX_PKG_SHA256=(
EOF
EPOCH11=3:
cat << EOF > build.sh.11
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"3:6.13" 2017
)
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.11
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=(
"3:6.18" 2017
)
TERMUX_PKG_SHA256=(
EOF
EPOCH12=3:
cat << EOF > build.sh.12
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="3:6.13"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.12
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="3:6.18"
TERMUX_PKG_SHA256=(
EOF
EPOCH13=3:
cat << EOF > build.sh.13
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3:6.13
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=(
EOF
cat << EOF > expected.build.sh.13
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="3:6.18"
TERMUX_PKG_SHA256=(
EOF
for i in build.sh.*; do
var="EPOCH${i##*.}"
EPOCH="${!var}"
false && \
perl -0777 -i -pe '
s/^TERMUX_PKG_REVISION=.*\n//mg;
s{(TERMUX_PKG_VERSION=\(?\s*)[^)\s]+}{
qq{$1"'"${EPOCH}${LATEST_VERSION}"'"}
}em
' "$i"
sed -z -r -i \
-e "s/(TERMUX_PKG_VERSION=\(?[[:space:]]*)[^[:space:]\)]+/\1\"${EPOCH}${LATEST_VERSION}\"/" \
-e "s/(^|\n)TERMUX_PKG_REVISION=[^\n]*(\n|$)/\1/" \
"$i"
if diff -Naur "$i" "expected.$i"; then
echo "test ${i##*.} passed"
else
echo "test ${i##*.} failed"
fi
done
cd - &>-
rm -rf "${temp_dir}"
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.
But I did not test the sed and perl commands on real buildscripts, only in this synthetic test.
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.
Probably I found it out, but it is a literal nightmare.
Suggested change
sed -r \ -e "s/^(TERMUX_PKG_VERSION=\(?)(.*)\$/\1\"${EPOCH}${LATEST_VERSION}\"/g" \ -e "/TERMUX_PKG_REVISION=/d" \ -i "${TERMUX_PKG_BUILDER_DIR}/build.sh" sed -z -r \ -e "s/(TERMUX_PKG_VERSION=\(?[[:space:]]*)[^[:space:]\)]+/\1\"${EPOCH}${LATEST_VERSION}\"/" \ -e "s/(^|\n)TERMUX_PKG_REVISION=[^\n]*(\n|$)/\1/" \ -i "${TERMUX_PKG_BUILDER_DIR}/build.sh" Or it you think perl is better
perl -0777 -i -pe ' s/^TERMUX_PKG_REVISION=.*\n//mg; s{(TERMUX_PKG_VERSION=\(?\s*)[^)\s]+}{ qq{$1"'"${EPOCH}${LATEST_VERSION}"'"} }em ' "${TERMUX_PKG_BUILDER_DIR}/build.sh"
tests.sh
Not my best work but it did the job.
#!/bin/bash temp_dir=$(mktemp -d) || { echo failed to create temp directory; exit 1; } cd "${temp_dir}" LATEST_VERSION=6.18 EPOCH01= cat << EOF > build.sh.01 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=(6.13 2017) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.01 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=("6.18" 2017) TERMUX_PKG_SHA256=( EOF EPOCH02= cat << EOF > build.sh.02 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=(6.13 2017) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.02 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=("6.18" 2017) TERMUX_PKG_SHA256=( EOF EPOCH03= cat << EOF > build.sh.03 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 6.13 2017 ) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.03 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "6.18" 2017 ) TERMUX_PKG_SHA256=( EOF EPOCH04= cat << EOF > build.sh.04 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 6.13 2017 ) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.04 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "6.18" 2017 ) TERMUX_PKG_SHA256=( EOF EPOCH05= cat << EOF > build.sh.05 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 6.13 2017 ) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.05 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "6.18" 2017 ) TERMUX_PKG_SHA256=( EOF EPOCH06= cat << EOF > build.sh.06 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 6.13 2017) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.06 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "6.18" 2017) TERMUX_PKG_SHA256=( EOF EPOCH07= cat << EOF > build.sh.07 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "6.13" 2017) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.07 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "6.18" 2017) TERMUX_PKG_SHA256=( EOF EPOCH08=3: cat << EOF > build.sh.08 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 3:6.13 2017) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.08 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "3:6.18" 2017) TERMUX_PKG_SHA256=( EOF EPOCH09=3: cat << EOF > build.sh.09 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 3:6.13 2017) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.09 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "3:6.18" 2017) TERMUX_PKG_SHA256=( EOF EPOCH10=3: cat << EOF > build.sh.10 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( 3:6.13 2017 ) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.10 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "3:6.18" 2017 ) TERMUX_PKG_SHA256=( EOF EPOCH11=3: cat << EOF > build.sh.11 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "3:6.13" 2017 ) TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.11 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=( "3:6.18" 2017 ) TERMUX_PKG_SHA256=( EOF EPOCH12=3: cat << EOF > build.sh.12 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3:6.13" TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.12 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3:6.18" TERMUX_PKG_SHA256=( EOF EPOCH13=3: cat << EOF > build.sh.13 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=3:6.13 TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=( EOF cat << EOF > expected.build.sh.13 TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3:6.18" TERMUX_PKG_SHA256=( EOF for i in build.sh.*; do var="EPOCH${i##*.}" EPOCH="${!var}" false && \ perl -0777 -i -pe ' s/^TERMUX_PKG_REVISION=.*\n//mg; s{(TERMUX_PKG_VERSION=\(?\s*)[^)\s]+}{ qq{$1"'"${EPOCH}${LATEST_VERSION}"'"} }em ' "$i" sed -z -r -i \ -e "s/(TERMUX_PKG_VERSION=\(?[[:space:]]*)[^[:space:]\)]+/\1\"${EPOCH}${LATEST_VERSION}\"/" \ -e "s/(^|\n)TERMUX_PKG_REVISION=[^\n]*(\n|$)/\1/" \ "$i" if diff -Naur "$i" "expected.$i"; then echo "test ${i##.*} passed" else echo "test ${i##.*} failed" fi done cd - &>- rm -rf "${temp_dir}"
As Apollo pointed out in the other PR.
I'd like to avoid adding perl
as an additional dependency to our build scripts.
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.
In this case you can test the sed
solution. Or I can try it when I get home.
Also as Robert mentioned perl
is a dependency of at least autoconf autogen automake build-essential gobject-introspection gobject-introspection-bin git
which are extensively used in our buildscripts so I hardly believe it will not be present on build host.
#24518 (comment)
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.
Sooooo
I found all packages like manpages with
$ grep -nr TERMUX_PKG_VERSION= --include=build.sh . | grep -v -E -e '="' -e '=[0-9]+' -e '=\$'
./packages/maxima/build.sh:5:TERMUX_PKG_VERSION=()
./packages/ncurses/build.sh:15:TERMUX_PKG_VERSION=(6.5.20240831
./packages/glulxe/build.sh:5:TERMUX_PKG_VERSION=(0.6.1
./packages/libandroid-support/build.sh:4:TERMUX_PKG_VERSION=(29
./packages/softether-vpn/build.sh:5:TERMUX_PKG_VERSION=(5.02.5180)
./packages/unar/build.sh:5:TERMUX_PKG_VERSION=()
./packages/perl/build.sh:12:TERMUX_PKG_VERSION=(5.38.2
./packages/hilbish/build.sh:5:TERMUX_PKG_VERSION=(
./packages/manpages/build.sh:6:TERMUX_PKG_VERSION=(6.13
./packages/ldc/build.sh:5:TERMUX_PKG_VERSION=(1.30.0)
./sample/build.sh:9:TERMUX_PKG_VERSION=
./disabled-packages/mingw-w64-crt/build.sh:6:TERMUX_PKG_VERSION=(10.0.0)
./disabled-packages/mingw-w64-gcc-libs/build.sh:5:TERMUX_PKG_VERSION=(12.2.0)
./disabled-packages/libmusicbrainz/build.sh:5:TERMUX_PKG_VERSION=()
./x11-packages/tigervnc/build.sh:5:TERMUX_PKG_VERSION=(1.15.0
./root-packages/zmap/build.sh:5:TERMUX_PKG_VERSION=(1:4.3.2
So I checked ncurses
, glulxe
, libandroid-support
, softether-vpn
, perl
, hilbish
, ldc
, tigervnc
and zmap
and it works there as well so I assume it works fine. And version replacing on regular packages was not broken.
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.
Actually 13 lines of code since it removes revision separately.
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.
Thanks for the headache I guess...
I'll look into it.
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.
I am not sure why by update-checksums
replaces all checksums in the checksums array so it is not the same case as in here. But there are a few things that can be refactored.
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.
Twaik.
Can you get me done with one headache before adding another?
I'm looking at it. I'll hear more suggestions when I'm done with this one.
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.
Sorry.
(This was just resolving the merge conflict, actual changes will be in the next change) |
Latest push isn't quite a working state yet, but I'm tired and I have a headache. tl;dr It turns sed substitutions into localized patches. |
dl_tmpdir="$(mktemp -d "${TMPDIR-/tmp}/termux.src.dl.XXXXXXXX")" | ||
|
||
if [[ -d "${dl_tmpdir}" ]]; then | ||
if ! curl --fail --location --retry 3 --output "${dl_tmpdir}/source-bundle" "$url"; then | ||
rm -rf "${dl_tmpdir}" | ||
fi | ||
|
||
if [[ -f "${dl_tmpdir}/source-bundle" ]]; then | ||
sha256sum "${dl_tmpdir}/source-bundle" | awk '{ print $1 }' | ||
fi | ||
|
||
if [[ -d "${dl_tmpdir}" ]]; then | ||
if ! curl --fail --location --retry 3 --output "${dl_tmpdir}/source-bundle" "$url"; then | ||
rm -rf "${dl_tmpdir}" | ||
fi |
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.
dl_tmpdir="$(mktemp -d "${TMPDIR-/tmp}/termux.src.dl.XXXXXXXX")" | |
if [[ -d "${dl_tmpdir}" ]]; then | |
if ! curl --fail --location --retry 3 --output "${dl_tmpdir}/source-bundle" "$url"; then | |
rm -rf "${dl_tmpdir}" | |
fi | |
if [[ -f "${dl_tmpdir}/source-bundle" ]]; then | |
sha256sum "${dl_tmpdir}/source-bundle" | awk '{ print $1 }' | |
fi | |
if [[ -d "${dl_tmpdir}" ]]; then | |
if ! curl --fail --location --retry 3 --output "${dl_tmpdir}/source-bundle" "$url"; then | |
rm -rf "${dl_tmpdir}" | |
fi | |
curl --fail --location --retry 3 --output - "$url" | sha256sum | awk '{ print $1 }' | |
if (( PIPESTATUS[0] )); then | |
echo "ERROR: Download failed, can not proceed." >&2 | |
exit 1 | |
fi |
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?