]>
Commit | Line | Data |
---|---|---|
87c0930c | 1 | #!/bin/bash |
308ad36c | 2 | # Symlink {build => src}/$pkg/debian/patches for easier editing. |
a420c606 XL |
3 | # |
4 | # If you give a second argument $2, will create this patch, add Cargo.toml to | |
5 | # it, open it for editing, refresh the patch, and call cargo build for you. | |
6 | # | |
7 | # If the build succeeds, exits with success, and you can re-rerun update.sh | |
8 | # If the build fails, will "quilt add" everything so you can begin editing the | |
9 | # files without forgetting to add them. | |
10 | ||
308ad36c XL |
11 | set -e |
12 | ||
13 | pkg="$1" | |
14 | ||
15 | if ! test -d "src/$pkg/debian"; then | |
16 | echo >&2 "not a directory: src/$pkg/debian" | |
17 | exit 1 | |
18 | fi | |
19 | ||
20 | test -d "src/$pkg/debian/patches" || mkdir "src/$pkg/debian/patches" | |
21 | rm -rf "build/$pkg/debian/patches" | |
22 | rm -rf "build/$pkg/.pc" | |
42c05a2b | 23 | mkdir -p "build/$pkg/debian" |
308ad36c | 24 | ln -sfT "$PWD/src/$pkg/debian/patches" "build/$pkg/debian/patches" |
a420c606 XL |
25 | |
26 | if [ -z "$2" ]; then exit 0; fi | |
27 | ||
28 | cd "build/$pkg" | |
29 | export QUILT_PATCHES=debian/patches | |
30 | patchname="${2%.patch}.patch" | |
31 | quilt new "$patchname" | |
32 | quilt add Cargo.toml | |
33 | sensible-editor Cargo.toml | |
34 | quilt refresh | |
35 | find src -type f -execdir quilt add '{}' + | |
36 | ||
91c08c65 | 37 | while ! cargo build --all-features; do |
a420c606 XL |
38 | |
39 | cat <<-eof | |
40 | Spawning a sub-shell. Please try to fix the build failure by editing files in | |
41 | src/, which have been already quilt-added for you to $patchname. Afterwards, | |
42 | don't forgot to run "quilt refresh". To exit this loop without having fixed the | |
43 | problem, press Ctrl-D then quickly Ctrl-C. | |
44 | eof | |
45 | $SHELL | |
46 | quilt refresh | |
a420c606 XL |
47 | |
48 | done | |
49 | ||
50 | echo "patching was a success!" |