Skip to content
Permalink
83e0d7979c
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
1 contributor

Users who have contributed to this file

executable file 74 lines (56 sloc) 1.46 KB
#! /bin/bash
if test -z "$1" -o '-h' = "$1"; then
cat <<__HELP
Usage: $0 [option] [bee-file]...
Convert old bee files into new be0 format. By the
way the script also removes white space clutter at
EOL. And when inside a git repo, renaming is done
with 'git mv'.
options:
-h show this help and exit
-n X set new version (e.g. 0.8.15)
-i increase build number
__HELP
exit 1
fi
BUMPBUILD=0
MV='mv -v'
if test '-i' = "$1"; then
BUMPBUILD=1
shift
fi
if test '-n' = "$1"; then
shift
NEWVERSION=$1
shift
if test -z "$NEWVERSION"; then
echo "# ERROR: missing version. Try: $0 -h"
exit 1
fi
if ! test -z $(echo "$NEWVERSION" | sed -e 's/[0-9\.]*//g'); then
echo "# ERROR: bad version '$NEWVERSION'. Try: $0 -h"
exit 1
fi
fi
if git status > /dev/null 2>&1; then
MV='git mv -v'
fi
for BEE in "${@+$@}"; do
if [[ $BEE =~ '.be0' ]]; then
echo "# NOTE $BEE: won't operate on be0 files."
continue
fi
grep '${PKGVERSION}' $BEE | grep -q 'SRCURL' || echo "# NOTE $BEE: No PKGVERSION in SRCURL."
REV=$(echo $BEE | rev | cut -d- -f1 | rev | cut -d. -f1)
VER=$(echo $BEE | rev | cut -d- -f2 | rev)
PKG=$(echo $BEE | rev | cut -d- -f3- | rev)
# echo "# got $BEE ($PKG / $VER / $REV)"
REV=$(( $REV + $BUMPBUILD ))
BE0="$PKG.be0"
$MV $BEE $BE0
if test -n "$NEWVERSION"; then
VER=$NEWVERSION
REV=0
fi
sed -i -e "2 i \\\n# BEE_VERSION $PKG-$VER-$REV" -e 's/\s*$//' $BE0
done