From 94f6c19eab347fa20c729be8cf8831375fc68d78 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Fri, 15 Jul 2016 16:44:10 -0500 Subject: [PATCH] Install man pages inside of the packages --- .gitignore | 1 + Dockerfile_build_ubuntu64 | 5 ++++- build.py | 17 ++++++++++++++++- man/Makefile | 9 ++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3592aa0a773..e234f391f04 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ integration/migration_data/ # man outputs man/*.xml man/*.1 +man/*.1.gz diff --git a/Dockerfile_build_ubuntu64 b/Dockerfile_build_ubuntu64 index 5c5ad69b740..1be43b236a0 100644 --- a/Dockerfile_build_ubuntu64 +++ b/Dockerfile_build_ubuntu64 @@ -12,7 +12,10 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ rpm \ zip \ python \ - python-boto + python-boto \ + asciidoc \ + xmlto \ + docbook-xsl RUN gem install fpm diff --git a/build.py b/build.py index 85a3e1d0d25..5d95ab198ed 100755 --- a/build.py +++ b/build.py @@ -24,6 +24,7 @@ SCRIPT_DIR = "/usr/lib/influxdb/scripts" CONFIG_DIR = "/etc/influxdb" LOGROTATE_DIR = "/etc/logrotate.d" +MAN_DIR = "/usr/share/man" INIT_SCRIPT = "scripts/init.sh" SYSTEMD_SCRIPT = "scripts/influxdb.service" @@ -61,6 +62,7 @@ --maintainer {} \ --directories {} \ --directories {} \ +--directories {} \ --description \"{}\"".format( VENDOR, PACKAGE_URL, @@ -71,6 +73,7 @@ MAINTAINER, LOG_DIR, DATA_DIR, + MAN_DIR, DESCRIPTION) for f in CONFIGURATION_FILES: @@ -120,7 +123,8 @@ def create_package_fs(build_root): DATA_DIR[1:], SCRIPT_DIR[1:], CONFIG_DIR[1:], - LOGROTATE_DIR[1:] ] + LOGROTATE_DIR[1:], + MAN_DIR[1:] ] for d in dirs: os.makedirs(os.path.join(build_root, d)) os.chmod(os.path.join(build_root, d), 0o755) @@ -144,6 +148,14 @@ def package_scripts(build_root, config_only=False, windows=False): shutil.copyfile(DEFAULT_CONFIG, os.path.join(build_root, CONFIG_DIR[1:], "influxdb.conf")) os.chmod(os.path.join(build_root, CONFIG_DIR[1:], "influxdb.conf"), 0o644) +def package_man_files(build_root): + """Copy and gzip man pages to the package filesystem.""" + logging.debug("Installing man pages.") + run("make -C man/ clean install DESTDIR={}/usr".format(build_root)) + for path, dir, files in os.walk(os.path.join(build_root, MAN_DIR[1:])): + for f in files: + run("gzip {}".format(os.path.join(path, f))) + def run_generate(): """Run 'go generate' to rebuild any static assets. """ @@ -602,6 +614,9 @@ def package(build_output, pkg_name, version, nightly=False, iteration=1, static= create_package_fs(build_root) package_scripts(build_root) + if platform != "windows": + package_man_files(build_root) + for binary in targets: # Copy newly-built binaries to packaging directory if platform == 'windows': diff --git a/man/Makefile b/man/Makefile index cb96c835569..a62b53a3966 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,5 +1,7 @@ #!/usr/bin/make -f +DESTDIR = /usr/local + MAN1_TXT = MAN1_TXT += influxd.txt MAN1_TXT += influxd-backup.txt @@ -16,6 +18,11 @@ DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT)) build: $(DOC_MAN1) +install: build + @echo ' INSTALL $(DOC_MAN1)' && \ + mkdir -p $(DESTDIR)/share/man/man1 && \ + install -m 0644 $(DOC_MAN1) $(DESTDIR)/share/man/man1 + clean: rm -f $(MAN_XML) $(DOC_MAN1) @@ -28,4 +35,4 @@ clean: @echo ' XMLTO $@' && \ xmlto man $< 2> /dev/null -.PHONY: build clean +.PHONY: build install clean