From 59e6b6630ab3bafa51806e3325fbdae92cc26d62 Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Thu, 21 Dec 2017 16:19:12 -0800 Subject: [PATCH] added initial fpm commands for building packages and minor updates to support --- .gitignore | 7 +++ Makefile.am | 103 +++++++++++++++++++----------------- configure.ac | 4 ++ daemon/core/constants.py.in | 2 +- daemon/setup.py | 22 ++++++-- daemon/src/Makefile.am | 2 +- daemon/src/setup.py | 1 + gui/Makefile.am | 1 - 8 files changed, 87 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index 448f711a..3e9cd0b7 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,10 @@ stamp-h1 # ignore test coverage files coverage.xml + +# python files +*.egg-info + +# ignore package files +*.rpm +*.deb diff --git a/Makefile.am b/Makefile.am index 4919ac0b..ca3b2b23 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,57 +72,62 @@ deb: @echo "First create source archive with: dpkg-source -b core-@CORE_VERSION@" @echo "Then build with: pbuilder-dist precise i386 build core*.dsc" -.PHONE: fpm + +define fpm-python = +fpm -s python -t $1 \ + -m "$(CORE_MAINTAINERS)" \ + --vendor "$(CORE_VENDOR)" \ + $2 +endef + +define fpm-gui = +fpm -s dir -t $1 -n core-gui \ + -m "$(CORE_MAINTAINERS)" \ + --license "BSD" \ + --description "Common Open Research Emulator GUI front-end" \ + --url http://www.nrl.navy.mil/itd/ncs/products/core \ + --vendor "$(CORE_VENDOR)" \ + -p core-gui_VERSION_ARCH.$1 \ + -v $(CORE_VERSION) \ + -d "bash" \ + -d "tcl" \ + -d "tk" \ + $2 \ + -C $(DESTDIR) +endef + +.PHONY: fpm fpm: + rm -f *.deb && rm -f *.rpm + $(call fpm-gui,rpm,-d "tkimg") + $(call fpm-gui,deb,-d "libtk-img") + $(call fpm-python,rpm,daemon/ns3/setup.py) + $(call fpm-python,deb,daemon/ns3/setup.py) fpm -s python -t rpm \ - -m "CORE Developers " \ - --vendor "CORE Developers" \ - daemon/setup.py - fpm -s python -t rpm \ - -m "CORE Developers " \ - --vendor "CORE Developers" \ - daemon/src/setup.py - fpm -s python -t rpm \ - -m "CORE Developers " \ - --vendor "CORE Developers" \ - daemon/ns3/setup.py - -.PHONY: fpm-deb -fpm-deb: - fpm -s dir -t deb -n core -v $(CORE_VERSION) -C "$DESTDIR" \ - -p core_VERSION_ARCH.deb \ - --license "BSD 2-clause" \ - --vendor "CORE Developers" \ - --description "Emulate virtual networks in a box." \ - --url http://www.nrl.navy.mil/itd/ncs/products/core \ - -m "CORE Developers " \ - -d "procps" \ - -d "libc6 >= 2.14" \ - -d "bash >= 3.0" \ - -d "bridge-utils" \ - -d "ebtables" \ - -d "iproute2" \ - -d "libev4" \ - -d "python >= 2.7" \ - --deb-recommends quagga - - -.PHONY: fpm-rpm -fpm-rpm: - fpm -s dir -t rpm -n core -v $(CORE_VERSION) -C "$DESTDIR" \ - -p core_VERSION_ARCH.rpm \ - --license "BSD 2-clause" \ - --vendor "CORE Developers" \ - --description "Emulate virtual networks in a box." \ - --url http://www.nrl.navy.mil/itd/ncs/products/core \ - -m "CORE Developers " \ - -d "procps" \ - -d "bash >= 3.0" \ - -d "bridge-utils" \ - -d "ebtables" \ - -d "iproute" \ - -d "libev" \ - -d "python >= 2.7" + -m "$(CORE_MAINTAINERS)" \ + --vendor "$(CORE_VENDOR)" \ + -d "procps-ng" \ + -d "bash >= 3.0" \ + -d "bridge-utils" \ + -d "ebtables" \ + -d "iproute" \ + -d "libev" \ + -d "net-tools" \ + -d "python >= 2.7, python < 3.0" \ + daemon/src/setup.py daemon/setup.py + fpm -s python -t deb \ + -m "$(CORE_MAINTAINERS)" \ + --vendor "$(CORE_VENDOR)" \ + -d "procps" \ + -d "libc6 >= 2.14" \ + -d "bash >= 3.0" \ + -d "bridge-utils" \ + -d "ebtables" \ + -d "iproute2" \ + -d "libev4" \ + -d "python (>= 2.7), python (<< 3.0)" \ + --deb-recommends quagga \ + daemon/src/setup.py daemon/setup.py .PHONY: core-restart core-restart: diff --git a/configure.ac b/configure.ac index a1f0ad6c..8227c1f5 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,8 @@ VERSION=$PACKAGE_VERSION CORE_VERSION=$PACKAGE_VERSION CORE_VERSION_DATE=m4_esyscmd_s([./revision.sh -d]) COREDPY_VERSION=$PACKAGE_VERSION +CORE_MAINTAINERS="CORE Developers " +CORE_VENDOR="CORE Developers" # # autoconf and automake initialization @@ -30,6 +32,8 @@ AM_INIT_AUTOMAKE([tar-ustar]) AC_SUBST(CORE_VERSION) AC_SUBST(CORE_VERSION_DATE) AC_SUBST(COREDPY_VERSION) +AC_SUBST(CORE_MAINTAINERS) +AC_SUBST(CORE_VENDOR) # # some of the following directory variables are not expanded at configure-time, diff --git a/daemon/core/constants.py.in b/daemon/core/constants.py.in index 674c0dc7..f5d05780 100644 --- a/daemon/core/constants.py.in +++ b/daemon/core/constants.py.in @@ -4,7 +4,7 @@ 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_SBIN_DIR = "@BINDIR@" BRCTL_BIN = "@brctl_path@/brctl" SYSCTL_BIN = "@sysctl_path@/sysctl" diff --git a/daemon/setup.py b/daemon/setup.py index 7aa128cf..78636c30 100644 --- a/daemon/setup.py +++ b/daemon/setup.py @@ -22,13 +22,29 @@ setup( ], install_requires=[ "enum34", - "logzero" + #"logzero", ], tests_require=[ "pytest", - "pytest-runner" + "pytest-runner", "pytest-cov", - "mock" + "mock", + ], + data_files=[ + ("/etc/core", [ + "data/core.conf", + "data/xen.conf", + ]), + ("/etc/init.d", [ + "../scripts/core-daemon", + ]), + ], + scripts=[ + "sbin/core-cleanup", + "sbin/core-daemon", + "sbin/core-manage", + "sbin/coresendmsg", + "sbin/core-xen-cleanup", ], description="Python components of CORE", url="http://www.nrl.navy.mil/itd/ncs/products/core", diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am index 0cec0814..131d593f 100644 --- a/daemon/src/Makefile.am +++ b/daemon/src/Makefile.am @@ -34,7 +34,7 @@ netns_SOURCES = ${SRC_NETNS} noinst_LIBRARIES = libnetns.a libnetns_a_SOURCES = netnsmodule.c vcmdmodule.c libnetns.a: - SBINDIR=@SBINDIR@ LDFLAGS="$(LDFLAGS) @libev_LIBS@" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build + SBINDIR=@SBINDIR@ LDFLAGS="$(LDFLAGS) @libev_LIBS@" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build_ext # Python libraries install install-exec-local: diff --git a/daemon/src/setup.py b/daemon/src/setup.py index 60819916..1c111062 100644 --- a/daemon/src/setup.py +++ b/daemon/src/setup.py @@ -29,6 +29,7 @@ setup( name="core-netns", version="1.0", description="Extension modules to support virtual nodes using Linux network namespaces", + scripts=["vcmd", "vnoded", "netns"], ext_modules=[ netns, vcmd diff --git a/gui/Makefile.am b/gui/Makefile.am index 9846d935..25c494fd 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -59,7 +59,6 @@ dist_coreaddons_DATA = $(ADDONS_FILES) coreconfigsdir = $(datadir)/core/examples/configs dist_coreconfigs_DATA = $(CONFIG_FILES) - dist-hook: rm -rf $(distdir)/addons/.svn