Skip to content

Commit 4dc55af

Browse files
committed
2 parents 2737443 + 2f03b4d commit 4dc55af

1,197 files changed

Lines changed: 79592 additions & 6798 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/golang_validation.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,18 @@ jobs:
4343
uses: actions/checkout@v6
4444
with:
4545
fetch-depth: 1
46-
- name: Set process id limit for 32-bit builds depending on aosp-libs
47-
run: echo 65535 | sudo tee /proc/sys/kernel/pid_max
4846
- name: Enable zram
49-
if: ${{ steps.build-info.outputs.skip-building != 'true' }}
5047
uses: ./.github/actions/zram
5148
with:
5249
algorithm: zstd
5350
size: 16G
5451
priority: 100
5552
device_name: /dev/zram0
56-
- name: Prepare environment
53+
- name: Load Docker image
54+
run: |
55+
./scripts/run-docker.sh true
56+
- name: Free additional disk space
5757
run: |
58-
./scripts/setup-ubuntu.sh
59-
./scripts/setup-android-sdk.sh
60-
sudo apt install ninja-build
6158
./scripts/free-space.sh
6259
- name: Golang validation
6360
run: ./scripts/bin/validation ${{ matrix.target_arch }} golang ${{ matrix.batch }} || exit 1

.github/workflows/package_updates.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,29 @@ jobs:
104104
with:
105105
fetch-depth: 0
106106
token: ${{ secrets.TERMUXBOT2_TOKEN }}
107-
- name: Set process id limit for 32-bit builds depending on aosp-libs
108-
run: echo 65535 | sudo tee /proc/sys/kernel/pid_max
109107
- name: Enable zram
110108
uses: ./.github/actions/zram
111109
with:
112110
algorithm: zstd
113111
size: 16G
114112
priority: 100
115113
device_name: /dev/zram0
114+
- name: Load Docker image
115+
run: |
116+
./scripts/run-docker.sh true
116117
- name: Free additional disk space
117-
run: CLEAN_DOCKER_IMAGES=false ./scripts/free-space.sh
118+
run: ./scripts/free-space.sh
119+
- name: Install needed dependencies for package updates
120+
run: |
121+
sudo apt-get update
122+
sudo apt-get install -y --no-install-recommends \
123+
curl \
124+
python3 \
125+
jq
118126
- name: Process package updates
119127
env:
120128
GITHUB_TOKEN: ${{ secrets.TERMUXBOT2_TOKEN }}
121129
BUILD_PACKAGES: "true"
122-
TERMUX_DOCKER__CONTAINER_EXEC_COMMAND__PRE_CHECK_IF_WILL_BUILD_PACKAGES: "true"
123130
CREATE_ISSUE: "true"
124131
GIT_COMMIT_PACKAGES: "true"
125132
GIT_PUSH_PACKAGES: "true"

.github/workflows/packages.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ on:
3838
- arm
3939
- i686
4040
- x86_64
41+
free-space:
42+
description: "Free space even if not building large package (useful when building a large number of packages)"
43+
type: boolean
44+
default: false
4145

4246
permissions: {} # none
4347

@@ -61,8 +65,6 @@ jobs:
6165
uses: actions/checkout@v6
6266
with:
6367
fetch-depth: 1000
64-
- name: Set process id limit for 32-bit builds depending on aosp-libs
65-
run: echo 65535 | sudo tee /proc/sys/kernel/pid_max
6668

