|
Lines 51-57
do
Link Here
|
| 51 |
# If the Makefile exists, continue and empty the tempfile, set up variables |
51 |
# If the Makefile exists, continue and empty the tempfile, set up variables |
| 52 |
echo -n > $tempfile |
52 |
echo -n > $tempfile |
| 53 |
revision_str=`grep "^PORTREVISION?\?=" "$1/Makefile"` |
53 |
revision_str=`grep "^PORTREVISION?\?=" "$1/Makefile"` |
| 54 |
revision_num=`echo "$revision_str" | awk -F "\t+" '{ print $2 }'` |
|
|
| 55 |
|
54 |
|
| 56 |
case $? in |
55 |
case $? in |
| 57 |
0) |
56 |
0) |
|
Lines 65-71
do
Link Here
|
| 65 |
;; |
64 |
;; |
| 66 |
(*) |
65 |
(*) |
| 67 |
# If the value of PORTREVISION is an integer, increase it by 1 |
66 |
# If the value of PORTREVISION is an integer, increase it by 1 |
| 68 |
printc "INFO: $1 PORTREVISION= $revision_num found, bumping it by 1." "green" |
67 |
printc "INFO: $1 $revision_str found, bumping it by 1." "green" |
| 69 |
rm -f $tempfile && awk -F "\t+" '/^PORTREVISION\??=/{ gsub ($2, $2+1) }; { print }' "$1/Makefile" > $tempfile \ |
68 |
rm -f $tempfile && awk -F "\t+" '/^PORTREVISION\??=/{ gsub ($2, $2+1) }; { print }' "$1/Makefile" > $tempfile \ |
| 70 |
&& cat $tempfile > "$1/Makefile" \ |
69 |
&& cat $tempfile > "$1/Makefile" \ |
| 71 |
|| printc "ERROR: $1 PORTREVISION found but failed to bump it!" "red" |
70 |
|| printc "ERROR: $1 PORTREVISION found but failed to bump it!" "red" |
|
Lines 80-87
do
Link Here
|
| 80 |
# If the exit code is 1 then PORTREVISION wasn't found, so we need to add one with value of 1 |
79 |
# If the exit code is 1 then PORTREVISION wasn't found, so we need to add one with value of 1 |
| 81 |
printc "INFO: $1 PORTREVISION not found, adding PORTREVISION= 1" "green" |
80 |
printc "INFO: $1 PORTREVISION not found, adding PORTREVISION= 1" "green" |
| 82 |
rm -f $tempfile && awk '/^(PORT|DIST)VERSION\??=\t/{ print; print "PORTREVISION=\t1"; next } { print }' "$1/Makefile" > $tempfile \ |
81 |
rm -f $tempfile && awk '/^(PORT|DIST)VERSION\??=\t/{ print; print "PORTREVISION=\t1"; next } { print }' "$1/Makefile" > $tempfile \ |
| 83 |
&& cat $tempfile > "$1/Makefile" \ |
82 |
&& cat $tempfile > "$1/Makefile" |
| 84 |
|| printc "ERROR: $1 PORTREVISION found but failed to bump it!" "red" |
83 |
# If there is not PORTREVISION line, maybe it is a slave port, try |
|
|
84 |
# to add it before a CATEGORIES, PKGNAMESUFFIX or PKGNAMEPREFIX line: |
| 85 |
for line in CATEGORIES PKGNAMEPREFIX PKGNAMESUFFIX; do |
| 86 |
if ! grep -q "^PORTREVISION?\?=" $1/Makefile; then |
| 87 |
rm -f $tempfile && awk '/^'${line}'\??=\t/{ print "PORTREVISION=\t1"; print; next } { print }' "$1/Makefile" > $tempfile \ |
| 88 |
&& cat $tempfile > "$1/Makefile" |
| 89 |
fi |
| 90 |
done |
| 91 |
# If it still is not there, bail out |
| 92 |
if ! grep -q "^PORTREVISION?\?=" $1/Makefile; then |
| 93 |
printc "ERROR: $1 PORTREVISION not found and failed to add it!" "red" |
| 94 |
fi |
| 85 |
;; |
95 |
;; |
| 86 |
*) |
96 |
*) |
| 87 |
printc "ERROR: PORTREVISION grep for $1 exited with error!" "red" |
97 |
printc "ERROR: PORTREVISION grep for $1 exited with error!" "red" |