Migrating convenience aliases to Buck usage

Change-Id: I01d21e9630625dc6e5200a0d1be625f8d2db7348
This commit is contained in:
Thomas Vachuska 2016-10-26 13:57:36 -07:00 committed by Brian O'Connor
parent 6b5a941cc1
commit 6066dff896
7 changed files with 33 additions and 89 deletions

View File

@ -14,8 +14,8 @@ export KARAF_DIST=$(basename $KARAF_ZIP .zip)
export PATH="$ONOS_ROOT/tools/dev/bin:$ONOS_ROOT/tools/test/bin:$PATH"
export PATH="$ONOS_ROOT/tools/build:$PATH"
# Fallback build number us derived from from the user name & time
export BUILD_NUMBER=${BUILD_NUMBER:-$(id -un)~$(date +'%Y/%m/%d@%H:%M')}
# Fallback build number us derived from from the user name
export BUILD_NUMBER=${BUILD_NUMBER:-$(id -un)}
# ONOS Version and onos.tar.gz staging environment
export ONOS_POM_VERSION="1.8.0-SNAPSHOT"
@ -39,10 +39,6 @@ export ONOS_TEST_STAGE_ROOT=${ONOS_TEST_STAGE_ROOT:-/tmp}
export ONOS_TEST_STAGE=$ONOS_STAGE_ROOT/$ONOS_TEST_BITS
export ONOS_TEST_TAR=$ONOS_TEST_STAGE.tar.gz
# Defaults for ONOS testing using remote machines.
# if [ -n "${ONOS_CELL}" -a -f $ONOS_ROOT/tools/test/cells/${ONOS_CELL} ]; then
# . $ONOS_ROOT/tools/test/cells/${ONOS_CELL}
# fi
export ONOS_INSTALL_DIR="/opt/onos" # Installation directory on remote
export OCI="${OCI:-192.168.56.101}" # ONOS Controller Instance
export ONOS_USER="${ONOS_USER:-sdn}" # ONOS user on remote system

View File

@ -3,9 +3,5 @@
# Builds the ONOS from source.
# -----------------------------------------------------------------------------
set -e
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
cd $ONOS_ROOT && mvn clean install "$@"
cd $ONOS_ROOT && onos-buck build onos && onos-buck test

View File

@ -8,37 +8,4 @@ set -e
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
apidocs=onos-apidocs-${ONOS_VERSION%~*}
function expandList {
list="";
while read line; do
[ -n "$line" ] && list="$list:$line"
done < $1
echo "${list#:*}"
}
function processPom {
cp $1 aux-$1
egrep '@[a-zA-Z0-9.-]+' $1 | sed 's:^[^@]*@::g' | sed 's:</.*$::g' | while read line; do
packages="$(expandList $line)"
sed "s/@$line/$packages/" aux-$1 > aux-$1.aux
mv aux-$1.aux aux-$1
done
}
set -e
trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT
rm -fr $ONOS_ROOT/docs/target
cd $ONOS_ROOT/docs
processPom external.xml
mvn -f aux-external.xml javadoc:aggregate "$@"
cd target && mv site/apidocs $apidocs
tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz $ONOS_STAGE_ROOT
cd $ONOS_ROOT/docs
processPom internal.xml
mvn -f aux-internal.xml javadoc:aggregate "$@"
onos-buck build //docs:external //docs:internal --show-output

View File

@ -3,6 +3,16 @@
# Packages ONOS distributable into onos.tar.gz, onos.zip or a deb file
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
cd $ONOS_ROOT && onos-buck build onos --show-output && onos-check-bits
exit $?
#=============================================================================
# FIXME: This needs to be refactored using Buck; for now it is disabled
# FIXME: .deb, .rpm, .zip need to be re-implemented
# FIXME: SM-ONOS packaging flavour needs to be re-implemented
set -e
# Build the staging directory used to produce the packages

View File

