From d90288f09e22ea03e83bce352610e7e0c1b55650 Mon Sep 17 00:00:00 2001 From: Chris Kuehl Date: Mon, 4 Apr 2016 13:25:38 -0700 Subject: [PATCH] Improve Debian packaging based on downstream package --- debian/.gitignore | 2 +- debian/clean | 2 ++ debian/compat | 2 +- debian/control | 40 +++++++++++++++++++++++----------------- debian/copyright | 33 +++++++++++++++++++++++++++++++++ debian/docs | 1 + debian/manpages | 2 +- debian/rules | 21 +++++++++++++++------ 8 files changed, 77 insertions(+), 26 deletions(-) create mode 100644 debian/clean create mode 100644 debian/copyright create mode 100644 debian/docs diff --git a/debian/.gitignore b/debian/.gitignore index edf16e9..22d5650 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -3,4 +3,4 @@ files substvars dumb-init/ -dumb-init.man +dumb-init.1 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..29869da --- /dev/null +++ b/debian/clean @@ -0,0 +1,2 @@ +tests/*.pyc +tests/*/*.pyc diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index 9e920e6..165315f 100644 --- a/debian/control +++ b/debian/control @@ -3,26 +3,32 @@ Section: utils Priority: extra Maintainer: Chris Kuehl Uploaders: Kent Wills -Build-Depends: debhelper (>= 7), gcc, fakeroot, python, python-pytest, - python-mock, help2man -Standards-Version: 3.9.6 +Build-Depends: + debhelper (>= 9), + help2man, +## Tests: + python, + python-pytest, + python-mock, +Standards-Version: 3.9.7 +Homepage: https://github.com/Yelp/dumb-init +Vcs-Browser: https://github.com/Yelp/dumb-init +Vcs-Git: https://github.com/Yelp/dumb-init.git Package: dumb-init Architecture: any Depends: ${misc:Depends} -Description: Simple wrapper script which proxies signals to a child - Docker runs your processes as PID1. The kernel doesn't apply default signal - handling to PID1 processes, so if your process doesn't register a custom - signal handler, signals like TERM will just bounce off your process. +Description: wrapper script which proxies signals to a child + dumb-init is a simple process supervisor and init system designed to run + as PID 1 inside minimal container environments (such as Docker). . - This can result in cases where sending signals to a `docker run` process - results in the run process exiting, but the container continuing in the - background. + Lightweight containers have popularized the idea of running a single + process or service without normal init systems like systemd or sysvinit. + However, omitting an init system often leads to incorrect handling of + processes and signals, and can result in problems such as containers + which can't be gracefully stopped, or leaking containers which should + have been destroyed. . - A workaround is to wrap your script in this proxy, which runs as PID1. Your - process then runs as some other PID, and the kernel won't treat the signals - that are proxied to them specially. - . - The proxy dies when your process dies, so it must not double-fork or do other - weird things (this is basically a requirement for doing things sanely in - Docker anyway). + dumb-init acts as PID 1 and immediately spawns your command as a child + process, taking care to properly handle and forward signals as they are + received. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..35f66f2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: dumb-init +Source: https://github.com/Yelp/dumb-init/ + +Files: * +Copyright: + 2015, 2016 Yelp, Inc. +License: Expat + +Files: debian/* +Copyright: + 2015, 2016 Yelp, Inc. + 2016 Dmitry Smirnov +License: Expat + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..ab1a32b --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README* diff --git a/debian/manpages b/debian/manpages index 0354a5f..29bae9f 100644 --- a/debian/manpages +++ b/debian/manpages @@ -1 +1 @@ -debian/dumb-init.man +debian/dumb-init.1 diff --git a/debian/rules b/debian/rules index f43a4e6..2229251 100755 --- a/debian/rules +++ b/debian/rules @@ -1,16 +1,28 @@ #!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + %: dh $@ -override_dh_auto_build: - dh_auto_build $@ +MAN=debian/dumb-init.1 + +override_dh_clean: + $(RM) -rv .cache + dh_clean $(MAN) + +$(MAN): help2man --name 'a minimal init system for Linux containers' \ --no-discard-stderr \ --include debian/help2man \ --no-info \ - ./dumb-init > debian/dumb-init.man + ./dumb-init > $@ + +override_dh_installman: $(MAN) + dh_installman override_dh_builddeb: + # Use gzip instead of xz to support older Debian/Ubuntu releases which + # might install our debs. dh_builddeb -- -Zgzip override_dh_auto_test: @@ -18,6 +30,3 @@ override_dh_auto_test: find . -name '__pycache__' -delete PATH=.:$$PATH py.test tests/ ps aux - -# we don't want it to wipe out our dist directory -override_dh_auto_clean: