initial cleanup passing over all makefiles and configure.ac
This commit is contained in:
parent
ac705f4908
commit
6210e70c80
28 changed files with 328 additions and 641 deletions
|
@ -1,4 +0,0 @@
|
|||
recursive-include sbin *.sh *.py
|
||||
include data/core.conf
|
||||
recursive-include examples/netns *.py *.sh
|
||||
recursive-exclude examples/netns *.pyc *.pyo
|
|
@ -7,73 +7,17 @@
|
|||
# Makefile for building netns components.
|
||||
#
|
||||
|
||||
SETUPPY = setup.py
|
||||
SETUPPYFLAGS = -v
|
||||
SETUPPY = setup.py
|
||||
SETUPPYFLAGS = -v
|
||||
|
||||
if WANT_DOCS
|
||||
SUBDIRS = doc
|
||||
endif
|
||||
|
||||
SBIN_FILES = \
|
||||
sbin/core-cleanup \
|
||||
sbin/core-daemon \
|
||||
sbin/core-manage \
|
||||
sbin/coresendmsg
|
||||
SCRIPT_FILES := $(notdir $(wildcard sbin/*))
|
||||
MAN_FILES := $(notdir $(wildcard ../doc/man/*.1))
|
||||
|
||||
dist_sbin_SCRIPTS = $(SBIN_FILES)
|
||||
|
||||
CONF_FILES = \
|
||||
data/core.conf
|
||||
|
||||
coreconfdir = $(CORE_CONF_DIR)
|
||||
dist_coreconf_DATA = $(CONF_FILES)
|
||||
|
||||
EXAMPLE_FILES = \
|
||||
examples/controlnet_updown \
|
||||
examples/emanemanifest2core.py \
|
||||
examples/emanemodel2core.py \
|
||||
examples/findcore.py \
|
||||
examples/stopsession.py
|
||||
|
||||
coreexdir = $(datadir)/core/examples
|
||||
dist_coreex_SCRIPTS = $(EXAMPLE_FILES)
|
||||
|
||||
EXAMPLE_MYSERVICES_FILES = \
|
||||
examples/myservices/README.txt \
|
||||
examples/myservices/__init__.py \
|
||||
examples/myservices/sample.py
|
||||
|
||||
coreexmyservicesdir = $(coreexdir)/myservices
|
||||
dist_coreexmyservices_DATA = $(EXAMPLE_MYSERVICES_FILES)
|
||||
|
||||
EXAMPLE_NETNS_FILES = \
|
||||
examples/netns/basicrange.py \
|
||||
examples/netns/daemonnodes.py \
|
||||
examples/netns/distributed.py \
|
||||
examples/netns/emane80211.py \
|
||||
examples/netns/howmanynodes.py \
|
||||
examples/netns/iperf-performance-chain.py \
|
||||
examples/netns/iperf-performance.sh \
|
||||
examples/netns/ospfmanetmdrtest.py \
|
||||
examples/netns/switch.py \
|
||||
examples/netns/switchtest.py \
|
||||
examples/netns/twonodes.sh \
|
||||
examples/netns/wlanemanetests.py \
|
||||
examples/netns/wlantest.py
|
||||
|
||||
coreexnetnsdir = $(coreexdir)/netns
|
||||
dist_coreexnetns_SCRIPTS= $(EXAMPLE_NETNS_FILES)
|
||||
|
||||
EXAMPLE_SERVICES_FILES = \
|
||||
examples/services/sampleFirewall \
|
||||
examples/services/sampleIPsec \
|
||||
examples/services/sampleVPNClient \
|
||||
examples/services/sampleVPNServer
|
||||
|
||||
coreexservicesdir = $(coreexdir)/services
|
||||
dist_coreexservices_DATA= $(EXAMPLE_SERVICES_FILES)
|
||||
|
||||
LOGROTATE_DIR = $(sysconfdir)/logrotate.d
|
||||
LOGROTATE_DIR = $(DESTDIR)/$(sysconfdir)/logrotate.d
|
||||
LOGROTATE_FILE = data/core-daemon.logrotate
|
||||
|
||||
# Python package build
|
||||
|
@ -83,47 +27,40 @@ build:
|
|||
|
||||
# Python package install
|
||||
install-exec-hook:
|
||||
$(MKDIR_P) ${DESTDIR}/${pythondir}
|
||||
$(MKDIR_P) ${DESTDIR}/${pyexecdir}
|
||||
PYTHONPATH=${DESTDIR}/${pythondir} $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \
|
||||
--prefix=${DESTDIR}/${pyprefix} \
|
||||
--install-purelib=${DESTDIR}/${pythondir} \
|
||||
--install-platlib=${DESTDIR}/${pyexecdir}
|
||||
$(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \
|
||||
--root=/$(DESTDIR) \
|
||||
--prefix=$(prefix) \
|
||||
--install-lib=$(pythondir) \
|
||||
--single-version-externally-managed
|
||||
|
||||
install-data-local:
|
||||
$(MKDIR_P) $(DESTDIR)$(LOGROTATE_DIR)
|
||||
$(INSTALL_DATA) $(LOGROTATE_FILE) \
|
||||
$(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate`
|
||||
#install-data-local:
|
||||
# $(MKDIR_P) $(DESTDIR)$(LOGROTATE_DIR)
|
||||
# $(INSTALL_DATA) $(LOGROTATE_FILE) \
|
||||
# $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate`
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate`
|
||||
#uninstall-local:
|
||||
# rm -f $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate`
|
||||
|
||||
# Python package uninstall
|
||||
#rmdir -p $(LOGROTATE_DIR) || true
|
||||
uninstall-hook:
|
||||
rm -rf ${pythondir}/core_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info
|
||||
rm -f ${pythondir}/core_python_netns-1.0-py${PYTHON_VERSION}.egg-info
|
||||
rm -rf ${pythondir}/core
|
||||
rmdir -p $(coreexservicesdir) || true
|
||||
rmdir -p $(coreexnetnsdir) || true
|
||||
rmdir -p $(coreexmyservicesdir) || true
|
||||
rmdir -p $(coreexdir) || true
|
||||
rmdir -p $(coreconfdir) || true
|
||||
rmdir -p $(LOGROTATE_DIR) || true
|
||||
rm -rf $(DESTDIR)/etc/core
|
||||
rm -rf $(DESTDIR)/$(datadir)/core
|
||||
rm -f $(addprefix $(DESTDIR)/$(datadir)/man/man1/, $(MAN_FILES))
|
||||
rm -f $(addprefix $(DESTDIR)/$(bindir)/,$(SCRIPT_FILES))
|
||||
rm -rf $(DESTDIR)/$(pythondir)/core-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
|
||||
rm -rf $(DESTDIR)/$(pythondir)/core
|
||||
|
||||
# Python package cleanup
|
||||
clean-local:
|
||||
-rm -rf build
|
||||
|
||||
# Python RPM package
|
||||
rpm:
|
||||
$(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) bdist_rpm
|
||||
|
||||
# because we include entire directories with EXTRA_DIST, we need to clean up
|
||||
# the source control files
|
||||
dist-hook:
|
||||
rm -rf `find $(distdir)/ -name .svn` `find $(distdir)/ -name '*.pyc'`
|
||||
rm -rf `find $(distdir)/ -name '*.pyc'`
|
||||
|
||||
DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST
|
||||
|
||||
# files to include with distribution tarball
|
||||
EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE)
|
||||
EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE)
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
# Constants created by autoconf ./configure script
|
||||
COREDPY_VERSION = "@COREDPY_VERSION@"
|
||||
CORE_STATE_DIR = "@CORE_STATE_DIR@"
|
||||
CORE_CONF_DIR = "@CORE_CONF_DIR@"
|
||||
CORE_DATA_DIR = "@CORE_DATA_DIR@"
|
||||
CORE_LIB_DIR = "@CORE_LIB_DIR@"
|
||||
CORE_SBIN_DIR = "@SBINDIR@"
|
||||
CORE_BIN_DIR = "@BINDIR@"
|
||||
COREDPY_VERSION = "@PACKAGE_VERSION@"
|
||||
CORE_STATE_DIR = "@CORE_STATE_DIR@"
|
||||
CORE_CONF_DIR = "@CORE_CONF_DIR@"
|
||||
CORE_DATA_DIR = "@CORE_DATA_DIR@"
|
||||
CORE_LIB_DIR = "@CORE_LIB_DIR@"
|
||||
|
||||
BRCTL_BIN = "@brctl_path@/brctl"
|
||||
SYSCTL_BIN = "@sysctl_path@/sysctl"
|
||||
IP_BIN = "@ip_path@/ip"
|
||||
TC_BIN = "@tc_path@/tc"
|
||||
EBTABLES_BIN = "@ebtables_path@/ebtables"
|
||||
IFCONFIG_BIN = "@ifconfig_path@/ifconfig"
|
||||
NGCTL_BIN = "@ngctl_path@/ngctl"
|
||||
VIMAGE_BIN = "@vimage_path@/vimage"
|
||||
QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga"
|
||||
MOUNT_BIN = "@mount_path@/mount"
|
||||
UMOUNT_BIN = "@umount_path@/umount"
|
||||
OVS_BIN = "@ovs_vs_path@/ovs-vsctl"
|
||||
OVS_FLOW_BIN = "@ovs_of_path@/ovs-ofctl"
|
||||
VNODED_BIN = "@bindir@/vnoded"
|
||||
VCMD_BIN = "@bindir@/vcmd"
|
||||
BRCTL_BIN = "@brctl_path@/brctl"
|
||||
SYSCTL_BIN = "@sysctl_path@/sysctl"
|
||||
IP_BIN = "@ip_path@/ip"
|
||||
TC_BIN = "@tc_path@/tc"
|
||||
EBTABLES_BIN = "@ebtables_path@/ebtables"
|
||||
QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga"
|
||||
MOUNT_BIN = "@mount_path@/mount"
|
||||
UMOUNT_BIN = "@umount_path@/umount"
|
||||
OVS_BIN = "@ovs_vs_path@/ovs-vsctl"
|
||||
OVS_FLOW_BIN = "@ovs_of_path@/ovs-ofctl"
|
||||
|
|
|
@ -86,7 +86,7 @@ class SimpleLxcNode(PyCoreNode):
|
|||
|
||||
# create a new namespace for this node using vnoded
|
||||
vnoded = [
|
||||
"%s/vnoded" % constants.CORE_BIN_DIR,
|
||||
constants.VNODED_BIN,
|
||||
"-v",
|
||||
"-c", self.ctrlchnlname,
|
||||
"-l", self.ctrlchnlname + ".log",
|
||||
|
|
|
@ -14,8 +14,6 @@ from core import constants
|
|||
from core import logger
|
||||
from core.misc import utils
|
||||
|
||||
VCMD = os.path.join(constants.CORE_BIN_DIR, "vcmd")
|
||||
|
||||
|
||||
class VnodeClient(object):
|
||||
"""
|
||||
|
@ -134,7 +132,7 @@ class VnodeClient(object):
|
|||
:rtype: int
|
||||
"""
|
||||
args = utils.split_args(args)
|
||||
return os.spawnlp(os.P_WAIT, VCMD, VCMD, "-c", self.ctrlchnlname, "--", *args)
|
||||
return os.spawnlp(os.P_WAIT, constants.VCMD_BIN, constants.VCMD_BIN, "-c", self.ctrlchnlname, "--", *args)
|
||||
|
||||
def redircmd(self, infd, outfd, errfd, args, wait=True):
|
||||
"""
|
||||
|
@ -171,7 +169,7 @@ class VnodeClient(object):
|
|||
:return: terminal command result
|
||||
:rtype: int
|
||||
"""
|
||||
args = ("xterm", "-ut", "-title", self.name, "-e", VCMD, "-c", self.ctrlchnlname, "--", sh)
|
||||
args = ("xterm", "-ut", "-title", self.name, "-e", constants.VCMD_BIN, "-c", self.ctrlchnlname, "--", sh)
|
||||
if "SUDO_USER" in os.environ:
|
||||
args = ("su", "-s", "/bin/sh", "-c",
|
||||
"exec " + " ".join(map(lambda x: "'%s'" % x, args)),
|
||||
|
@ -185,7 +183,7 @@ class VnodeClient(object):
|
|||
:param str sh: shell to execute command in
|
||||
:return: str
|
||||
"""
|
||||
return "%s -c %s -- %s" % (VCMD, self.ctrlchnlname, sh)
|
||||
return "%s -c %s -- %s" % (constants.VCMD_BIN, self.ctrlchnlname, sh)
|
||||
|
||||
def shcmd(self, cmd, sh="/bin/sh"):
|
||||
"""
|
||||
|
|
|
@ -49,9 +49,9 @@ copyright = u'2017, core-dev'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '@CORE_VERSION@'
|
||||
version = '@PACKAGE_VERSION@'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '@CORE_VERSION@'
|
||||
release = '@PACKAGE_VERSION@'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -4,13 +4,13 @@ Defines how CORE will be built for installation.
|
|||
|
||||
import glob
|
||||
import os
|
||||
from distutils.command.install import install
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import find_packages
|
||||
from distutils.core import setup
|
||||
|
||||
_CORE_DIR = "/etc/core"
|
||||
_MAN_DIR = "/usr/local/share/man/man1"
|
||||
_SHARE_DIR = "/usr/local/share/core"
|
||||
_MAN_DIR = "share/man/man1"
|
||||
_EXAMPLES_DIR = "share/core"
|
||||
_SYSV = "/etc/init.d"
|
||||
_SYSTEMD = "/etc/systemd/system"
|
||||
|
||||
|
@ -30,31 +30,6 @@ def glob_files(glob_path):
|
|||
return glob.glob(glob_path)
|
||||
|
||||
|
||||
class CustomInstall(install):
|
||||
user_options = install.user_options + [
|
||||
("service=", None, "determine which service file to include")
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
install.initialize_options(self)
|
||||
self.service = "sysv"
|
||||
|
||||
def finalize_options(self):
|
||||
install.finalize_options(self)
|
||||
assert self.service in ("sysv", "systemd"), "must be sysv or systemd"
|
||||
|
||||
def run(self):
|
||||
if self.service == "sysv":
|
||||
self.distribution.data_files.append((
|
||||
_SYSV, ["../scripts/core-daemon"]
|
||||
))
|
||||
else:
|
||||
self.distribution.data_files.append((
|
||||
_SYSTEMD, ["../scripts/core-daemon.service"]
|
||||
))
|
||||
install.run(self)
|
||||
|
||||
|
||||
data_files = [
|
||||
(_CORE_DIR, [
|
||||
"data/core.conf",
|
||||
|
@ -62,7 +37,7 @@ data_files = [
|
|||
]),
|
||||
(_MAN_DIR, glob_files("../doc/man/**.1")),
|
||||
]
|
||||
data_files.extend(recursive_files(_SHARE_DIR, "examples"))
|
||||
data_files.extend(recursive_files(_EXAMPLES_DIR, "examples"))
|
||||
|
||||
setup(
|
||||
name="core",
|
||||
|
@ -90,7 +65,4 @@ setup(
|
|||
author_email="core-dev@nrl.navy.mil",
|
||||
license="BSD",
|
||||
long_description="Python scripts and modules for building virtual emulated networks.",
|
||||
cmdclass={
|
||||
"install": CustomInstall
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue