Skip to content

Commit

Permalink
oebb: make environment file configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
  • Loading branch information
koenkooi committed May 5, 2011
1 parent 52e9530 commit 8f81ffd
Showing 1 changed file with 31 additions and 49 deletions.
80 changes: 31 additions & 49 deletions oebb.sh
Expand Up @@ -33,6 +33,7 @@ PROXYHOST=""
OE_BASE=${PWD} OE_BASE=${PWD}
# incremement this to force recreation of config files # incremement this to force recreation of config files
BASE_VERSION=1 BASE_VERSION=1
OE_ENV_FILE=~/.oe/environment-oecore


############################################################################### ###############################################################################
# SET_ENVIRONMENT() - Setup environment variables for OE development # SET_ENVIRONMENT() - Setup environment variables for OE development
Expand All @@ -47,17 +48,17 @@ export BBFETCH2=True
# If an env already exists, use it, otherwise generate it # If an env already exists, use it, otherwise generate it
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------


if [ -e ~/.oe/environment-oecore ] ; then if [ -e ${OE_ENV_FILE} ] ; then
. ~/.oe/environment-oecore . ${OE_ENV_FILE}
fi fi


if [ x"${BASE_VERSION}" != x"${SCRIPTS_BASE_VERSION}" ] ; then if [ x"${BASE_VERSION}" != x"${SCRIPTS_BASE_VERSION}" ] ; then
echo "BASE_VERSION mismatch, recreating ~/.oe/environment-oecore" echo "BASE_VERSION mismatch, recreating ${OE_ENV_FILE}"
rm ~/.oe/environment-oecore rm ${OE_ENV_FILE}
fi fi


if [ -e ~/.oe/environment-oecore ] ; then if [ -e ${OE_ENV_FILE} ] ; then
. ~/.oe/environment-oecore . ${OE_ENV_FILE}
else else


mkdir -p ~/.oe/ mkdir -p ~/.oe/
Expand All @@ -68,11 +69,11 @@ else
DISTRO="angstrom-2010.x" DISTRO="angstrom-2010.x"
DISTRO_DIRNAME=`echo $DISTRO | sed s#[.-]#_#g` DISTRO_DIRNAME=`echo $DISTRO | sed s#[.-]#_#g`


echo "export SCRIPTS_BASE_VERSION=${BASE_VERSION}" > ~/.oe/environment-oecore echo "export SCRIPTS_BASE_VERSION=${BASE_VERSION}" > ${OE_ENV_FILE}
echo "export BBFETCH2=True" >> ~/.oe/environment-oecore echo "export BBFETCH2=True" >> ${OE_ENV_FILE}


echo "export DISTRO=\"${DISTRO}\"" >> ~/.oe/environment-oecore echo "export DISTRO=\"${DISTRO}\"" >> ${OE_ENV_FILE}
echo "export DISTRO_DIRNAME=\"${DISTRO_DIRNAME}\"" >> ~/.oe/environment-oecore echo "export DISTRO_DIRNAME=\"${DISTRO_DIRNAME}\"" >> ${OE_ENV_FILE}


#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Specify the root directory for your OpenEmbedded development # Specify the root directory for your OpenEmbedded development
Expand All @@ -87,27 +88,27 @@ else
mkdir -p ${OE_SOURCE_DIR} mkdir -p ${OE_SOURCE_DIR}
export OE_BASE export OE_BASE


echo "export OE_BUILD_DIR=\"${OE_BUILD_DIR}\"" >> ~/.oe/environment-oecore echo "export OE_BUILD_DIR=\"${OE_BUILD_DIR}\"" >> ${OE_ENV_FILE}
echo "export BUILDDIR=\"${OE_BUILD_DIR}\"" >> ~/.oe/environment-oecore echo "export BUILDDIR=\"${OE_BUILD_DIR}\"" >> ${OE_ENV_FILE}
echo "export OE_BUILD_TMPDIR=\"${OE_BUILD_TMPDIR}\"" >> ~/.oe/environment-oecore echo "export OE_BUILD_TMPDIR=\"${OE_BUILD_TMPDIR}\"" >> ${OE_ENV_FILE}
echo "export OE_SOURCE_DIR=\"${OE_SOURCE_DIR}\"" >> ~/.oe/environment-oecore echo "export OE_SOURCE_DIR=\"${OE_SOURCE_DIR}\"" >> ${OE_ENV_FILE}


