2215f6dc |
1 | #!/bin/bash |
2 | |
3 | ## Cleanup the vendor tree. The main issue here is that civi Civi is |
4 | ## deployed as a module inside a CMS, so all its source-code gets published. |
5 | ## Some libraries distribute admin tools and sample files which should not |
6 | ## be published. |
7 | ## |
8 | ## This script should be idempotent -- if you rerun it several times, it |
9 | ## should always produce the same post-condition. |
10 | |
11 | ## Replace a line in a file |
12 | ## This is a bit like 'sed -i', but dumber and more cross-platform. |
13 | |
14 | ############################################################################## |
15 | ## usage: safe_delete <relpath...> |
16 | function safe_delete() { |
17 | for file in "$@" ; do |
18 | if [ -z "$file" ]; then |
19 | echo "Skip: empty file name" |
20 | elif [ -e "$file" ]; then |
21 | rm -rf "$file" |
22 | fi |
23 | done |
24 | } |
25 | |
26 | |
27 | ############################################################################## |
28 | # @fixme Extend pear/mail rather than patching it. |
29 | if ! grep -q 'CRM-1367' vendor/pear/mail/Mail.php; then |
30 | patch -d vendor/pear/mail -p1 < tools/scripts/composer/patches/pear-mail.patch.txt |
31 | fi |
32 | |
33 | safe_delete vendor/pear/console_getopt/{package.xml,README.rst,tests} |
34 | safe_delete vendor/pear/mail/{package.xml,README.rst,tests} |
35 | safe_delete vendor/pear/pear-core-minimal/{package.xml,README.rst} |