updated rpm/deb files to be built for both sysv and systemd

This commit is contained in:
Blake J. Harnden 2018-01-04 14:33:25 -08:00
parent d799390c4a
commit 3da4c32825
3 changed files with 95 additions and 32 deletions

View file

@ -99,37 +99,51 @@ fpm -s dir -t $1 -n core-gui \
-C $(DESTDIR) -C $(DESTDIR)
endef endef
define fpm-daemon-rpm =
fpm -s python -t rpm \
-p NAME_$1_VERSION_ARCH.rpm \
--python-setup-py-arguments --service=$1 \
-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" \
netns/setup.py daemon/setup.py
endef
define fpm-daemon-deb =
fpm -s python -t deb \
-p NAME_$1_VERSION_ARCH.deb \
--python-setup-py-arguments --service=$1 \
-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 \
netns/setup.py daemon/setup.py
endef
.PHONY: fpm .PHONY: fpm
fpm: clean-local-fpm fpm: clean-local-fpm
$(call fpm-gui,rpm,-d "tkimg") $(call fpm-gui,rpm,-d "tkimg")
$(call fpm-gui,deb,-d "libtk-img") $(call fpm-gui,deb,-d "libtk-img")
$(call fpm-python,rpm,daemon/ns3/setup.py) $(call fpm-python,rpm,daemon/ns3/setup.py)
$(call fpm-python,deb,daemon/ns3/setup.py) $(call fpm-python,deb,daemon/ns3/setup.py)
fpm -s python -t rpm \ $(call fpm-daemon-rpm,systemd)
-m "$(CORE_MAINTAINERS)" \ $(call fpm-daemon-rpm,sysv)
--vendor "$(CORE_VENDOR)" \ $(call fpm-daemon-deb,systemd)
-d "procps-ng" \ $(call fpm-daemon-deb,sysv)
-d "bash >= 3.0" \
-d "bridge-utils" \
-d "ebtables" \
-d "iproute" \
-d "libev" \
-d "net-tools" \
-d "python >= 2.7, python < 3.0" \
netns/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 \
netns/setup.py daemon/setup.py
.PHONY: clean-local-fpm .PHONY: clean-local-fpm
clean-local-fpm: clean-local-fpm:

View file

@ -3,6 +3,33 @@ Defines how CORE will be built for installation.
""" """
from setuptools import setup, find_packages from setuptools import setup, find_packages
from distutils.command.install import install
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((
"/etc/init.d", ["../scripts/core-daemon"]
))
else:
self.distribution.data_files.append((
"/etc/systemd/system", ["../scripts/core-daemon.service"]
))
install.run(self)
setup( setup(
name="core", name="core",
@ -23,9 +50,6 @@ setup(
"data/xen.conf", "data/xen.conf",
"data/logging.conf", "data/logging.conf",
]), ]),
("/etc/init.d", [
"../scripts/core-daemon",
]),
], ],
scripts=[ scripts=[
"sbin/core-cleanup", "sbin/core-cleanup",
@ -39,5 +63,8 @@ setup(
author="Boeing Research & Technology", author="Boeing Research & Technology",
author_email="core-dev@nrl.navy.mil", author_email="core-dev@nrl.navy.mil",
license="BSD", license="BSD",
long_description="Python scripts and modules for building virtual emulated networks." long_description="Python scripts and modules for building virtual emulated networks.",
cmdclass={
"install": CustomInstall
}
) )

View file

@ -1,7 +1,26 @@
# Copyright (c)2010-2012 the Boeing Company. """
# See the LICENSE file included in this distribution. Defines how CORE netns will be build for installation.
"""
from setuptools import setup, Extension from setuptools import setup, Extension
from distutils.command.install import install
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):
install.run(self)
netns = Extension( netns = Extension(
"netns", "netns",
@ -38,5 +57,8 @@ setup(
author="Boeing Research & Technology", author="Boeing Research & Technology",
author_email="core-dev@nrl.navy.mil", author_email="core-dev@nrl.navy.mil",
license="BSD", license="BSD",
long_description="Extension modules and utilities to support virtual nodes using Linux network namespaces" long_description="Extension modules and utilities to support virtual nodes using Linux network namespaces",
cmdclass={
"install": CustomInstall
}
) )