Code: Select all
# sort and clean the search results
LANG=C cat $TMPDIR/pkglist | sort --field-separator='-' -k1,1df -k2gr -k3gr -k4gr | uniq > $TMPDIR/pkglist1
Note that pkglist is generated in this line:
Code: Select all
# create the search results
cut -f1 -d'|' ${HOME}/.packages/${REPOFILE} 2>/dev/null | grep "^$1" > $TMPDIR/pkglist
I note that the filed seperator in the sort statment is "-". In my example (i.e. libwayland-client0_1.12.0-1+deb9u1) there are two dashes. I wonder if this causes any issues?
Here is some related strange output:
Code: Select all
bash -x pkg --names libwayland-client0 2>&1 | tee wayland_names.log
....
+ cut -f1 '-d|' /root/.packages/Packages-devuan-ascii-main
+ grep '^libwayland-client0'
+ '[' false = true ']'
+ hide_blacklisted_pkgs_from_search_results
+ '[' false = true ']'
++ echo fbset petget rgb sysfiles sysklogd
++ sed -e 's/ /|/g'
+ blacklisted_pkgs_list='fbset|petget|rgb|sysfiles|sysklogd'
+ cat /tmp/pkg//pkglist
+ grep -v -E ''\''fbset|petget|rgb|sysfiles|sysklogd'\'''
+ mv /tmp/pkg//pkglist_without_blacklisted /tmp/pkg//pkglist
+ rm '/tmp/pkg//pkglist_*'
+ '[' false = false ']'
+ local ALIAS_LIST
+ local ALIAS
+ local ALIAS_RES
+ '[' libwayland-client0 '!=' '' -a -f /tmp/pkg//pkg_aliases ']'
++ grep -m1 libwayland-client0 /tmp/pkg//pkg_aliases
++ tr , ' '
+ ALIAS_LIST=
+ echo
+ read ALIAS
+ '[' '' = '' ']'
+ continue
+ read ALIAS
+ LANG=C
+ cat /tmp/pkg//pkglist
+ sort --field-separator=- -k1,1df -k2gr -k3gr -k4gr
+ uniq
+ mv /tmp/pkg//pkglist1 /tmp/pkg//pkglist
+ '[' -s /tmp/pkg//pkglist ']'
+ cat /tmp/pkg//pkglist
libwayland-client0_1.12.0-1
+ '[' '!' -f /tmp/pkg//pkglist ']'
+ rm /tmp/pkg//pkglist