6769
- name: Gather build summary
6870
id: build-info
@@ -116,7 +118,6 @@ jobs:
116118
# Forces CI to cancel current build with status 'passed'
117119
if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 --no-merges "HEAD"); then
118120
tar cf artifacts/debs-${{ matrix.target_arch }}.tar debs
119-
echo "docker-build=true" >> $GITHUB_OUTPUT
120121
echo "[!] Force exiting as tag '%ci:no-build' was applied to HEAD commit message."
121122
exit 0
122123
fi
@@ -204,31 +205,33 @@ jobs:
204205
205206
echo "packages: ${packages[*]}"
206207
207-
docker='true'
208+
free_space='false'
209+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
210+
free_space=${{ github.event.inputs.free-space }}
211+
else
212+
if grep -qiP '^\s*%ci:free-disk\s*$' <(git log --format="%B" -n 1 --no-merges "HEAD"); then
213+
free_space=true
214+
fi
215+
fi
208216
if [[ "${#packages[@]}" -gt 0 ]]; then
209217
for pkg in "${packages[@]}"; do
210218
if grep -qFx "$pkg" ./scripts/big-pkgs.list; then
211-
docker='false'
219+
free_space='true'
212220
break
213221
fi
214222
done
215223
fi
224+
echo "free-space=$free_space" >> $GITHUB_OUTPUT
216225
217-
echo "docker-build=$docker" >> $GITHUB_OUTPUT
226+
needs_docker_build=false
218227
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
219228
# Build local Docker image if setup scripts were changed.
220229
# Useful for pull requests submitting changes for both build environment and packages.
221230
if grep -qP '^scripts/(Dockerfile|properties\.sh|setup-android-sdk\.sh|setup-ubuntu\.sh)$' <<< "$CHANGED_FILES"; then
222-
echo "Detected changes for environment setup scripts. Building custom Docker image now."
223-
if [ $docker == 'false' ]; then
224-
echo "Skipping due to building large packages."
225-
exit 0
226-
fi
227-
cd ./scripts
228-
docker build -t ghcr.io/termux/package-builder:latest .
229-
cd ..
231+
needs_docker_build=true
230232
fi
231233
fi
234+
echo "needs-docker-build=$needs_docker_build" >> $GITHUB_OUTPUT
232235
233236
- name: Lint packages
234237
run: |
@@ -253,22 +256,24 @@ jobs:
253256
priority: 100
254257
device_name: /dev/zram0
255258

259+
- name: Build docker image
260+
if: ${{ steps.build-info.outputs.needs-docker-build == 'true' }}
261+
run: |
262+
docker build -t ghcr.io/termux/package-builder:latest scripts/
263+
docker buildx prune -af
264+
265+
- name: Load Docker image
266+
if: ${{ steps.build-info.outputs.free-space == 'true' && steps.build-info.outputs.skip-building != 'true' }}
267+
run: |
268+
./scripts/run-docker.sh true
269+
256270
- name: Free additional disk space (if needed)
257-
if: ${{ steps.build-info.outputs.docker-build == 'false' && steps.build-info.outputs.skip-building != 'true' }}
271+
if: ${{ steps.build-info.outputs.free-space == 'true' && steps.build-info.outputs.skip-building != 'true' }}
258272
run: |
259-
./scripts/setup-ubuntu.sh
260-
# need to unset these for setup-android-sdk.sh.
261-
unset NDK ANDROID_HOME
262-
./scripts/setup-android-sdk.sh
263-
rm -f ${HOME}/lib/ndk-*.zip ${HOME}/lib/sdk-*.zip
264-
sudo apt install ninja-build
265273
./scripts/free-space.sh
266274
267275
- name: Build packages
268276
if: ${{ steps.build-info.outputs.skip-building != 'true' }}
269-
env:
270-
DOCKER_BUILD: ${{ steps.build-info.outputs.docker-build }}
271-
TERMUX_DOCKER__CONTAINER_EXEC_COMMAND__PRE_CHECK_IF_WILL_BUILD_PACKAGES: "true"
272277
run: |
273278
declare -a packages=()
274279
for repo_path in $(jq --raw-output 'del(.pkg_format) | keys | .[]' repo.json); do
@@ -281,16 +286,7 @@ jobs:
281286
echo "packages: ${packages[*]}"
282287
283288
if [[ "${#packages[@]}" -gt 0 ]]; then
284-
if [ "$DOCKER_BUILD" == 'false' ]; then
285-
# these need to be unset a second time again for ./build-package.sh
286-
# when it is run outside of Docker, because GitHub Actions does not
287-
# support permanently unsetting variables at time of writing.
288-
# https://github.com/actions/runner/issues/1126
289-
unset NDK ANDROID_HOME
290-
./build-package.sh -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
291-
else
292-
./scripts/run-docker.sh ./build-package.sh -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
293-
fi
289+
./scripts/run-docker.sh -d ./build-package.sh -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
294290
fi
295291
296292
- name: Generate build artifacts
@@ -335,6 +331,10 @@ jobs:
335331
with:
336332
name: debs-${{ matrix.target_arch }}-${{ github.sha }}
337333
path: ./artifacts
334+
- name: AppArmor Logs
335+
if: always()
336+
run: |
337+
sudo dmesg | grep apparmor
338338
339339
test-buildorder-random:
340340
permissions:

