Skip to content

Commit

Permalink
Upgrade to Veins 5.2, INET 4.2.2, INET 3.7.1, fix Simu5G at 1.1.0, fo…
Browse files Browse the repository at this point in the history
…llow rename of Plexe
  • Loading branch information
sommer committed Dec 6, 2021
1 parent 0687a75 commit 11f5a39
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 79 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Select use_veins_vlc:
1 - no
2 - yes
Choose from 1, 2 (1, 2) [1]:
Select use_plexe_veins:
Select use_plexe:
1 - no
2 - yes
Choose from 1, 2 (1, 2) [1]:
Expand All @@ -53,7 +53,7 @@ Cookiecutter checks successful.
Cookiecutter successful. Running git commands to set up repository.
[...]
From https://github.com/sommer/veins
* tag veins-5.1 -> FETCH_HEAD
* tag veins-5.2 -> FETCH_HEAD
Added dir 'veins'
Repository set up successful. Running git commands to clean up.
Cookiecutter successful.
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"use_inet": ["no", "yes"],
"use_inet3": ["no", "yes"],
"use_veins_vlc": ["no", "yes"],
"use_plexe_veins": ["no", "yes"],
"use_plexe": ["no", "yes"],
"use_simulte": ["no", "yes"],
"use_simu5g": ["no", "yes"],
"_dummy": ""
Expand Down
15 changes: 7 additions & 8 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# INET
{%- if cookiecutter.use_inet == "yes" %}
subprocess.check_call(['git', 'subtree', 'add', '--prefix=inet', '--message', 'Merge INET 4.2.1', 'https://github.com/inet-framework/inet', 'v4.2.1'])
subprocess.check_call(['git', 'subtree', 'add', '--prefix=inet', '--message', 'Merge INET 4.2.2', 'https://github.com/inet-framework/inet', 'v4.2.2'])
#subprocess.check_call(['git', 'rm', 'inet/.gitmodules', 'inet/showcases', 'inet/tutorials'])
#subprocess.check_call(['git', 'commit', '--message', 'inet: remove submodules (showcases and tutorials)'])
#subprocess.check_call(['git', 'subtree', 'add', '--squash', '--prefix=inet/tutorials', '--message', 'Merge INET Tutorials 4.0.0', 'https://github.com/inet-framework/inet-tutorials', 'v4.0.0'])
Expand All @@ -40,7 +40,7 @@

# INET (version 3)
{%- if cookiecutter.use_inet3 == "yes" %}
subprocess.check_call(['git', 'subtree', 'add', '--prefix=inet', '--message', 'Merge INET 3.6.8', 'https://github.com/inet-framework/inet', 'v3.6.8'])
subprocess.check_call(['git', 'subtree', 'add', '--prefix=inet', '--message', 'Merge INET 3.7.1', 'https://github.com/inet-framework/inet', 'v3.7.1'])
subprocess.check_call(['git', 'rm', 'inet/.gitmodules', 'inet/showcases', 'inet/tutorials'])
subprocess.check_call(['git', 'commit', '--message', 'inet: remove submodules (showcases and tutorials)'])
#subprocess.check_call(['git', 'subtree', 'add', '--squash', '--prefix=inet/tutorials', '--message', 'Merge INET Tutorials 3.6.4', 'https://github.com/inet-framework/inet-tutorials', 'v3.6.4'])
Expand All @@ -52,9 +52,9 @@
subprocess.check_call(['git', 'subtree', 'add', '--prefix=veins_vlc', '--message', 'Merge Veins VLC 1.0', 'https://github.com/veins/veins_vlc', 'veins-vlc-1.0'])
{%- endif %}

# Plexe Veins
{%- if cookiecutter.use_plexe_veins == "yes" %}
subprocess.check_call(['git', 'subtree', 'add', '--prefix=plexe_veins', '--message', 'Merge Plexe Veins 3.0', 'https://github.com/michele-segata/plexe-veins', 'plexe-3.0'])
# Plexe
{%- if cookiecutter.use_plexe == "yes" %}
subprocess.check_call(['git', 'subtree', 'add', '--prefix=plexe', '--message', 'Merge Plexe 3.0', 'https://github.com/michele-segata/plexe', 'plexe-3.0'])
{%- endif %}

# SimuLTE
Expand All @@ -70,12 +70,11 @@

