Rev 2 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 5 | ||
---|---|---|---|
1 | #!/bin/sh |
1 | #!/bin/sh |
2 | ## 01_line-endings.dpatch by Magnus Holmgren <magnus@kibibyte.se> |
2 | ## 01_line-endings.dpatch by Magnus Holmgren <magnus@kibibyte.se> |
3 | ## |
3 | ## |
4 | ## All lines beginning with `## DP:' are a description of the patch. |
4 | ## All lines beginning with `## DP:' are a description of the patch. |
5 | ## DP: Convert CRLF line endings to LF in certain Windows-related files |
5 | ## DP: Convert CRLF line endings to LF in certain Windows-related files |
6 | 6 | ||
7 | FILES_WITH_CRLF="src/libspf2/spf_dns_windns.c |
7 | FILES_WITH_CRLF="src/libspf2/spf_dns_windns.c |
8 | src/libspf2/spf_win32.c |
8 | src/libspf2/spf_win32.c |
9 | src/libreplace/win32_config.h |
9 | src/libreplace/win32_config.h |
10 | src/include/spf_dns_windns.h |
10 | src/include/spf_dns_windns.h |
11 | src/include/spf_win32.h" |
11 | src/include/spf_win32.h" |
12 | 12 | ||
13 | set -e |
13 | set -e |
14 | 14 | ||
15 | dpatch_patch() { |
15 | dpatch_patch() { |
- | 16 | if [ ! -f debian/patched/patched-line-endings.tar.gz ]; then |
|
- | 17 | tar -czf debian/patched/patched-line-endings.tar.gz $FILES_WITH_CRLF |
|
16 | # Change line endings to LF in files with CRLF |
18 | # Change line endings to LF in files with CRLF |
17 | sed -ri -e 's/\r$//' $FILES_WITH_CRLF |
19 | sed -ri -e 's/\r$//' $FILES_WITH_CRLF |
- | 20 | fi |
|
18 | } |
21 | } |
19 | 22 | ||
20 | dpatch_unpatch() { |
23 | dpatch_unpatch() { |
21 | # Change line endings back to CRLF in files that had it in the tarball |
24 | # Change line endings back to CRLF in files that had it in the tarball |
22 | # Unfortunately there are exceptions ... have to watch out for changes |
- | |
23 | # in future upstream versions (or simply make backups instead). |
- | |
24 | sed -ri -e '/\r$|^#pragma comment/!s/$/\r/' $FILES_WITH_CRLF |
- | |
25 | sed -ri -e '$s/\r$//' src/libspf2/spf_dns_windns.c |
25 | tar -xzf debian/patched/patched-line-endings.tar.gz |
26 | } |
26 | } |
27 | 27 | ||
28 | DPATCH_LIB_NO_DEFAULT=1 |
28 | DPATCH_LIB_NO_DEFAULT=1 |
29 | 29 | ||
30 | . /usr/share/dpatch/dpatch.lib.sh |
30 | . /usr/share/dpatch/dpatch.lib.sh |