.github/workflows/vagrant.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/zig_validation.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,18 @@ jobs:
4343
uses: actions/checkout@v6
4444
with:
4545
fetch-depth: 1
46-
- name: Set process id limit for 32-bit builds depending on aosp-libs
47-
run: echo 65535 | sudo tee /proc/sys/kernel/pid_max
4846
- name: Enable zram
49-
if: ${{ steps.build-info.outputs.skip-building != 'true' }}
5047
uses: ./.github/actions/zram
5148
with:
5249
algorithm: zstd
5350
size: 16G
5451
priority: 100
5552
device_name: /dev/zram0
56-
- name: Prepare environment
53+
- name: Load Docker image
54+
run: |
55+
./scripts/run-docker.sh true
56+
- name: Free additional disk space
5757
run: |
58-
./scripts/setup-ubuntu.sh
59-
./scripts/setup-android-sdk.sh
6058
./scripts/free-space.sh
6159
- name: Zig validation
6260
run: ./scripts/bin/validation ${{ matrix.target_arch }} zig ${{ matrix.batch }} || exit 1

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ Session.vim
66
.netrwhist
77
*~
88

9-
# Vagrant
10-
scripts/.vagrant/
11-
129
# Logs
1310
scripts/*.log
1411
/*.log

CODEOWNERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
/scripts/ @Grimler91 @thunder-coding
1616
/repo.json @Grimler91 @thunder-coding
1717

18+
# Docker security profiles
19+
/scripts/profile.json @thunder-coding @licy183
20+
/scripts/*.apparmor @thunder-coding
21+
1822
# Build script linter
1923
/scripts/lint-packages.sh @TomJo2000
2024

@@ -28,6 +32,10 @@
2832
# Nodejs setup script
2933
/scripts/build/setup/termux_setup_nodejs.sh @thunder-coding
3034

35+
# Python setup scripts
36+
/scripts/build/setup/termux_setup_python_pip.sh @thunder-coding
37+
/scripts/build/setup/termux_setup_build_python.sh @thunder-coding
38+
3139
# Packages owned by @finagolfin
3240
/packages/libdispatch/ @finagolfin
3341
/packages/libllvm/ @finagolfin
@@ -84,6 +92,7 @@
8492
/packages/nodejs/ @thunder-coding
8593
/packages/nodejs-lts/ @thunder-coding
8694
/packages/npm/ @thunder-coding
95+
/packages/python/ @thunder-coding
8796
/packages/silicon/ @thunder-coding
8897
/packages/slides/ @thunder-coding
8998

build-package.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_ldc.sh"
149149
# shellcheck source=scripts/build/setup/termux_setup_no_integrated_as.sh
150150
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_no_integrated_as.sh"
151151

152+
# Utility function for setting up build-python for cross-compilation of Python and crossenv
153+
# shellcheck source=scripts/build/setup/termux_setup_build_python.sh
154+
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_build_python.sh"
155+
152156
# Utility function for python packages to setup a python.
153157
# shellcheck source=scripts/build/setup/termux_setup_python_pip.sh
154158
source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_python_pip.sh"
@@ -660,7 +664,7 @@ for (( i=0; i < ${#PACKAGE_LIST[@]}; i++ )); do
660664
if [[ "$TERMUX_BUILD_IGNORE_LOCK" != "true" ]]; then
661665
flock -n 5 || termux_error_exit "Another build is already running within same environment."
662666
fi
663-
667+
(
664668
# Handle 'all' arch:
665669
if [[ "$TERMUX_ON_DEVICE_BUILD" == "false" && -n "${TERMUX_ARCH+x}" && "${TERMUX_ARCH}" == 'all' ]]; then
666670
_SELF_ARGS=()
@@ -798,6 +802,7 @@ for (( i=0; i < ${#PACKAGE_LIST[@]}; i++ )); do
798802
fi
799803
termux_add_package_to_built_packages_list "$TERMUX_PKG_NAME"
800804
termux_step_finish_build
805+
) 5>&-
801806
) 5< "$TERMUX_BUILD_LOCK_FILE"
802807
done
803808

clean.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,16 @@ fi
9393
rm -Rf "/data/data/.built-packages"
9494
fi
9595

96-
rm -Rf "$TERMUX_TOPDIR"
96+
# unmount overlayfs before we remove the parent directory
97+
[ -d "$TERMUX_TOPDIR" ] && for dir in $(find "$TERMUX_TOPDIR" -type d); do
98+
if mountpoint -q "$dir"; then
99+
umount "$dir"
100+
fi
101+
done
102+
103+
# We can't use rm -Rf "$TERMUX_TOPDIR" in case the "$TERMUX_TOPDIR" is mounted as a Docker volume
104+
if [ -d "$TERMUX_TOPDIR" ]; then
105+
find "$TERMUX_TOPDIR" -type f,l,b,c -delete
106+
find "$TERMUX_TOPDIR" -type d ! -path "$TERMUX_TOPDIR" -delete
107+
fi
97108
} 5< "$TERMUX_BUILD_LOCK_FILE"
File renamed without changes.

0 commit comments

Comments
 (0)