From: Gordon Hecker Date: Fri, 22 Jan 2010 09:40:47 +0000 (+0100) Subject: cleanup: fix global tools to work with modularized libraries X-Git-Tag: e2factory-2.3.4pre1~9 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=9528001a8e2e374d3f595533427122eb715719f1;p=e2factory.git cleanup: fix global tools to work with modularized libraries Signed-off-by: Gordon Hecker --- diff --git a/Makefile b/Makefile index 7f5267f..21fa5d9 100644 --- a/Makefile +++ b/Makefile @@ -72,16 +72,9 @@ all: e2commit buildconfig.lua $(MAKE) -C extensions all install: all - mkdir -p $(DESTDIR)$(BINDIR) - mkdir -p $(DESTDIR)$(LIBDIR) - mkdir -p $(DESTDIR)$(LIBEXECDIR) - mkdir -p $(DESTDIR)$(INCDIR) - mkdir -p $(DESTDIR)$(MANDIR) - mkdir -p $(DESTDIR)$(TOOLDIR) - install -m 644 buildconfig.lua $(DESTDIR)$(LIBDIR) + $(MAKE) -C global install $(MAKE) -C lua install $(MAKE) -C generic install - $(MAKE) -C global install $(MAKE) -C local install $(MAKE) -C doc/man install $(MAKE) -C templates install diff --git a/generic/cache.lua b/generic/cache.lua index 52fac51..c8041a4 100644 --- a/generic/cache.lua +++ b/generic/cache.lua @@ -26,6 +26,9 @@ ]] module("cache", package.seeall) +require("e2lib") +require("transport") +require("url") --- cache -- @class table diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 0108e54..7aede66 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -28,6 +28,12 @@ module("e2lib", package.seeall) require("strict") require("buildconfig") +require("lock") +require("err") +require("plugin") +require("tools") +require("cache") +require("luafile") _version = "e2factory, the emlix embedded build system, version " .. buildconfig.VERSION @@ -92,6 +98,8 @@ globals = { global_interface_version_file = ".e2/global-version", lock = nil, logrotate = 5, -- configurable via config.log.logrotate + _version = _version, + _licence = _licence, } -- Interrupt handling @@ -233,7 +241,7 @@ function warnf(category, format, ...) end if globals.warn_category[category] == true then local prefix = "Warning: " - if log_debug then + if globals.log_debug then prefix = string.format("Warning [%s]: ", category) end log(1, prefix .. string.format(format, ...)) @@ -332,7 +340,7 @@ function getlogflags() if getlog(4) then logflags = logflags .. " --v4" end - if log_debug then + if globals.log_debug then logflags = logflags .. " --log-debug" end return " " .. logflags diff --git a/generic/e2option.lua b/generic/e2option.lua index 5c836cb..bdbf514 100644 --- a/generic/e2option.lua +++ b/generic/e2option.lua @@ -216,7 +216,7 @@ function parse(args) category) flag("log-debug", "enable logging of debugging output", function() - e2lib.log_debug = true + e2lib.globals.log_debug = true return true end, category) @@ -241,9 +241,9 @@ function parse(args) category) flag("licence", "show licence information", function() - print(_version) + print(e2lib.globals._version) print() - print(_licence) + print(e2lib.globals._licence) e2lib.finish(0) end, category) @@ -357,7 +357,7 @@ end -- @param rc number: return code, passed to e2lib.finish() -- @return nil function usage(rc) - print(_version) + print(e2lib.globals._version) print([[ Copyright (C) 2007-2009 by Gordon Hecker and Oskar Schirmer, emlix GmbH Copyright (C) 2007-2008 by Felix Winkelmann, emlix GmbH diff --git a/generic/luafile.lua b/generic/luafile.lua index cc0f63b..92247a3 100644 --- a/generic/luafile.lua +++ b/generic/luafile.lua @@ -27,6 +27,7 @@ module("luafile", package.seeall) +require("luafile_ll") function new() local f = {} diff --git a/global/Makefile b/global/Makefile index 6e575bd..03a66c5 100644 --- a/global/Makefile +++ b/global/Makefile @@ -29,22 +29,38 @@ TOPLEVEL = .. include $(TOPLEVEL)/make.vars -VPATH = .:$(TOPLEVEL)/generic +VPATH = .:$(TOPLEVEL)/generic:$(TOPLEVEL) SCRIPTS = GLOBALLUATOOLS = e2-create-project e2-fetch-project e2-install-e2 e2-root GLOBALSHTOOLS = e2-locate-project-root e2ssh GLOBALTOOLS = $(GLOBALLUATOOLS) $(GLOBALSHTOOLS) CLEAN_FILES = *~ $(GLOBALTOOLS) *.lc e2 $(SCRIPTS) *.lua e2-su *.sh e2.conf - +LUA_LIBS = strict.lua collection.lua loader.lua plugin.lua e2lib.lua +LUA_LIBS += e2option.lua hash.lua tools.lua transport.lua cache.lua url.lua +LUA_LIBS += generic_git.lua luafile.lua lua-version-map.lua err.lua lock.lua +LUA_LIBS += buildconfig.lua .PHONY: all install uninstall clean all: e2 e2-root $(SCRIPTS) e2-su $(GLOBALLUATOOLS:=.lc) \ - $(GLOBALSHTOOLS:=.sh) e2.conf e2generic.lc sha1.so e2-su-2.2 \ + $(GLOBALSHTOOLS:=.sh) e2.conf sha1.so e2-su-2.2 \ luafile_ll.so e2util.so -install: all +install-dirs: + install -d $(DESTDIR)$(BINDIR) + install -d $(DESTDIR)$(LIBDIR) + install -d $(DESTDIR)$(LIBEXECDIR) + install -d $(DESTDIR)$(INCDIR) + install -d $(DESTDIR)$(MANDIR) + install -d $(DESTDIR)$(TOOLDIR) + install -d $(DESTDIR)$(SYSCONFDIR) + install -d -m 2775 -g $(E2_GROUP) $(DESTDIR)$(LOCALSTATEDIR) + +install-lua: $(LUA_LIBS) + install -m 644 $^ $(DESTDIR)$(LIBDIR) + +install: all install-dirs install-lua for i in $(GLOBALLUATOOLS) ; do \ install -m 755 $$i.lc $(DESTDIR)$(TOOLDIR)/$$i ; \ ln -sf e2 $(DESTDIR)$(BINDIR)/$$i ; \ @@ -55,13 +71,10 @@ install: all install -m 755 e2-root $(DESTDIR)$(TOOLDIR)/ install -m 4754 -o root -g $(E2_GROUP) e2-su $(DESTDIR)$(BINDIR)/ install -m 755 e2 $(DESTDIR)$(BINDIR)/ - install -d $(DESTDIR)$(SYSCONFDIR) if [ ! -f "$(DESTDIR)$(SYSCONFDIR)/e2.conf" ] ; then \ install -m 644 e2.conf $(DESTDIR)$(SYSCONFDIR)/e2.conf ; \ fi install -m 644 e2.conf $(DESTDIR)$(SYSCONFDIR)/e2.conf.sample - install -d -m 2775 -g $(E2_GROUP) $(DESTDIR)$(LOCALSTATEDIR) - install -m 644 e2generic.lc $(DESTDIR)$(LIBDIR) install -m 755 sha1.so $(DESTDIR)$(LIBDIR) install -m 755 luafile_ll.so $(DESTDIR)$(LIBDIR) install -m 755 e2util.so $(DESTDIR)$(LIBDIR) @@ -76,7 +89,6 @@ uninstall: rm -f $(DESTDIR)$(BINDIR)/$$i ; \ done rm -f $(DESTDIR)$(BINDIR)/e2-su-2.2 - rm -f $(DESTDIR)$(LIBDIR)/e2generic.lc rm -f $(DESTDIR)$(LIBDIR)/luafile_ll.so rm -f $(DESTDIR)$(LIBDIR)/e2util.so rm -f $(DESTDIR)$(TOOLDIR)/e2-root @@ -119,14 +131,6 @@ e2-root: e2-root.lc e2.conf: e2.conf.in $(TOPLEVEL)/scripts/genscript.sh $< $@ -e2generic.lc: strict.lua collection.lua loader.lua \ - plugin.lua \ - e2lib.lua e2option.lua hash.lua tools.lua \ - transport.lua cache.lua url.lua generic_git.lua \ - luafile.lua lua-version-map.lua \ - error.lua lock.lua - $(BUILD_LUAC) -o $@ $^ - sha1.so: sha1.o lsha1.o luafile_ll.so: luafile_ll.o diff --git a/global/e2-create-project.lua.in b/global/e2-create-project.lua.in index eb33720..bc77977 100755 --- a/global/e2-create-project.lua.in +++ b/global/e2-create-project.lua.in @@ -26,7 +26,9 @@ ]] require("buildconfig") -require("e2generic") +require("e2lib") +require("e2option") +require("generic_git") e2lib.init() @@ -36,7 +38,8 @@ usage: e2-create-project [