]> git.ipfire.org Git - people/ms/nitsi.git/commitdiff
Add configure.ac and Makefile.am and make them work
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 5 May 2018 15:31:50 +0000 (17:31 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 5 May 2018 15:31:50 +0000 (17:31 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
12 files changed:
Makefile.am [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
nitsi.in [moved from nitsi with 93% similarity]
src/nitsi/__init__.py [new file with mode: 0644]
src/nitsi/disk.py [moved from disk.py with 100% similarity]
src/nitsi/machine.py [moved from machine.py with 97% similarity]
src/nitsi/network.py [moved from network.py with 100% similarity]
src/nitsi/recipe.py [moved from recipe.py with 96% similarity]
src/nitsi/serial_connection.py [moved from serial_connection.py with 100% similarity]
src/nitsi/test.py [moved from test.py with 94% similarity]
src/nitsi/virtual_environ.py [moved from virtual_environ.py with 96% similarity]

diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..aa22d6d
--- /dev/null
@@ -0,0 +1,107 @@
+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:
+
+pythondir  = $(pyexecdir)
+
+CLEANFILES =
+DISTCLEANFILES =
+EXTRA_DIST =
+INSTALL_DIRS =
+noinst_DATA =
+
+
+AM_V_XSLT   = $(AM_V_XSLT_$(V))
+AM_V_XSLT_  = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+AM_V_XSLT_0 = @echo "  XSLT    " $@;
+
+bin_SCRIPTS = \
+       nitsi
+
+CLEANFILES += \
+       nitsi
+
+nitsi_PYTHON = \
+       src/nitsi/__init__.py \
+       src/nitsi/disk.py \
+       src/nitsi/machine.py \
+       src/nitsi/network.py \
+       src/nitsi/recipe.py \
+       src/nitsi/serial_connection.py \
+       src/nitsi/test.py \
+       src/nitsi/virtual_environ.py
+
+
+nitsidir = $(pythondir)/nitsi
+
+# ------------------------------------------------------------------------------
+
+.PHONY: man
+man: $(MANPAGES) $(MANPAGES_HTML)
+
+if ENABLE_MANPAGES
+MANPAGES = \
+       man/nitsi.1
+
+MANPAGES_XML  = $(patsubst %.1,%.xml,$(patsubst %.5,%.xml,$(MANPAGES)))
+MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML))
+
+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
+
+# ------------------------------------------------------------------------------
+
+substitutions = \
+       '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
+       '|PACKAGE_VERSION=$(PACKAGE_VERSION)|'
+
+SED_PROCESS = \
+       $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+       $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
+               < $< > $@
+
+nitsi: nitsi.in Makefile
+       $(SED_PROCESS)
\ No newline at end of file
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..54516bc
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+autoreconf --force --install
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..279309b
--- /dev/null
@@ -0,0 +1,66 @@
+AC_PREREQ([2.64])
+
+AC_INIT([nitsi],
+       [0.9],
+       [info@ipfire.org],
+       [nitsi],
+       [https://git.ipfire.org/pub/git/people/jschlag/nitsi.git])
+
+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])
+
+AC_PROG_LN_S
+AC_PROG_MKDIR_P
+AC_PROG_SED
+
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
+# Python
+AM_PATH_PYTHON([3.5])
+
+AX_PYTHON_MODULE([libvirt], [fatal], [python3])
+AX_PYTHON_MODULE([guestfs], [fatal], [python3])
+AX_PYTHON_MODULE([serial], [fatal], [python3])
+
+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_CONFIG_FILES([
+       Makefile
+])
+
+AC_OUTPUT
+AC_MSG_RESULT([
+       ${PACKAGE_NAME} ${VERSION}
+
+       prefix:                 ${prefix}
+       sysconfdir:             ${sysconfdir}
+
+       Generate man-pages:     ${have_manpages}
+])
\ No newline at end of file
diff --git a/nitsi b/nitsi.in
similarity index 93%
rename from nitsi
rename to nitsi.in
index d107a3458fadcdd17398eb488c0ecd9eb2d11bc2..a87aa0a82d407f9c56dd9b94fbe7157f33522e1b 100755 (executable)
--- a/nitsi
+++ b/nitsi.in
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-from test import test
+from nitsi.test import test
 import logging
 
 logger = logging.getLogger("nitsi")
diff --git a/src/nitsi/__init__.py b/src/nitsi/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 100%
rename from disk.py
rename to src/nitsi/disk.py
similarity index 97%
rename from machine.py
rename to src/nitsi/machine.py
index 7d5f148335d4d7643606ae4aa92000eacbe9848c..b49fe302f825f664629078111014df57bcb81c84 100644 (file)
@@ -2,9 +2,9 @@
 
 import xml.etree.ElementTree as ET
 
-from disk import disk
+from nitsi.disk import disk
 
-from serial_connection import serial_connection
+from nitsi.serial_connection import serial_connection
 
 import os
 import libvirt
similarity index 100%
rename from network.py
rename to src/nitsi/network.py
similarity index 96%
rename from recipe.py
rename to src/nitsi/recipe.py
index b7967f735f013694544c490b83260328ee7a7f1a..b4d3b44d6e436379b94037a05c9d41e249859d1c 100644 (file)
--- a/recipe.py
@@ -35,7 +35,7 @@ class recipe():
             self.in_recursion = False
 
         self.circle = circle
-        self.log.debug("Tests we have already included: {}".format(self.circle))
+        self.log.debug("Recipes we have already included: {}".format(self.circle))
 
         if not os.path.isfile(self.recipe_file):
             self.log.error("{} is not a file".format(self.recipe_file))
similarity index 94%
rename from test.py
rename to src/nitsi/test.py
index 9ea57981e5b4a47acad742d593c40fe1e965e44f..0ddcdab5d4205c32056f454213b0f6d711ce0f96 100755 (executable)
--- a/test.py
@@ -7,8 +7,8 @@ import os
 
 import configparser
 
-from virtual_environ import virtual_environ
-from recipe import recipe
+from nitsi.virtual_environ import virtual_environ
+from nitsi.recipe import recipe
 
 import logging
 
@@ -22,7 +22,7 @@ class test():
         except BaseException as e:
             logger.error("Could not get absolute path")
 
-        self.log.debug(self.path)
+        self.log.debug("Path of this test is: {}".format(self.path))
 
         self.settings_file = "{}/settings".format(self.path)
         if not os.path.isfile(self.settings_file):
@@ -77,10 +77,13 @@ class test():
             self.virtual_machines[name].login()
 
     def load_recipe(self):
+        self.log.info("Going to load the recipe")
         try:
             self.recipe = recipe(self.recipe_file)
             for line in self.recipe.recipe:
                 self.log.debug(line)
+
+            self.log.debug("This was the recipe")
         except BaseException as e:
             self.log.error("Failed to load recipe")
             raise e
similarity index 96%
rename from virtual_environ.py
rename to src/nitsi/virtual_environ.py
index 16f7d21b50fc11024b17e3b39db55bf0c43abdeb..586d433a84e5c7d55431d154671186be2b24e303 100644 (file)
@@ -1,8 +1,8 @@
 #!/usr/bin/python3
 
-from machine import machine
+from nitsi.machine import machine
 
-from network import network
+from nitsi.network import network
 
 import os
 import configparser