Skip to content

Commit

Permalink
beesh: add callback function bee_version
Browse files Browse the repository at this point in the history
at the same time add utility function bee_die and relax the checks
so that we can update the full version string from inside the
bee file
  • Loading branch information
donald committed Jul 5, 2016
1 parent df14014 commit b473c27
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/beesh.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,20 @@ function build_in_sourcedir() {
BUILD_IN_SOURCEDIR=1
}

function bee_die() {
print_error $*
exit 1
}

function bee_version() {
test -n "$1" || bee_die "bee_version: missing argument"
test "$PKGFULLVERSION"="0" -a -z "$PKGREVISION" || bee_die "bee_version: version is already fixed"
local oPKGFULLNAME="$PKGFULLNAME"
eval $("${BEE_BINDIR}/beeversion" "$1") || bee_die "bee_version: invalid version string"
validate_pkg_complete || bee_die "bee_version: please use the proper package versioning (e.g. package-1.0-0)"
test "$PKGFULLNAME" = "$oPKGFULLNAME" || bee_die "bee_version: not allowed to change the package name from $oPKGFULLNAME to $PKGFULLNAME"
}

function add_sourcesubdir() {
print_warning "WARNING: add_sourcesubdir is deprecated in favor of sourcesubdir_append"
sourcesubdir_append "${@}"
Expand Down Expand Up @@ -747,7 +761,6 @@ function save_current_package_variables() {

function extract_new_package_variables() {
nPKGFULLNAME="${PKGNAME}${PKGEXTRANAME:+_${PKGEXTRANAME}}"

if [ "${oPKGFULLNAME}" != "${PKGFULLNAME}" ] ; then
if [ "${oPKGFULLNAME}" != "${nPKGFULLNAME}" ] ; then
print_error "${BEE##*/}: Changing PKGFULLNAME and one of PKGNAME or PKGEXTRANAME is not supported."
Expand All @@ -764,10 +777,6 @@ function extract_new_package_variables() {

nPKGFULLVERSION="${PKGVERSION}${PKGEXTRAVERSION:+_${PKGEXTRAVERSION}}"
if [ "${oPKGFULLVERSION}" != "${PKGFULLVERSION}" ] ; then
if [ "${oPKGFULLVERSION}" != "${nPKGFULLVERSION}" ] ; then
print_error "${BEE##*/}: Changing PKGFULLVERSION and one of PKGVERSION or PKGEXTRAVERSION is not supported."
exit 1
fi
PKGVERSION=${PKGFULLVERSION//_*}
if [ "$PKGVERSION" = "$PKGFULLVERSION" ] ; then
PKGEXTRAVERSION=""
Expand Down

0 comments on commit b473c27

Please sign in to comment.