echo "export OE_BASE=\"${OE_BASE}\"" >> ~/.oe/environment-oecore echo "export OE_BASE=\"${OE_BASE}\"" >> ${OE_ENV_FILE}


#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Include up-to-date bitbake in our PATH. # Include up-to-date bitbake in our PATH.
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
export PATH=${OE_SOURCE_DIR}/openembedded-core/scripts:${OE_SOURCE_DIR}/bitbake/bin:${PATH} export PATH=${OE_SOURCE_DIR}/openembedded-core/scripts:${OE_SOURCE_DIR}/bitbake/bin:${PATH}


echo "export PATH=\"${PATH}\"" >> ~/.oe/environment-oecore echo "export PATH=\"${PATH}\"" >> ${OE_ENV_FILE}


#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Make sure Bitbake doesn't filter out the following variables from our # Make sure Bitbake doesn't filter out the following variables from our
# environment. # environment.
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCLIBC TCMODE GIT_PROXY_COMMAND http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS" export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCLIBC TCMODE GIT_PROXY_COMMAND http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"


echo "export BB_ENV_EXTRAWHITE=\"${BB_ENV_EXTRAWHITE}\"" >> ~/.oe/environment-oecore echo "export BB_ENV_EXTRAWHITE=\"${BB_ENV_EXTRAWHITE}\"" >> ${OE_ENV_FILE}


#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Specify proxy information # Specify proxy information
Expand All @@ -119,10 +120,10 @@ else
export SVN_CONFIG_DIR=${OE_BUILD_DIR}/subversion_config export SVN_CONFIG_DIR=${OE_BUILD_DIR}/subversion_config
export GIT_CONFIG_DIR=${OE_BUILD_DIR}/git_config export GIT_CONFIG_DIR=${OE_BUILD_DIR}/git_config


echo "export http_proxy=\"${http_proxy}\"" >> ~/.oe/environment-oecore echo "export http_proxy=\"${http_proxy}\"" >> ${OE_ENV_FILE}
echo "export ftp_proxy=\"${ftp_proxy}\"" >> ~/.oe/environment-oecore echo "export ftp_proxy=\"${ftp_proxy}\"" >> ${OE_ENV_FILE}
echo "export SVN_CONFIG_DIR=\"${SVN_CONFIG_DIR}\"" >> ~/.oe/environment-oecore echo "export SVN_CONFIG_DIR=\"${SVN_CONFIG_DIR}\"" >> ${OE_ENV_FILE}
echo "export GIT_CONFIG_DIR=\"${GIT_CONFIG_DIR}\"" >> ~/.oe/environment-oecore echo "export GIT_CONFIG_DIR=\"${GIT_CONFIG_DIR}\"" >> ${OE_ENV_FILE}


config_svn_proxy config_svn_proxy
config_git_proxy config_git_proxy
Expand All @@ -133,7 +134,7 @@ else
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
export BBPATH=${OE_BUILD_DIR}:${OE_SOURCE_DIR}/openembedded-core/meta${BBPATH_EXTRA} export BBPATH=${OE_BUILD_DIR}:${OE_SOURCE_DIR}/openembedded-core/meta${BBPATH_EXTRA}


echo "export BBPATH=\"${BBPATH}\"" >> ~/.oe/environment-oecore echo "export BBPATH=\"${BBPATH}\"" >> ${OE_ENV_FILE}


