@@ -2,24 +2,29 @@ BEGIN {
22 # Mapping from root-level path to expected symlink destination.
33 # https://github.com/floppym/merge-usr/blob/15dd02207bdee7ca6720d7024e8c0ffdc166ed23/merge-usr#L17-L25
44 # Note: Debian does NOT merge /usr/sbin into /usr/bin, so /sbin -> usr/sbin.
5- expected[ " ./ bin" ] = " usr/bin"
6- expected[ " ./ sbin" ] = " usr/sbin"
7- expected[ " ./ lib" ] = " usr/lib"
8- expected[ " ./ lib32" ] = " usr/lib32"
9- expected[ " ./ lib64" ] = " usr/lib64"
10- expected[ " ./ libx32" ] = " usr/libx32"
11- prefixes = " ./ bin|./ sbin|./ lib|./ lib32|./ lib64|./ libx32"
5+ expected[ " bin" ] = " usr/bin"
6+ expected[ " sbin" ] = " usr/sbin"
7+ expected[ " lib" ] = " usr/lib"
8+ expected[ " lib32" ] = " usr/lib32"
9+ expected[ " lib64" ] = " usr/lib64"
10+ expected[ " libx32" ] = " usr/libx32"
11+ prefixes = " bin|sbin|lib|lib32|lib64|libx32"
1212}
1313{
14- path = $1
14+ original_path = $1
15+ path = original_path
16+ # Normalize: strip leading ./ or /
17+ sub (/^ \.\/ /, " " , path)
18+ sub (/^ \/ /, " " , path)
19+
1520 if (path in expected) {
1621 if ($0 !~ /type=link /) {
17- VIOLATIONS[ path ] = path " is not a symlink (must link to " expected[ path] " )"
22+ VIOLATIONS[ original_path ] = original_path " is not a symlink (must link to " expected[ path] " )"
1823 } else if (match ($0 , / link=([^ \t ]+ ) /, dest) && dest[ 1 ] != expected[ path] ) {
19- VIOLATIONS[ path ] = path " symlinks to '" dest[ 1 ] " ' instead of '" expected[ path] " '"
24+ VIOLATIONS[ original_path ] = original_path " symlinks to '" dest[ 1 ] " ' instead of '" expected[ path] " '"
2025 }
21- } else if ($0 ~ (" ^(" prefixes " )/" )) {
22- VIOLATIONS[ path ] = path " found under a merged-usr symlink path (should not exist)"
26+ } else if (path ~ (" ^(" prefixes " )/" )) {
27+ VIOLATIONS[ original_path ] = original_path " found under a merged-usr symlink path (should not exist)"
2328 }
2429}
2530END {
0 commit comments