4 # CARGO='../nailing-cargo/nailing-cargo cargo' make && make check CARGO='../nailing-cargo/nailing-cargo cargo'
7 # Why do we need this ?
9 # https://stackoverflow.com/questions/33025887/how-to-use-a-local-unpublished-crate
10 # https://github.com/rust-lang/cargo/issues/1481
13 lock=${PWD%/*}/.nail.lock
14 if [ "x$NAILING_CARGO" != "x$lock" ]; then
16 exec with-lock-ex -w "$lock" "$0" "$@"
19 exec 203<../Cargo.nail
23 /^ *\[dependencies\]/,/^ \[/{
26 exec 204<../Cargo.nail
27 while read <&204 what where; do
28 if [ "x$what" = x- ]; then continue; fi
29 if [ "x$what" = 'x#' ]; then continue; fi
30 qwhere="${where//\//\\/}"
32 s/^'$what' *= *\(\".*\"\) *$/'$what' = { version = \1 }/;
33 s/^'$what' *= *{/'$what' = { path = "..\/'"${qwhere}"'", /;
34 /^'$what' *=/ s/version *= *\"[^"]*\"//;
35 /^'$what' *=/ s/, *\([,}]\)/\1/;
41 exec 204<../Cargo.nail
42 while read <&204 what where; do
43 if [ "x$what" = 'x#' ]; then continue; fi
46 sed <$wf >$wf.nailing~ "$sed"
49 exec 204<../Cargo.nail
50 while read <&204 what where; do
51 if [ "x$what" = 'x#' ]; then continue; fi
53 if ! test -e $wf.unnailed~; then
60 while read <&203 what where; do
61 if [ "x$what" = "x#" ]; then continue; fi
63 if test -e $wf.unnailed~; then
66 mv -f $wf.unnailed~ $wf
72 exec 204<../Cargo.nail
74 while read <&204 what where; do
75 if [ "x$what" = 'x#' ]; then continue; fi
77 printf >&2 ' %s' "$what"
78 if cmp -s $wf.nailed~ $wf.nailing~; then
82 mv -f $wf.nailing~ $wf