-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
chore(scripts/termux_step_install_license): total refactor #20867
Conversation
I'd like some clarification on this check in the current version. termux-packages/scripts/build/termux_step_install_license.sh Lines 81 to 85 in eeca771
I can't see what it is meant to accomplish.
Since I don't see any way for that check to ever fail, I removed it. |
All initial smoke tests seem favorable. |
The check is to verify so that there are files in We can probably check this in a more intuitive way, maybe with find. |
|
Looks fine otherwise from a quick look. However, note that debian does not use Additionally, lot of packages use the machine-readable |
Well if you're in the mood to break APIs. |
I've had a read through the linked resources. |
For checking if license file was added. license_files="$(find "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" -maxdepth 1 -type f -name "LICENSE*")"
if [ -z "$license_files" ]; then
# error out
fi For mulitple filenames, you can use something like |
Should that be a |
I don't suggest using the machine-readable However, I do suggest that we use |
Yep, that's definitely far easier than implementing the whole standard right away.
Eventual consistency, eh? :P |
Yeah, best use |
Thanks. |
Well, if you wanna rebuild all 2000+ packages, who am I to say no, have fun with failed builds and missing source urls :p |
CI's been flakey lately anyway. |
0536afb
to
4c20870
Compare
Alright, that's:
If you still want the All other threads should be resolved now. |
# Will match regular files and symlinks to regular files
$ find -L . -maxdepth 1 -type f
# Will match regular files, symlinks to regular files and broken symlinks
$ find -L . -maxdepth 1 \( -type f -o -type l \)
# Will match regular files, symlinks to regular files, symlinks to directories and broken symlinks
$ find . -maxdepth 1 \( -type f -o -type l \) Based on above, best use following. It will not match broken symlinks to license files, assuming that's what we want. license_files="$(find -L "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" -maxdepth 1 -type f -name "copyright*")"
if [ -z "$license_files" ]; then
# error out
fi |
Yep I think that tracks with what we are actually trying to check. |
I think license file symlinks may not be valid during build time, let me check. |
Yup, they wouldn't exist, use following with license_files="$(find -L "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" -maxdepth 1 \( -type f -o -type l \) -name "copyright*")"
if [ -z "$license_files" ]; then
# error out
fi |
By symlinks not being valid, I meant that |
Going with local license_files
license_files="$(find -L "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" -maxdepth 1 \( -type f -o -type l \) -name "copyright*")"
[[ -n "$license_files" ]] || {
termux_error_exit "No LICENSE file was installed for $TERMUX_PKG_NAME"
} which is semantically identical. |
How dare you! |
I think the |
Yeah, yeah, it's fine. |
This would only catch all license files missing. Just wondering if we wanna do something about individual missing licenses. We can probably co-opt the The cp: cannot stat 'License.no.such.file': No such file or directory Which works just fine. All good from me then. |
4c20870
to
271785e
Compare
Yes, check would pass if at least one license file exists. If you wanna ensure no missing licenses, in case, a specific loop never ran to fail for local license_list
if [[ -n "${TERMUX_PKG_LICENSE_FILE}" ]]; then
license_list="$TERMUX_PKG_LICENSE_FILE"
else
license_list="$TERMUX_PKG_LICENSE"
fi
...
license_files="$(find -L "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" -maxdepth 1 \( -type f -o -type l \) -name "copyright*")"
if [ -z "$license_files" ]; then
# error out
fi
if [ "$(echo "$license_files" | wc -l)" != "$(echo "$license_list" | sed -E -e 's/[ \t]//g' -e 's/,/\n/g' | wc -l)" ]; then
# error out
fi |
I think I'll just be satisfied with And |
eliminate shellcheck warnings and reduce jank in here
271785e
to
3f6d0ed
Compare
and link to `libandroid-support`
Part of:
This PR is a total refactor of
scripts/build/termux_step_install_license.sh
.The goal was to eliminate shellcheck warnings and reduce jank.