-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix(ci): fixing package cleanup to work with toybox df. #23530
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
Conversation
|
Works fine on my device. |
936093e to
0a5c961
Compare
robertkirkman
left a 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.
Ok now it is working on my device as expected.
e76ec14 to
edbbbf5
Compare
330b717 to
d78d634
Compare
|
Since this PR makes newly added build step disabled by default it should be harmless. |
| # Get available space (df outputs sizes in 1024-byte blocks) | ||
| local space_available="$(df -P "/var/lib/docker" | awk 'NR==2 {print $4}')" | ||
| # Get available space in bytes | ||
| local space_available="$(df "/var/lib/docker" | awk 'NR==2 {print $4 * 1024}')" |
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.
Add a case if /var/lib/docker not exist or the command fails, fallback to check current location disk space
build-package.sh
Outdated
| fi | ||
| ;; | ||
| -c) TERMUX_CONTINUE_BUILD=true;; | ||
| -C) TERMUX_CLEANUP_PACKAGES=true;; |
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.
Rename to TERMUX_CLEANUP_BUILT_PACKAGES_ON_LOW_DISK_SPACE
d78d634 to
833f12b
Compare
|
termux-packages/scripts/build/termux_step_cleanup_packages.sh Lines 14 to 24 in 833f12b
$ func() { set -e; local res="$(false)"; echo here1; }
(func;)
func1() { set -e; local res; res="$(false)"; echo here2; }
(func1;)
here1
local packages packages_regex
packages="$(find ${TERMUX_PACKAGES_DIRECTORIES} -mindepth 1 -maxdepth 1 -type d -printf '%f\n')"
[[ -z "$packages" ]] && return 0
# Exclude current package.
packages="$(printf "%s" "$packages" | grep -Fxv "$TERMUX_PKG_NAME")"
[[ -z "$packages" ]] && return 0
packages_regex="$(printf "%s" "$packages" | sed -zE 's/[][\.|$(){}?+*^]/\\&/g' | sed -E 's/(.*)/(\1)/g' | sed -zE -e 's/[\n]+/|/g' -e 's/(.*)/(\1)/g')"
(cd "$TERMUX_TOPDIR" && find . -mindepth 1 -maxdepth 1 -type d -regextype posix-extended -regex "^\./$packages_regex$" -exec rm -rf "{}" +) |
In this case nothing bad will happen, cleanup will not be performed. Seems to be harmless.
Correct, and that is the reason for
Correct. Did not think about it.
|
8be3236 to
833f12b
Compare
833f12b to
0e26cf6
Compare
0e26cf6 to
724ead3
Compare
|
Please init to allow reuse outside |
|
Truboxl, I asked about that but, twaik explained that there is some reason it is better to stay this way here |
|
It would be extremely helpful and speed up review process of changing the build scripts by having CI for on device build. Not that we are allowing on device built packages to be uploaded to server yet (with some exceptions like pypy). |
Probably we should create |
TomJo2000
left a 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.
LGTM, I'd just like the space threshold to be standardized.
724ead3 to
02f96bd
Compare
|
Seems to be fine, I'll merge this in 12 hours if no one objects. |
I discussed some information about that here, i believe licy183 might try to make that, but I will try to make it also. I created a There are a lot of packages that currently have various errors when built with
There are some packages that rely on audio or graphics libraries, which I believe termux-docker cannot currently build or test effectively with exactly accurate behavior to what a full AVD would, because of not having, for one example, OpenSL ES libraries or stubs yet, so any workflow doing this would need to be limited primarily to purely "headless" CLI packages first, but it would still be a good start. |
In your old code, you would be getting an empty variable for packages when command fails, and then using it to generate a regex and then using it to remove directories. If something bad doesn't happen, it wouldn't be because its harmless, but because you were lucky. You still haven't separated the
You would still not be creating a valid or at least logical regex. That dummy token will be added to
Yes, it should be fine to do that as well, at the cost of slight cost if there are lot of directories. |
You mean declare all local variables on separate line at the start of the function?
The whole point was to create a token that will not match in any case :) . |
|
Oh, ok. TIL. |
02f96bd to
dc6ea3a
Compare
|
Done. |
|
So now it should be fine, right? |
|
Yes, thanks |
Fixes on-device builds.