diff --git a/functions-common b/functions-common index 6b1f473004..c5c2ec7d42 100644 --- a/functions-common +++ b/functions-common @@ -36,6 +36,11 @@ XTRACE=$(set +o | grep xtrace) set +o xtrace +# Global Config Variables +declare -A GITREPO +declare -A GITBRANCH +declare -A GITDIR + # Config Functions # ================ @@ -598,6 +603,18 @@ function git_clone { cd $orig_dir } +# A variation on git clone that lets us specify a project by it's +# actual name, like oslo.config. This is exceptionally useful in the +# library installation case +function git_clone_by_name { + local name=$1 + local repo=${GITREPO[$name]} + local dir=${GITDIR[$name]} + local branch=${GITBRANCH[$name]} + git_clone $repo $dir $branch +} + + # git can sometimes get itself infinitely stuck with transient network # errors or other issues with the remote end. This wraps git in a # timeout/retry loop and is intended to watch over non-local git @@ -1541,6 +1558,26 @@ function pip_install { fi } +# should we use this library from their git repo, or should we let it +# get pulled in via pip dependencies. +function use_library_from_git { + local name=$1 + local enabled=1 + [[ ,${LIBS_FROM_GIT}, =~ ,${name}, ]] && enabled=0 + return $enabled +} + +# setup a library by name. If we are trying to use the library from +# git, we'll do a git based install, otherwise we'll punt and the +# library should be installed by a requirements pull from another +# project. +function setup_lib { + local name=$1 + local dir=${GITDIR[$name]} + setup_install $dir +} + + # this should be used if you want to install globally, all libraries should # use this, especially *oslo* ones function setup_install { diff --git a/lib/infra b/lib/infra index e18c66ed48..cd439e723a 100644 --- a/lib/infra +++ b/lib/infra @@ -19,7 +19,7 @@ set +o xtrace # Defaults # -------- -PBR_DIR=$DEST/pbr +GITDIR["pbr"]=$DEST/pbr REQUIREMENTS_DIR=$DEST/requirements # Entry Points @@ -31,8 +31,12 @@ function install_infra { git_clone $REQUIREMENTS_REPO $REQUIREMENTS_DIR $REQUIREMENTS_BRANCH # Install pbr - git_clone $PBR_REPO $PBR_DIR $PBR_BRANCH - setup_install $PBR_DIR + if use_library_from_git "pbr"; then + git_clone_by_name "pbr" + setup_lib "pbr" + else + pip_install "pbr" + fi } # Restore xtrace diff --git a/lib/oslo b/lib/oslo index e5fa37e17f..c95a3a805f 100644 --- a/lib/oslo +++ b/lib/oslo @@ -20,21 +20,21 @@ set +o xtrace # Defaults # -------- -CLIFF_DIR=$DEST/cliff -OSLOCFG_DIR=$DEST/oslo.config -OSLOCON_DIR=$DEST/oslo.concurrency -OSLODB_DIR=$DEST/oslo.db -OSLOI18N_DIR=$DEST/oslo.i18n -OSLOLOG_DIR=$DEST/oslo.log -OSLOMID_DIR=$DEST/oslo.middleware -OSLOMSG_DIR=$DEST/oslo.messaging -OSLORWRAP_DIR=$DEST/oslo.rootwrap -OSLOSERIALIZATION_DIR=$DEST/oslo.serialization -OSLOUTILS_DIR=$DEST/oslo.utils -OSLOVMWARE_DIR=$DEST/oslo.vmware -PYCADF_DIR=$DEST/pycadf -STEVEDORE_DIR=$DEST/stevedore -TASKFLOW_DIR=$DEST/taskflow +GITDIR["cliff"]=$DEST/cliff +GITDIR["oslo.config"]=$DEST/oslo.config +GITDIR["oslo.concurrency"]=$DEST/oslo.concurrency +GITDIR["oslo.db"]=$DEST/oslo.db +GITDIR["oslo.i18n"]=$DEST/oslo.i18n +GITDIR["oslo.log"]=$DEST/oslo.log +GITDIR["oslo.middleware"]=$DEST/oslo.middleware +GITDIR["oslo.messaging"]=$DEST/oslo.messaging +GITDIR["oslo.rootwrap"]=$DEST/oslo.rootwrap +GITDIR["oslo.serialization"]=$DEST/oslo.serialization +GITDIR["oslo.utils"]=$DEST/oslo.utils +GITDIR["oslo.vmware"]=$DEST/oslo.vmware +GITDIR["pycadf"]=$DEST/pycadf +GITDIR["stevedore"]=$DEST/stevedore +GITDIR["taskflow"]=$DEST/taskflow # Support entry points installation of console scripts OSLO_BIN_DIR=$(get_python_exec_prefix) @@ -42,52 +42,31 @@ OSLO_BIN_DIR=$(get_python_exec_prefix) # Entry Points # ------------ +function _do_install_oslo_lib { + local name=$1 + if use_library_from_git "$name"; then + git_clone_by_name "$name" + setup_lib "$name" + fi +} + # install_oslo() - Collect source and prepare function install_oslo { - git_clone $CLIFF_REPO $CLIFF_DIR $CLIFF_BRANCH - setup_install $CLIFF_DIR - - git_clone $OSLOI18N_REPO $OSLOI18N_DIR $OSLOI18N_BRANCH - setup_install $OSLOI18N_DIR - - git_clone $OSLOUTILS_REPO $OSLOUTILS_DIR $OSLOUTILS_BRANCH - setup_install $OSLOUTILS_DIR - - git_clone $OSLOSERIALIZATION_REPO $OSLOSERIALIZATION_DIR $OSLOSERIALIZATION_BRANCH - setup_install $OSLOSERIALIZATION_DIR - - git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH - setup_install $OSLOCFG_DIR - - git_clone $OSLOCON_REPO $OSLOCON_DIR $OSLOCON_BRANCH - setup_install $OSLOCON_DIR - - git_clone $OSLOLOG_REPO $OSLOLOG_DIR $OSLOLOG_BRANCH - setup_install $OSLOLOG_DIR - - git_clone $OSLOMID_REPO $OSLOMID_DIR $OSLOMID_BRANCH - setup_install $OSLOMID_DIR - - git_clone $OSLOMSG_REPO $OSLOMSG_DIR $OSLOMSG_BRANCH - setup_install $OSLOMSG_DIR - - git_clone $OSLORWRAP_REPO $OSLORWRAP_DIR $OSLORWRAP_BRANCH - setup_install $OSLORWRAP_DIR - - git_clone $OSLODB_REPO $OSLODB_DIR $OSLODB_BRANCH - setup_install $OSLODB_DIR - - git_clone $OSLOVMWARE_REPO $OSLOVMWARE_DIR $OSLOVMWARE_BRANCH - setup_install $OSLOVMWARE_DIR - - git_clone $PYCADF_REPO $PYCADF_DIR $PYCADF_BRANCH - setup_install $PYCADF_DIR - - git_clone $STEVEDORE_REPO $STEVEDORE_DIR $STEVEDORE_BRANCH - setup_install $STEVEDORE_DIR - - git_clone $TASKFLOW_REPO $TASKFLOW_DIR $TASKFLOW_BRANCH - setup_install $TASKFLOW_DIR + _do_install_oslo_lib "cliff" + _do_install_oslo_lib "oslo.i18n" + _do_install_oslo_lib "oslo.utils" + _do_install_oslo_lib "oslo.serialization" + _do_install_oslo_lib "oslo.config" + _do_install_oslo_lib "oslo.concurrency" + _do_install_oslo_lib "oslo.log" + _do_install_oslo_lib "oslo.middleware" + _do_install_oslo_lib "oslo.messaging" + _do_install_oslo_lib "oslo.rootwrap" + _do_install_oslo_lib "oslo.db" + _do_install_oslo_lib "olso.vmware" + _do_install_oslo_lib "pycadf" + _do_install_oslo_lib "stevedore" + _do_install_oslo_lib "taskflow" } # Restore xtrace diff --git a/stackrc b/stackrc index 580fabf9f7..96924732a5 100644 --- a/stackrc +++ b/stackrc @@ -222,68 +222,68 @@ ORC_REPO=${ORC_REPO:-${GIT_BASE}/openstack/os-refresh-config.git} ORC_BRANCH=${ORC_BRANCH:-master} # cliff command line framework -CLIFF_REPO=${CLIFF_REPO:-${GIT_BASE}/openstack/cliff.git} -CLIFF_BRANCH=${CLIFF_BRANCH:-master} +GITREPO["cliff"]=${CLIFF_REPO:-${GIT_BASE}/openstack/cliff.git} +GITBRANCH["cliff"]=${CLIFF_BRANCH:-master} # oslo.concurrency -OSLOCON_REPO=${OSLOCON_REPO:-${GIT_BASE}/openstack/oslo.concurrency.git} -OSLOCON_BRANCH=${OSLOCON_BRANCH:-master} +GITREPO["oslo.concurrency"]=${OSLOCON_REPO:-${GIT_BASE}/openstack/oslo.concurrency.git} +GITBRANCH["olso.concurrency"]=${OSLOCON_BRANCH:-master} # oslo.config -OSLOCFG_REPO=${OSLOCFG_REPO:-${GIT_BASE}/openstack/oslo.config.git} -OSLOCFG_BRANCH=${OSLOCFG_BRANCH:-master} +GITREPO["oslo.config"]=${OSLOCFG_REPO:-${GIT_BASE}/openstack/oslo.config.git} +GITBRANCH["oslo.config"]=${OSLOCFG_BRANCH:-master} # oslo.db -OSLODB_REPO=${OSLODB_REPO:-${GIT_BASE}/openstack/oslo.db.git} -OSLODB_BRANCH=${OSLODB_BRANCH:-master} +GITREPO["olso.db"]=${OSLODB_REPO:-${GIT_BASE}/openstack/oslo.db.git} +GITBRANCH["olso.db"]=${OSLODB_BRANCH:-master} # oslo.i18n -OSLOI18N_REPO=${OSLOI18N_REPO:-${GIT_BASE}/openstack/oslo.i18n.git} -OSLOI18N_BRANCH=${OSLOI18N_BRANCH:-master} +GITREPO["olso.i18n"]=${OSLOI18N_REPO:-${GIT_BASE}/openstack/oslo.i18n.git} +GITBRANCH["olso.i18n"]=${OSLOI18N_BRANCH:-master} # oslo.log -OSLOLOG_REPO=${OSLOLOG_REPO:-${GIT_BASE}/openstack/oslo.log.git} -OSLOLOG_BRANCH=${OSLOLOG_BRANCH:-master} +GITREPO["olso.log"]=${OSLOLOG_REPO:-${GIT_BASE}/openstack/oslo.log.git} +GITBRANCH["olso.log"]=${OSLOLOG_BRANCH:-master} # oslo.messaging -OSLOMSG_REPO=${OSLOMSG_REPO:-${GIT_BASE}/openstack/oslo.messaging.git} -OSLOMSG_BRANCH=${OSLOMSG_BRANCH:-master} +GITREPO["olso.messaging"]=${OSLOMSG_REPO:-${GIT_BASE}/openstack/oslo.messaging.git} +GITBRANCH["olso.messaging"]=${OSLOMSG_BRANCH:-master} # oslo.middleware -OSLOMID_REPO=${OSLOMID_REPO:-${GIT_BASE}/openstack/oslo.middleware.git} -OSLOMID_BRANCH=${OSLOMID_BRANCH:-master} +GITREPO["oslo.middleware"]=${OSLOMID_REPO:-${GIT_BASE}/openstack/oslo.middleware.git} +GITBRANCH["oslo.middleware"]=${OSLOMID_BRANCH:-master} # oslo.rootwrap -OSLORWRAP_REPO=${OSLORWRAP_REPO:-${GIT_BASE}/openstack/oslo.rootwrap.git} -OSLORWRAP_BRANCH=${OSLORWRAP_BRANCH:-master} +GITREPO["olso.rootwrap"]=${OSLORWRAP_REPO:-${GIT_BASE}/openstack/oslo.rootwrap.git} +GITBRANCH["olso.rootwrap"]=${OSLORWRAP_BRANCH:-master} # oslo.serialization -OSLOSERIALIZATION_REPO=${OSLOSERIALIZATION_REPO:-${GIT_BASE}/openstack/oslo.serialization.git} -OSLOSERIALIZATION_BRANCH=${OSLOSERIALIZATION_BRANCH:-master} +GITREPO["olso.serialization"]=${OSLOSERIALIZATION_REPO:-${GIT_BASE}/openstack/oslo.serialization.git} +GITBRANCH["olso.serialization"]=${OSLOSERIALIZATION_BRANCH:-master} # oslo.utils -OSLOUTILS_REPO=${OSLOUTILS_REPO:-${GIT_BASE}/openstack/oslo.utils.git} -OSLOUTILS_BRANCH=${OSLOUTILS_BRANCH:-master} +GITREPO["olso.utils"]=${OSLOUTILS_REPO:-${GIT_BASE}/openstack/oslo.utils.git} +GITBRANCH["olso.utils"]=${OSLOUTILS_BRANCH:-master} # oslo.vmware -OSLOVMWARE_REPO=${OSLOVMWARE_REPO:-${GIT_BASE}/openstack/oslo.vmware.git} -OSLOVMWARE_BRANCH=${OSLOVMWARE_BRANCH:-master} +GITREPO["olso.vmware"]=${OSLOVMWARE_REPO:-${GIT_BASE}/openstack/oslo.vmware.git} +GITBRANCH["olso.vmware"]=${OSLOVMWARE_BRANCH:-master} # pycadf auditing library -PYCADF_REPO=${PYCADF_REPO:-${GIT_BASE}/openstack/pycadf.git} -PYCADF_BRANCH=${PYCADF_BRANCH:-master} +GITREPO["pycadf"]=${PYCADF_REPO:-${GIT_BASE}/openstack/pycadf.git} +GITBRANCH["pycadf"]=${PYCADF_BRANCH:-master} # stevedore plugin manager -STEVEDORE_REPO=${STEVEDORE_REPO:-${GIT_BASE}/openstack/stevedore.git} -STEVEDORE_BRANCH=${STEVEDORE_BRANCH:-master} +GITREPO["stevedore"]=${STEVEDORE_REPO:-${GIT_BASE}/openstack/stevedore.git} +GITBRANCH["stevedore"]=${STEVEDORE_BRANCH:-master} # taskflow plugin manager -TASKFLOW_REPO=${TASKFLOW_REPO:-${GIT_BASE}/openstack/taskflow.git} -TASKFLOW_BRANCH=${TASKFLOW_BRANCH:-master} +GITREPO["taskflow"]=${TASKFLOW_REPO:-${GIT_BASE}/openstack/taskflow.git} +GITBRANCH["taskflow"]=${TASKFLOW_BRANCH:-master} # pbr drives the setuptools configs -PBR_REPO=${PBR_REPO:-${GIT_BASE}/openstack-dev/pbr.git} -PBR_BRANCH=${PBR_BRANCH:-master} +GITREPO["pbr"]=${PBR_REPO:-${GIT_BASE}/openstack-dev/pbr.git} +GITBRANCH["pbr"]=${PBR_BRANCH:-master} # neutron service NEUTRON_REPO=${NEUTRON_REPO:-${GIT_BASE}/openstack/neutron.git}