#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Reconfigure dash # Reconfigure dash
Expand All @@ -143,8 +144,8 @@ else
expect -c 'spawn sudo dpkg-reconfigure -freadline dash; send "n\n"; interact;' expect -c 'spawn sudo dpkg-reconfigure -freadline dash; send "n\n"; interact;'
fi fi


echo "There now is a sourceable script in ~/.oe/enviroment. You can do '. ~/.oe/environment-oecore' and run 'bitbake something' without using $0 as wrapper" echo "There now is a sourceable script in ~/.oe/enviroment. You can do '. ${OE_ENV_FILE}' and run 'bitbake something' without using $0 as wrapper"
fi # if -e ~/.oe/environment-oecore fi # if -e ${OE_ENV_FILE}
} }




Expand Down Expand Up @@ -184,8 +185,8 @@ function oe_build()
fi fi


set_environment set_environment
if [ -e ~/.oe/environment-oecore ] ; then if [ -e ${OE_ENV_FILE} ] ; then
echo "Using ~/.oe/environment-oecore to setup needed variables. It is recommended to do '. ~/.oe/environment-oecore' and run 'bitbake something' without using $0 as wrapper" echo "Using ${OE_ENV_FILE} to setup needed variables. It is recommended to do '. ${OE_ENV_FILE}' and run 'bitbake something' without using $0 as wrapper"
fi fi
cd ${OE_BUILD_DIR} cd ${OE_BUILD_DIR}
if [ -z $MACHINE ] ; then if [ -z $MACHINE ] ; then
Expand Down Expand Up @@ -230,27 +231,8 @@ function update_oe()
############################################################################### ###############################################################################
function config_oe() function config_oe()
{ {
#--------------------------------------------------------------------------
# Determine the proper machine name MACHINE="${CL_MACHINE}"
#--------------------------------------------------------------------------
case ${CL_MACHINE} in
beagle|beagleboard)
MACHINE="beagleboard"
;;
dm6446evm|davinci-evm)
MACHINE="davinci-dvevm"
;;
omap3evm)
MACHINE="omap3evm"
;;
shiva|omap3517-evm)
MACHINE="omap3517-evm"
;;
*)
echo "Unknown machine ${CL_MACHINE}, passing it to OE directly"
MACHINE="${CL_MACHINE}"
;;
esac


#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Write out the OE bitbake configuration file. # Write out the OE bitbake configuration file.
Expand Down Expand Up @@ -335,7 +317,7 @@ fi
_EOF _EOF
chmod +x ${GIT_CONFIG_DIR}/git-proxy.sh chmod +x ${GIT_CONFIG_DIR}/git-proxy.sh
export GIT_PROXY_COMMAND=${GIT_CONFIG_DIR}/git-proxy.sh export GIT_PROXY_COMMAND=${GIT_CONFIG_DIR}/git-proxy.sh
echo "export GIT_PROXY_COMMAND=\"\${GIT_CONFIG_DIR}/git-proxy.sh\"" >> ~/.oe/environment-oecore echo "export GIT_PROXY_COMMAND=\"\${GIT_CONFIG_DIR}/git-proxy.sh\"" >> ${OE_ENV_FILE}
fi fi
} }


Expand Down Expand Up @@ -392,7 +374,7 @@ echo " $0 update"
echo "" echo ""
echo " Not recommended, but also possible:" echo " Not recommended, but also possible:"
echo " $0 bitbake <bitbake target>" echo " $0 bitbake <bitbake target>"
echo " It is recommended to do '. ~/.oe/environment-oecore' and run 'bitbake something' inside ${BUILDDIR} without using oebb.sh as wrapper" echo " It is recommended to do '. ${OE_ENV_FILE}' and run 'bitbake something' inside ${BUILDDIR} without using oebb.sh as wrapper"
echo "" echo ""
echo "You must invoke \"$0 config <machine>\" and then \"$0 update\" prior" echo "You must invoke \"$0 config <machine>\" and then \"$0 update\" prior"
echo "to your first bitbake command" echo "to your first bitbake command"
Expand Down

0 comments on commit 8f81ffd

Please sign in to comment.