1 | #!/bin/sh |
---|
2 | |
---|
3 | treedir=$1 |
---|
4 | shift |
---|
5 | |
---|
6 | function portfile { |
---|
7 | echo ${treedir}/$(port file "$1" | grep -o "\\([^/]*/\\)\\{2\\}[^/]*\$") |
---|
8 | } |
---|
9 | |
---|
10 | for port in $(port echo $@); do |
---|
11 | file=$(portfile ${port}) |
---|
12 | echo Bumping ${port} in ${file} |
---|
13 | echo Checking for an existing revision... |
---|
14 | revision=$(grep ^revision "${file}" | awk '{print $2}') |
---|
15 | if test -n "${revision}"; then |
---|
16 | echo Revision found: ${revision} |
---|
17 | new=$(expr ${revision} + 1) |
---|
18 | echo Incrementing to ${new}... |
---|
19 | sed -i .before-bump /^revision/s/${revision}/${new}/ "${file}" |
---|
20 | else |
---|
21 | echo Revision not found |
---|
22 | echo Inserting revision 1 |
---|
23 | sed -i .before-bump "/^version/a\\ |
---|
24 | revision 1 |
---|
25 | " "${file}" |
---|
26 | fi |
---|
27 | diff -u ${file}.before-bump ${file} |
---|
28 | echo Done. |
---|
29 | done |
---|