Changes to generate the external libraries using scripts (#6)

* Extracted a constant for ev-tools and fixec out structure

* Added the logic to clone evio if not present and workspaceroot logic

* Fixed errors after integeration testing and made the functions more modular

* Fixed more errors caught while integration testing

* Fixed the way the scripts are called during webrtc build

* Minor fixes for build tincan

* Cleaned up the code and added param for EdgeVPNIO

* Changed EdgeVPNIO to EdgeVPNio
pull/8/head
Rajath Ganesh 2020-10-29 15:06:18 -07:00 committed by GitHub
parent caf1967ee5
commit 43e2edee1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 134 deletions

View File

@ -5,6 +5,8 @@ from scripts.Link import Link
import subprocess import subprocess
import os import os
SH = "ev-tools.sh"
class EvtTools: class EvtTools:
def __init__(self): def __init__(self):
@ -59,81 +61,81 @@ class EvtTools:
def clean(self): def clean(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh clean"], shell=True) subprocess.run([SH + " clean"], shell=True)
def build_tools(self): def build_tools(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh deps"], shell=True) subprocess.run([SH + " deps"], shell=True)
def pull_src(self): def pull_src(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh src"], shell=True) subprocess.run([SH + " src"], shell=True)
def tincan(self): def tincan(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh tincan"], shell=True) subprocess.run([SH + " tincan"], shell=True)
def debpak(self): def debpak(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh debpak"], shell=True) subprocess.run([SH + " debpak"], shell=True)
def testbed(self): def testbed(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh testbed"], shell=True) subprocess.run([SH + " testbed"], shell=True)
def venv(self): def venv(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh venv"], shell=True) subprocess.run([SH + " venv"], shell=True)
def xmpp(self): def xmpp(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh xmpp"], shell=True) subprocess.run([SH + " xmpp"], shell=True)
def build_docker(self): def build_docker(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh dkrimg"], shell=True) subprocess.run([SH + " dkrimg"], shell=True)
def build_webrtc(self): def build_webrtc(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_webrtc"], shell=True) subprocess.run([(SH + " build_webrtc")], shell=True)
def build_webrtc_release_ubuntu(self): def build_webrtc_release_ubuntu(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_webrtc_with_release_ubuntu"], shell=True) subprocess.run([SH + " build_webrtc_with_release_ubuntu"], shell=True)
def build_webrtc_debug_raspberry(self): def build_webrtc_debug_raspberry(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_webrtc_with_debug_raspberry_pi"], shell=True) subprocess.run([SH + " build_webrtc_with_debug_raspberry_pi"], shell=True)
def build_webrtc_release_raspberry(self): def build_webrtc_release_raspberry(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_webrtc_with_release_raspberry_pi"], shell=True) subprocess.run([SH + " build_webrtc_with_release_raspberry_pi"], shell=True)
def build_tincan(self): def build_tincan(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_tincan"], shell=True) subprocess.run([SH + " build_tincan"], shell=True)
def build_tincan_release_ubuntu(self): def build_tincan_release_ubuntu(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_tincan_release_ubuntu"], shell=True) subprocess.run([SH + " build_tincan_release_ubuntu"], shell=True)
def build_tincan_debug_raspberry(self): def build_tincan_debug_raspberry(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_tincan_debug_raspberry"], shell=True) subprocess.run([SH + " build_tincan_debug_raspberry"], shell=True)
def build_tincan_release_raspberry(self): def build_tincan_release_raspberry(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh build_tincan_release_raspberry"], shell=True) subprocess.run([SH + " build_tincan_release_raspberry"], shell=True)
def check_for_link(self): def check_for_link(self):
if os.path.isfile("ev-tools.sh"): if os.path.isfile(SH):
return True return True
else: else:
print("Please run evt --sync and then retry the command.") print("Please run evt --sync and then retry the command.")
def all(self): def all(self):
if self.check_for_link(): if self.check_for_link():
subprocess.run(["ev-tools.sh all"], shell=True) subprocess.run([SH + " all"], shell=True)
def main(): def main():
tools = EvtTools() tools = EvtTools()
@ -147,7 +149,7 @@ def main():
return return
if tools.args.tincan: if tools.args.tincan:
tools.tincan() tools.build_tincan()
return return
if tools.args.debpak: if tools.args.debpak:
@ -186,10 +188,6 @@ def main():
tools.build_webrtc_release_raspberry() tools.build_webrtc_release_raspberry()
return return
if tools.args.tincan:
tools.build_tincan()
return
if tools.args.tincan_r: if tools.args.tincan_r:
tools.build_tincan_release_ubuntu() tools.build_tincan_release_ubuntu()
return return

View File

@ -53,25 +53,30 @@ class Link:
""" """
Get the active branch name of the Evio and Tools repo. Get the active branch name of the Evio and Tools repo.
""" """
present_dir = os.getcwd()[0:3] # present_dir = os.getcwd()[0:3]
for root, subdirs, files in os.walk(present_dir): # for root, subdirs, files in os.walk(present_dir):
for d in subdirs: # for d in subdirs:
if d == "evio": # if d == "evio":
self.dir_path = os.path.join(root, d) # self.dir_path = os.path.join(root, d)
pwd = os.getcwd()[0:]
os.chdir(os.getenv("HOME") + "/workspace/EdgeVPNio")
if path.exists("evio"):
self.dir_path = os.getcwd()[0:]
else:
self.dir_path = os.getcwd()[0:]
git.Git(self.dir_path).clone("https://github.com/EdgeVPNio/evio.git")
self.evio_repo = git.Repo(self.dir_path) self.evio_repo = git.Repo(str(self.dir_path) + "/evio")
#print("Evio Branch name:" + str(self.evio_repo.active_branch)) #print("Evio Branch name:" + str(self.evio_repo.active_branch))
for root, subdirs, files in os.walk(present_dir): self.dir_path_tools = "~/workspace/EdgeVPNio/tools"
for d in subdirs:
if d == "tools":
self.dir_path_tools = os.path.join(root, d)
self.tools_repo = git.Repo(self.dir_path_tools) self.tools_repo = git.Repo(self.dir_path_tools)
#print("Tools Branch name:" + str(self.tools_repo.active_branch)) #print("Tools Branch name:" + str(self.tools_repo.active_branch))
os.chdir(str(pwd))
def main(self): def main(self):
self.sync("20.7.2") self.sync("20.7.2")
if __name__ == "__main__": if __name__ == "__main__":
link = Link() link = Link()
link.main() link.main()

View File

@ -3,6 +3,12 @@
EVIO=https://github.com/EdgeVPNio/evio.git EVIO=https://github.com/EdgeVPNio/evio.git
EXLIBS=https://github.com/ipop-project/3rd-Party-Libs.git EXLIBS=https://github.com/ipop-project/3rd-Party-Libs.git
PY=python3.8 PY=python3.8
WorkspaceRoot=~/workspace
EdgeVPNIO=EdgeVPNio
Build_WRTC=./$EdgeVPNIO/tools/scripts/build_webrtc.sh
Get_Archives=./$EdgeVPNIO/tools/scripts/get_archives.sh
Get_Include=./$EdgeVPNIO/tools/scripts/get_include.sh
Build_Tincan=./$EdgeVPNIO/tools/scripts/build_tincan.sh
function install_build_tools function install_build_tools
{ {
@ -27,23 +33,23 @@ function pull_src
function make_debpak function make_debpak
{ {
wd=$(pwd) wd=$(pwd)
cd ../../.. cd ~/workspace
mkdir -p out mkdir -p out
cd $wd cd ~/workspace/$EdgeVPNIO/tools
cp ../debian-package ../../../out cp ./debian-package ../../out
cp ../evio/controller/Controller.py ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \ cp ../evio/controller/Controller.py ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
mkdir -p ../../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/ mkdir -p ../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/
cp ../evio/controller/template-config.json ../../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \ cp ../evio/controller/template-config.json ../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp -r ../evio/controller/modules/ ../evio/controller/framework/ ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \ cp -r ../evio/controller/modules/ ../evio/controller/framework/ ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/ && \ chmod 0775 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/ && \
chmod 0664 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/* && \ chmod 0664 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/* && \
chmod 0775 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/modules/ && \ chmod 0775 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/modules/ && \
chmod 0664 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/modules/* && \ chmod 0664 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/modules/* && \
chmod 0664 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/Controller.py && \ chmod 0664 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/Controller.py && \
chmod 0664 ../../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \ chmod 0664 ../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp ../evio/tincan/trunk/out/release/x86_64/tincan ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \ cp ../evio/tincan/trunk/out/release/x86_64/tincan ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/tincan && \ chmod 0775 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/tincan && \
cd ../../../out/debian-package/ && \ cd ../../out/debian-package/ && \
./deb-gen && \ ./deb-gen && \
rm -rf edge-vpnio/opt/edge-vpnio/framework \ rm -rf edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \ edge-vpnio/opt/edge-vpnio/modules \
@ -89,9 +95,11 @@ function make_venv
function make_dkrimg function make_dkrimg
{ {
mv debian-package/edge-vpnio_20.7_amd64.deb docker-image/ && \ mkdir -p ~/workspace/out/docker-image
docker build -f ./../docker-image/evio-base.Dockerfile -t edgevpnio/evio-base:1.0 ./docker-image && \ cd ~/workspace/$EdgeVPNIO/tools
docker build -f ./../docker-image/evio-node.Dockerfile -t edgevpnio/evio-node:20.7.3 ./docker-image mv ../../out/debian-package/edge-vpnio_20.7_amd64.deb docker-image/ && \
docker build -f ./docker-image/evio-base.Dockerfile -t edgevpnio/evio-base:1.0 ../../out/docker-image && \
docker build -f ./docker-image/evio-node.Dockerfile -t edgevpnio/evio-node:20.7.3 ../../out/docker-image
} }
@ -120,100 +128,50 @@ function do_clean
# tincan # tincan
wd=$(pwd) wd=$(pwd)
cd ../../evio/tincan/trunk/build cd ~/workspace/$EdgeVPNIO/evio/tincan/trunk/build
make clean; make clean;
cd $wd cd ~/workspace/out/
#debian pak #debian pak
cd ../debian-package/ && \ cd ./debian-package/ && \
rm -ri ./edge-vpnio_20.7_amd64.deb \ rm -ri ./edge-vpnio_20.7_amd64.deb \
edge-vpnio/opt/edge-vpnio/framework \ edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \ edge-vpnio/opt/edge-vpnio/modules \
edge-vpnio/opt/edge-vpnio/tincan \ edge-vpnio/opt/edge-vpnio/tincan \
edge-vpnio/opt/edge-vpnio/template-config.json \ edge-vpnio/opt/edge-vpnio/template-config.json \
edge-vpnio/opt/edge-vpnio/Controller.py && \ edge-vpnio/opt/edge-vpnio/Controller.py
cd $wd
# docker-image # docker-image
cd ..
rm -f docker-image/edge-vpnio_20.7_amd64.deb rm -f docker-image/edge-vpnio_20.7_amd64.deb
docker rmi edgevpnio/evio-base:1.0 edgevpnio/evio-node:20.7 docker rmi edgevpnio/evio-base:1.0 edgevpnio/evio-node:20.7
docker rmi $(docker images -q --filter "dangling=true") docker rmi $(docker images -q --filter "dangling=true")
# testbed # testbed
cd ../testbed cd ~/workspace/$EdgeVPNIO/tools/testbed
rm -rf config log cert venv rm -rf config log cert venv
cd $wd cd $wd
} }
function build_webrtc function build_webrtc()
{ {
wd=$(pwd) wd=$(pwd)
cd scripts cd $WorkspaceRoot
chmod +x build_webrtc.sh get_archives.sh get_include.sh chmod +x $Build_WRTC $Get_Archives $Get_Include
./build_webrtc.sh -b debug -t ubuntu $Build_WRTC -b "$1" -t "$2"
./get_archives.sh -b debug -t ubuntu if [ $? -eq '0' ]; then
./get_include.sh -b debug -t ubuntu cd $WorkspaceRoot
} $Get_Archives -b "$1" -t "$2"
if [ $? -eq '0' ]; then
function build_webrtc_with_release_ubuntu cd $WorkspaceRoot
{ $Get_Include
wd=$(pwd) fi
cd scripts fi
chmod +x build_webrtc.sh get_archives.sh get_include.sh
./build_webrtc.sh -b release -t ubuntu
./get_archives.sh -b release -t ubuntu
./get_include.sh -b release -t ubuntu
cd $wd cd $wd
} }
function build_webrtc_with_debug_raspberry_pi function build_tincan() {
{
wd=$(pwd) wd=$(pwd)
cd scripts cd $WorkspaceRoot
chmod +x build_webrtc.sh get_archives.sh get_include.sh chmod +x $Build_Tincan
./build_webrtc.sh -b debug -t raspberry-pi $Build_Tincan -b "$1" -t "$2"
./get_archives.sh -b debug -t raspberry-pi
./get_include.sh -b debug -t raspberry-pi
cd $wd
}
function build_webrtc_with_release_raspberry_pi
{
wd=$(pwd)
cd scripts
chmod +x build_webrtc.sh get_archives.sh get_include.sh
./build_webrtc.sh -b release -t raspberry-pi
./get_archives.sh -b release -t raspberry-pi
./get_include.sh -b release -t raspberry-pi
cd $wd
}
function build_tincan {
wd=$(pwd)
cd scripts
chmod +x ./build_tincan.sh
./build_tincan.sh -b debug -t ubuntu
cd $wd
}
function build_tincan_release_ubuntu {
wd=$(pwd)
cd scripts
chmod +x ./build_tincan.sh
./build_tincan.sh -b release -t ubuntu
cd $wd
}
function build_tincan_debug_raspberry {
wd=$(pwd)
cd scripts
chmod +x ./build_tincan.sh
./build_tincan.sh -b debug -t raspberry-pi
cd $wd
}
function build_tincan_release_raspberry {
wd=$(pwd)
cd scripts
chmod +x ./build_tincan.sh
./build_tincan.sh -b debug -t raspberry-pi
cd $wd cd $wd
} }
@ -255,28 +213,28 @@ case $1 in
do_clean do_clean
;; ;;
build_webrtc) build_webrtc)
build_webrtc build_webrtc debug ubuntu
;; ;;
build_webrtc_with_release_ubuntu) build_webrtc_with_release_ubuntu)
build_webrtc_with_release_ubuntu build_webrtc release ubuntu
;; ;;
build_webrtc_with_debug_raspberry_pi) build_webrtc_with_debug_raspberry_pi)
build_webrtc_with_debug_raspberry_pi build_webrtc debug raspberry-pi
;; ;;
build_webrtc_with_release_raspberry_pi) build_webrtc_with_release_raspberry_pi)
build_webrtc_with_release_raspberry_pi build_webrtc release raspberry-pi
;; ;;
build_tincan) build_tincan)
build_tincan build_tincan debug ubuntu
;; ;;
build_tincan_release_ubuntu) build_tincan_release_ubuntu)
build_tincan_release_ubuntu build_tincan release ubuntu
;; ;;
build_tincan_debug_raspberry) build_tincan_debug_raspberry)
build_tincan_debug_raspberry build_tincan debug raspberry-pi
;; ;;
build_tincan_release_raspberry) build_tincan_release_raspberry)
build_tincan_release_raspberry build_tincan release raspberry-pi
;; ;;
all) all)
do_full_setup do_full_setup

View File

@ -32,6 +32,7 @@ copyHeaders webrtc-checkout/src/third_party/jsoncpp/source/include/json out/incl
copyHeaders webrtc-checkout/src/third_party/jsoncpp/generated/version.h out/include/json copyHeaders webrtc-checkout/src/third_party/jsoncpp/generated/version.h out/include/json
copyHeaders webrtc-checkout/src/common_types.h out/include/webrtc copyHeaders webrtc-checkout/src/common_types.h out/include/webrtc
copyHeaders webrtc-checkout/src/third_party/ffmpeg/libavcodec/jni.h out/include/webrtc copyHeaders webrtc-checkout/src/third_party/ffmpeg/libavcodec/jni.h out/include/webrtc
#files other than *.h #files other than *.h
mkdir -p out/include/libc++ mkdir -p out/include/libc++
mkdir -p out/include/libc++abi mkdir -p out/include/libc++abi