1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-06 11:00:13 +02:00

Revert "Rewrite fd-commit in POSIX Shell"

This reverts commit 62ba9dc07e.
This commit is contained in:
Daniel Martí 2014-07-06 11:29:31 +02:00
parent 353e8dda00
commit 1bcf7c7ce1

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# fd-commit - part of the FDroid server tools
# Commits updates to apps, allowing you to edit the commit messages
@ -18,7 +18,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
commands=""
commands=()
if [ ! -d metadata ]; then
if [ -d ../metadata ]; then
@ -30,17 +30,15 @@ if [ ! -d metadata ]; then
fi
while read line; do
[ -z "$line" ] && continue
case "$line" in
*\?\?*metadata/*.txt) new=true ;;
*M*metadata/*.txt) new=false ;;
esac
if [[ "$line" == *\?\?*metadata/*.txt ]]; then
new=true
elif [[ "$line" == *M*metadata/*.txt ]]; then
new=false
fi
file=${line##* }
id=${file##*/}
id=${id%.txt*}
if [ $# -gt 0 ]; then
case "$@" in
*" $id "*) ;; # Middle
@ -55,10 +53,11 @@ while read line; do
name= autoname=
while read l; do
case "$l" in
'Auto Name:'*) autoname=${l#*:} ;;
'Name:'*) name=${l#*:} ;;
esac
if [[ "$l" == "Auto Name:"* ]]; then
autoname=${l#*:}
elif [[ "$l" == "Name:"* ]]; then
name=${l#*:}
fi
done < "$file"
if [ -n "$name" ]; then
@ -75,26 +74,25 @@ while read line; do
onlybuild=true
newbuild=false
disable=false
while read l; do
case "$l" in
*"Maintainer Notes:"*) break ;;
"-Build:"*) onlybuild=false ;;
"+Build:"*)
$newbuild && onlybuild=false
newbuild=true
build=${l#*:}
version=${build%%,*}
build=${build#*,}
vercode=${build%%,*}
;;
'+'*"disable="*)
$newbuild && $onlybuild && disable=true
;;
esac
done << EOF
$(git diff HEAD -- "$file")
EOF
if [[ "$l" == *"Maintainer Notes:"* ]]; then
break
fi
if [[ "$l" == "-Build:"* ]]; then
onlybuild=false
elif [[ "$l" == "+Build:"* ]]; then
if $newbuild; then
onlybuild=false
fi
newbuild=true
build=${l#*:}
version=${build%%,*}
build=${build#*,}
vercode=${build%%,*}
elif $newbuild && $onlybuild && [[ "$l" == "+"*"disable="* ]]; then
disable=true
fi
done < <(git diff HEAD -- "$file")
if $newbuild && $onlybuild; then
if $disable; then
@ -108,18 +106,13 @@ EOF
fi
message=${message//\"/\\\"}
commands="$commands%%git add -- $file $extra && git commit -m \"$message\" -e -v"
commands+=("git add -- $file $extra && git commit -m \"$message\" -e -v")
done < <(git status --porcelain metadata)
done << EOF
$(git status --porcelain metadata)
EOF
[ -z "$commands" ] && exit 0
[[ -z $commands ]] && exit 0
git reset >/dev/null
IFS='%%'
for cmd in $commands; do
[ -z "$cmd" ] && continue
eval $cmd
for cmd in "${commands[@]}"; do
eval "$cmd"
git reset >/dev/null
done