summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-07-06 18:23:43 +0300
committerHanoh Haim <hhaim@cisco.com>2015-07-06 18:23:43 +0300
commit52ada6a50262b441f1c65d3159b255ca26a53c14 (patch)
treec30da09462d7e4b1a3aa64e500a711d7f02f7b7a
parenta6ad28529f021849cc10f44077c3c10f89a13dba (diff)
update build scripts
-rwxr-xr-xVERSION4
-rwxr-xr-xlinux_dpdk/ws_main.py206
-rwxr-xr-xsrc/main_dpdk.cpp31
3 files changed, 234 insertions, 7 deletions
diff --git a/VERSION b/VERSION
index 3566bb74..bdd3949a 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1,3 @@
-v1.72
+v1.74
+
+
diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py
index 6e066661..73a1982e 100755
--- a/linux_dpdk/ws_main.py
+++ b/linux_dpdk/ws_main.py
@@ -11,6 +11,7 @@ import commands;
import shutil;
import copy;
import re
+import uuid
# these variables are mandatory ('/' are converted automatically)
@@ -20,6 +21,12 @@ out = 'build_dpdk'
b_path ="./build/linux_dpdk/"
+C_VER_FILE = "version.c"
+H_VER_FILE = "version.h"
+
+BUILD_NUM_FILE = "../VERSION"
+
+
#######################################
# utility for group source code
###################################
@@ -154,6 +161,13 @@ yaml_src = SrcGroup(dir='yaml-cpp/src/',
'tag.cpp']);
+version_src = SrcGroup(
+ dir='linux_dpdk',
+ src_list=[
+ 'version.c',
+ ])
+
+
dpdk_src = SrcGroup(dir='src/dpdk_lib18/',
src_list=[
'librte_ring/rte_ring.c',
@@ -306,8 +320,7 @@ bp =SrcGroups([
cmn_src ,
net_src ,
yaml_src,
- #sw_mini_shell_grp_src
- #dpdk_src
+ version_src
]);
l2fwd_main_src = SrcGroup(dir='src',
@@ -583,6 +596,7 @@ def post_build(bld):
install_single_system(bld, exec_p, obj);
def build(bld):
+ bld.add_pre_fun(pre_build)
bld.add_post_fun(post_build);
for obj in build_types:
build_type(bld,obj);
@@ -602,6 +616,194 @@ def install_single_system (bld, exec_p, build_obj):
os.symlink(relative_path, dest_file);
+def pre_build(bld):
+ print "update version files"
+ create_version_files ()
+
+
+def write_file (file_name,s):
+ f=open(file_name,'w')
+ f.write(s)
+ f.close()
+
+
+def get_build_num ():
+ s='';
+ if os.path.isfile(BUILD_NUM_FILE):
+ f=open(BUILD_NUM_FILE,'r');
+ s+=f.readline().rstrip();
+ f.close();
+ return s;
+
+def create_version_files ():
+ s =''
+ s +="#ifndef __TREX_VER_FILE__ \n"
+ s +="#define __TREX_VER_FILE__ \n"
+ s +="#ifdef __cplusplus \n"
+ s +=" extern \"C\" { \n"
+ s +=" #endif \n";
+ s +='#define VERSION_USER "%s" \n' % os.environ.get('USER', 'unknown')
+ s +='extern char * get_build_date(void); \n'
+ s +='extern char * get_build_time(void); \n'
+ s +='#define VERSION_UIID "%s" \n' % uuid.uuid1()
+ s +='#define VERSION_BUILD_NUM "%s" \n' % get_build_num()
+ s +="#ifdef __cplusplus \n"
+ s +=" } \n"
+ s +=" #endif \n";
+ s +="#endif \n"
+
+ write_file (H_VER_FILE ,s)
+
+ s ='#include "version.h" \n'
+ s +='#define VERSION_UIID1 "%s" \n' % uuid.uuid1()
+ s +="char * get_build_date(void){ \n"
+ s +=" return (__DATE__); \n"
+ s +=" } \n"
+ s +=" \n"
+ s +="char * get_build_time(void){ \n"
+ s +=" return (__TIME__ ); \n"
+ s +=" } \n"
+
+ write_file (C_VER_FILE,s)
+
+def build_test(bld):
+ create_version_files ()
+
+def _copy_single_system (bld, exec_p, build_obj,o):
+ o='build_dpdk/linux_dpdk/';
+ src_file = os.path.realpath(o+build_obj.get_target())
+ print src_file;
+ if os.path.exists(src_file):
+ dest_file = exec_p +build_obj.get_target()
+ print dest_file
+ os.system("cp %s %s " %(src_file,dest_file));
+ os.system("chmod +x %s " %(dest_file));
+
+def copy_single_system (bld, exec_p, build_obj):
+ _copy_single_system (bld, exec_p, build_obj,'build_dpdk/linux_dpdk/')
+
+def copy_single_system1 (bld, exec_p, build_obj):
+ _copy_single_system (bld, exec_p, build_obj,'../scripts/')
+
+
+files_list=[
+ 'libzmq.so.3.1.0',
+ 'libzmq.so.3',
+ 'trex-cfg',
+ 'bp-sim-32',
+ 'bp-sim-64',
+ 'bp-sim-32-debug',
+ 'bp-sim-64-debug',
+ 'release_notes.pdf',
+ 'dpdk_nic_bind.py',
+ 'dpdk_setup_ports.py',
+ 'doc_process.py',
+ 'trex_daemon_server'
+ ];
+
+files_dir=['cap2','avl','cfg','ko','automation','python-lib']
+
+
+class Env(object):
+ @staticmethod
+ def get_env(name) :
+ s= os.environ.get(name);
+ if s == None:
+ print "You should define $",name
+ raise Exception("Env error");
+ return (s);
+
+ @staticmethod
+ def get_release_path () :
+ s= Env().get_env('TREX_LOCAL_PUBLISH_PATH');
+ s +=get_build_num ()+"/"
+ return s;
+
+ @staticmethod
+ def get_remote_release_path () :
+ s= Env().get_env('TREX_REMOTE_PUBLISH_PATH');
+ return s;
+
+ @staticmethod
+ def get_local_web_server () :
+ s= Env().get_env('TREX_WEB_SERVER');
+ return s;
+
+ # extral web
+ @staticmethod
+ def get_trex_ex_web_key() :
+ s= Env().get_env('TREX_EX_WEB_KEY');
+ return s;
+
+ @staticmethod
+ def get_trex_ex_web_path() :
+ s= Env().get_env('TREX_EX_WEB_PATH');
+ return s;
+
+ @staticmethod
+ def get_trex_ex_web_user() :
+ s= Env().get_env('TREX_EX_WEB_USER');
+ return s;
+
+ @staticmethod
+ def get_trex_ex_web_srv() :
+ s= Env().get_env('TREX_EX_WEB_SRV');
+ return s;
+
+
+
+def release(bld):
+ """ release to local folder """
+ print "copy images and libs"
+ exec_p =Env().get_release_path();
+ os.system(' mkdir -p '+exec_p);
+
+ for obj in build_types:
+ copy_single_system (bld,exec_p,obj);
+ copy_single_system1 (bld,exec_p,obj)
+
+ for obj in files_list:
+ src_file = '../scripts/'+obj
+ dest_file = exec_p +'/'+obj
+ os.system("cp %s %s " %(src_file,dest_file));
+
+ for obj in files_dir:
+ src_file = '../scripts/'+obj+'/'
+ dest_file = exec_p +'/'+obj+'/'
+ os.system("cp -rv %s %s " %(src_file,dest_file));
+ os.system("chmod 755 %s " %(dest_file));
+
+ rel=get_build_num ()
+ os.system('cd %s/..;tar --exclude="*.pyc" -zcvf %s/%s.tar.gz %s' %(exec_p,os.getcwd(),rel,rel))
+ os.system("mv %s/%s.tar.gz %s" % (os.getcwd(),rel,exec_p));
+
+
+def publish(bld):
+ exec_p = Env().get_release_path()
+ rel=get_build_num ()
+
+ release_name ='%s.tar.gz' % (rel);
+ from_ = exec_p+'/'+release_name;
+ os.system("rsync -av %s %s:%s/%s " %(from_,Env().get_local_web_server(),Env().get_remote_release_path (), release_name))
+ os.system("ssh %s 'cd %s;rm be_latest; ln -P %s be_latest' " %(Env().get_local_web_server(),Env().get_remote_release_path (),release_name))
+ os.system("ssh %s 'cd %s;rm latest; ln -P %s latest' " %(Env().get_local_web_server(),Env().get_remote_release_path (),release_name))
+
+
+def publish_ext(bld):
+ exec_p = Env().get_release_path()
+ rel=get_build_num ()
+
+ release_name ='%s.tar.gz' % (rel);
+ from_ = exec_p+'/'+release_name;
+ os.system('rsync -avz -e "ssh -i %s" --rsync-path=/usr/bin/rsync %s %s@%s:%s/release/%s' % (Env().get_trex_ex_web_key(),from_, Env().get_trex_ex_web_user(),Env().get_trex_ex_web_srv(),Env().get_trex_ex_web_path() ,release_name) )
+ os.system("ssh -i %s -l %s %s 'cd %s/release/;rm be_latest; ln -P %s be_latest' " %(Env().get_trex_ex_web_key(),Env().get_trex_ex_web_user(),Env().get_trex_ex_web_srv(),Env().get_trex_ex_web_path(),release_name))
+ os.system("ssh -i %s -l %s %s 'cd %s/release/;rm latest; ln -P %s latest' " %(Env().get_trex_ex_web_key(),Env().get_trex_ex_web_user(),Env().get_trex_ex_web_srv(),Env().get_trex_ex_web_path(),release_name))
+
+
+
+
+
+
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 22ecc52f..a0258ef1 100755
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -55,6 +55,7 @@ limitations under the License.
#include <common/arg/SimpleGlob.h>
#include <common/arg/SimpleOpt.h>
#include <common/basic_utils.h>
+#include <../linux_dpdk/version.h>
extern "C" {
#include <dpdk_lib18/librte_pmd_ixgbe/ixgbe/ixgbe_type.h>
@@ -637,9 +638,31 @@ static int usage(){
printf("\n");
printf("\n");
- printf(" Copyright (C) 2012 by hhaim Cisco-System POC for Israel dev-test \n");
- printf(" version : %s \n",VERSION);
-
+ printf(" Copyright (c) 2015-2015 Cisco Systems, Inc. \n");
+ printf(" \n");
+ printf(" Licensed under the Apache License, Version 2.0 (the 'License') \n");
+ printf(" you may not use this file except in compliance with the License. \n");
+ printf(" You may obtain a copy of the License at \n");
+ printf(" \n");
+ printf(" http://www.apache.org/licenses/LICENSE-2.0 \n");
+ printf(" \n");
+ printf(" Unless required by applicable law or agreed to in writing, software \n");
+ printf(" distributed under the License is distributed on an \"AS IS\" BASIS, \n");
+ printf(" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n");
+ printf(" See the License for the specific language governing permissions and \n");
+ printf(" limitations under the License. \n");
+ printf(" \n");
+ printf(" Open Source Components / Libraries \n");
+ printf(" DPDK (BSD) \n");
+ printf(" YAML-CPP (BSD) \n");
+ printf(" \n");
+ printf(" Open Source Binaries \n");
+ printf(" ZMQ (LGPL v3plus) \n");
+ printf(" \n");
+ printf(" Version : %s \n",VERSION_BUILD_NUM);
+ printf(" User : %s \n",VERSION_USER);
+ printf(" Date : %s , %s \n",get_build_date(),get_build_time());
+ printf(" Uuid : %s \n",VERSION_UIID);
return (0);
}
@@ -4371,7 +4394,7 @@ int main_test(int argc , char * argv[]){
int ret;
unsigned lcore_id;
- printf("Starting T-Rex %s please wait ... \n",VERSION);
+ printf("Starting TRex %s please wait ... \n",VERSION);
CGlobalInfo::m_options.preview.clean();