Fixed the whole process and added more options for debpak

pull/8/head
Rajath Ganesh 2020-11-09 17:30:54 -05:00
parent 9eb5b2b88e
commit aeba5e2029
5 changed files with 88 additions and 63 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
dpkg-deb --build --root-owner-group edge-vpnio .
rm -f edge-vpnio/DEBIAN/control
rm -f edge-vpnio/DEBIAN/control
rm -f EdgeVPNio/tools/debian-package/edge-vpnio/DEBIAN/control

View File

@ -5,7 +5,7 @@ from scripts.Link import Link
import subprocess
import os
SH = ".\ev-tools.sh"
SH = "./ev-tools.sh"
class EvtTools:
@ -22,7 +22,13 @@ class EvtTools:
parser.add_argument("--src", action="store_true", default=False, dest="src",
help="Clones EVIO repo.")
parser.add_argument("--debpak", action="store_true", default=False, dest="debpak",
help="Generates the Debian package.")
help="Generates the Ubuntu Debian x64 debug package.")
parser.add_argument("--debpak_rel", action="store_true", default=False, dest="debpak_r",
help="Generates the Ubuntu Debian x64 release package.")
parser.add_argument("--debpak_arm_dbg", action="store_true", default=False, dest="debpak_a_d",
help="Generates the ARM Debian debug package.")
parser.add_argument("--debpak_arm_rel", action="store_true", default=False, dest="debpak_a_r",
help="Generates the ARM Debian release package.")
parser.add_argument("--testbed", action="store_true", default=False, dest="testbed",
help="Installs required dependencies for a testbed.")
parser.add_argument("--venv", action="store_true", default=False, dest="venv",
@ -79,6 +85,18 @@ class EvtTools:
if self.check_for_link():
subprocess.run([SH + " debpak"], shell=True)
def debpak_release(self):
if self.check_for_link():
subprocess.run([SH + " debpak_release"], shell=True)
def debpak_arm_debug(self):
if self.check_for_link():
subprocess.run([SH + " debpak_arm_debug"], shell=True)
def debpak_arm_release(self):
if self.check_for_link():
subprocess.run([SH + " debpak_arm_release"], shell=True)
def testbed(self):
if self.check_for_link():
subprocess.run([SH + " testbed"], shell=True)
@ -156,6 +174,18 @@ def main():
tools.debpak()
return
if tools.args.debpak_r:
tools.debpak_release()
return
if tools.args.debpak_a_d:
tools.debpak_arm_debug()
return
if tools.args.debpak_a_r:
tools.debpak_arm_release()
return
if tools.args.testbed:
tools.testbed()
return

View File

@ -3,37 +3,29 @@ import time
import subprocess
import fileinput
import sys
from scripts.tool_config import CONTROL_VER as control
from scripts.tool_config import OFFICIAL as official
from scripts.tool_config import MAJOR_VER as mjr
from scripts.tool_config import MINOR_VER as mnr
from scripts.tool_config import REVISION_VER as rvn
import shutil
from tool_config import CONTROL_VER as control
from tool_config import OFFICIAL as official
from tool_config import MAJOR_VER as mjr
from tool_config import MINOR_VER as mnr
from tool_config import REVISION_VER as rvn
class Versioning:
def changeVersionInTincan(self, major, minor, revision, build):
def changeVersionInTincan(self):
major = mjr
minor = mnr
revision = rvn
if official:
build = 0
ver = str(mjr) + "." + str(mnr) + "." + str(revision)
else:
build = int(time.time())
build = int(str(time.time())[-6:])
ver = str(mjr) + "." + str(mnr) + "." + str(revision) + "." + str(build)
wd = os.getcwd()
location1 = "~/workspace/EdgeVPNIO/evio/tincan/trunk/include/tincan_version.h"
location = '.'
location1 = os.environ['HOME'] + "/workspace/EdgeVPNio/evio/tincan/trunk/include"
location = './scripts'
os.chdir(location)
# version_h_r = open("tincan_version.h", 'r').read()
# version_h_w = open("tincan_version.h", 'w')
# m = version_h_r.replace("static const uint16_t kTincanVerMjr = 0;", "static const uint16_t kTincanVerMjr = " + major + ";")
# m = version_h_r.replace("static const uint16_t kTincanVerMnr = 0;", "static const uint16_t kTincanVerMnr = " + minor + ";")
# m = version_h_r.replace("static const uint16_t kTincanVerRev = 0;", "static const uint16_t kTincanVerRev = " + revision + ";")
# m = version_h_r.replace("static const uint16_t kTincanVerBld = 0;", "static const uint16_t kTincanVerBld = " + build + ";")
# version_h_w.write(m)
# os.chdir(wd)
str1 = "/*\n* EdgeVPNio\n* Copyright 2020, University of Florida\n*\n" \
"* Permission is hereby granted, free of charge, to any person obtaining a copy\n" \
"* of this software and associated documentation files (the \"Software\"), to deal\n" \
@ -53,7 +45,7 @@ class Versioning:
"* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n" \
"* THE SOFTWARE.\n" \
"*/\n"
with open('tincan_version.h', 'w') as t_file:
with open('./tincan_version.h', 'w') as t_file:
t_file.write(str1)
t_file.write("#ifndef TINCAN_VERSION_H_\n")
t_file.write("#define TINCAN_VERSION_H_\n")
@ -66,7 +58,11 @@ class Versioning:
t_file.write(" static const uint8_t kTincanControlVer = " + str(control) + ";\n")
t_file.write("} // namespace tincan\n")
t_file.write("#endif // TINCAN_VERSION_H_")
os.replace('tincan_version.h', location1)
src = os.path.join(os.getcwd(), 'tincan_version.h')
filename = os.path.basename(src)
dest = os.path.join(location1, filename)
shutil.move(src, dest)
str1 = "#\n# EdgeVPNio\n# Copyright 2020, University of Florida\n#\n" \
"# Permission is hereby granted, free of charge, to any person obtaining a copy\n" \
"# of this software and associated documentation files (the \"Software\"), to deal\n" \
@ -86,7 +82,7 @@ class Versioning:
"# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n" \
"# THE SOFTWARE.\n" \
"#/\n"
location2 = "~/workspace/EdgeVPNIO/evio/controller/framework/Version.py"
location2 = os.environ['HOME'] + "/workspace/EdgeVPNio/evio/controller/framework"
with open('Version.py', 'w') as c_file:
c_file.write(str1)
c_file.write("\n")
@ -96,28 +92,22 @@ class Versioning:
c_file.write("EVIO_VER_REV = " + str(revision) + "\n")
c_file.write("EVIO_VER_BLD = " + str(build) + "\n")
c_file.write("EVIO_VER_CTL = " + str(control) + "\n")
os.replace('Version.py', location2)
os.chdir("../debian-package")
# for line in fileinput.input('./deb-gen', inplace=True):
# if line.strip().startswith('Version'):
# if official:
# line = 'Version : ' + ver + '\n'
# else:
# line = 'Version : ' + ver + '-dev\n'
# sys.stdout.write(line)
subprocess.run("./debian-config")
for line in fileinput.input('./edge-vpnio/DEBIAN/control', inplace=True):
if line.strip().startswith('Version'):
if official:
line = 'Version : ' + ver + '\n'
else:
line = 'Version : ' + ver + '-dev\n'
sys.stdout.write(line)
os.chdir(wd)
# os.replace('./temp', './deb-gen')
# os.rename(r'./temp', r'./deb-gen')
src1 = os.path.join(os.getcwd(), 'Version.py')
filename1 = os.path.basename(src1)
dest1 = os.path.join(location2, filename1)
shutil.move(src1, dest1)
if len(sys.argv) > 1:
os.chdir("../debian-package")
subprocess.run("./debian-config")
for line in fileinput.input('./edge-vpnio/DEBIAN/control', inplace=True):
if line.strip().startswith('Version'):
if official:
line = 'Version : ' + ver + '\n'
else:
line = 'Version : ' + ver + '-dev\n'
sys.stdout.write(line)
os.chdir(wd)
if __name__ == '__main__':
version = Versioning()
version.changeVersionInTincan(20, 10, 0, 192385)
version.changeVersionInTincan()

View File

@ -30,16 +30,17 @@ function pull_src
cd $wd
}
function make_debpak
function make_debpak ()
{
python3 ./scripts/Versioning.py
wd=$(pwd)
cd ~/workspace
mkdir -p out
cd ~/workspace/$EdgeVPNIO/tools
cp ./debian-package ../../out
cp ../evio/controller/Controller.py ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
cp -r ./debian-package ../../out
cp -r ../evio/controller/Controller.py ../../out/debian-package/edge-vpnio/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 -r ../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/ && \
chmod 0775 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/ && \
chmod 0664 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/* && \
@ -47,7 +48,7 @@ function make_debpak
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/etc/opt/edge-vpnio/config.json && \
cp ../evio/tincan/trunk/out/release/x86_64/tincan ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
cp -r ../evio/tincan/out/"$2"/"$1"/tincan ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/tincan && \
cd ../../out/debian-package/ && \
./deb-gen && \
@ -95,9 +96,10 @@ function make_venv
function make_dkrimg
{
python3 ./scripts/Versioning.py
mkdir -p ~/workspace/out/docker-image
cd ~/workspace/$EdgeVPNIO/tools
mv ../../out/debian-package/edge-vpnio_20.7_amd64.deb docker-image/ && \
mv ../../out/debian-package/*.deb ~/workspace/out/docker-image && \
wd=$(pwd)
cd ../../out/debian-package/
NAME=`ls | grep *.deb`
@ -138,7 +140,7 @@ function do_clean
cd ~/workspace/out/
#debian pak
cd ./debian-package/ && \
rm -ri ./edge-vpnio_20.7_amd64.deb \
rm -ri ./*.deb \
edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \
edge-vpnio/opt/edge-vpnio/tincan \
@ -146,7 +148,7 @@ function do_clean
edge-vpnio/opt/edge-vpnio/Controller.py
# docker-image
cd ..
rm -f docker-image/edge-vpnio_20.7_amd64.deb
rm -f docker-image/*.deb
docker rmi edgevpnio/evio-base:1.0 edgevpnio/evio-node:20.7
docker rmi $(docker images -q --filter "dangling=true")
# testbed
@ -173,6 +175,7 @@ function build_webrtc()
}
function build_tincan() {
python3 ./scripts/Versioning.py
wd=$(pwd)
cd $WorkspaceRoot
chmod +x $Build_Tincan
@ -200,7 +203,16 @@ case $1 in
pull_src
;;
debpak)
make_debpak
make_debpak debug debian-x64
;;
debpak_release)
make_debpak release debian-x64
;;
debpak_arm_debug)
make_debpak debug debian-arm
;;
debpak_arm_release)
make_debpak release debian-arm
;;
dkrimg)
make_dkrimg

View File

@ -1,16 +1,8 @@
#!/bin/bash
sudo apt install -y python3.8 python3.8-dev python3.8-venv python3-pip
# ls /usr/bin/python*
# update-alternatives --display python
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 20
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 30
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 40
# update-alternatives --display python
# python -V
deactivate 2>/dev/null
python -m venv venv && \
source venv/bin/activate && \
export PATH="$PATH:." && \
chmod 775 ./evt && \
pip3 install gitpython simplejson