Skip to content

Commit

Permalink
Install man pages inside of the packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jsternberg committed Jul 22, 2016
1 parent e091b6d commit 94f6c19
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ integration/migration_data/
# man outputs
man/*.xml
man/*.1
man/*.1.gz
5 changes: 4 additions & 1 deletion Dockerfile_build_ubuntu64
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 16 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -61,6 +62,7 @@
--maintainer {} \
--directories {} \
--directories {} \
--directories {} \
--description \"{}\"".format(
VENDOR,
PACKAGE_URL,
Expand All @@ -71,6 +73,7 @@
MAINTAINER,
LOG_DIR,
DATA_DIR,
MAN_DIR,
DESCRIPTION)

for f in CONFIGURATION_FILES:
Expand Down Expand Up @@ -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)
Expand All @@ -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.
"""
Expand Down Expand Up @@ -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':
Expand Down
9 changes: 8 additions & 1 deletion man/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/make -f

DESTDIR = /usr/local

MAN1_TXT =
MAN1_TXT += influxd.txt
MAN1_TXT += influxd-backup.txt
Expand All @@ -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)

Expand All @@ -28,4 +35,4 @@ clean:
@echo ' XMLTO $@' && \
xmlto man $< 2> /dev/null

.PHONY: build clean
.PHONY: build install clean

0 comments on commit 94f6c19

Please sign in to comment.