# Simu5G
{%- if cookiecutter.use_simu5g == "yes" %}
subprocess.check_call(['git', 'subtree', 'add', '--prefix=simu5g', '--message', 'Merge Simu5G Master', 'https://github.com/Unipisa/Simu5G.git', 'master'])

subprocess.check_call(['git', 'subtree', 'add', '--prefix=simu5g', '--message', 'Merge Simu5G Master', 'https://github.com/Unipisa/Simu5G.git', 'v1.1.0'])
{%- endif %}

# Veins
subprocess.check_call(['git', 'subtree', 'add', '--prefix=veins', '--message', 'Merge Veins 5.1', 'https://github.com/sommer/veins', 'veins-5.1'])
subprocess.check_call(['git', 'subtree', 'add', '--prefix=veins', '--message', 'Merge Veins 5.2', 'https://github.com/sommer/veins', 'veins-5.2'])

# Cookiecutter project
subprocess.check_call(['git', 'add', '.'])
Expand Down
8 changes: 4 additions & 4 deletions {{cookiecutter.project_name_as_file_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ endif
{%- if cookiecutter.use_veins_vlc == "yes" %}
$(MAKE) -C veins_vlc all
{%- endif %}
{%- if cookiecutter.use_plexe_veins == "yes" %}
$(MAKE) -C plexe_veins all
{%- if cookiecutter.use_plexe == "yes" %}
$(MAKE) -C plexe all
{%- endif %}
{%- if cookiecutter.use_simu5g == "yes" %}
ifdef MODE
Expand Down Expand Up @@ -80,8 +80,8 @@ clean:
{%- if cookiecutter.use_veins_vlc == "yes" %}
$(MAKE) -C veins_vlc clean
{%- endif %}
{%- if cookiecutter.use_plexe_veins == "yes" %}
$(MAKE) -C plexe_veins clean
{%- if cookiecutter.use_plexe == "yes" %}
$(MAKE) -C plexe clean
{%- endif %}
{%- if cookiecutter.use_simu5g == "yes" %}
$(MAKE) -C simu5g clean
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name_as_file_name}}/configure
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ set -e
{%- if cookiecutter.use_veins_vlc == "yes" %}
(cd veins_vlc && ./configure "$@")
{%- endif %}
{%- if cookiecutter.use_plexe_veins == "yes" %}
(cd plexe_veins && ./configure --with-veins=../veins "$@")
{%- if cookiecutter.use_plexe == "yes" %}
(cd plexe && ./configure --with-veins=../veins "$@")
{%- endif %}
{%- if cookiecutter.use_simulte == "yes" %}
(cd simulte && make makefiles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
{%- if cookiecutter.use_veins_vlc == "yes" %}
<project>veins-vlc</project>
{%- endif %}
{%- if cookiecutter.use_plexe_veins == "yes" %}
<project>plexe-veins</project>
{%- if cookiecutter.use_plexe == "yes" %}
<project>plexe</project>
{%- endif %}
{%- if cookiecutter.use_simu5g == "yes" %}
<project>simu5G</project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Supported program versions ##

- Veins 5.1 (see <http://veins.car2x.org/>)
- Veins 5.2 (see <http://veins.car2x.org/>)
- OMNeT++ 5.6.2 (see <https://omnetpp.org/>)

## License ##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ parser.add_option("--with-veins", dest="veins", help="link with a version of Vei
{%- if cookiecutter.use_veins_vlc == "yes" %}
parser.add_option("--with-veins-vlc", dest="veins_vlc", help="link with a version of Veins VLC installed in PATH", metavar="PATH", default="../veins_vlc")
{%- endif %}
{%- if cookiecutter.use_plexe_veins == "yes" %}
parser.add_option("--with-plexe-veins", dest="plexe_veins", help="link with a version of Plexe Veins installed in PATH", metavar="PATH", default="../plexe_veins")
{%- if cookiecutter.use_plexe == "yes" %}
parser.add_option("--with-plexe", dest="plexe", help="link with a version of Plexe installed in PATH", metavar="PATH", default="../plexe")
{%- endif %}
{%- if cookiecutter.use_simulte == "yes" %}
parser.add_option("--with-simulte", dest="simulte", help="link with a version of SimuLTE installed in PATH", metavar="PATH", default="../simulte")
Expand Down Expand Up @@ -86,13 +86,14 @@ if args:
makemake_flags = ['-f', '--deep', '--no-deep-includes', '--make-so', '-I', '.', '-o', '{{ cookiecutter.project_name_as_file_name }}', '-O', 'out']
run_libs = [os.path.join('src', '{{ cookiecutter.project_name_as_file_name }}')]
run_neds = [os.path.join('src', '{{ cookiecutter.project_name_as_file_name }}')]
run_excs = []
run_imgs = [os.path.join('images')]


# Add flags for Veins
if options.veins:
fname = os.path.join(options.veins, 'print-veins-version')
expect_version = [b'5.1']
expect_version = [b'5.2']
try:
info('Running "%s" to determine Veins version.' % fname)
version = subprocess.check_output(['env', fname]).strip()
Expand Down Expand Up @@ -122,22 +123,38 @@ if options.veins:

# Add flags for INET
if options.inet:
fname = os.path.join(options.inet, '_scripts/get_version')
expect_version = [b'4.2.0', b'4.2.1']
expect_version = [b'4.2.0', b'4.2.1', b'4.2.2', b'4.2.3', b'4.2.4', b'4.2.5', b'4.2.8', b'4.3.0', b'4.3.1', b'4.3.2', b'4.3.5']
try:
info('Running "%s" to determine INET version.' % fname)
version = subprocess.check_output(['env', fname]).strip()
if not version in expect_version:
warning('')
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('Unsupported INET Version. Expecting %s, found %s' % (versions_to_hr(expect_version), version_to_hr(version)))
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('')
else:
info('Found INET version %s. Okay.' % version_to_hr(version))
except subprocess.CalledProcessError as e:
error('Could not determine INET Version (by running %s): %s. Check the path to INET (--with-inet=... option) and the INET version (should be version %s)' % (fname, e, versions_to_hr(expect_version)))
sys.exit(1)
fname1 = os.path.join(options.inet, 'Version')
info('Reading "%s" to determine INET version.' % fname1)
f = open(fname1, 'rb')
s = f.readline()
s = s.strip()
s = s.split(b'-', 3)
assert s[0] == b'inet', 'Version string does not start with "inet"'
version = s[1]
f.close()
except (AssertionError, EnvironmentError) as e1:
try:
fname2 = os.path.join(options.inet, '_scripts/get_version')
info('Running "%s" to determine INET version.' % fname2)
version = subprocess.check_output(['env', fname2], stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e2:
try:
fname3 = os.path.join(options.inet, 'bin/inet_version')
info('Running "%s" to determine INET version.' % fname3)
version = subprocess.check_output(['env', fname3], stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e3:
error('Could not determine INET Version; neither by reading %s (%s), nor by running %s (%s), nor by running %s (%s). Check the path to INET (--with-inet=... option) and the INET version (should be version %s)' % (fname1, e1, fname2, e2, fname3, e3, versions_to_hr(expect_version)))
sys.exit(1)
if not version in expect_version:
warning('')
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('Unsupported INET Version. Expecting %s, found %s' % (versions_to_hr(expect_version), version_to_hr(version)))
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('')
else:
info('Found INET version %s. Okay.' % version_to_hr(version))

inet_header_dirs = [os.path.join(os.path.relpath(options.inet, 'src'), 'src')]
inet_includes = ['-I' + s for s in inet_header_dirs]
Expand All @@ -147,13 +164,15 @@ if options.inet:
makemake_flags += inet_includes + inet_link + inet_defs
run_libs = [os.path.relpath(os.path.join(options.inet, 'src', 'INET'))] + run_libs
run_neds = [os.path.relpath(os.path.join(options.inet, 'src'))] + run_neds
if not version in [b'4.2.0', b'4.2.1', b'4.2.2', b'4.2.3', b'4.2.4']:
run_excs = [os.path.relpath(os.path.join(options.inet, '.nedexclusions'))] + run_excs
run_imgs = [os.path.relpath(os.path.join(options.inet, 'images'))] + run_imgs


# Add flags for Veins_INET
if options.veins_inet:
fname = os.path.join(options.veins_inet, 'print-veins_inet-version')
expect_version = [b'4.0']
expect_version = [b'5.2']
try:
info('Running "%s" to determine Veins_INET version.' % fname)
version = subprocess.check_output(['env', fname]).strip()
Expand Down Expand Up @@ -184,22 +203,38 @@ if options.veins_inet:

# Add flags for INET (version 3)
if options.inet3:
fname = os.path.join(options.inet3, '_scripts/get_version')
expect_version = [b'3.6.5', b'3.6.6', b'3.6.7', b'3.6.8']
expect_version = [b'3.6.5', b'3.6.6', b'3.6.7', b'3.6.8', b'3.7.0', b'3.7.1', b'3.8.1']
try:
info('Running "%s" to determine INET version.' % fname)
version = subprocess.check_output(['env', fname]).strip()
if not version in expect_version:
warning('')
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('Unsupported INET Version. Expecting %s, found %s' % (versions_to_hr(expect_version), version_to_hr(version)))
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('')
else:
info('Found INET version %s. Okay.' % version_to_hr(version))
except subprocess.CalledProcessError as e:
error('Could not determine INET Version (by running %s): %s. Check the path to INET (--with-inet3=... option) and the INET version (should be version %s)' % (fname, e, versions_to_hr(expect_version)))
sys.exit(1)
fname1 = os.path.join(options.inet, 'Version')
info('Reading "%s" to determine INET version.' % fname1)
f = open(fname1, 'rb')
s = f.readline()
s = s.strip()
s = s.split(b'-', 3)
assert s[0] == b'inet', 'Version string does not start with "inet"'
version = s[1]
f.close()
except (AssertionError, EnvironmentError) as e1:
try:
fname2 = os.path.join(options.inet, '_scripts/get_version')
info('Running "%s" to determine INET version.' % fname2)
version = subprocess.check_output(['env', fname2], stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e2:
try:
fname3 = os.path.join(options.inet, 'bin/inet_version')
info('Running "%s" to determine INET version.' % fname3)
version = subprocess.check_output(['env', fname3], stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e3:
error('Could not determine INET Version; neither by reading %s (%s), nor by running %s (%s), nor by running %s (%s). Check the path to INET (--with-inet=... option) and the INET version (should be version %s)' % (fname1, e1, fname2, e2, fname3, e3, versions_to_hr(expect_version)))
sys.exit(1)
if not version in expect_version:
warning('')
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('Unsupported INET Version. Expecting %s, found %s' % (versions_to_hr(expect_version), version_to_hr(version)))
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('')
else:
info('Found INET version %s. Okay.' % version_to_hr(version))

inet3_header_dirs = [os.path.join(os.path.relpath(options.inet3, 'src'), 'src')]
inet3_includes = ['-I' + s for s in inet3_header_dirs]
Expand All @@ -215,7 +250,7 @@ if options.inet3:
# Add flags for Veins_INET
if options.veins_inet3:
fname = os.path.join(options.veins_inet3, 'print-veins_inet-version')
expect_version = [b'3.0']
expect_version = [b'5.2']
try:
info('Running "%s" to determine Veins_INET version.' % fname)
version = subprocess.check_output(['env', fname]).strip()
Expand Down Expand Up @@ -273,37 +308,37 @@ if options.veins_vlc:
run_neds = [os.path.relpath(os.path.join(options.veins_vlc, 'src', 'veins-vlc'))] + run_neds
run_imgs = [os.path.relpath(os.path.join(options.veins_vlc, 'images'))] + run_imgs
{%- endif %}
{%- if cookiecutter.use_plexe_veins == "yes" %}
{%- if cookiecutter.use_plexe == "yes" %}


# Add flags for Plexe Veins
if options.plexe_veins:
fname = os.path.join(options.plexe_veins, 'src', 'plexe', 'plexe.h')
expect_version = [b'3.0-alpha1']
# Add flags for Plexe
if options.plexe:
fname = os.path.join(options.plexe, 'print-plexe-version')
expect_version = [b'3.0']
try:
info('Running "%s" to determine Plexe Veins version.' % fname)
version = subprocess.check_output(['env', 'cat', fname]).strip()
if not version:
info('Running "%s" to determine Plexe version.' % fname)
version = subprocess.check_output(['env', fname]).strip()
if not version in expect_version:
warning('')
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('Unsupported Plexe Veins Version. Expecting %s, found %s' % (versions_to_hr(expect_version), version_to_hr(version)))
warning('Unsupported Plexe Version. Expecting %s, found %s' % (versions_to_hr(expect_version), version_to_hr(version)))
warning('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
warning('')
else:
info('Found Plexe Veins version %s. Okay.' % version_to_hr(version))
info('Found Plexe version %s. Okay.' % version_to_hr(version))
except subprocess.CalledProcessError as e:
error('Could not determine Plexe Veins Version (by running %s): %s. Check the path to Plexe Veins (--with-plexe-veins=... option) and the Plexe Veins version (should be version %s)' % (fname, e, versions_to_hr(expect_version)))
error('Could not determine Plexe Version (by running %s): %s. Check the path to Plexe (--with-plexe=... option) and the Plexe version (should be version %s)' % (fname, e, versions_to_hr(expect_version)))
sys.exit(1)

plexe_veins_header_dirs = [os.path.join(os.path.relpath(options.plexe_veins, 'src'), 'src')]
plexe_veins_includes = ['-I' + s for s in plexe_veins_header_dirs]
plexe_veins_link = ["-L" + os.path.join(os.path.relpath(options.plexe_veins, 'src'), 'src'), "-lplexe$(D)"]
plexe_veins_defs = []
plexe_header_dirs = [os.path.join(os.path.relpath(options.plexe, 'src'), 'src')]
plexe_includes = ['-I' + s for s in plexe_header_dirs]
plexe_link = ["-L" + os.path.join(os.path.relpath(options.plexe, 'src'), 'src'), "-lplexe$(D)"]
plexe_defs = []

makemake_flags += plexe_veins_includes + plexe_veins_link + plexe_veins_defs
run_libs = [os.path.relpath(os.path.join(options.plexe_veins, 'src', 'plexe'))] + run_libs
run_neds = [os.path.relpath(os.path.join(options.plexe_veins, 'src', 'plexe'))] + run_neds
run_imgs = [os.path.relpath(os.path.join(options.plexe_veins, 'images'))] + run_imgs
makemake_flags += plexe_includes + plexe_link + plexe_defs
run_libs = [os.path.relpath(os.path.join(options.plexe, 'src', 'plexe'))] + run_libs
run_neds = [os.path.relpath(os.path.join(options.plexe, 'src', 'plexe'))] + run_neds
run_imgs = [os.path.relpath(os.path.join(options.plexe, 'images'))] + run_imgs
{%- endif %}
{%- if cookiecutter.use_simulte == "yes" %}

Expand Down Expand Up @@ -362,6 +397,7 @@ if not os.path.isdir('out'):
f = open(os.path.join('out', 'config.py'), 'w')
f.write('run_libs = %s\n' % repr(run_libs))
f.write('run_neds = %s\n' % repr(run_neds))
f.write('run_excs = %s\n' % repr(run_excs))
f.write('run_imgs = %s\n' % repr(run_imgs))
f.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ def relpath(s):

run_libs = [relpath(s) for s in run_libs]
run_neds = [relpath(s) for s in run_neds] + ['.']
run_excs = [relpath(s) for s in run_excs]
run_imgs = [relpath(s) for s in run_imgs]

run_excs_lines = []
for run_exc in run_excs:
if os.path.isfile(run_exc):
with open(run_exc, 'r') as f:
run_excs_lines += [line.strip() for line in f]

opp_run = 'opp_run'
if args.debug:
args.mode = 'debug'
Expand All @@ -67,9 +74,15 @@ def relpath(s):
else:
assert False, 'unknown --mode option'

lib_flags = ['-l%s' % s for s in run_libs]
ned_flags = ['-n' + ';'.join(run_neds)]
img_flags = ['--image-path=' + ';'.join(run_imgs)]
lib_flags = []
if run_libs:
lib_flags += ['-l%s' % s for s in run_libs]
ned_flags = []
if run_neds:
ned_flags += ['-n' + ';'.join(run_neds)]
img_flags = []
if run_imgs:
img_flags += ['--image-path=' + ';'.join(run_imgs)]

prefix = []
if args.tool == 'lldb':
Expand All @@ -86,6 +99,8 @@ def relpath(s):
if args.verbose:
print("Running with command line arguments: %s" % ' '.join(['"%s"' % arg for arg in cmdline]))

os.environ['OMNETPP_NED_PACKAGE_EXCLUSIONS'] = ';'.join(list(filter(None, os.getenv('OMNETPP_NED_PACKAGE_EXCLUSIONS', '').split(';'))) + run_excs_lines)

if os.name == 'nt':
subprocess.call(['env'] + cmdline)
else:
Expand Down
Loading

0 comments on commit 11f5a39

Please sign in to comment.