mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
Revert "Rewrite fd-commit in POSIX Shell"
This reverts commit 62ba9dc07e.
This commit is contained in:
parent
353e8dda00
commit
1bcf7c7ce1
1 changed files with 36 additions and 43 deletions
79
fd-commit
79
fd-commit
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# fd-commit - part of the FDroid server tools
|
# fd-commit - part of the FDroid server tools
|
||||||
# Commits updates to apps, allowing you to edit the commit messages
|
# 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
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
commands=""
|
commands=()
|
||||||
|
|
||||||
if [ ! -d metadata ]; then
|
if [ ! -d metadata ]; then
|
||||||
if [ -d ../metadata ]; then
|
if [ -d ../metadata ]; then
|
||||||
|
|
@ -30,17 +30,15 @@ if [ ! -d metadata ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read line; do
|
while read line; do
|
||||||
[ -z "$line" ] && continue
|
if [[ "$line" == *\?\?*metadata/*.txt ]]; then
|
||||||
|
new=true
|
||||||
case "$line" in
|
elif [[ "$line" == *M*metadata/*.txt ]]; then
|
||||||
*\?\?*metadata/*.txt) new=true ;;
|
new=false
|
||||||
*M*metadata/*.txt) new=false ;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
file=${line##* }
|
file=${line##* }
|
||||||
|
|
||||||
id=${file##*/}
|
id=${file##*/}
|
||||||
id=${id%.txt*}
|
id=${id%.txt*}
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
case "$@" in
|
case "$@" in
|
||||||
*" $id "*) ;; # Middle
|
*" $id "*) ;; # Middle
|
||||||
|
|
@ -55,10 +53,11 @@ while read line; do
|
||||||
|
|
||||||
name= autoname=
|
name= autoname=
|
||||||
while read l; do
|
while read l; do
|
||||||
case "$l" in
|
if [[ "$l" == "Auto Name:"* ]]; then
|
||||||
'Auto Name:'*) autoname=${l#*:} ;;
|
autoname=${l#*:}
|
||||||
'Name:'*) name=${l#*:} ;;
|
elif [[ "$l" == "Name:"* ]]; then
|
||||||
esac
|
name=${l#*:}
|
||||||
|
fi
|
||||||
done < "$file"
|
done < "$file"
|
||||||
|
|
||||||
if [ -n "$name" ]; then
|
if [ -n "$name" ]; then
|
||||||
|
|
@ -75,26 +74,25 @@ while read line; do
|
||||||
onlybuild=true
|
onlybuild=true
|
||||||
newbuild=false
|
newbuild=false
|
||||||
disable=false
|
disable=false
|
||||||
|
|
||||||
while read l; do
|
while read l; do
|
||||||
case "$l" in
|
if [[ "$l" == *"Maintainer Notes:"* ]]; then
|
||||||
*"Maintainer Notes:"*) break ;;
|
break
|
||||||
"-Build:"*) onlybuild=false ;;
|
fi
|
||||||
"+Build:"*)
|
if [[ "$l" == "-Build:"* ]]; then
|
||||||
$newbuild && onlybuild=false
|
onlybuild=false
|
||||||
newbuild=true
|
elif [[ "$l" == "+Build:"* ]]; then
|
||||||
build=${l#*:}
|
if $newbuild; then
|
||||||
version=${build%%,*}
|
onlybuild=false
|
||||||
build=${build#*,}
|
fi
|
||||||
vercode=${build%%,*}
|
newbuild=true
|
||||||
;;
|
build=${l#*:}
|
||||||
'+'*"disable="*)
|
version=${build%%,*}
|
||||||
$newbuild && $onlybuild && disable=true
|
build=${build#*,}
|
||||||
;;
|
vercode=${build%%,*}
|
||||||
esac
|
elif $newbuild && $onlybuild && [[ "$l" == "+"*"disable="* ]]; then
|
||||||
done << EOF
|
disable=true
|
||||||
$(git diff HEAD -- "$file")
|
fi
|
||||||
EOF
|
done < <(git diff HEAD -- "$file")
|
||||||
|
|
||||||
if $newbuild && $onlybuild; then
|
if $newbuild && $onlybuild; then
|
||||||
if $disable; then
|
if $disable; then
|
||||||
|
|
@ -108,18 +106,13 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
message=${message//\"/\\\"}
|
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
|
[[ -z $commands ]] && exit 0
|
||||||
$(git status --porcelain metadata)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
[ -z "$commands" ] && exit 0
|
|
||||||
|
|
||||||
git reset >/dev/null
|
git reset >/dev/null
|
||||||
IFS='%%'
|
for cmd in "${commands[@]}"; do
|
||||||
for cmd in $commands; do
|
eval "$cmd"
|
||||||
[ -z "$cmd" ] && continue
|
|
||||||
eval $cmd
|
|
||||||
git reset >/dev/null
|
git reset >/dev/null
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue