mirror of https://github.com/EdgeVPNio/tools.git
Fixed the whole process and added more options for debpak
parent
9eb5b2b88e
commit
aeba5e2029
|
@ -2,3 +2,4 @@
|
||||||
|
|
||||||
dpkg-deb --build --root-owner-group edge-vpnio .
|
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
|
34
evt-tools.py
34
evt-tools.py
|
@ -5,7 +5,7 @@ from scripts.Link import Link
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
SH = ".\ev-tools.sh"
|
SH = "./ev-tools.sh"
|
||||||
|
|
||||||
|
|
||||||
class EvtTools:
|
class EvtTools:
|
||||||
|
@ -22,7 +22,13 @@ class EvtTools:
|
||||||
parser.add_argument("--src", action="store_true", default=False, dest="src",
|
parser.add_argument("--src", action="store_true", default=False, dest="src",
|
||||||
help="Clones EVIO repo.")
|
help="Clones EVIO repo.")
|
||||||
parser.add_argument("--debpak", action="store_true", default=False, dest="debpak",
|
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",
|
parser.add_argument("--testbed", action="store_true", default=False, dest="testbed",
|
||||||
help="Installs required dependencies for a testbed.")
|
help="Installs required dependencies for a testbed.")
|
||||||
parser.add_argument("--venv", action="store_true", default=False, dest="venv",
|
parser.add_argument("--venv", action="store_true", default=False, dest="venv",
|
||||||
|
@ -79,6 +85,18 @@ class EvtTools:
|
||||||
if self.check_for_link():
|
if self.check_for_link():
|
||||||
subprocess.run([SH + " debpak"], shell=True)
|
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):
|
def testbed(self):
|
||||||
if self.check_for_link():
|
if self.check_for_link():
|
||||||
subprocess.run([SH + " testbed"], shell=True)
|
subprocess.run([SH + " testbed"], shell=True)
|
||||||
|
@ -156,6 +174,18 @@ def main():
|
||||||
tools.debpak()
|
tools.debpak()
|
||||||
return
|
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:
|
if tools.args.testbed:
|
||||||
tools.testbed()
|
tools.testbed()
|
||||||
return
|
return
|
||||||
|
|
|
@ -3,37 +3,29 @@ import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import fileinput
|
import fileinput
|
||||||
import sys
|
import sys
|
||||||
from scripts.tool_config import CONTROL_VER as control
|
import shutil
|
||||||
from scripts.tool_config import OFFICIAL as official
|
from tool_config import CONTROL_VER as control
|
||||||
from scripts.tool_config import MAJOR_VER as mjr
|
from tool_config import OFFICIAL as official
|
||||||
from scripts.tool_config import MINOR_VER as mnr
|
from tool_config import MAJOR_VER as mjr
|
||||||
from scripts.tool_config import REVISION_VER as rvn
|
from tool_config import MINOR_VER as mnr
|
||||||
|
from tool_config import REVISION_VER as rvn
|
||||||
|
|
||||||
|
|
||||||
class Versioning:
|
class Versioning:
|
||||||
def changeVersionInTincan(self, major, minor, revision, build):
|
def changeVersionInTincan(self):
|
||||||
major = mjr
|
major = mjr
|
||||||
minor = mnr
|
minor = mnr
|
||||||
revision = rvn
|
revision = rvn
|
||||||
if official:
|
if official:
|
||||||
build = 0
|
|
||||||
ver = str(mjr) + "." + str(mnr) + "." + str(revision)
|
ver = str(mjr) + "." + str(mnr) + "." + str(revision)
|
||||||
else:
|
else:
|
||||||
build = int(time.time())
|
build = int(str(time.time())[-6:])
|
||||||
ver = str(mjr) + "." + str(mnr) + "." + str(revision) + "." + str(build)
|
ver = str(mjr) + "." + str(mnr) + "." + str(revision) + "." + str(build)
|
||||||
|
|
||||||
wd = os.getcwd()
|
wd = os.getcwd()
|
||||||
location1 = "~/workspace/EdgeVPNIO/evio/tincan/trunk/include/tincan_version.h"
|
location1 = os.environ['HOME'] + "/workspace/EdgeVPNio/evio/tincan/trunk/include"
|
||||||
location = '.'
|
location = './scripts'
|
||||||
os.chdir(location)
|
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" \
|
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" \
|
"* 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" \
|
"* 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" \
|
"* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n" \
|
||||||
"* THE SOFTWARE.\n" \
|
"* THE SOFTWARE.\n" \
|
||||||
"*/\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(str1)
|
||||||
t_file.write("#ifndef TINCAN_VERSION_H_\n")
|
t_file.write("#ifndef TINCAN_VERSION_H_\n")
|
||||||
t_file.write("#define 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(" static const uint8_t kTincanControlVer = " + str(control) + ";\n")
|
||||||
t_file.write("} // namespace tincan\n")
|
t_file.write("} // namespace tincan\n")
|
||||||
t_file.write("#endif // TINCAN_VERSION_H_")
|
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" \
|
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" \
|
"# 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" \
|
"# 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" \
|
"# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n" \
|
||||||
"# THE SOFTWARE.\n" \
|
"# THE SOFTWARE.\n" \
|
||||||
"#/\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:
|
with open('Version.py', 'w') as c_file:
|
||||||
c_file.write(str1)
|
c_file.write(str1)
|
||||||
c_file.write("\n")
|
c_file.write("\n")
|
||||||
|
@ -96,15 +92,12 @@ class Versioning:
|
||||||
c_file.write("EVIO_VER_REV = " + str(revision) + "\n")
|
c_file.write("EVIO_VER_REV = " + str(revision) + "\n")
|
||||||
c_file.write("EVIO_VER_BLD = " + str(build) + "\n")
|
c_file.write("EVIO_VER_BLD = " + str(build) + "\n")
|
||||||
c_file.write("EVIO_VER_CTL = " + str(control) + "\n")
|
c_file.write("EVIO_VER_CTL = " + str(control) + "\n")
|
||||||
os.replace('Version.py', location2)
|
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")
|
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")
|
subprocess.run("./debian-config")
|
||||||
for line in fileinput.input('./edge-vpnio/DEBIAN/control', inplace=True):
|
for line in fileinput.input('./edge-vpnio/DEBIAN/control', inplace=True):
|
||||||
if line.strip().startswith('Version'):
|
if line.strip().startswith('Version'):
|
||||||
|
@ -114,10 +107,7 @@ class Versioning:
|
||||||
line = 'Version : ' + ver + '-dev\n'
|
line = 'Version : ' + ver + '-dev\n'
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
os.chdir(wd)
|
os.chdir(wd)
|
||||||
# os.replace('./temp', './deb-gen')
|
|
||||||
# os.rename(r'./temp', r'./deb-gen')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
version = Versioning()
|
version = Versioning()
|
||||||
version.changeVersionInTincan(20, 10, 0, 192385)
|
version.changeVersionInTincan()
|
||||||
|
|
|
@ -30,16 +30,17 @@ function pull_src
|
||||||
cd $wd
|
cd $wd
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_debpak
|
function make_debpak ()
|
||||||
{
|
{
|
||||||
|
python3 ./scripts/Versioning.py
|
||||||
wd=$(pwd)
|
wd=$(pwd)
|
||||||
cd ~/workspace
|
cd ~/workspace
|
||||||
mkdir -p out
|
mkdir -p out
|
||||||
cd ~/workspace/$EdgeVPNIO/tools
|
cd ~/workspace/$EdgeVPNIO/tools
|
||||||
cp ./debian-package ../../out
|
cp -r ./debian-package ../../out
|
||||||
cp ../evio/controller/Controller.py ../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
|
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/
|
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/ && \
|
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/* && \
|
||||||
|
@ -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/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 -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 && \
|
chmod 0775 ../../out/debian-package/edge-vpnio/opt/edge-vpnio/tincan && \
|
||||||
cd ../../out/debian-package/ && \
|
cd ../../out/debian-package/ && \
|
||||||
./deb-gen && \
|
./deb-gen && \
|
||||||
|
@ -95,9 +96,10 @@ function make_venv
|
||||||
|
|
||||||
function make_dkrimg
|
function make_dkrimg
|
||||||
{
|
{
|
||||||
|
python3 ./scripts/Versioning.py
|
||||||
mkdir -p ~/workspace/out/docker-image
|
mkdir -p ~/workspace/out/docker-image
|
||||||
cd ~/workspace/$EdgeVPNIO/tools
|
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)
|
wd=$(pwd)
|
||||||
cd ../../out/debian-package/
|
cd ../../out/debian-package/
|
||||||
NAME=`ls | grep *.deb`
|
NAME=`ls | grep *.deb`
|
||||||
|
@ -138,7 +140,7 @@ function do_clean
|
||||||
cd ~/workspace/out/
|
cd ~/workspace/out/
|
||||||
#debian pak
|
#debian pak
|
||||||
cd ./debian-package/ && \
|
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/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 \
|
||||||
|
@ -146,7 +148,7 @@ function do_clean
|
||||||
edge-vpnio/opt/edge-vpnio/Controller.py
|
edge-vpnio/opt/edge-vpnio/Controller.py
|
||||||
# docker-image
|
# docker-image
|
||||||
cd ..
|
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 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
|
||||||
|
@ -173,6 +175,7 @@ function build_webrtc()
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_tincan() {
|
function build_tincan() {
|
||||||
|
python3 ./scripts/Versioning.py
|
||||||
wd=$(pwd)
|
wd=$(pwd)
|
||||||
cd $WorkspaceRoot
|
cd $WorkspaceRoot
|
||||||
chmod +x $Build_Tincan
|
chmod +x $Build_Tincan
|
||||||
|
@ -200,7 +203,16 @@ case $1 in
|
||||||
pull_src
|
pull_src
|
||||||
;;
|
;;
|
||||||
debpak)
|
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)
|
dkrimg)
|
||||||
make_dkrimg
|
make_dkrimg
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
sudo apt install -y python3.8 python3.8-dev python3.8-venv python3-pip
|
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
|
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 40
|
||||||
# update-alternatives --display python
|
|
||||||
# python -V
|
|
||||||
deactivate 2>/dev/null
|
deactivate 2>/dev/null
|
||||||
python -m venv venv && \
|
python -m venv venv && \
|
||||||
source venv/bin/activate && \
|
source venv/bin/activate && \
|
||||||
export PATH="$PATH:." && \
|
|
||||||
chmod 775 ./evt && \
|
chmod 775 ./evt && \
|
||||||
pip3 install gitpython simplejson
|
pip3 install gitpython simplejson
|
||||||
|
|
Loading…
Reference in New Issue