Skip to content

Commit f8e5ea9

Browse files
committed
✨feat(utils): We can now reliably check Termux dependencies from Termux repos and TUR.
1 parent 48e3b58 commit f8e5ea9

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

tests/test-utils.sh

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,14 @@ check_ubuntu_dependencies() {
179179
# Check if a list of packages exist
180180
# in Termux
181181
#######################################
182-
# BUG: The search engine return similar terms.
183-
# For example if we look for python and it doesn't exist but python-lol does,
184-
# it will return 200
182+
# You can also manually check if a package exist on
183+
# https://repology.org/projects/?search=$package_name&inrepo=termux
185184
check_termux_dependencies() {
186185
error_flag=0 # 0 means no error
187186

188187
# Iterate over each package name in the array
189188
for package_name in "$@"; do
190-
local url="https://repology.org/projects/?search=$package_name&inrepo=termux"
189+
local url="https://github.com/termux/termux-packages/tree/master/packages/$package_name"
191190

192191
# Check if the package exists in Termux
193192
if [ "$(curl -s -o /dev/null -w "%{http_code}" "$url")" -eq 200 ]; then
@@ -201,6 +200,29 @@ check_termux_dependencies() {
201200
return "$error_flag"
202201
}
203202

203+
#######################################
204+
# Check if a list of packages exist
205+
# in Termux User Repository (TUR)
206+
#######################################
207+
check_tur_dependencies() {
208+
error_flag=0 # 0 means no error
209+
210+
# Iterate over each package name in the array
211+
for package_name in "$@"; do
212+
local url="https://github.com/termux-user-repository/tur/tree/master/tur/$package_name"
213+
214+
# Check if the package exists in Termux
215+
if [ "$(curl -s -o /dev/null -w "%{http_code}" "$url")" -eq 200 ]; then
216+
echo "$package_name"
217+
else
218+
echo "$package_name → ERROR: It doesn't exist in Termux (TUR)"
219+
error_flag=1
220+
fi
221+
done
222+
223+
return "$error_flag"
224+
}
225+
204226
#######################################
205227
# Check if a list of packages exist
206228
# in MacOS homebrew

0 commit comments

Comments
 (0)