]> git.proxmox.com Git - debcargo-conf.git/blame - dev/link-patches.sh
Merge remote-tracking branch 'origin/pending-unic-segment'
[debcargo-conf.git] / dev / link-patches.sh
CommitLineData
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
11set -e
12
13pkg="$1"
14
15if ! test -d "src/$pkg/debian"; then
16 echo >&2 "not a directory: src/$pkg/debian"
17 exit 1
18fi
19
20test -d "src/$pkg/debian/patches" || mkdir "src/$pkg/debian/patches"
21rm -rf "build/$pkg/debian/patches"
22rm -rf "build/$pkg/.pc"
42c05a2b 23mkdir -p "build/$pkg/debian"
308ad36c 24ln -sfT "$PWD/src/$pkg/debian/patches" "build/$pkg/debian/patches"
a420c606
XL
25
26if [ -z "$2" ]; then exit 0; fi
27
28cd "build/$pkg"
29export QUILT_PATCHES=debian/patches
30patchname="${2%.patch}.patch"
31quilt new "$patchname"
32quilt add Cargo.toml
33sensible-editor Cargo.toml
34quilt refresh
35find src -type f -execdir quilt add '{}' +
36
91c08c65 37while ! cargo build --all-features; do
a420c606
XL
38
39cat <<-eof
40Spawning a sub-shell. Please try to fix the build failure by editing files in
41src/, which have been already quilt-added for you to $patchname. Afterwards,
42don't forgot to run "quilt refresh". To exit this loop without having fixed the
43problem, press Ctrl-D then quickly Ctrl-C.
44eof
45$SHELL
46quilt refresh
a420c606
XL
47
48done
49
50echo "patching was a success!"