这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@robertkirkman
Copy link
Member

@robertkirkman robertkirkman commented Apr 6, 2025

if [ -n "${TERMUX_PKG_EXCLUDED_ARCHES:=""}" ] && [ "$TERMUX_PKG_EXCLUDED_ARCHES" != "${TERMUX_PKG_EXCLUDED_ARCHES/$TERMUX_ARCH/}" ]; then
echo "Skipping building $TERMUX_PKG_NAME for arch $TERMUX_ARCH"
exit 0
fi

  • and also proceeded beyond this point,

if [ "$TERMUX_PKG_HAS_DEBUG" = "true" ]; then
DEBUG="-dbg"
else
echo "Skipping building debug build for $TERMUX_PKG_NAME"
exit 0
fi

  • or if it would have skipped all packages in the list of packages to build without building anything.

  • if the build would have continued or an unknown situation occurs, zero is returned, but if all packages in the list of packages to build would have been skipped, 85 (C_EX__NOOP) is returned.

  • if an error handled by this script, such as a syntax error in the -a argument or the package name argument list occurs, a similar error message to what build-package.sh would have printed is shown, and 1 is returned.

  • in run-docker.sh, the command passed to run-docker.sh is run in build-package-dry-run-simulation.sh before doing anything else only if the command passed has build-package.sh in its first argument, and only continues if a zero value is returned by build-package-dry-run-simulation.sh, which indicates either that at least one package will be built, or that the passed command is empty or not build-package.sh.

@robertkirkman robertkirkman requested a review from Grimler91 as a code owner April 6, 2025 11:51
@robertkirkman
Copy link
Member Author

  • I am not sure whether this is fully compatible with the case of running the scripts/run-docker.sh command on a MacOS or BSD computer that has a VM-based docker command installed. This scripts/run-docker.sh has been tested on a GNU/Linux computer with a traditional native-container docker command installed. If someone who has MacOS or BSD regularly uses scripts/run-docker.sh locally on their computer, it might be convenient if they could help me test this to implement it fully for their device.

Copy link
Member

@twaik twaik left a comment

Choose a reason for hiding this comment

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

LGTM.

@agnostic-apollo
Copy link
Member

And you likely meant --dry-run instead of --dummy.

@robertkirkman
Copy link
Member Author

And you likely meant --dry-run instead of --dummy.

I do like that name better for this also. I will change it to that.

@robertkirkman robertkirkman marked this pull request as draft April 7, 2025 00:25
@robertkirkman robertkirkman changed the title chore(scripts/run-docker): implement dummy build to skip launching container if no packages would have been built chore(scripts/run-docker): implement dry run to skip launching container if no packages would have been built Apr 7, 2025
@robertkirkman robertkirkman force-pushed the dummy-build branch 4 times, most recently from 867df14 to 8b4db25 Compare April 9, 2025 13:42
@robertkirkman robertkirkman changed the title chore(scripts/run-docker): implement dry run to skip launching container if no packages would have been built chore(scripts/run-docker): implement dry run simulation to skip launching container if no packages would have been built Apr 9, 2025
@robertkirkman robertkirkman marked this pull request as ready for review April 10, 2025 02:03
@robertkirkman
Copy link
Member Author

Ok, now I've made sort of another version that's based on agnostic-apollo's request to try using grep instead of sourcing build.sh files.

I believe I have incorporated most of the requests into this version, and while it probably needs more changes, I would be interested in knowing whether this version is changing in the right direction.

@robertkirkman robertkirkman force-pushed the dummy-build branch 3 times, most recently from 221b5c1 to 5f77f5a Compare July 5, 2025 01:03
if: ${{ steps.build-info.outputs.skip-building != 'true' }}
env:
DOCKER_BUILD: ${{ steps.build-info.outputs.docker-build }}
TERMUX_DOCKER__CONTAINER_EXEC_COMMAND__PRE_CHECK_IF_WILL_BUILD_PACKAGES: "true"
Copy link
Member Author

@robertkirkman robertkirkman Jul 5, 2025

Choose a reason for hiding this comment

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

I assume that this would be the appropriate place to enable this in CI.

I have tested this on my own GitHub Actions in this run, on the ecl package, which has TERMUX_PKG_EXCLUDED_ARCHES="i686, x86_64":

https://github.com/robertkirkman/termux-packages/actions/runs/16082984132/job/45390315328

It is working. What happens in practice is, for the i686 and x86_64 jobs, the "build" workflow step very quickly completes without building anything, but showing a green success mark, not red failed or gray skipped, and an artifact does upload. However, what is in the artifact is just nothing except a .placeholder file, which is empty, and a built_termux-main_packages.txt file, which contains the list of packages that would have been built if the build were not skipped, in this test "ecl".

@twaik do you think this is proper behavior to happen, or should it be adjusted to be different in any way?

@robertkirkman robertkirkman force-pushed the dummy-build branch 3 times, most recently from 049f908 to 01fa00e Compare July 5, 2025 01:53
@agnostic-apollo
Copy link
Member

Looks fine from my side otherwise, I'll leave any testing to you.

@robertkirkman
Copy link
Member Author

since twaik opened the original issue, I would be interested in review from twaik about the current version before merging, because the version originally approved has changed so completely that it's not recognizable anymore

…hing container if no packages would have been built

- Fixes termux#24116

- adds a new script to `scripts/bin`, `build-package-dry-run-simulation.sh`, which is used to test whether the entire `build-package.sh` command would have both proceeded beyond this point,

https://github.com/termux/termux-packages/blob/040710f4927fc42cb74a85911e42da0a3f2e1f39/scripts/build/termux_step_start_build.sh#L13-L16

- and also proceeded beyond this point,

https://github.com/termux/termux-packages/blob/040710f4927fc42cb74a85911e42da0a3f2e1f39/scripts/build/termux_step_start_build.sh#L42-L47

- or if it would have skipped all packages in the list of packages to build without building anything.

- if the build would have continued or an unknown situation occurs, zero is returned, but if all packages in the list of packages to build would have been skipped, 85 (`C_EX__NOOP`) is returned.

- if an error handled by this script, such as a syntax error in the `-a` argument or the package name argument list occurs, a similar error message to what `build-package.sh` would have printed is shown, and 1 is returned.

- in `run-docker.sh`, the command passed to `run-docker.sh` is run in `build-package-dry-run-simulation.sh` before doing anything else only if the command passed has `build-package.sh` in its first argument, and only continues if a zero value is returned by `build-package-dry-run-simulation.sh`, which indicates either that at least one package will be built, or that the passed command is empty or not `build-package.sh`.
@robertkirkman
Copy link
Member Author

It seems like twaik might be taking a break, and I believe this is ready, so I will merge this in 24 hours if no problems are found.

@robertkirkman robertkirkman merged commit b4f3190 into termux:master Jul 18, 2025
2 checks passed
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.

[CI]: worker should perform package skip BEFORE docker image is being pulled.

4 participants