]>
Commit | Line | Data |
---|---|---|
7eda085c KZ |
1 | #!/bin/sh |
2 | # | |
68331655 | 3 | # Copyright (C) 2009 Karel Zak <kzak@redhat.com> |
7eda085c KZ |
4 | # |
5 | ||
0a8e0e8b RM |
6 | # find all git-tracked and existing *.c and *.h files |
7 | # exclude some (sub)directories | |
68331655 | 8 | # sort the list |
7eda085c | 9 | |
0a8e0e8b RM |
10 | if [ ! -f "po/Makevars" ]; then |
11 | echo "error: update-potfiles must run in the top-level directory" >&2 | |
12 | exit 1 | |
13 | fi | |
7c2ee1d2 | 14 | |
0a8e0e8b RM |
15 | # find all git-tracked files |
16 | source_files=$(git ls-files . 2>/dev/null) | |
17 | if [ $? -ne 0 ] || [ -z "$source_files" ]; then | |
0a8e0e8b RM |
18 | # we still go through the rest of this script to provide at least an empty |
19 | # list or remove non-existing (deleted) files | |
20 | source_files=$(cat po/POTFILES.in 2>/dev/null) | |
21 | fi | |
a7f95887 JC |
22 | if [ $? -ne 0 ] || [ -z "$source_files" ]; then |
23 | source_files=$(find . -type f -printf "%P\\n" 2>/dev/null) | |
24 | fi | |
0a8e0e8b RM |
25 | |
26 | # apply include/exclude patterns | |
27 | source_files=$( | |
28 | echo "$source_files" \ | |
29 | | sed \ | |
30 | -e '/\(\.h\|\.c\)$/!d' \ | |
31 | -e '/^tests\//d' \ | |
32 | -e '/\/samples\//d' \ | |
7d78e988 | 33 | -e '/^Documentation\//d' \ |
0a8e0e8b RM |
34 | ) |
35 | ||
36 | # throw away non-existing files (dirty git repo) | |
37 | echo "$source_files" \ | |
38 | | xargs -r find 2>/dev/null \ | |
39 | | sort \ | |
40 | > po/POTFILES.in | |
41 | ||
42 | # if this script is broken then we have probably an empty list | |
43 | [ -s po/POTFILES.in ] || echo "$0: warning: po/POTFILES.in is empty" >&2 |