Permalink
Cannot retrieve contributors at this time
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?
bee-files/scripts/beenullify.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
116 lines (95 sloc)
3.26 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 | |
T=/dev/shm/beenullify.$$ | |
exec 10<>$T | |
rm $T | |
cat<<_EOPAT_ >&10 | |
# EXCLUDE+=() | |
## | |
## './pkg-version-N.bee' or | |
## 'beesh ./pkg-version-N.bee' | |
## pkgname-pkgversion-pkgrevision.bee | |
## 'src' or 'cmake' or .. | |
## Add filename patterns to the EXCLUDE array of files that should not | |
## Add URLs/pathes to patch files to the PATCHURL array. | |
## Additional hints: | |
## be added to you package but may be present in the image directory. | |
## bee cannot detect buildtypes specified in subdirectories. | |
## bee-package. (Additional hints are located at the end of this file.) | |
## Build the package by executing | |
## by default this may be 'make install DESTDIR="${D}"' | |
## Change the default (auto-detected) steps to | |
## directory. | |
## downloaded. Version variables may be used to simplify reuse of this bee-file. | |
## Everything in this file will be executed in a bash environment. | |
## extract, patch, configure/setup, build and install the software. | |
## image directory "${D}" | |
## Make sure the mee_install function does install everything to the | |
## outside the source directory and need to be build inside the source | |
## see http://beezinga.org/ | |
## Sometimes packages "hide" the real sources in a subdirectory named | |
## The name of this bee-file should follow the following naming convention: | |
## The source URL(s) define the location of the sources that will be | |
## The sources will be patched in the order of the array. | |
## this file was created by bee init and should be executed to build a | |
## Uncomment the next statement, if the software may not be able to be build | |
## use 'sourcesubdir_append' to specify this directory if known. | |
## You may remove all comments as long as SRCURL[0]="" is set. | |
############################################################################### | |
_EOPAT_ | |
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 -e "2 i \\\n# BEE_VERSION $PKG-$VER-$REV" -e 's/\s*$//' $BE0 > ${BE0}.tmp | |
grep -vFf /proc/$$/fd/10 ${BE0}.tmp | cat -s > $BE0 | |
rm ${BE0}.tmp | |
done |