@ -45,25 +45,27 @@ function o {
egrep "${1:-$ONOS_ROOT}" | head -n 1)
}
# Short-hand for 'mvn clean install' for us lazy folk
alias mci='mvn clean install'
alias mcis='mvn clean install -DskipTests -Dcheckstyle.skip'
alias mis='mvn install -DskipTests -Dcheckstyle.skip'
# Buck (if "buck" is not on the PATH)
[ -z "$(which buck)" ] && alias buck="onos-buck"
# Short-hand for ONOS build, package and test.
alias ob='onos-build'
alias obf='ob -DskipTests -Dcheckstyle.skip'
alias obi='onos-build -Dmaven.test.failure.ignore=true'
alias obs='onos-build-selective'
alias obf='(cd $ONOS_ROOT && buck build onos)'
alias obd='onos-build-docs'
alias op='onos-package'
alias ok='onos-karaf'
alias ot='onos-test'
alias deprecatedAlias='echo "This alias has been deprecated."'
alias obi=deprecatedAlias
alias obs=deprecatedAlias
alias ok='buck run onos-local'
alias oh='onos localhost halt'
alias ol='onos-log'
alias ow='onos-watch'
alias ocl='onos-check-logs'
alias oi='setPrimaryInstance'
alias pub='onos-push-update-bundle'
# Short-hand for tailing and searching the ONOS (karaf) log
alias tl='$ONOS_ROOT/tools/dev/bin/onos-local-log'
@ -89,6 +91,13 @@ alias docs='open $ONOS_ROOT/docs/target/site/apidocs/index.html'
alias rsdocs='onos-rsdocs'
alias gui='onos-gui'
# Short-hand for 'mvn clean install' for us lazy folk
alias mci='mvn clean install'
alias mcis='mvn clean install -DskipTests -Dcheckstyle.skip'
alias mis='mvn install -DskipTests -Dcheckstyle.skip'
# Git annotated one-line log
alias gil='git log --oneline --decorate=short'
# Test related conveniences
@ -97,7 +106,6 @@ alias sshctl='onos-ssh'
alias sshnet='onos-ssh $OCN'
# Applies the settings in the specified topology recipe file or lists current
# topo recipe definition if no topo recipe file is given.
function topo {
@ -276,9 +284,3 @@ alias atttopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/attmpls-cfg.json'
# Load UK topo GEO data
alias uktopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/uk-cfg.json'
# Git annotated one-line log
alias gil='git log --oneline --decorate=short'
# Buck (if "buck" is not on the PATH)
[ -z "$(which buck)" ] && alias buck="onos-buck"

View File

@ -22,7 +22,7 @@ if [ $? -ne 0 ]; then
echo "ONOS archive is not a valid tar file" && exit 1
fi
tar tzf ${ONOS_TAR} | grep -q onos-${ONOS_VERSION}.*/VERSION
tar tzf ${ONOS_TAR} | grep -q onos-${ONOS_POM_VERSION}.*/VERSION
if [ $? -ne 0 ]; then
echo "ONOS archive does not contain the proper version file" && exit 1
fi

View File

@ -1,27 +0,0 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# Pushes the specified bundle to the remote ONOS cell machines and updates it.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
cd ~/.m2/repository
jar=$(find org/onosproject -type f -name '*.jar' | grep -e $1 | grep -v -e -tests | head -n 1)
[ -z "$jar" ] && echo "No bundle $1 found for" && exit 1
bundle=$(echo $(basename $jar .jar) | sed 's/-[0-9].*//g')
echo "pushing bundle: $bundle"
nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
for node in $nodes; do
scp -q $jar $ONOS_USER@$node:.m2/repository/$jar
scp -q $jar $ONOS_USER@$node:$ONOS_INSTALL_DIR/$KARAF_DIST/system/$jar
ssh $ONOS_USER@$node "
$ONOS_INSTALL_DIR/bin/onos \"bundle:stop -f $bundle\"
$ONOS_INSTALL_DIR/bin/onos \"bundle:update -f $bundle\"
$ONOS_INSTALL_DIR/bin/onos \"bundle:start -f $bundle\"
" 2>/dev/null
done