Improving checks on AniNIX standards
This commit is contained in:
parent
184c2c5915
commit
c988f725fb
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
wiki/
|
||||||
pkg/
|
pkg/
|
||||||
src/
|
src/
|
||||||
*.tar.xz
|
*.tar.xz
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
diff -w <(curl -s 'https://aninix.net/AniNIX/Ubiqtorate/raw/branch/main/roles/Foundation/files/custom/options/license/AniNIX-WTFPL') ./LICENSE
|
# If the package hasn't been installed yet, since we are the origin, we have to bootstrap.
|
||||||
|
if [ "$(basename "$PWD")" == 'Uniglot' ] && [ ! -f /usr/share/licenses/Uniglot/LICENSE ]; then
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
diff -w /usr/share/licenses/Uniglot/LICENSE ./LICENSE;
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
if [ "$(basename "$PWD")" == 'Uniglot' ]; then
|
||||||
|
echo INFO: You are changing the LICENSE and need to update downstream projects.
|
||||||
|
echo INFO: You also need to redeploy AniNIX/Foundation via AniNIX/Ubiqtorate for new projects.
|
||||||
|
exit 0;
|
||||||
|
else
|
||||||
|
echo ERROR: License is out of sync with AniNIX/Uniglot or you don\'t have Uniglot locally installed.
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
fi;
|
||||||
|
21
Hooks/scripts.d/check-AniNIX-Makefile
Executable file
21
Hooks/scripts.d/check-AniNIX-Makefile
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Enforce each of the lines
|
||||||
|
for line in compile install clean uninstall test checkperm diff reverse; do
|
||||||
|
|
||||||
|
newlinenum="$(grep -nE "^$line:" "Makefile" | cut -f 1 -d ':')"
|
||||||
|
|
||||||
|
# Case 1: Missing section
|
||||||
|
if [ -z "$newlinenum" ]; then
|
||||||
|
echo "$file" is missing "$line"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Case 2: Line is out of order
|
||||||
|
if [ "$newlinenum" -lt "$linenum" ]; then
|
||||||
|
echo "$file" has section "$line" out of order.
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
linenum="$newlinenum"
|
||||||
|
|
||||||
|
done
|
22
Hooks/scripts.d/check-AniNIX-PKGBUILD
Executable file
22
Hooks/scripts.d/check-AniNIX-PKGBUILD
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ensure that the following lines match the base PKGBUILD
|
||||||
|
retcode=0
|
||||||
|
(for term in pkgname replaces pkgver epoch pkgdesc url license ../LICENSE; do
|
||||||
|
current="$(grep "${term}" ./PKGBUILD)"
|
||||||
|
reference="$(grep "${term}" /opt/aninix/Uniglot/pacman/PKGBUILD)"
|
||||||
|
diff <(printf "${reference}") <(echo "${current}")S
|
||||||
|
retcode="$(( $retcode || $? ))";
|
||||||
|
done) &>/dev/null
|
||||||
|
|
||||||
|
if [ "$(basename "$0")" == 'Uniglot' ] && [ "$retcode" != 0 ]; then
|
||||||
|
if [ ! -f /opt/aninix/Uniglot/pacman/PKGBUILD ]; then
|
||||||
|
# Suppress output for this package when it isn't installed yet.
|
||||||
|
echo $0
|
||||||
|
else
|
||||||
|
echo INFO: You have introduced delta for the PKGBUILD. You may need to update downstream projects.
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
elif [ "$retcode" != 0 ]; then
|
||||||
|
echo ERROR: PKGBUILD is out of sync with AniNIX/Uniglot.
|
||||||
|
fi
|
55
Hooks/scripts.d/check-AniNIX-READMEs
Executable file
55
Hooks/scripts.d/check-AniNIX-READMEs
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
# Allow verbosity
|
||||||
|
if [ "$1" == "-v" ]; then
|
||||||
|
set -x;
|
||||||
|
shift;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Allow passing in more than just the landing README.md, but default to ./README.md
|
||||||
|
files="$@"
|
||||||
|
if [ -z "$files" ]; then
|
||||||
|
files="./README.md"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Iterate on each file.
|
||||||
|
for file in $files; do
|
||||||
|
|
||||||
|
# Reset order tracking
|
||||||
|
linenum=0
|
||||||
|
|
||||||
|
# Enforce each of the lines
|
||||||
|
for line in '^# Etymology$' '^# Relevant Files and Software$' '^# Available Clients$' '^# Equivalents or Competition$'; do
|
||||||
|
newlinenum="$(grep -nE "$line" "$file" | cut -f 1 -d ':')"
|
||||||
|
|
||||||
|
# Case 1: Missing section
|
||||||
|
if [ -z "$newlinenum" ]; then
|
||||||
|
echo "$file" is missing "$line"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Case 2: Line is out of order
|
||||||
|
if [ "$newlinenum" -lt "$linenum" ]; then
|
||||||
|
echo "$file" has section "$line" out of order.
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
linenum="$newlinenum"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# Case 3: Spelling errors are present
|
||||||
|
spellerrors="$(cat "$file" | aspell -p <(echo personal_ws-1.1 en 0; cat ~/.vim/spell/en.utf-8.add) list)"
|
||||||
|
if [ `echo "$spellerrors" | wc -l` -ne 1 ]; then
|
||||||
|
echo "$file" has spelling errors.
|
||||||
|
echo "$spellerrors"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# Wiki documentation is procedurally generated in its own repo.
|
||||||
|
if ! grep -E ^wiki/ .gitignore 1>/dev/null; then
|
||||||
|
echo The wiki folder needs to be ignored.
|
||||||
|
exit 4
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user