githooks/pre-commit: remove file size check
This still comes from the aports hook, where we want to avoid too large patches, but in pmaports we have big kernel config files that might exceed the configured 256 kiB limit. Currently the following files exceed that limit and used git commit --no-verify to overcome the error (or didn't configure git hooks): 260K ./device/community/linux-postmarketos-qcom-laptop/config-postmarketos-qcom-laptop.aarch64 268K ./main/postmarketos-bootsplash/OpenSans-Regular.svg 336K ./device/downstream/linux-amazon-checkers/0003-Add-missing-kconfig-files.patch 376K ./device/downstream/linux-amazon-austin/silence-power-logspam.patch Alternatively we can increase the file limit, but i'm not sure what that solves. In future for Alpine, I want to move the check to abuild's internal linting, which makes it visible for all APKBUILDs, consistent with other of abuild's linters and also shows up on CI. Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7603>
This commit is contained in:
parent
dd15329220
commit
32e9ca423e
1 changed files with 0 additions and 22 deletions
|
|
@ -5,10 +5,6 @@
|
||||||
#
|
#
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Maximal allowed size (in bytes) of a file.
|
|
||||||
FILE_SIZE_LIMIT=262144 # 256 kiB
|
|
||||||
|
|
||||||
|
|
||||||
if ! command -v sha512sum >/dev/null; then
|
if ! command -v sha512sum >/dev/null; then
|
||||||
# macOS / BSDs (?) don't have sha512sum, but shasum.
|
# macOS / BSDs (?) don't have sha512sum, but shasum.
|
||||||
alias sha512sum='shasum -a 512'
|
alias sha512sum='shasum -a 512'
|
||||||
|
|
@ -95,20 +91,6 @@ check_local_sources() {
|
||||||
return $status
|
return $status
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks if the file ($1) being committed is not bigger than FILE_SIZE_LIMIT.
|
|
||||||
check_file_size() {
|
|
||||||
local path="$1"
|
|
||||||
local size
|
|
||||||
|
|
||||||
size=$(git cat-file -s ":$path")
|
|
||||||
if [ $size -gt $FILE_SIZE_LIMIT ]; then
|
|
||||||
local size_kb=$(( size / 1024 ))
|
|
||||||
|
|
||||||
error "file \"$path\" is quite big ($(( size / 1024 )) kiB), better put a remote url in source="
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
[ -f "$_staged" ] && rm "$_staged"
|
[ -f "$_staged" ] && rm "$_staged"
|
||||||
}
|
}
|
||||||
|
|
@ -122,8 +104,4 @@ for apkbuild in $(changed_files '**/APKBUILD'); do
|
||||||
cleanup
|
cleanup
|
||||||
done
|
done
|
||||||
|
|
||||||
for path in $(changed_files); do
|
|
||||||
check_file_size "$path"
|
|
||||||
done
|
|
||||||
|
|
||||||
trap - EXIT
|
trap - EXIT
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue