Skip to content

Commit e0df5e6

Browse files
committed
filters: add PDB file filter
Program Database (PDB) file contains debug symbol for PE binary, which can be found in most .NET softwares.
1 parent 99bcb3c commit e0df5e6

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

filters/80-elf.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
##filter/elf.sh: ELF-related filters
33
##@copyright GPL-2.0+
44

5+
# executable and libraries can only exist in following directories in AOSC OS package
6+
# ref: AOSC OS Package Styling Manual (https://wiki.aosc.io/developer/packaging/package-styling-manual/)
7+
# Filesystem Hierarchy Standard 3.0 (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html)
8+
BIN_DIRS=(
9+
opt/
10+
usr/bin/
11+
usr/lib/
12+
usr/libexec/
13+
usr/local/bin/
14+
usr/local/lib/
15+
usr/local/libexec/
16+
)
17+
518
filter_elf() {
619
local _opts=()
720
if ! bool "$ABSTRIP"; then
@@ -13,7 +26,8 @@ filter_elf() {
1326
fi
1427

1528
local _elf_path=()
16-
for i in "$PKGDIR"/{opt/*/*/,opt/*/,usr/,}{lib{,64,exec},{s,}bin}/; do
29+
for p in "${BIN_DIRS[@]}"; do
30+
i="$PKGDIR"/"$p"
1731
if [ -d "$i" ]; then
1832
_elf_path+=("$i")
1933
fi

filters/81-pdb.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
##filter/pdb.sh: Move or delete Program Database file
3+
##@copyright GPL-2.0+
4+
5+
filter_pdb() {
6+
for p in ${BIN_DIRS[@]}; do
7+
i="$PKGDIR"/"$p"
8+
if [ -d "$i" ]; then
9+
for f in `find $i -type f -name "*.pdb"`; do
10+
if bool "$ABSPLITDBG"; then
11+
path="${f#"$PKGDIR"}"
12+
abinfo "Saving Program Database file $f ..."
13+
mkdir -p `dirname "$SYMDIR"/"$path"`
14+
mv "$f" "$SYMDIR"/"$path"
15+
elif bool "$ABSTRIP"; then
16+
abinfo "Dropping Program Database file $f ..."
17+
rm "$f"
18+
fi
19+
done
20+
fi
21+
done
22+
}
23+
24+
ab_register_filter pdb

0 commit comments

Comments
 (0)