Skip to content

Commit bfc86bf

Browse files
authored
Merge pull request #84 from archlinux/add-sogrep-zst
Add pkggrep: script for grepping for an exact symbol
2 parents bd8075b + fbb5437 commit bfc86bf

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ BASH_SCRIPTS = \
99
aur/review \
1010
package/parse-submodules \
1111
package/pkgsearch \
12-
package/rebuild-todo
12+
package/rebuild-todo \
13+
package/pkggrep
1314

1415
PYTHON_SCRIPTS = \
1516
package/staging2testing \

package/pkggrep

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
# SPDX-License-Identifier: GPL-2.0
4+
5+
set -eou pipefail
6+
7+
PROGNAME="${BASH_SOURCE[0]##*/}"
8+
9+
usage() {
10+
cat <<- _EOF_
11+
Usage: ${PROGNAME} [OPTIONS] expression
12+
13+
Does a full search on all files currently in the repository.
14+
This is useful if one wants to search for a symbol instead of a soname.
15+
For sonames please use 'sogrep'.
16+
17+
OPTIONS
18+
-h, --help Show this help text
19+
20+
Examples:
21+
$ ${PROGNAME} _ZN3fmt3v116detail10locale_refC1ISt6localeEERKT_
22+
_EOF_
23+
}
24+
25+
if ! ((${#})); then
26+
usage
27+
exit 0
28+
fi
29+
30+
SEARCH_EXPRESSION=""
31+
SEARCH_HOST="build.archlinux.org"
32+
33+
while ((${#})); do
34+
key="${1}"
35+
case ${key} in
36+
-h|--help)
37+
usage
38+
exit 0
39+
;;
40+
--)
41+
shift
42+
break
43+
;;
44+
-*)
45+
echo "invalid argument: $key"
46+
usage
47+
exit 1
48+
;;
49+
*)
50+
SEARCH_EXPRESSION="${key}"
51+
;;
52+
esac
53+
shift
54+
done
55+
56+
ssh "${SEARCH_HOST}" "parallel \"rg --files-with-matches --search-zip -- '${SEARCH_EXPRESSION}' {} && pacman -Qpq {}\" ::: /srv/ftp/pool/*/*.zst"

0 commit comments

Comments
 (0)