From 19af30bdc8210006f22c59414c58bcec367ef0e8 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 5 Apr 2020 23:02:54 +0100 Subject: [PATCH 1/3] bbvpn bashrc.local --- local/bb_local_dev/.bashrc.local | 93 ++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 local/bb_local_dev/.bashrc.local diff --git a/local/bb_local_dev/.bashrc.local b/local/bb_local_dev/.bashrc.local new file mode 100644 index 0000000..8fdc4f5 --- /dev/null +++ b/local/bb_local_dev/.bashrc.local @@ -0,0 +1,93 @@ +#!/bin/bash + +#wget +#export http_proxy=devproxy.bloomberg.com:82 +#export https_proxy=devproxy.bloomberg.com:82 + +export DOCKER_HOST=tcp://0.0.0.0:2375 + +if [[ "$(hostname)" == "lnxmqts01" ]]; then + export SKELETON_DEPLOY=$HOME/devel/bb/skeleton_internals +fi + +#export DEV_CINC=-I. +#export DEV_CPPINC=-I. +#export DEV_FINC=-I. + +#I need this to run distributor locally. +#export PGPASSFILE=$HOME/.fit_pgpass +#export PGSERVICEFILE=$HOME/.fit_pg_service.conf + +export IS_64BIT=yes +BBBITS=64 +#PATH=/bb/build/Linux-x86_64-64/release/robolibs/stage/opt/bb/libexec/build-base/:$PATH +#export BBTAG=$(/opt/bb/bin/robolibs-current-build --tag local --bits $BBBITS) #Doesn't work on bbvpn +export ARCHCODE=amd64 +export DPKG_DISTRO=unstable +export DPKG_DISTRO_DIR=$HOME/cmake-distro-dev +#export DPKG_SNAPSHOT=$(/opt/bb/bin/dpkg-distro-current-snapshot $DPKG_DISTRO) #This is slow. + +export PATH=/opt/bb/bin:$PATH + +getop() { # BOX + if [[ $# -ne 1 ]]; then + echo "Usage: getop " + else + local BOX="$1" + local BIN="/bb/bin/getprdwin" + $BIN -u op1 -i -s $BOX -d "op1 for $USER on $BOX" + fi +} + +git-repo-setup(){ + + if [[ $# -ne 0 ]]; then + echo "Usage: just run inside a bbgithub repo." + return + fi + + st=$(git status) + if [[ $? -ne 0 ]]; then + echo "Looks this is not a git repo." + return + fi + + us=$(git remote get-url upstream 2> /dev/null) + if [[ $? -eq 0 ]]; then + echo "Upstream already exist as $us." + return + fi + + url=$(git remote get-url origin) + if [[ $? -ne 0 ]]; then + echo "Origin URL is unknown." + return + fi + + re="^(.*)[/:]([^/:]*)/(.*)$" + if [[ $url =~ $re ]]; then + prefix=${BASH_REMATCH[1]} + org=${BASH_REMATCH[2]} + repo=${BASH_REMATCH[3]} + else + echo "Failed to pars the repo URL." + return + fi + + upstream_repo=bbgithub:$org/$repo + origin_repo=bbgithub:vkhachatrya5/$repo + + git remote rm origin + echo "Setting origin=$origin_repo" + git remote add origin $origin_repo + echo "Setting upstream=$upstream_repo" + git remote add upstream $upstream_repo + git remote -v +} + +git-master-refresh(){ + git fetch upstream master + git co upstream/master + git br -D master + git co -b master +} From d54ce5b3c2104aaa59021f8fe7d4d696e180a3fc Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 26 Jun 2020 04:21:10 -0400 Subject: [PATCH 2/3] local/bb/.bashrc.local --- local/bb/.bashrc.local | 76 +++++------------------------------------- 1 file changed, 9 insertions(+), 67 deletions(-) diff --git a/local/bb/.bashrc.local b/local/bb/.bashrc.local index a4c467b..7929f89 100755 --- a/local/bb/.bashrc.local +++ b/local/bb/.bashrc.local @@ -17,7 +17,7 @@ export DEV_CPPINC=-I. export DEV_FINC=-I. #I need this to run distributor locally. -export PGPASSFILE=$HOME/.fit_pgpass +export PGPASSFILE=$HOME/.pgpass export PGSERVICEFILE=$HOME/.fit_pg_service.conf export SRC_DIR=$HOME/devel/src @@ -25,6 +25,7 @@ export BOOST_DIR=$SRC_DIR/boost #export TBB_DIR=$SRC_DIR/tbb #export TBB_LIB=$TBB_DIR/build/linux_intel64_gcc_cc4.8.2_libc2.12_kernel2.6.32_release/ #export TBB_LIB_DEBUG=$TBB_DIR/build/linux_intel64_gcc_cc4.8.2_libc2.12_kernel2.6.32_debug/ +export PIP_INDEX_URL=https://artprod.dev.bloomberg.com/artifactory/api/pypi/bloomberg-pypi/simple alias bb='cd $HOME/devel/bb >/dev/null' #complete -f -X '!*.mk' plink @@ -48,7 +49,7 @@ if [[ "$os" == "GNU/Linux" ]]; then else BBBITS=32 fi -export BBTAG=$(/opt/bb/bin/robolibs-current-build --tag local --bits $BBBITS) +export BBTAG=$(/opt/bb/bin/robolibs-current-build --tag trunk --bits $BBBITS) getop() { # BOX if [[ $# -ne 1 ]]; then @@ -73,73 +74,14 @@ run() { fi } -sun() { # CMD - if [[ $# -ne 1 ]]; then - echo "Usage: sun " - else - run njtsdev3 $@ - fi +use-blot-meta(){ + export DPKG_ARCH=$(/opt/bb/bin/dpkg-architecture -qDEB_BUILD_ARCH) + export DPKG_DISTRO_DIR=$HOME/bb/blot-meta/cmake-distro-dev/${DPKG_ARCH} } -ibm() { # CMD - if [[ $# -ne 1 ]]; then - echo "Usage: ibm " - else - run ibm3 $@ - fi -} - -git-repo-setup(){ - - if [[ $# -ne 0 ]]; then - echo "Usage: just run inside a bbgithub repo." - return - fi - - st=$(git status) - if [[ $? -ne 0 ]]; then - echo "Looks this is not a git repo." - return - fi - - us=$(git remote get-url upstream 2> /dev/null) - if [[ $? -eq 0 ]]; then - echo "Upstream already exist as $us." - return - fi - - url=$(git remote get-url origin) - if [[ $? -ne 0 ]]; then - echo "Origin URL is unknown." - return - fi - - re="^(.*)[/:]([^/:]*)/(.*)$" - if [[ $url =~ $re ]]; then - prefix=${BASH_REMATCH[1]} - org=${BASH_REMATCH[2]} - repo=${BASH_REMATCH[3]} - else - echo "Failed to pars the repo URL." - return - fi - - upstream_repo=bbgithub:$org/$repo - origin_repo=bbgithub:vkhachatrya5/$repo - - git remote rm origin - echo "Setting origin=$origin_repo" - git remote add origin $origin_repo - echo "Setting upstream=$upstream_repo" - git remote add upstream $upstream_repo - git remote -v -} - -git-master-refresh(){ - git fetch upstream master - git co upstream/master - git br -D master - git co -b master +use-local-distro(){ + unset DPKG_ARCH + unset DPKG_DISTRO_DIR } # From 3cff4617993dce93a5edc17abfded81eb0a635e7 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Fri, 25 Sep 2020 04:59:50 -0400 Subject: [PATCH 3/3] Python venv added to .bashrc. --- config/.bashrc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/config/.bashrc b/config/.bashrc index 23a7bf9..698c45a 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -121,8 +121,8 @@ if [ -n "$PS1" ]; then c_cwd="$(tput setaf 99)" c_time="$(tput setaf 33)" #Light blue c_branch="$(tput setaf 138)" - c_exit="$(tput setaf 203)" #Red - c_jobs="$(tput setaf 220)" #Yellow + c_error="$(tput setaf 203)" #Red + c_info="$(tput setaf 220)" #Yellow else c_reset="$(tput sgr0)" c_user="$(tput setaf 1)" # @@ -130,8 +130,8 @@ if [ -n "$PS1" ]; then c_cwd="$(tput setaf 7)" #White c_time="$(tput setaf 6)" #Cyan c_branch="$(tput setaf 6)" #Cyan - c_exit="$(tput setaf 1)" #Red - c_jobs="$(tput setaf 3)" #Yellow + c_error="$(tput setaf 1)" #Red + c_info="$(tput setaf 3)" #Yellow fi [ -n "$(which svn)" ] && prompt_check_svn=true @@ -177,21 +177,29 @@ if [ -n "$PS1" ]; then # exit code if not zero # if [ "$exit_code" -ne "0" ]; then - PS1+=",\[$c_exit\]rc=$exit_code" + PS1+=",\[$c_error\]rc=$exit_code" + fi + # + # Python venv. + # + local jobs_bg=$(jobs -r | wc -l | tr -d ' ') + if [ -n "$VIRTUAL_ENV" ]; then + # PS1+=",\[$c_info\]$(realpath --relative-to=$PWD $VIRTUAL_ENV)" + PS1+=",\[$c_info\]$(basename $VIRTUAL_ENV)" fi # # Info about jobs. # local jobs_bg=$(jobs -r | wc -l | tr -d ' ') if [ $jobs_bg -gt 0 ]; then - PS1+=",\[$c_jobs\]bg=$jobs_bg" + PS1+=",\[$c_info\]bg=$jobs_bg" fi # # Info about jobs. # local jobs_stopped=$(jobs -s | wc -l | tr -d ' ') if [ $jobs_stopped -gt 0 ]; then - PS1+=",\[$c_jobs\]stp=$jobs_stopped" + PS1+=",\[$c_info\]stp=$jobs_stopped" fi