这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/emacs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ termux_step_post_get_source() {
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
fi

# Version guard
local ver_e=${TERMUX_PKG_VERSION#*:}
local ver_x=$(. $TERMUX_SCRIPTDIR/x11-packages/emacs-x/build.sh; echo ${TERMUX_PKG_VERSION#*:})
if [ "${ver_e}" != "${ver_x}" ]; then
termux_error_exit "Version mismatch between emacs and emacs-x."
fi

# XXX: We have to start with new host build each time
# to avoid build error when cross compiling.
rm -Rf $TERMUX_PKG_HOSTBUILD_DIR
Expand Down
1 change: 1 addition & 0 deletions packages/flang/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TERMUX_PKG_LICENSE_FILE="flang/LICENSE.TXT"
TERMUX_PKG_MAINTAINER="@termux"
LLVM_MAJOR_VERSION=20
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.1.3
TERMUX_PKG_ALIGN_VERSION_WITH=libllvm
TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-project-$TERMUX_PKG_VERSION.src.tar.xz
TERMUX_PKG_SHA256=b6183c41281ee3f23da7fda790c6d4f5877aed103d1e759763b1008bdd0e2c50
TERMUX_PKG_AUTO_UPDATE=false
Expand Down
7 changes: 0 additions & 7 deletions packages/libllvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ termux_step_host_build() {
}

termux_step_pre_configure() {
# Version guard to keep flang in sync
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this have a mutual TERMUX_PKG_ALIGN_VERSION_WITH=flang to coincide with Flang's TERMUX_PKG_ALIGN_VERSION_WITH=libllvm?
I wouldn't expect any issues from such a "loop" in alignment.

And if that does cause an issue, it should be handled by the alignment solver.

It should be visible from every package that has an alignment with another package that that alignment exists.
Just as every package in an update group should visibly be part of said update group.

Copy link
Member Author

Choose a reason for hiding this comment

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

TERMUX_PKG_ALIGN_VERSION_WITH handling code check package referenced in this variable and all packages referencing current package in their TERMUX_PKG_ALIGN_VERSION_WITH if any. So it is kinda being checked both ways.

Update group does not mean all packages in update group must have same versions. It only means they should be updated in single push/pull_request to avoid dependency update hell.

Copy link
Member

Choose a reason for hiding this comment

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

I would still prefer to have a visual/text indicator of alignment or group membership in every package with such a relation.

Makes it significantly easier to search for such relations.
So in this case adding a,

TERMUX_PKG_ALIGN_VERSION_WITH=flang

makes it obvious from both package's build script that they require alignment with the other.

We should probably also turn TERMUX_PKG_ALIGN_VERSION_WITH into a comma separated list like TERMUX_PKG_LICENSE for example, since more than 2 packages may need to be version aligned with each other.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ofc you can do that to make it obvious, but it is not required. Anyway when you will try to update one of them without updating another one you will get version mismatch error.

Copy link
Member

Choose a reason for hiding this comment

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

Please cross-reference it for all packages that we're adding this to at the inception of the feature so we don't have to track these down later.
I'm even considering adding a linter rule to enforce full cross-referencing of alignments so this doesn't become a mess to figure out.

Note

Also in case you didn't catch it earlier,
Turning TERMUX_PKG_ALIGN_VERSION_WITH into a comma separated list
like TERMUX_PKG_LICENSE would be helpful since more than 2 packages may need to have their versions aligned.

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably it will be better to make checking code to find all packages referencing same package in TERMUX_PKG_ALIGN_VERSION_WITH to make sure version guard works for all of them.

Otherwise we might end up with referencing 60+ packages in every 60 buildscripts of them. And it will end up with a tree wide updating buildscripts if we add more kframeworks6 libraries.

like TERMUX_PKG_LICENSE would be helpful since more than 2 packages may need to have their versions aligned.

I solved this by mentioning same package in all of packages requiring version aligning.

Copy link
Member

Choose a reason for hiding this comment

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

Probably it will be better to make checking code to find all packages referencing same package in TERMUX_PKG_ALIGN_VERSION_WITH to make sure version guard works for all of them.

Otherwise we might end up with referencing 60+ packages in every 60 buildscripts of them. And it will end up with a tree wide updating buildscripts if we add more kframeworks6 libraries.

That's where the update group comes in though, no?
It doesn't imply version alignment, but it does imply a grouping.

like TERMUX_PKG_LICENSE would be helpful since more than 2 packages may need to have their versions aligned.

I solved this by mentioning same package in all of packages requiring version aligning.

Thanks. I feel like this is gonna be a mess otherwise so I wanna get ahead of it.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's where the update group comes in though, no? It doesn't imply version alignment, but it does imply a grouping.

Yep. TERMUX_PKG_ALIGN_VERSION_WITH should come in separate PR, but it changes same files so I not decided if I should move it away from this PR. And also it helps us make sure nobody will break packages with randoms PRs updating specific packages despite of existing (or not yet existing) version guards.

local flang_version=$(. $TERMUX_SCRIPTDIR/packages/flang/build.sh; echo ${TERMUX_PKG_VERSION})
local flang_revision=$(TERMUX_PKG_REVISION=0; . $TERMUX_SCRIPTDIR/packages/flang/build.sh; echo ${TERMUX_PKG_REVISION})
if [ "${flang_version}" != "${TERMUX_PKG_VERSION}" ] || [ "${flang_revision}" != "${TERMUX_PKG_REVISION}" ]; then
termux_error_exit "Version mismatch between libllvm and flang. libllvm=$TERMUX_PKG_VERSION:$TERMUX_PKG_REVISION, flang=$flang_version:$flang_revision"
fi

# Add unknown vendor, otherwise it screws with the default LLVM triple
# detection.
export LLVM_DEFAULT_TARGET_TRIPLE=${CCTERMUX_HOST_PLATFORM/-/-unknown-}
Expand Down
9 changes: 0 additions & 9 deletions packages/libprotobuf/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
"
TERMUX_PKG_NO_STATICSPLIT=true

termux_step_post_get_source() {
# Version guard
local ver_e=${TERMUX_PKG_VERSION#*:}
local ver_x=$(. $TERMUX_SCRIPTDIR/packages/protobuf-static/build.sh; echo ${TERMUX_PKG_VERSION#*:})
if [ "${ver_e}" != "${ver_x}" ]; then
termux_error_exit "Version mismatch between libprotobuf and protobuf-static."
fi
}

termux_step_post_make_install() {
install -Dm600 -t $TERMUX_PREFIX/share/doc/libutf8-range \
$TERMUX_PKG_SRCDIR/third_party/utf8_range/LICENSE
Expand Down
12 changes: 2 additions & 10 deletions packages/mpv/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ TERMUX_PKG_MAINTAINER="Joshua Kahn @TomJo2000"
TERMUX_PKG_VERSION="0.40.0"
TERMUX_PKG_SRCURL=https://github.com/mpv-player/mpv/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=10a0f4654f62140a6dd4d380dcf0bbdbdcf6e697556863dc499c296182f081a3
TERMUX_PKG_AUTO_UPDATE=false
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_AUTO_UPDATE_GROUP=x11/mpv
Copy link
Member

Choose a reason for hiding this comment

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

Right, so how did you choose the names for the update groups?
Because It's obviously not based on the file paths.
And I'd prefer to not bring channel information into the group names.

If the update group names are "arbitrary" I'd prefer them to follow the project name or a suitable proxy like kf6

Suggested change
TERMUX_PKG_AUTO_UPDATE_GROUP=x11/mpv
TERMUX_PKG_AUTO_UPDATE_GROUP="mpv"

Copy link
Member Author

Choose a reason for hiding this comment

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

Name of update group is copied directly to PR description and, as a consequence, to git commit in the case if you squash two commits after PR reviewing.

Copy link
Member

Choose a reason for hiding this comment

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

I think it'd probably be better to not put semantic meaning into the name of the update group.

What would the current commit messages be anyway?
I'd expect it to just bundle up a set of bump($CHANNEL/$PKG_NAME): $NEW_VERSION commits into a PR under the title of:

if  (( "${#versions[*]}" == 1 )); then
	title="bump(${group}): ${versions[@]}"
else
	title="bump(${group}): group update"
fi

In which case bump(x11/kframeworks6): group update vs. bump(kf6): group update is a purely cosmetic difference in the PR title.

Copy link
Member

Choose a reason for hiding this comment

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

There may also be a case where a package may be part of multiple autoupdate groups.
Although that is probably best left for when it actually happens.

Copy link
Member Author

Choose a reason for hiding this comment

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

In which case bump(x11/kframeworks6): group update vs. bump(kf6): group update is a purely cosmetic difference in the PR title.

All packages under kf6 group have version aligning enabled so commit message will be, i.e., bump(x11/kf6): 6.14.0 which complies with commit messages we had before.
Currently all other update groups or have single package (big package) or have version aligning.

There may also be a case where a package may be part of multiple autoupdate groups.

It should not happen. It is not designed this way.

Copy link
Member

Choose a reason for hiding this comment

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

In which case bump(x11/kframeworks6): group update vs. bump(kf6): group update is a purely cosmetic difference in the PR title.

All packages under kf6 group have version aligning enabled so commit message will be, i.e., bump(x11/kf6): 6.14.0 which complies with commit messages we had before. Currently all other update groups or have single package (big package) or have version aligning.

I don't think the versions always matching or all packages in a group always being updated at the same time is a particularly good assumption to make.
Say I'd like to make an update group for tree-sitter later for example,
those versions don't match, and they're often but not always updated at the same time.
Although I suppose I shouldn't be conflating this with a "rebuilds group".

There may also be a case where a package may be part of multiple autoupdate groups.

It should not happen. It is not designed this way.

Not right now.
But yeah no point implementing a feature we don't have a need for yet.

Copy link
Member Author

@twaik twaik Apr 18, 2025

Choose a reason for hiding this comment

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

In my understanding auto-update group definition is similar to rebuild group: group of packages which are required to be updated in the same PR/push because of version or ABI mismatch. I planned to implement something like creating autoupdate group for, i.e. boost with automatic revbumping of all revdeps (because of possible ABI mismatch of newer boost version).

But yeah no point implementing a feature we don't have a need for yet.

As I said before my understanding of update group is similar to rebuild group so I do not see the point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
TERMUX_PKG_AUTO_UPDATE_GROUP=x11/mpv
TERMUX_PKG_AUTO_UPDATE_GROUP="mpv"

Since these two packages exist in different repos we can omit the x11/ preffix. But PR title will be less fine after this 😞 .

Copy link
Member

Choose a reason for hiding this comment

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

I'm gonna reiterate that I don't think repo channel information should be part of the update group names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably it should be in the case if all packages in update group exist in the same repo. Just for consistency with other bump commits.

TERMUX_PKG_DEPENDS="alsa-lib, ffmpeg, jack, libandroid-glob, libandroid-support, libarchive, libass, libcaca, libiconv, liblua52, libsixel, libuchardet, openal-soft, pulseaudio, rubberband, zlib, libplacebo"
TERMUX_PKG_RM_AFTER_INSTALL="share/icons share/applications"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
Expand All @@ -31,15 +32,6 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-Dandroid-media-ndk=disabled
"

termux_step_post_get_source() {
# Version guard
local ver_m=${TERMUX_PKG_VERSION#*:}
local ver_x=$(. $TERMUX_SCRIPTDIR/x11-packages/mpv-x/build.sh; echo ${TERMUX_PKG_VERSION#*:})
if [ "${ver_m}" != "${ver_x}" ]; then
termux_error_exit "Version mismatch between mpv and mpv-x."
fi
}

termux_step_pre_configure() {
LDFLAGS+=" -landroid-glob"
sed -i "s/host_machine.system() == 'android'/false/" ${TERMUX_PKG_SRCDIR}/meson.build
Expand Down
9 changes: 0 additions & 9 deletions packages/octave/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ ac_cv_func_setpwuid=no
"
TERMUX_PKG_EXCLUDED_ARCHES="arm, i686"

termux_step_post_get_source() {
# Version guard
local ver_e=${TERMUX_PKG_VERSION#*:}
local ver_x=$(. $TERMUX_SCRIPTDIR/x11-packages/octave-x/build.sh; echo ${TERMUX_PKG_VERSION#*:})
if [ "${ver_e}" != "${ver_x}" ]; then
termux_error_exit "Version mismatch between octave and octave-x."
fi
}

termux_step_pre_configure() {
termux_setup_flang

Expand Down
4 changes: 0 additions & 4 deletions packages/poppler/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ termux_step_pre_configure() {
if ! test "${_POPPLER_SOVERSION}"; then
termux_error_exit "Please set _POPPLER_SOVERSION variable."
fi
local sover_x11=$(. $TERMUX_SCRIPTDIR/x11-packages/poppler-qt/build.sh; echo $_POPPLER_SOVERSION)
if [ "${sover_x11}" != "${_POPPLER_SOVERSION}" ]; then
termux_error_exit "SOVERSION mismatch with \"poppler-qt\" package."
fi
local sover_cmake=$(sed -En 's/^set\(POPPLER_SOVERSION_NUMBER "([0-9]+)"\)$/\1/p' CMakeLists.txt)
if [ "${sover_cmake}" != "${_POPPLER_SOVERSION}" ]; then
termux_error_exit "SOVERSION guard check failed (CMakeLists.txt: \"${sover_cmake}\")."
Expand Down
19 changes: 1 addition & 18 deletions packages/protobuf-static/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
# Please align the version with `libprotobuf` package.
TERMUX_PKG_VERSION=30.0
TERMUX_PKG_ALIGN_VERSION_WITH=libprotobuf
TERMUX_PKG_SRCURL=https://github.com/protocolbuffers/protobuf/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=9df0e9e8ebe39f4fbbb9cf7db3d811287fe3616b2f191eb2bf5eaa12539c881f
v_proto_version_shared=$(. $TERMUX_SCRIPTDIR/packages/libprotobuf/build.sh; echo ${TERMUX_PKG_VERSION})
Expand All @@ -26,24 +27,6 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DCMAKE_INSTALL_LIBDIR=lib
"

termux_step_post_get_source() {
# Version guard
local ver_e=${TERMUX_PKG_VERSION#*:}
local ver_x=$(. $TERMUX_SCRIPTDIR/packages/libprotobuf/build.sh; echo ${TERMUX_PKG_VERSION#*:})
if [ "${ver_e}" != "${ver_x}" ]; then
termux_error_exit "Version mismatch between libprotobuf and protobuf-static."
fi
}

termux_step_pre_configure() {
# Version guard
local ver_shared=$(. $TERMUX_SCRIPTDIR/packages/libprotobuf/build.sh; echo ${TERMUX_PKG_VERSION#*:})
local ver_static=${TERMUX_PKG_VERSION#*:}
if [ "${ver_shared}" != "${ver_static}" ]; then
termux_error_exit "Version mismatch between libprotobuf and protobuf-static."
fi
}

termux_step_post_make_install() {
# Copy lib/*.cmake to opt/protobuf-cmake/static for future use
mkdir -p $TERMUX_PREFIX/opt/protobuf-cmake/static
Expand Down
9 changes: 0 additions & 9 deletions packages/tsmuxer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,3 @@ TERMUX_PKG_SRCURL=https://github.com/justdan96/tsMuxer/archive/refs/tags/${_VERS
TERMUX_PKG_SHA256=e975d7ab9a73448b1c2c1ded311977a6f0dc77398edb720158dbcf213d9cf4df
TERMUX_PKG_AUTO_UPDATE=false
TERMUX_PKG_DEPENDS="freetype, libc++, zlib"

termux_step_post_get_source() {
# Version guard
local ver_t=${TERMUX_PKG_VERSION#*:}
local ver_g=$(. $TERMUX_SCRIPTDIR/x11-packages/tsmuxergui/build.sh; echo ${TERMUX_PKG_VERSION#*:})
if [ "${ver_t}" != "${ver_g}" ]; then
termux_error_exit "Version mismatch between tsmuxer and tsmuxergui."
fi
}
1 change: 1 addition & 0 deletions root-packages/v4l-utils/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="GPL-2.0, LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.24.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_ALIGN_VERSION_WITH=libv4l
TERMUX_PKG_SRCURL=https://linuxtv.org/downloads/v4l-utils/v4l-utils-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=cbb7fe8a6307f5ce533a05cded70bb93c3ba06395ab9b6d007eb53b75d805f5b
TERMUX_PKG_DEPENDS="argp, libc++, libv4l"
Expand Down
73 changes: 73 additions & 0 deletions scripts/bin/update-packages
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ set -u
# Push changes to remote.
: "${GIT_PUSH_PACKAGES:=false}"

# Ensure unique workflow run ID exists or generate one.
: "${GITHUB_RUN_ID:=$(shuf -i 1000000000-9999999999 -n 1)}"

export TERMUX_PKG_UPDATE_METHOD="" # Which method to use for updating? (repology, github or gitlab)
export TERMUX_PKG_UPDATE_TAG_TYPE="" # Whether to use latest-release-tag or newest-tag.
export TERMUX_GITLAB_API_HOST="gitlab.com" # Default host for gitlab-ci.
Expand Down Expand Up @@ -129,6 +132,13 @@ declare -A _LATEST_TAGS=()
declare -A _FAILED_UPDATES=()
declare -a _ALREADY_SEEN=() # Array of packages successfully updated or skipped.

# get list of auto-update groups.
readarray -t AUTO_UPDATE_GROUPS < <(
grep -hr TERMUX_PKG_AUTO_UPDATE_GROUP --include=build.sh "${TERMUX_SCRIPTDIR}" \
| sort -u \
| sed -e "s/^TERMUX_PKG_AUTO_UPDATE_GROUP=['\"]*//" -e "s/['\"]*\$//" || :
)

# _fetch_and_cache_tags fetches all possible tags using termux_pkg_auto_update, but using Ninja build system.
# The key difference is that we make the process concurrent, allowing us to fetch tags simultaneously rather than one at a time.
# Once all tags are cached, the termux_pkg_auto_update function will operate much more quickly.
Expand Down Expand Up @@ -292,6 +302,38 @@ _run_update() {
fi
}

_create_pending_prs_for_auto_update_groups() {
local changed_files current_ref versions title
current_ref="$(git rev-parse --abbrev-ref HEAD)"
for group in ${AUTO_UPDATE_GROUPS[@]}; do
# switch to potential PR branch if it exists.
git checkout "auto-update/${group}/${GITHUB_RUN_ID}" || continue

# obtain all build.sh files compared to origin.
readarray -t changed_files < <(git diff --name-only "$(git merge-base "${current_ref}" HEAD)" HEAD | grep '/build.sh$')

# read all versions
readarray -t versions < <(
for _build_sh in "${changed_files[@]}"; do
( # do everything in subshell to avoid variable mess
set +e +u
. "${_build_sh}" >/dev/null 2>&1
[[ -n "${TERMUX_PKG_VERSION#*:}" ]] && echo "${TERMUX_PKG_VERSION#*:}"
)
done | sort -u
)

if (( "${#versions[*]}" == 1 )); then
title="bump(${group}): ${versions[@]}"
else
title="bump(${group}): group update"
fi

gh pr create --title "${title}" --body "This PR has been automatically submitted by Github Actions." --base "master"
git checkout "${current_ref}"
done
}

declare -a _CACHED_ISSUE_TITLES=()
# Check if an issue with same title already exists and is open.
_gh_check_issue_exists() {
Expand All @@ -315,6 +357,29 @@ _gh_check_issue_exists() {
return 1
}

declare -a _CACHED_PR_TITLES=()
# Check if a PR with same title already exists and is open.
_gh_check_pr_exists() {
local pkg_dir="$1" auto_update_group
if [[ -z "${_CACHED_PR_TITLES[*]}" ]]; then
readarray -t _CACHED_PR_TITLES < <(
gh pr list \
--limit 10000 \
--author termuxbot2 --label "bot" \
--state open \
--search "bump in:title type:issue" \
--json title | jq -r '.[] | .title' | sort -u
)
fi

auto_update_group="$(grep TERMUX_PKG_AUTO_UPDATE_GROUP "${pkg_dir}/build.sh" \
| sed -e "s/^TERMUX_PKG_AUTO_UPDATE_GROUP=['\"]*//" -e "s/['\"]*\$//" || :)"

[[ -z "${auto_update_group}" ]] && return 1

printf "%s\n" "${arr[@]}" | grep -q "^bump(${auto_update_group})"
}

_should_update() {
local pkg_dir="$1"

Expand All @@ -332,6 +397,12 @@ _should_update() {
if [[ " ${_ALREADY_SEEN[*]} ${!_FAILED_UPDATES[*]} " =~ " $(basename "${pkg_dir}") " ]]; then
return 1 # Skip.
fi

if [[ "${BUILD_PACKAGES}" == "true" && "${GITHUB_ACTIONS:-}" == "true" ]] && _gh_check_pr_exists "${pkg_dir}"; then
echo "INFO: Skipping '$(basename "${pkg_dir}")', existing update PR for it hasn't been merged yet."
return 1
fi

if [[ "${BUILD_PACKAGES}" == "true" ]] && [[ "${GITHUB_ACTIONS:-}" == "true" ]] && _gh_check_issue_exists "$(basename "${pkg_dir}")"; then
echo "INFO: Skipping '$(basename "${pkg_dir}")', an update issue for it hasn't been resolved yet."
return 1
Expand Down Expand Up @@ -399,6 +470,8 @@ else
fi
unset _unix_millis

_create_pending_prs_for_auto_update_groups

################################################FAILURE HANDLING#################################################

_gh_create_new_issue() {
Expand Down
1 change: 1 addition & 0 deletions scripts/build/termux_step_setup_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ termux_step_setup_variables() {
: "${TERMUX_PKGS__BUILD__RM_ALL_PKGS_BUILT_MARKER_AND_INSTALL_FILES:="true"}"
: "${TERMUX_PKGS__BUILD__RM_ALL_PKG_BUILD_DEPENDENT_DIRS:="false"}"
: "${TERMUX_PKG_API_LEVEL:="24"}"
: "${TERMUX_PKG_ALIGN_VERSION_WITH:=}"
: "${TERMUX_CONTINUE_BUILD:="false"}"
: "${TERMUX_QUIET_BUILD:="false"}"
: "${TERMUX_WITHOUT_DEPVERSION_BINDING:="false"}"
Expand Down
19 changes: 19 additions & 0 deletions scripts/build/termux_step_start_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ termux_step_start_build() {
# Path to hostbuild marker, for use if package has hostbuild step
TERMUX_HOSTBUILD_MARKER="$TERMUX_PKG_HOSTBUILD_DIR/TERMUX_BUILT_FOR_$TERMUX_PKG_VERSION"

# Check if versions are aligned between linked packages.
# Also check if there are other packages wanting to keep version aligned with this package.
readarray -t PACKAGES_WANTING_VERSIONS_ALIGNED < <(grep -R -l \
-E "TERMUX_PKG_ALIGN_VERSION_WITH=['\"]?$TERMUX_PKG_NAME['\"]?" \
--include="build.sh" ${TERMUX_PACKAGES_DIRECTORIES} || :)
if [ -n "${TERMUX_PKG_ALIGN_VERSION_WITH}" ]; then
local _filename="$(find ${TERMUX_PACKAGES_DIRECTORIES} -mindepth 2 -maxdepth 2 -type f -path "*/${TERMUX_PKG_ALIGN_VERSION_WITH}/build.sh")"
[ -z "${_filename}" ] && termux_error_exit "Can not verify version aligning, package ${TERMUX_PKG_ALIGN_VERSION_WITH} is not found"
PACKAGES_WANTING_VERSIONS_ALIGNED+=("${_filename}")
fi

# Perform version aligning check
for _build_sh in "${PACKAGES_WANTING_VERSIONS_ALIGNED[@]}"; do
local version="$(set +e +u; . "${_build_sh}" &>/dev/null; echo ${TERMUX_PKG_VERSION#*:})"
if [ "${version#*:}" != "${TERMUX_PKG_VERSION#*:}" ]; then
termux_error_exit "Version mismatch between ${TERMUX_PKG_NAME} and $(basename $(dirname "$_build_sh"))."
fi
done

if [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
# Metapackage has no sources and therefore platform-independent.
TERMUX_PKG_SKIP_SRC_EXTRACT=true
Expand Down
29 changes: 19 additions & 10 deletions scripts/updates/utils/termux_pkg_upgrade_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ termux_pkg_upgrade_version() {

local LATEST_VERSION="$1"
local SKIP_VERSION_CHECK="${2:-}"
local EPOCH
EPOCH="${TERMUX_PKG_VERSION%%:*}" # If there is no epoch, this will be the full version.
local EPOCH; EPOCH="${TERMUX_PKG_VERSION%%:*}" # If there is no epoch, this will be the full version.
local CURRENT_REF; CURRENT_REF="$(git rev-parse --abbrev-ref HEAD)"
# Check if it isn't the full version and add ':'.
if [[ "${EPOCH}" != "${TERMUX_PKG_VERSION}" ]]; then
EPOCH="${EPOCH}:"
Expand Down Expand Up @@ -122,32 +122,41 @@ termux_pkg_upgrade_version() {
fi
done < "${TERMUX_SCRIPTDIR}/scripts/big-pkgs.list"

_termux_should_cleanup "${big_package}" && "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./clean.sh
if [[ -z "${TERMUX_PKG_AUTO_UPDATE_GROUP}" ]]; then
_termux_should_cleanup "${big_package}" && "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./clean.sh

if ! "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./build-package.sh -C -a "${TERMUX_ARCH}" -i "${TERMUX_PKG_NAME}"; then
_termux_should_cleanup "${big_package}" && "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./clean.sh
git checkout -- "${TERMUX_PKG_BUILDER_DIR}"
termux_error_exit "ERROR: failed to build."
fi

if ! "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./build-package.sh -C -a "${TERMUX_ARCH}" -i "${TERMUX_PKG_NAME}"; then
_termux_should_cleanup "${big_package}" && "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./clean.sh
git checkout -- "${TERMUX_PKG_BUILDER_DIR}"
termux_error_exit "ERROR: failed to build."
fi

_termux_should_cleanup "${big_package}" && "${TERMUX_SCRIPTDIR}/scripts/run-docker.sh" ./clean.sh

if [[ "${GIT_COMMIT_PACKAGES}" == "true" ]]; then
echo "INFO: Committing package."
echo "INFO: Committing package${TERMUX_PKG_AUTO_UPDATE_GROUP:+" to ${TERMUX_PKG_AUTO_UPDATE_GROUP} update group"}."
stderr="$(
if [[ -n "${TERMUX_PKG_AUTO_UPDATE_GROUP}" ]]; then
# Switch to auto-update branch, create if needed
git checkout -b "auto-update/${TERMUX_PKG_AUTO_UPDATE_GROUP}/${GITHUB_RUN_ID}" || \
git checkout "auto-update/${TERMUX_PKG_AUTO_UPDATE_GROUP}/${GITHUB_RUN_ID}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
git checkout "auto-update/${TERMUX_PKG_AUTO_UPDATE_GROUP}/${GITHUB_RUN_ID}"
git checkout "auto-update/${TERMUX_PKG_AUTO_UPDATE_GROUP}/${GITHUB_RUN_ID}"

Copy link
Member Author

Choose a reason for hiding this comment

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

Indentation is needed to make it explicit it is a part of another command (it goes after \ in the previous line).

Copy link
Member

Choose a reason for hiding this comment

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

Then move the || down instead.

Suggested change
git checkout "auto-update/${TERMUX_PKG_AUTO_UPDATE_GROUP}/${GITHUB_RUN_ID}"
|| git checkout "auto-update/${TERMUX_PKG_AUTO_UPDATE_GROUP}/${GITHUB_RUN_ID}"

fi
git add "${TERMUX_PKG_BUILDER_DIR}" 2>&1 >/dev/null
git commit -m "bump(${repo}/${TERMUX_PKG_NAME}): ${LATEST_VERSION}" \
-m "This commit has been automatically submitted by Github Actions." 2>&1 >/dev/null
)" || {
git reset HEAD --hard
[[ -n "${TERMUX_PKG_AUTO_UPDATE_GROUP}" ]] && git checkout "${CURRENT_REF}"
termux_error_exit <<-EndOfError
ERROR: git commit failed. See below for details.
${stderr}
EndOfError
}
[[ -n "${TERMUX_PKG_AUTO_UPDATE_GROUP}" ]] && git checkout "${CURRENT_REF}"
fi

if [[ "${GIT_PUSH_PACKAGES}" == "true" ]]; then
if [[ "${GIT_PUSH_PACKAGES}" == "true" && -z "${TERMUX_PKG_AUTO_UPDATE_GROUP}" ]]; then
echo "INFO: Pushing package."
stderr="$(
# Fetch and pull before attempting to push to avoid a situation
Expand Down
8 changes: 1 addition & 7 deletions x11-packages/emacs-x/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TERMUX_PKG_MAINTAINER="@termux"
# Update both emacs and emacs-x to the same version in one PR.
TERMUX_PKG_VERSION=30.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_ALIGN_VERSION_WITH=emacs
TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz
if [[ $TERMUX_PKG_VERSION == *-rc* ]]; then
TERMUX_PKG_SRCURL=https://alpha.gnu.org/gnu/emacs/pretest/emacs-${TERMUX_PKG_VERSION#*:}.tar.xz
Expand Down Expand Up @@ -76,13 +77,6 @@ termux_step_post_get_source() {
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
fi

# Version guard
local ver_e=$(. $TERMUX_SCRIPTDIR/packages/emacs/build.sh; echo ${TERMUX_PKG_VERSION#*:})
local ver_x=${TERMUX_PKG_VERSION#*:}
if [ "${ver_e}" != "${ver_x}" ]; then
termux_error_exit "Version mismatch between emacs and emacs-x."
fi

# XXX: We have to start with new host build each time
# to avoid build error when cross compiling.
rm -Rf $TERMUX_PKG_HOSTBUILD_DIR
Expand Down
2 changes: 2 additions & 0 deletions x11-packages/extra-cmake-modules/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ TERMUX_PKG_VERSION="6.13.0"
TERMUX_PKG_SRCURL="https://download.kde.org/stable/frameworks/${TERMUX_PKG_VERSION%.*}/extra-cmake-modules-${TERMUX_PKG_VERSION}.tar.xz"
TERMUX_PKG_SHA256=7006017c00c817ff4c056995146d271791d1487a398d39ea6cac1cd59a8bf402
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_AUTO_UPDATE_GROUP=x11/kframeworks6
TERMUX_PKG_ALIGN_VERSION_WITH=kf6-kconfig
TERMUX_PKG_DEPENDS="cmake"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DBUILD_HTML_DOCS=OFF
Expand Down
Loading