From: Michael Tremer Date: Tue, 5 May 2015 14:58:41 +0000 (+0000) Subject: Use autotools X-Git-Tag: 001^0 X-Git-Url: http://git.ipfire.org/?p=collecty.git;a=commitdiff_plain;h=2fc9f9a209c07082fb045e97cf5559641a897747 Use autotools --- diff --git a/.gitignore b/.gitignore index e1d3d69..6256b1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,26 @@ -*.mo -*.png +/Makefile +/build-aux +/man/*.[0-9] +/man/*.html +/missing +/src/systemd/collecty.service +/tmp *.py[co] -*.tar.gz +/*.tar.bz2 +/*.tar.gz +/*.tar.xz +*.log +*.cache +*.gmo +*.mo +*~ +Makefile.in +aclocal.m4 +config.log +config.status +configure +install-sh +intltool-extract.in +intltool-merge.in +intltool-update.in +stamp-* diff --git a/LICENSE b/COPYING similarity index 100% rename from LICENSE rename to COPYING diff --git a/Makefile b/Makefile deleted file mode 100644 index 6fcc787..0000000 --- a/Makefile +++ /dev/null @@ -1,92 +0,0 @@ -############################################################################### -# # -# collecty - A system statistics collection daemon for IPFire # -# Copyright (C) 2012 IPFire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -PACKAGE_NAME = collecty -PACKAGE_VERSION = 0.0.2 - -DESTDIR = -PREFIX = /usr -BINDIR = $(PREFIX)/bin -SBINDIR = $(PREFIX)/sbin -LOCALEDIR = $(PREFIX)/share/locale -UNITDIR = $(PREFIX)/lib/systemd/system - -PYTHON_VER := $(shell python -c "import platform; print '.'.join(platform.python_version_tuple()[:2])") -PYTHON_DIR = $(DESTDIR)/usr/lib/python$(PYTHON_VER)/site-packages/ - -### -# Translation stuff -### -# A list of all files that need translation -TRANSLATION_FILES = $(shell find collecty -type f -name "*.py") collectyd - -POT_FILE = po/$(PACKAGE_NAME).pot -PO_FILES = $(wildcard po/*.po) -MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES)) - -.PHONY: all -all: $(MO_FILES) - -.PHONY: pot -pot: $(POT_FILE) - -.PHONY: dist -dist: - git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD | gzip -9 \ - > $(NAME)-$(VERSION).tar.gz - -.PHONY: install -install: $(MO_FILES) - -mkdir -pv $(PYTHON_DIR) - cp -rvf collecty $(PYTHON_DIR) - - -mkdir -pv $(DESTDIR)$(SBINDIR) - install -v -m 755 collectyd $(DESTDIR)$(SBINDIR) - - # Install configuration - -mkdir -pv $(DESTDIR)/etc/$(PACKAGE_NAME) - cp -vf example.conf $(DESTDIR)/etc/$(PACKAGE_NAME)/$(PACKAGE_NAME).conf - - # Install translation files. - -mkdir -pv $(DESTDIR)$(LOCALEDIR) - for file in $(MO_FILES); do \ - lang=$$(basename $${file/.mo/}); \ - mkdir -pv $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES; \ - install -v -m 644 $${file} \ - $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES/$(PACKAGE_NAME).mo; \ - done - - # Install systemd unit files. - mkdir -pv $(DESTDIR)$(UNITDIR) - install -m 644 -v collecty.service $(DESTDIR)$(UNITDIR) - -# Cleanup temporary files. -.PHONY: clean -clean: - rm -f $(MO_FILES) - -# Translation stuff. -$(POT_FILE): $(TRANSLATION_FILES) Makefile - xgettext --language python -d $(PACKAGE_NAME) -k_ -kN_ \ - -o $@ --add-comments --from-code=UTF-8 $(sort $^) - -# Compile gettext dictionaries from translation files. -%.mo: %.po - msgfmt -o $@ $< diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e0a882a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,171 @@ +############################################################################### +# # +# collecty - The IPFire statictics collection daemon # +# Copyright (C) 2015 collecty development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} +AM_MAKEFLAGS = --no-print-directory +AUTOMAKE_OPTIONS = color-tests + +# remove target it the command fails +.DELETE_ON_ERROR: + +# keep itermediate files +.SECONDARY: + +SUBDIRS = . po + +pythondir = $(pyexecdir) + +CLEANFILES = +DISTCLEANFILES = +EXTRA_DIST = +INSTALL_DIRS = +noinst_DATA = + +@INTLTOOL_POLICY_RULE@ + +.PHONY: update-po +update-po: + $(MAKE) -C po update-po + +DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) + +# ------------------------------------------------------------------------------ + +AM_V_XSLT = $(AM_V_XSLT_$(V)) +AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY)) +AM_V_XSLT_0 = @echo " XSLT " $@; + +# ------------------------------------------------------------------------------ + +dist_doc_DATA = \ + COPYING + +# ------------------------------------------------------------------------------ + +dist_bin_SCRIPTS = \ + src/collectyd \ + src/collecty-client + +collecty_PYTHON = \ + src/collecty/__init__.py \ + src/collecty/client.py \ + src/collecty/constants.py \ + src/collecty/daemon.py \ + src/collecty/errors.py \ + src/collecty/i18n.py \ + src/collecty/ping.py + +collectydir = $(pythondir)/collecty + +collectyplugins_PYTHON = \ + src/collecty/plugins/base.py \ + src/collecty/plugins/cpu.py \ + src/collecty/plugins/entropy.py \ + src/collecty/plugins/__init__.py \ + src/collecty/plugins/interface.py \ + src/collecty/plugins/latency.py \ + src/collecty/plugins/loadavg.py \ + src/collecty/plugins/memory.py + +collectypluginsdir = $(collectydir)/plugins + +# ------------------------------------------------------------------------------ + +if ENABLE_MANPAGES +MANPAGES = \ + man/collectyd.1 + +MANPAGES_XML = $(patsubst %.1,%.xml,$(patsubst %.5,%.xml,$(MANPAGES))) +MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML)) + +man: $(MANPAGES) $(MANPAGES_HTML) + +man_MANS = \ + $(MANPAGES) + +noinst_DATA += \ + $(MANPAGES_HTML) + +CLEANFILES += \ + $(man_MANS) \ + $(MANPAGES_HTML) + +EXTRA_DIST += \ + $(MANPAGES_XML) \ + man/custom-html.xsl + +XSLTPROC_FLAGS = \ + --nonet \ + --stringparam man.output.quietly 1 \ + --stringparam funcsynopsis.style ansi \ + --stringparam man.th.extra1.suppress 1 \ + --stringparam man.authors.section.enabled 1 \ + --stringparam man.copyright.section.enabled 1 + +XSLTPROC_COMMAND_MAN = \ + $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \ + http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +XSLTPROC_COMMAND_HTML = \ + $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $< + +man/%.1: man/%.xml + $(XSLTPROC_COMMAND_MAN) + +man/%.5: man/%.xml + $(XSLTPROC_COMMAND_MAN) + +man/%.html: man/%.xml man/custom-html.xsl + $(XSLTPROC_COMMAND_HTML) + +endif + +# ------------------------------------------------------------------------------ + +if HAVE_SYSTEMD +systemdsystemunit_DATA = \ + src/systemd/collecty.service + +CLEANFILES += \ + $(systemdsystemunit_DATA) + +INSTALL_DIRS += \ + $(systemdsystemunitdir) +endif + +EXTRA_DIST += \ + src/systemd/collecty.service.in + +# ------------------------------------------------------------------------------ + +substitutions = \ + '|PACKAGE_NAME=$(PACKAGE_NAME)|' \ + '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \ + '|configsdir=$(configsdir)|' \ + '|bindir=$(bindir)|' + +SED_PROCESS = \ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ + $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \ + < $< > $@ + +src/systemd/%: src/systemd/%.in Makefile + $(SED_PROCESS) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..077e109 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +intltoolize --force --automake +autoreconf --force --install --symlink diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..899fc2d --- /dev/null +++ b/configure.ac @@ -0,0 +1,122 @@ +############################################################################### +# # +# collecty - The IPFire statictics collection daemon # +# Copyright (C) 2015 collecty development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +AC_PREREQ([2.64]) + +AC_INIT([collecty], + [001], + [info@ipfire.org], + [collecty], + [http://git.ipfire.org/?p=oddments/collecty.git;a=summary]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([build-aux]) + +AC_PREFIX_DEFAULT([/usr]) + +AM_INIT_AUTOMAKE([ + foreign + 1.11 + -Wall + -Wno-portability + silent-rules + tar-pax + subdir-objects +]) +AM_SILENT_RULES([yes]) + +IT_PROG_INTLTOOL([0.40.0]) + +GETTEXT_PACKAGE=collecty +AC_SUBST(GETTEXT_PACKAGE) + +AC_PROG_LN_S +AC_PROG_MKDIR_P +AC_PROG_SED + +AC_PATH_PROG([XSLTPROC], [xsltproc]) + +# Python +AM_PATH_PYTHON([2.7]) + +save_LIBS="$LIBS" + +# pkg-config +PKG_PROG_PKG_CONFIG +# This makes sure pkg.m4 is available. +m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config]) + +# ------------------------------------------------------------------------------ +have_manpages=no +AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages], + [do not install man pages])) +AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes]) +AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"]) + +# ------------------------------------------------------------------------------ + +AC_ARG_WITH([systemd], + AS_HELP_STRING([--with-systemd], [Enable systemd support.]) +) + +AS_IF([test "x$with_systemd" != "xno"], + [PKG_CHECK_MODULES(systemd, [libsystemd-daemon], + [have_systemd=yes], [have_systemd=no])], + [have_systemd=no] +) + +AS_IF([test "x$have_systemd" = "xyes"], + [AC_MSG_CHECKING([for systemd system unit directory]) + AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)] + ) + + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) + + if test -n "$systemdsystemunitdir" -a "x$systemdsystemunitdir" != xno; then + AC_MSG_RESULT([$systemdsystemunitdir]) + else + AC_MSG_ERROR([not found (try --with-systemdsystemunitdir)]) + fi + ], + [AS_IF([test "x$with_systemd" = "xyes"], + [AC_MSG_ERROR([Systemd support is enabled but no systemd has been found.]) + ]) +]) + +AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"]) + +# ------------------------------------------------------------------------------ + +AC_CONFIG_FILES([ + Makefile + po/Makefile.in +]) + +AC_OUTPUT +AC_MSG_RESULT([ + ${PACKAGE_NAME} ${VERSION} + + prefix: ${prefix} + + Systemd support ${have_systemd} + Generate man-pages: ${have_manpages} +]) diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..55eaa80 --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,6 @@ +intltool.m4 +libtool.m4 +ltoptions.m4 +ltsugar.m4 +ltversion.m4 +lt~obsolete.m4 diff --git a/man/collectyd.xml b/man/collectyd.xml new file mode 100644 index 0000000..f84db93 --- /dev/null +++ b/man/collectyd.xml @@ -0,0 +1,105 @@ + + + + + + collectyd + collectyd + + + + Developer + Michael + Tremer + michael.tremer@ipfire.org + + + + + + collectyd + 1 + + + + collectyd + Statistics collection daemon + + + + + collectyd + OPTIONS + COMMAND + + + + + Description + + + collectyd is a simple and extensible + framework for collecting system statistics of IPFire systems. + + + + + Options + + + The following options are understood: + + + + + + + + + + + + + + Enables the debugging output. + + + + + + + + + + + + + + + Shows the help message provided by the program and exit. + + + + + + + + Exit Codes + + + collectyd will normally exit with code 0. + If there has been a problem and the daemon cannot recover from that + it will exit with an exit code unequal to zero. + + + + + Bugs + + + Please report all bugs to the official bugtracker at + http://bugs.ipfire.org/. + + + diff --git a/man/custom-html.xsl b/man/custom-html.xsl new file mode 100644 index 0000000..fe2b54e --- /dev/null +++ b/man/custom-html.xsl @@ -0,0 +1,31 @@ + + + + + + + + + + + .html + + + + + + + + + + index.html + + Index + +
+
+ + + + +
diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 0000000..ee12156 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,4 @@ +POTFILES +Makefile.in.in +.intltool-merge-cache +Makefile diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..7673daa --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +de diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..193d1d9 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,15 @@ +src/collecty/client.py +src/collecty/constants.py +src/collecty/daemon.py +src/collecty/errors.py +src/collecty/i18n.py +src/collecty/__init__.py +src/collecty/ping.py +src/collecty/plugins/base.py +src/collecty/plugins/cpu.py +src/collecty/plugins/entropy.py +src/collecty/plugins/__init__.py +src/collecty/plugins/interface.py +src/collecty/plugins/latency.py +src/collecty/plugins/loadavg.py +src/collecty/plugins/memory.py diff --git a/collecty-client b/src/collecty-client similarity index 100% rename from collecty-client rename to src/collecty-client diff --git a/collecty/__init__.py b/src/collecty/__init__.py similarity index 100% rename from collecty/__init__.py rename to src/collecty/__init__.py diff --git a/collecty/client.py b/src/collecty/client.py similarity index 100% rename from collecty/client.py rename to src/collecty/client.py diff --git a/collecty/constants.py b/src/collecty/constants.py similarity index 100% rename from collecty/constants.py rename to src/collecty/constants.py diff --git a/collecty/daemon.py b/src/collecty/daemon.py similarity index 100% rename from collecty/daemon.py rename to src/collecty/daemon.py diff --git a/collecty/errors.py b/src/collecty/errors.py similarity index 100% rename from collecty/errors.py rename to src/collecty/errors.py diff --git a/collecty/i18n.py b/src/collecty/i18n.py similarity index 100% rename from collecty/i18n.py rename to src/collecty/i18n.py diff --git a/collecty/ping.py b/src/collecty/ping.py similarity index 100% rename from collecty/ping.py rename to src/collecty/ping.py diff --git a/collecty/plugins/__init__.py b/src/collecty/plugins/__init__.py similarity index 100% rename from collecty/plugins/__init__.py rename to src/collecty/plugins/__init__.py diff --git a/collecty/plugins/base.py b/src/collecty/plugins/base.py similarity index 100% rename from collecty/plugins/base.py rename to src/collecty/plugins/base.py diff --git a/collecty/plugins/cpu.py b/src/collecty/plugins/cpu.py similarity index 100% rename from collecty/plugins/cpu.py rename to src/collecty/plugins/cpu.py diff --git a/collecty/plugins/entropy.py b/src/collecty/plugins/entropy.py similarity index 100% rename from collecty/plugins/entropy.py rename to src/collecty/plugins/entropy.py diff --git a/collecty/plugins/interface.py b/src/collecty/plugins/interface.py similarity index 100% rename from collecty/plugins/interface.py rename to src/collecty/plugins/interface.py diff --git a/collecty/plugins/latency.py b/src/collecty/plugins/latency.py similarity index 100% rename from collecty/plugins/latency.py rename to src/collecty/plugins/latency.py diff --git a/collecty/plugins/loadavg.py b/src/collecty/plugins/loadavg.py similarity index 100% rename from collecty/plugins/loadavg.py rename to src/collecty/plugins/loadavg.py diff --git a/collecty/plugins/memory.py b/src/collecty/plugins/memory.py similarity index 100% rename from collecty/plugins/memory.py rename to src/collecty/plugins/memory.py diff --git a/collectyd b/src/collectyd similarity index 100% rename from collectyd rename to src/collectyd diff --git a/collecty.service b/src/systemd/collecty.service.in similarity index 82% rename from collecty.service rename to src/systemd/collecty.service.in index 78bd26e..8a8bbca 100644 --- a/collecty.service +++ b/src/systemd/collecty.service.in @@ -2,7 +2,7 @@ Description=collecty - A system data collecting daemon [Service] -ExecStart=/usr/sbin/collectyd +ExecStart=@bindir@/collectyd ExecReload=/bin/kill -HUP $MAINPID [Install]