feat(aa): rewrite rules formatting.

This commit is contained in:
Alexandre Pujol 2024-06-19 23:30:36 +01:00
parent e91b0cc070
commit 944f9575a0
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 111 additions and 27 deletions

View file

@ -94,9 +94,11 @@ var (
fileAlphabet = []string{
"@{exec_path}", // 1. entry point
"@{sh_path}", // 2.1 shells
"@{bin}", // 2.1 binaries
"@{lib}", // 2.2 libraries
"/opt", // 2.3 opt binaries & libraries
"@{coreutils_path}", // 2.2 coreutils
"@{open_path}", // 2.3 binaries paths
"@{bin}", // 2.3 binaries
"@{lib}", // 2.4 libraries
"/opt", // 2.5 opt binaries & libraries
"/usr/share", // 3. shared data
"/etc", // 4. system configuration
"/var", // 5.1 system read/write data
@ -107,8 +109,9 @@ var (
"@{user_config_dirs}", // 7.2 user config
"@{user_share_dirs}", // 7.3 user shared
"/tmp", // 8.1 Temporary data
"@{run}", // 8.2 Runtime data
"/dev/shm", // 8.3 Shared memory
"@{tmp}", // 8.1. User temporary data
"/dev/shm", // 8.2 Shared memory
"@{run}", // 8.3 Runtime data
"@{sys}", // 9. Sys files
"@{PROC}", // 10. Proc files
"/dev", // 11. Dev files
@ -117,6 +120,20 @@ var (
}
fileWeights = generateWeights(fileAlphabet)
// Some file rule should be sorted in the same group
fileAlphabetGroups = map[string]string{
"@{exec_path}": "exec",
"@{sh_path}": "exec",
"@{coreutils_path}": "exec",
"@{open_path}": "exec",
"@{bin}": "exec",
"@{lib}": "exec",
"/opt": "exec",
"/tmp": "tmp",
"@{tmp}": "tmp",
"/dev/shm": "tmp",
}
// The order AARE should be sorted
stringAlphabet = []byte(
"!\"#$%&'(){}[]*+,-./:;<=>?@\\^_`|~0123456789abcdefghijklmnopqrstuvwxyz",