diff --git a/Makefile b/Makefile index 21e4f7c..1c26827 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,7 @@ VERBOSE_FLAGS= -x VERBOSE_HIDDEN= @ .endif -.for _VERSION in ABI LUA PERL PHP PYTHON RUBY +.for _VERSION in ABI LUA PERL PHP PYTHON RUBY VERSION VERSIONS+= PRODUCT_${_VERSION}=${${_VERSION}} .endfor @@ -168,7 +168,7 @@ VERSIONS+= PRODUCT_CRYPTO=${FLAVOUR:[1]:tl} ${STEP}: lint-steps ${VERBOSE_HIDDEN} cd ${.CURDIR}/build && \ sh ${VERBOSE_FLAGS} ./${.TARGET}.sh -a ${ARCH} -F ${KERNEL} \ - -f "${FLAVOUR}" -n ${NAME} -v ${VERSION} -s ${_CONFIGDIR} \ + -f "${FLAVOUR}" -n ${NAME} -v "${VERSIONS}" -s ${_CONFIGDIR} \ -S ${SRCDIR} -P ${PORTSDIR} -p ${PLUGINSDIR} -T ${TOOLSDIR} \ -C ${COREDIR} -R ${PORTSREFDIR} -t ${TYPE} -k "${PRIVKEY}" \ -K "${PUBKEY}" -l "${SIGNCHK}" -L "${SIGNCMD}" -d ${DEVICE} \ @@ -177,9 +177,8 @@ ${STEP}: lint-steps -g ${TOOLSBRANCH} -E ${COREBRANCH} -G ${PORTSREFBRANCH} \ -H "${COREENV}" -u "${UEFI:tl}" -U "${SUFFIX}" -i ${COMPORT} \ -V "${ADDITIONS}" -O "${GITBASE}" -r "${SERVER}" \ - -q "${VERSIONS}" -h "${PLUGINSENV}" -I "${UPLOADDIR}" \ - -D "${EXTRABRANCH}" -A "${PORTSREFURL}" -J "${PORTSENV}" \ - ${${STEP}_ARGS} + -h "${PLUGINSENV}" -I "${UPLOADDIR}" -D "${EXTRABRANCH}" \ + -A "${PORTSREFURL}" -J "${PORTSENV}" ${${STEP}_ARGS} .endfor .for SCRIPT in ${SCRIPTS} diff --git a/build/base.sh b/build/base.sh index 6a1a11c..ec84484 100644 --- a/build/base.sh +++ b/build/base.sh @@ -39,10 +39,7 @@ if [ -f "${BASESET}" -a -z "${1}" ]; then fi git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH -if [ -z "${VERSION}" ]; then # XXX - git_describe ${SRCDIR} - PRODUCT_VERSION=${REPO_VERSION} -fi +git_version ${SRCDIR} BASESET=${SETSDIR}/base-${PRODUCT_VERSION}-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.txz diff --git a/build/common.sh b/build/common.sh index bf31ee1..f14f42d 100644 --- a/build/common.sh +++ b/build/common.sh @@ -28,7 +28,7 @@ set -e -OPTS="A:a:B:b:C:c:D:d:E:e:F:f:G:g:H:h:I:i:J:K:k:L:l:m:n:O:o:P:p:q:R:r:S:s:T:t:U:u:v:V:" +OPTS="A:a:B:b:C:c:D:d:E:e:F:f:G:g:H:h:I:i:J:K:k:L:l:m:n:O:o:P:p:R:r:S:s:T:t:U:u:v:V:" while getopts ${OPTS} OPT; do case ${OPT} in @@ -131,11 +131,6 @@ while getopts ${OPTS} OPT; do p) export PLUGINSDIR=${OPTARG} ;; - q) - for _VERSION in ${OPTARG}; do - eval "export ${_VERSION}" - done - ;; R) export PORTSREFDIR=${OPTARG} ;; @@ -169,7 +164,9 @@ while getopts ${OPTS} OPT; do export PRODUCT_UEFI=${OPTARG} ;; v) - export PRODUCT_VERSION=${OPTARG} + for _VERSION in ${OPTARG}; do + eval "export ${_VERSION}" + done ;; V) export PRODUCT_ADDITIONS=${OPTARG} @@ -366,28 +363,34 @@ git_pull() fi } -git_describe() +git_version() { - HEAD=${2:-"HEAD"} + if [ -z "$(echo ${PRODUCT_VERSION} | tr -d 0-9)" ]; then + git_describe ${1} + export PRODUCT_VERSION=${REPO_VERSION} + fi - VERSION=$(git -C ${1} describe --abbrev=0 --always ${HEAD}) - REVISION=$(git -C ${1} rev-list --count ${VERSION}..${HEAD}) - COMMENT=$(git -C ${1} rev-list --max-count=1 ${HEAD} | cut -c1-9) - BRANCH=$(git -C ${1} rev-parse --abbrev-ref ${HEAD}) - - if [ -z "${VERSION%%*/*}" ]; then - echo ">>> Tag '${VERSION}' of ${1} must not contain slashes" >&2 + if [ -z "${PRODUCT_VERSION%%*/*}" ]; then + echo ">>> Invalid product version: ${PRODUCT_VERSION}" >&2 exit 1 fi +} + +git_describe() +{ + local VERSION=$(git -C ${1} describe --abbrev=0 --always HEAD) + local REVISION=$(git -C ${1} rev-list --count ${VERSION}..HEAD) + local COMMENT=$(git -C ${1} rev-list --max-count=1 HEAD | cut -c1-9) + local BRANCH=$(git -C ${1} rev-parse --abbrev-ref HEAD) if [ "${REVISION}" != "0" ]; then # must construct full version string manually VERSION=${VERSION}_${REVISION} fi - export REPO_VERSION=${VERSION} - export REPO_COMMENT=${COMMENT} export REPO_BRANCH=${BRANCH} + export REPO_COMMENT=${COMMENT} + export REPO_VERSION=${VERSION} } git_branch() @@ -962,10 +965,7 @@ bundle_packages() REDOS=${@} - if [ -z "${VERSION}" ]; then # XXX - git_describe ${PORTSDIR} - PRODUCT_VERSION=${REPO_VERSION} - fi + git_version ${PORTSDIR} # clean up in case of partial run rm -rf ${BASEDIR}${PACKAGESDIR}-new diff --git a/build/distfiles.sh b/build/distfiles.sh index ad59f0e..735d6b4 100644 --- a/build/distfiles.sh +++ b/build/distfiles.sh @@ -60,6 +60,7 @@ fi git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH git_branch ${PORTSDIR} ${PORTSBRANCH} PORTSBRANCH +git_version ${PORTSDIR} setup_stage ${STAGEDIR} setup_base ${STAGEDIR} @@ -70,11 +71,6 @@ setup_distfiles ${STAGEDIR} extract_packages ${STAGEDIR} || true -if [ -z "${VERSION}" ]; then # XXX - git_describe ${PORTSDIR} - PRODUCT_VERSION=${REPO_VERSION} -fi - sh ./make.conf.sh > ${STAGEDIR}/etc/make.conf echo "CLEAN_FETCH_ENV=yes" >> ${STAGEDIR}/etc/make.conf diff --git a/build/kernel.sh b/build/kernel.sh index 2abc8c6..f6c4146 100644 --- a/build/kernel.sh +++ b/build/kernel.sh @@ -39,10 +39,7 @@ if [ -f "${KERNELSET}" -a -z "${1}" ]; then fi git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH -if [ -z "${VERSION}" ]; then # XXX - git_describe ${SRCDIR} - PRODUCT_VERSION=${REPO_VERSION} -fi +git_version ${SRCDIR} KERNEL_DEBUG_SET=${SETSDIR}/kernel-dbg-${PRODUCT_VERSION}-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.txz KERNEL_RELEASE_SET=${SETSDIR}/kernel-${PRODUCT_VERSION}-${PRODUCT_ARCH}${PRODUCT_DEVICE+"-${PRODUCT_DEVICE}"}.txz diff --git a/build/xtools.sh b/build/xtools.sh index 03ed881..5424d5f 100644 --- a/build/xtools.sh +++ b/build/xtools.sh @@ -44,10 +44,7 @@ if [ -f "${XTOOLSET}" -a -z "${1}" ]; then fi git_branch ${SRCDIR} ${SRCBRANCH} SRCBRANCH -if [ -z "${VERSION}" ]; then # XXX - git_describe ${SRCDIR} - PRODUCT_VERSION=${REPO_VERSION} -fi +git_version ${SRCDIR} XTOOLSET=${SETSDIR}/xtools-${PRODUCT_VERSION}-${PRODUCT_ARCH}.txz